Fix wic numbering

Fix #1011
This commit is contained in:
Julien Duponchelle committed 2017-05-12 09:48:05 +02:00
1 parent 766456014b
commit 19a6157f64
3 files changed
+16 -10

No files matched your search

+4
View File
@@ -70,6 +70,10 @@ class Port:
return self._name
return self.short_name_type + "{}/{}".format(self._interface_number, self._port_number)
@short_name.setter
def short_name(self, val):
self._short_name = val
def __json__(self):
return {
"name": self._name,
+4 -2
View File
@@ -194,7 +194,9 @@ class DynamipsPortFactory:
port_class = cls.WIC_MATRIX[properties[name]]["port"]
if port_class:
for port_number in range(0, cls.WIC_MATRIX[properties[name]]["nb_ports"]):
name = "{}{}/{}".format(port_class.long_name_type(), 0, wic_port_number)
ports.append(port_class(name, 0, 0, wic_port_number))
name = "{}{}/{}".format(port_class.long_name_type(), 0, wic_port_number - 16)
port = port_class(name, 0, 0, wic_port_number)
port.short_name = "{}{}/{}".format(port.short_name_type, 0, wic_port_number - 16)
ports.append(port)
wic_port_number += 1
return ports