1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Fix port name in the cloud

Fix #1534
This commit is contained in:
Julien Duponchelle 2016-09-22 17:11:40 +02:00
parent 6837cc8e23
commit 286112ced4
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 33 additions and 0 deletions

View File

@ -499,6 +499,11 @@ class Node:
elif self._node_type == "dynamips": elif self._node_type == "dynamips":
self._ports = DynamipsPortFactory(self.properties) self._ports = DynamipsPortFactory(self.properties)
return return
elif self._node_type in ("cloud", "nat"):
adapter_number = 0
for port in self.properties["ports_mapping"]:
self._ports.append(PortFactory(port["name"], adapter_number, adapter_number, 0, "ethernet"))
adapter_number += 1
else: else:
self._ports = StandardPortFactory(self.properties, self._port_by_adapter, self._first_port_name, self._port_name_format, self._port_segment_size) self._ports = StandardPortFactory(self.properties, self._port_by_adapter, self._first_port_name, self._port_name_format, self._port_segment_size)
return return

View File

@ -116,6 +116,34 @@ def test_list_ports_adapters(node):
] ]
def test_list_ports_adapters_cloud(project, compute):
"""
List port using adapters properties
"""
node = Node(project, compute, "demo",
node_id=str(uuid.uuid4()),
node_type="cloud")
node.properties["ports_mapping"] = [
{
"interface": "eth0",
"name": "eth0",
"port_number": 0,
"type": "ethernet"
}
]
assert node.__json__()["ports"] == [
{
"name": "eth0",
"short_name": "e0/0",
"data_link_types": {"Ethernet": "DLT_EN10MB"},
"port_number": 0,
"adapter_number": 0,
"link_type": "ethernet"
}
]
def test_list_ports_atm_switch(project, compute): def test_list_ports_atm_switch(project, compute):
""" """
List port for atm switch List port for atm switch