mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-30 01:28:56 +00:00
parent
6837cc8e23
commit
286112ced4
@ -499,6 +499,11 @@ class Node:
|
||||
elif self._node_type == "dynamips":
|
||||
self._ports = DynamipsPortFactory(self.properties)
|
||||
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:
|
||||
self._ports = StandardPortFactory(self.properties, self._port_by_adapter, self._first_port_name, self._port_name_format, self._port_segment_size)
|
||||
return
|
||||
|
@ -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):
|
||||
"""
|
||||
List port for atm switch
|
||||
|
Loading…
Reference in New Issue
Block a user