Skip to content

Commit aaf9588

Browse files
authored
Merge pull request #259 from stephanerobert/remove_logical_marker_from_interface
Remove logical interface marking
2 parents 02f841a + 14c8270 commit aaf9588

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

netman/adapters/switches/juniper/qfx_copper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def parse_mac_address_table(self, mac_table):
5959
interface = first_text(vlan_path.xpath("l2ng-l2-mac-logical-interface"))
6060
vlan = int(first_text(vlan_path.xpath("l2ng-l2-vlan-id")))
6161
mac_address = first_text(vlan_path.xpath("l2ng-l2-mac-address"))
62-
type = self._parse_interface_type(interface)
62+
interface, type = self._parse_interface_type(interface)
6363
mac.append(MacAddress(vlan, mac_address, interface, type))
6464
return mac
6565

6666
def _parse_interface_type(self, interface):
6767
if interface.startswith("ae"):
68-
return "Agregated"
68+
return interface.strip('.0'), "Agregated"
6969
else:
70-
return "Physical"
70+
return interface.strip('.0'), "Physical"

netman/adapters/switches/juniper/standard.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ def parse_mac_address_table(self, mac_table):
227227
if interface not in rejected_interface_names:
228228
mac_address = first_text(mac_table.xpath("mac-address"))
229229
vlan = int(first_text(mac_table.xpath("mac-vlan-tag")))
230-
type = self._parse_interface_type(interface)
230+
interface, type = self._parse_interface_type(interface)
231231
mac.append(MacAddress(vlan, mac_address, interface, type))
232232
return mac
233233

234234
def _parse_interface_type(self, interface):
235235
if interface.startswith("ae"):
236-
return "Agregated"
236+
return interface.strip('.0'), "Agregated"
237237
else:
238-
return "Physical"
238+
return interface.strip('.0'), "Physical"

tests/adapters/switches/juniper_qfx_copper_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,15 +709,15 @@ def test_get_mac_addresses(self):
709709

710710
for mac_address in mac_addresses:
711711
if mac_address.mac_address == '00:11:c6:01:53:a7':
712-
assert_that(mac_address.interface, is_('ae47.0'))
712+
assert_that(mac_address.interface, is_('ae47'))
713713
assert_that(mac_address.vlan, is_(4063))
714714
assert_that(mac_address.type, is_('Agregated'))
715715
elif mac_address.mac_address == '00:11:90:3d:33:58':
716-
assert_that(mac_address.interface, is_('xe-0/0/6.0'))
716+
assert_that(mac_address.interface, is_('xe-0/0/6'))
717717
assert_that(mac_address.vlan, is_(4080))
718718
assert_that(mac_address.type, is_('Physical'))
719719
elif mac_address.mac_address == '00:11:b7:b4:74:2c':
720-
assert_that(mac_address.interface, is_('ae47.0'))
720+
assert_that(mac_address.interface, is_('ae47'))
721721
assert_that(mac_address.vlan, is_(4063))
722722
assert_that(mac_address.type, is_('Agregated'))
723723
else:

tests/adapters/switches/juniper_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6701,11 +6701,11 @@ def test_get_mac_addresses(self):
67016701

67026702
for mac_address in mac_addresses:
67036703
if mac_address.mac_address == '02:e0:52:36:38:01':
6704-
assert_that(mac_address.interface, is_('ae19.0'))
6704+
assert_that(mac_address.interface, is_('ae19'))
67056705
assert_that(mac_address.vlan, is_(3991))
67066706
assert_that(mac_address.type, is_('Agregated'))
67076707
elif mac_address.mac_address == '52:d1:aa:9a:b2:2b':
6708-
assert_that(mac_address.interface, is_('ge-1/0/13.0'))
6708+
assert_that(mac_address.interface, is_('ge-1/0/13'))
67096709
assert_that(mac_address.vlan, is_(3991))
67106710
assert_that(mac_address.type, is_('Physical'))
67116711
else:

0 commit comments

Comments
 (0)