Skip to content

Commit

Permalink
Merge pull request #168 from bugdealer/develop
Browse files Browse the repository at this point in the history
get_lldp_neighbors_detail rpc fix
  • Loading branch information
mirceaulinic committed Jun 14, 2017
2 parents fe2fb86 + e91a4d3 commit b019279
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 6 deletions.
12 changes: 7 additions & 5 deletions napalm_junos/junos.py
Expand Up @@ -616,15 +616,17 @@ def get_lldp_neighbors_detail(self, interface=''):
return {}
interfaces = lldp_table.get().keys()

old_junos = napalm_base.helpers.convert(
int, self.device.facts.get('version', '0.0').split('.')[0], 0) < 13

# get lldp neighbor by interface rpc for EX Series, QFX Series, J Series
# and SRX Series is get-lldp-interface-neighbors-information,
# and rpc for M, MX, and T Series is get-lldp-interface-neighbors
# ref1: https://apps.juniper.net/xmlapi/operTags.jsp (Junos 13.1 and later)
# ref2: https://www.juniper.net/documentation/en_US/junos12.3/information-products/topic-collections/junos-xml-ref-oper/index.html (Junos 12.3) # noqa
lldp_table.GET_RPC = 'get-lldp-interface-neighbors'
if old_junos:
if self.device.facts.get('personality') not in ('MX', 'M', 'T'):
lldp_table.GET_RPC = 'get-lldp-interface-neighbors-information'

for interface in interfaces:
if old_junos:
if self.device.facts.get('personality') not in ('MX', 'M', 'T'):
lldp_table.get(interface_name=interface)
else:
lldp_table.get(interface_device=interface)
Expand Down

This file was deleted.

@@ -0,0 +1 @@
personality: SWITCH
@@ -0,0 +1 @@
{"me0.0": [{"remote_port_description": "Po1:sw21.tpe01:xe-0/1/0", "remote_port": "Ethernet3/2/1", "remote_system_description": "Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504", "remote_chassis_id": "00:1C:73:EE:C0:46", "remote_system_name": "core05.tpe01", "parent_interface": "ae0.0", "remote_system_capab": "Bridge Router", "remote_system_enable_capab": "Bridge"}], "xe-4/3/6": [{"remote_port_description": "Po1:sw21.tpe01:xe-0/1/0", "remote_port": "Ethernet3/2/1", "remote_system_description": "Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504", "remote_chassis_id": "00:1C:73:EE:C0:46", "remote_system_name": "core05.tpe01", "parent_interface": "ae0.0", "remote_system_capab": "Bridge Router", "remote_system_enable_capab": "Bridge"}], "xe-0/1/0.0": [{"remote_port_description": "Po1:sw21.tpe01:xe-0/1/0", "remote_port": "Ethernet3/2/1", "remote_system_description": "Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504", "remote_chassis_id": "00:1C:73:EE:C0:46", "remote_system_name": "core05.tpe01", "parent_interface": "ae0.0", "remote_system_capab": "Bridge Router", "remote_system_enable_capab": "Bridge"}], "ge-0/0/0.0": [{"remote_port_description": "Po1:sw21.tpe01:xe-0/1/0", "remote_port": "Ethernet3/2/1", "remote_system_description": "Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504", "remote_chassis_id": "00:1C:73:EE:C0:46", "remote_system_name": "core05.tpe01", "parent_interface": "ae0.0", "remote_system_capab": "Bridge Router", "remote_system_enable_capab": "Bridge"}]}
@@ -0,0 +1 @@
personality: MX
@@ -0,0 +1,41 @@
<lldp-neighbors-information style="detail">
<lldp-neighbor-information>
<lldp-index>23</lldp-index>
<lldp-ttl>120</lldp-ttl>
<lldp-timemark>Mon Apr 18 10:04:06 2016</lldp-timemark>
<lldp-age>29</lldp-age>
<lldp-local-interface>xe-0/1/0.0</lldp-local-interface>
<lldp-local-parent-interface-name>ae0.0</lldp-local-parent-interface-name>
<lldp-local-port-id>600</lldp-local-port-id>
<lldp-local-port-ageout-count>0</lldp-local-port-ageout-count>
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
<lldp-remote-chassis-id>00:1c:73:ee:c0:46</lldp-remote-chassis-id>
<lldp-remote-port-id-subtype>Interface name</lldp-remote-port-id-subtype>
<lldp-remote-port-id>Ethernet3/2/1</lldp-remote-port-id>
<lldp-remote-port-description>Po1:sw21.tpe01:xe-0/1/0</lldp-remote-port-description>
<lldp-remote-system-name>core05.tpe01</lldp-remote-system-name>
<lldp-system-description>
<lldp-remote-system-description>Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504</lldp-remote-system-description>
</lldp-system-description>
<lldp-remote-system-capabilities-supported>Bridge Router </lldp-remote-system-capabilities-supported>
<lldp-remote-system-capabilities-enabled>Bridge </lldp-remote-system-capabilities-enabled>
<lldp-remote-management-address-type>IPv4</lldp-remote-management-address-type>
<lldp-remote-management-address>199.27.130.35</lldp-remote-management-address>
<lldp-remote-management-address-port-id>2000900</lldp-remote-management-address-port-id>
<lldp-remote-management-address-sub-type>1</lldp-remote-management-address-sub-type>
<lldp-remote-management-address-interface-subtype>ifIndex(2)</lldp-remote-management-address-interface-subtype>
<lldp-remote-management-addr-oid>1.3.6.1.2.1.31.1.1.1.1.2000900</lldp-remote-management-addr-oid>
<lldp-remote-org-def-info-oui>0.80.c2</lldp-remote-org-def-info-oui>
<lldp-remote-org-def-info-subtype>1</lldp-remote-org-def-info-subtype>
<lldp-remote-org-def-info-index>1</lldp-remote-org-def-info-index>
<lldp-remote-org-def-info>0001 </lldp-remote-org-def-info>
<lldp-remote-org-def-info-oui>0.12.f</lldp-remote-org-def-info-oui>
<lldp-remote-org-def-info-subtype>3</lldp-remote-org-def-info-subtype>
<lldp-remote-org-def-info-index>2</lldp-remote-org-def-info-index>
<lldp-remote-org-def-info>03000F4241 </lldp-remote-org-def-info>
<lldp-remote-org-def-info-oui>0.12.f</lldp-remote-org-def-info-oui>
<lldp-remote-org-def-info-subtype>4</lldp-remote-org-def-info-subtype>
<lldp-remote-org-def-info-index>3</lldp-remote-org-def-info-index>
<lldp-remote-org-def-info>2414 </lldp-remote-org-def-info>
</lldp-neighbor-information>
</lldp-neighbors-information>
@@ -0,0 +1,35 @@
<lldp-neighbors-information style="brief">
<lldp-neighbor-information>
<lldp-local-port-id>xe-4/3/6</lldp-local-port-id>
<lldp-local-parent-interface-name>-</lldp-local-parent-interface-name>
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
<lldp-remote-chassis-id>00:1c:73:8f:0a:ed</lldp-remote-chassis-id>
<lldp-remote-port-id-subtype>Interface name</lldp-remote-port-id-subtype>
<lldp-remote-port-id>Ethernet1</lldp-remote-port-id>
<lldp-remote-system-name>peer00.lab.demo</lldp-remote-system-name>
</lldp-neighbor-information>
<lldp-neighbor-information>
<lldp-local-interface>me0.0</lldp-local-interface>
<lldp-local-parent-interface-name>-</lldp-local-parent-interface-name>
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
<lldp-remote-chassis-id>00:23:47:50:21:40</lldp-remote-chassis-id>
<lldp-remote-port-description>27</lldp-remote-port-description>
<lldp-remote-system-name>lom-bjg61-r1-1</lldp-remote-system-name>
</lldp-neighbor-information>
<lldp-neighbor-information>
<lldp-local-interface>ge-0/0/0.0</lldp-local-interface>
<lldp-local-parent-interface-name>-</lldp-local-parent-interface-name>
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
<lldp-remote-chassis-id>02:e4:c8:6c:a4:00</lldp-remote-chassis-id>
<lldp-remote-port-description>GigabitEthernet0/0/0/0</lldp-remote-port-description>
<lldp-remote-system-name>rtr00.demo</lldp-remote-system-name>
</lldp-neighbor-information>
<lldp-neighbor-information>
<lldp-local-interface>xe-0/1/0.0</lldp-local-interface>
<lldp-local-parent-interface-name>-</lldp-local-parent-interface-name>
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
<lldp-remote-chassis-id>dc:38:e1:b7:26:16</lldp-remote-chassis-id>
<lldp-remote-port-description>xe-0/0/0</lldp-remote-port-description>
<lldp-remote-system-name>spine00</lldp-remote-system-name>
</lldp-neighbor-information>
</lldp-neighbors-information>

0 comments on commit b019279

Please sign in to comment.