gns3-server 3.0.0b3__py3-none-any.whl → 3.0.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gns3-server might be problematic. Click here for more details.

Files changed (93) hide show
  1. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/METADATA +32 -31
  2. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/RECORD +93 -89
  3. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/WHEEL +1 -1
  4. gns3server/api/routes/compute/cloud_nodes.py +1 -1
  5. gns3server/api/routes/compute/docker_nodes.py +3 -0
  6. gns3server/api/routes/compute/nat_nodes.py +1 -1
  7. gns3server/api/routes/compute/vmware_nodes.py +1 -1
  8. gns3server/api/routes/compute/vpcs_nodes.py +10 -4
  9. gns3server/api/routes/controller/projects.py +13 -1
  10. gns3server/api/routes/controller/users.py +2 -2
  11. gns3server/appliances/almalinux.gns3a +6 -6
  12. gns3server/appliances/aruba-arubaoscx.gns3a +39 -0
  13. gns3server/appliances/cisco-csr1000v.gns3a +28 -2
  14. gns3server/appliances/cisco-iou-l2.gns3a +2 -2
  15. gns3server/appliances/cisco-iou-l3.gns3a +2 -2
  16. gns3server/appliances/cisco-vWLC.gns3a +29 -1
  17. gns3server/appliances/debian.gns3a +28 -0
  18. gns3server/appliances/fortiadc.gns3a +46 -4
  19. gns3server/appliances/fortianalyzer.gns3a +42 -0
  20. gns3server/appliances/fortiauthenticator.gns3a +58 -2
  21. gns3server/appliances/fortigate.gns3a +42 -0
  22. gns3server/appliances/fortimanager.gns3a +42 -0
  23. gns3server/appliances/fortiweb.gns3a +56 -0
  24. gns3server/appliances/hbcd-pe.gns3a +62 -0
  25. gns3server/appliances/juniper-junos-space.gns3a +3 -2
  26. gns3server/appliances/juniper-vmx-legacy.gns3a +1 -1
  27. gns3server/appliances/juniper-vmx-vcp.gns3a +1 -1
  28. gns3server/appliances/juniper-vmx-vfp.gns3a +2 -1
  29. gns3server/appliances/juniper-vqfx-pfe.gns3a +1 -1
  30. gns3server/appliances/juniper-vqfx-re.gns3a +2 -1
  31. gns3server/appliances/juniper-vrr.gns3a +1 -1
  32. gns3server/appliances/juniper-vsrx.gns3a +2 -1
  33. gns3server/appliances/mikrotik-chr.gns3a +30 -99
  34. gns3server/appliances/nixos.gns3a +52 -0
  35. gns3server/appliances/opnsense.gns3a +13 -0
  36. gns3server/appliances/pan-vm-fw.gns3a +26 -0
  37. gns3server/appliances/reactos.gns3a +10 -10
  38. gns3server/appliances/security-onion.gns3a +27 -3
  39. gns3server/appliances/truenas.gns3a +104 -0
  40. gns3server/appliances/ubuntu-cloud.gns3a +35 -20
  41. gns3server/appliances/ubuntu-docker.gns3a +1 -1
  42. gns3server/appliances/ubuntu-gui.gns3a +13 -0
  43. gns3server/appliances/viptela-edge-genericx86-64.gns3a +28 -2
  44. gns3server/appliances/viptela-smart-genericx86-64.gns3a +27 -1
  45. gns3server/appliances/viptela-vmanage-genericx86-64.gns3a +32 -4
  46. gns3server/appliances/vyos.gns3a +95 -98
  47. gns3server/compute/base_node.py +1 -0
  48. gns3server/compute/docker/__init__.py +8 -2
  49. gns3server/compute/docker/docker_vm.py +56 -2
  50. gns3server/compute/docker/resources/init.sh +5 -2
  51. gns3server/compute/dynamips/__init__.py +0 -4
  52. gns3server/compute/dynamips/nodes/router.py +20 -0
  53. gns3server/compute/notification_manager.py +2 -2
  54. gns3server/compute/qemu/qemu_vm.py +26 -15
  55. gns3server/config_samples/gns3_server.conf +13 -3
  56. gns3server/configs/iou_l2_base_startup-config.txt +1 -1
  57. gns3server/configs/iou_l3_base_startup-config.txt +1 -1
  58. gns3server/controller/__init__.py +27 -13
  59. gns3server/controller/appliance_manager.py +9 -6
  60. gns3server/controller/export_project.py +27 -23
  61. gns3server/controller/import_project.py +24 -3
  62. gns3server/controller/node.py +8 -2
  63. gns3server/controller/notification.py +4 -4
  64. gns3server/controller/project.py +96 -8
  65. gns3server/controller/snapshot.py +3 -8
  66. gns3server/controller/symbols.py +1 -1
  67. gns3server/controller/topology.py +31 -2
  68. gns3server/crash_report.py +1 -1
  69. gns3server/db/models/templates.py +1 -0
  70. gns3server/db/tasks.py +1 -1
  71. gns3server/db_migrations/versions/9a5292aa4389_add_mac_address_field_in_docker_.py +27 -0
  72. gns3server/schemas/compute/docker_nodes.py +1 -0
  73. gns3server/schemas/compute/ethernet_switch_nodes.py +1 -1
  74. gns3server/schemas/config.py +3 -0
  75. gns3server/schemas/controller/templates/cloud_templates.py +2 -2
  76. gns3server/schemas/controller/templates/docker_templates.py +4 -3
  77. gns3server/schemas/controller/templates/dynamips_templates.py +5 -5
  78. gns3server/schemas/controller/templates/ethernet_hub_templates.py +1 -1
  79. gns3server/schemas/controller/templates/ethernet_switch_templates.py +2 -2
  80. gns3server/schemas/controller/templates/iou_templates.py +2 -2
  81. gns3server/schemas/controller/templates/qemu_templates.py +12 -12
  82. gns3server/schemas/controller/templates/virtualbox_templates.py +4 -5
  83. gns3server/schemas/controller/templates/vmware_templates.py +4 -4
  84. gns3server/schemas/controller/templates/vpcs_templates.py +2 -2
  85. gns3server/static/web-ui/index.html +3 -3
  86. gns3server/static/web-ui/{main.f3840f9b1c0240e6.js → main.ed82697b58d803e7.js} +1 -1
  87. gns3server/utils/__init__.py +32 -0
  88. gns3server/utils/asyncio/aiozipstream.py +15 -11
  89. gns3server/utils/hostname.py +53 -0
  90. gns3server/version.py +1 -1
  91. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/LICENSE +0 -0
  92. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/entry_points.txt +0 -0
  93. {gns3_server-3.0.0b3.dist-info → gns3_server-3.0.0rc2.dist-info}/top_level.txt +0 -0
@@ -21,6 +21,9 @@ import re
21
21
  import shlex
22
22
  import textwrap
23
23
  import posixpath
24
+ import socket
25
+ import errno
26
+ import hashlib
24
27
 
25
28
 
26
29
  def force_unix_path(path):
@@ -89,3 +92,32 @@ def parse_version(version):
89
92
  version.append("000000")
90
93
  version.append("final")
91
94
  return tuple(version)
95
+
96
+
97
+ def is_ipv6_enabled() -> bool:
98
+
99
+ if not socket.has_ipv6:
100
+ return False # the socket library has no support for IPv6
101
+ try:
102
+ with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as sock:
103
+ sock.bind(("::1", 0))
104
+ return True
105
+ except OSError as e:
106
+ if e.errno in (errno.EADDRNOTAVAIL, errno.EAFNOSUPPORT):
107
+ # EADDRNOTAVAIL is the errno if IPv6 modules/drivers are loaded but disabled.
108
+ # EAFNOSUPPORT is the errno if IPv6 modules/drivers are not loaded at all.
109
+ return False
110
+ if e.errno == errno.EADDRINUSE:
111
+ return True
112
+ raise
113
+
114
+ def md5sum(filename):
115
+ """
116
+ Calculate the MD5 checksum of a file.
117
+ """
118
+
119
+ hash_md5 = hashlib.md5()
120
+ with open(filename, "rb") as f:
121
+ for chunk in iter(lambda: f.read(4096), b""):
122
+ hash_md5.update(chunk)
123
+ return hash_md5.hexdigest()
@@ -195,14 +195,17 @@ class ZipFile(zipfile.ZipFile):
195
195
  self._comment = comment
196
196
  self._didModify = True
197
197
 
198
- async def data_generator(self, path):
199
-
200
- async with aiofiles.open(path, "rb") as f:
201
- while True:
202
- part = await f.read(self._chunksize)
203
- if not part:
204
- break
205
- yield part
198
+ async def data_generator(self, path, islink=False):
199
+
200
+ if islink:
201
+ yield os.readlink(path).encode()
202
+ else:
203
+ async with aiofiles.open(path, "rb") as f:
204
+ while True:
205
+ part = await f.read(self._chunksize)
206
+ if not part:
207
+ break
208
+ yield part
206
209
  return
207
210
 
208
211
  async def _run_in_executor(self, task, *args, **kwargs):
@@ -268,12 +271,13 @@ class ZipFile(zipfile.ZipFile):
268
271
  raise ValueError("either (exclusively) filename or iterable shall be not None")
269
272
 
270
273
  if filename:
271
- st = os.stat(filename)
274
+ st = os.stat(filename, follow_symlinks=False)
272
275
  isdir = stat.S_ISDIR(st.st_mode)
276
+ islink = stat.S_ISLNK(st.st_mode)
273
277
  mtime = time.localtime(st.st_mtime)
274
278
  date_time = mtime[0:6]
275
279
  else:
276
- st, isdir, date_time = None, False, time.localtime()[0:6]
280
+ st, isdir, islink, date_time = None, False, False, time.localtime()[0:6]
277
281
  # Create ZipInfo instance to store file information
278
282
  if arcname is None:
279
283
  arcname = filename
@@ -331,7 +335,7 @@ class ZipFile(zipfile.ZipFile):
331
335
 
332
336
  file_size = 0
333
337
  if filename:
334
- async for buf in self.data_generator(filename):
338
+ async for buf in self.data_generator(filename, islink):
335
339
  file_size = file_size + len(buf)
336
340
  CRC = zipfile.crc32(buf, CRC) & 0xFFFFFFFF
337
341
  if cmpr:
@@ -32,6 +32,28 @@ def is_ios_hostname_valid(hostname: str) -> bool:
32
32
  return False
33
33
 
34
34
 
35
+ def to_ios_hostname(name):
36
+ """
37
+ Convert name to an IOS hostname
38
+ """
39
+
40
+ # Replace invalid characters with hyphens
41
+ name = re.sub(r'[^a-zA-Z0-9-]', '-', name)
42
+
43
+ # Ensure the hostname starts with a letter
44
+ if not re.search(r'^[a-zA-Z]', name):
45
+ name = 'a' + name
46
+
47
+ # Ensure the hostname ends with a letter or digit
48
+ if not re.search(r'[a-zA-Z0-9]$', name):
49
+ name = name.rstrip('-') + '0'
50
+
51
+ # Truncate the hostname to 63 characters
52
+ name = name[:63]
53
+
54
+ return name
55
+
56
+
35
57
  def is_rfc1123_hostname_valid(hostname: str) -> bool:
36
58
  """
37
59
  Check if a hostname is valid according to RFC 1123
@@ -57,3 +79,34 @@ def is_rfc1123_hostname_valid(hostname: str) -> bool:
57
79
 
58
80
  allowed = re.compile(r"(?!-)[a-zA-Z0-9-]{1,63}(?<!-)$")
59
81
  return all(allowed.match(label) for label in labels)
82
+
83
+
84
+ def to_rfc1123_hostname(name: str) -> str:
85
+ """
86
+ Convert name to RFC 1123 hostname
87
+ """
88
+
89
+ # Replace invalid characters with hyphens
90
+ name = re.sub(r'[^a-zA-Z0-9-.]', '-', name)
91
+
92
+ # Remove trailing dot if it exists
93
+ name = name.rstrip('.')
94
+
95
+ # Ensure each label is not longer than 63 characters
96
+ labels = name.split('.')
97
+ labels = [label[:63] for label in labels]
98
+
99
+ # Remove leading and trailing hyphens from each label if they exist
100
+ labels = [label.strip('-') for label in labels]
101
+
102
+ # Check if the TLD is all-numeric and if so, replace it with "invalid"
103
+ if re.match(r"[0-9]+$", labels[-1]):
104
+ labels[-1] = 'invalid'
105
+
106
+ # Join the labels back together
107
+ name = '.'.join(labels)
108
+
109
+ # Ensure the total length is not longer than 253 characters
110
+ name = name[:253]
111
+
112
+ return name
gns3server/version.py CHANGED
@@ -22,7 +22,7 @@
22
22
  # or negative for a release candidate or beta (after the base version
23
23
  # number has been incremented)
24
24
 
25
- __version__ = "3.0.0b3"
25
+ __version__ = "3.0.0rc2"
26
26
  __version_info__ = (3, 0, 0, -99)
27
27
 
28
28
  if "dev" in __version__: