Skip to content
This repository was archived by the owner on Feb 10, 2018. It is now read-only.

Commit 4acf660

Browse files
authored
Merge pull request #171 from napalm-automation/develop
Release 0.10.2
2 parents db47aee + b8e892b commit 4acf660

File tree

11 files changed

+88
-8
lines changed

11 files changed

+88
-8
lines changed

napalm_junos/junos.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _detect_config_format(self, config):
180180
]
181181
if config.strip().startswith('<'):
182182
return 'xml'
183-
elif config.split(' ')[0] in set_action_matches:
183+
elif config.strip().split(' ')[0] in set_action_matches:
184184
return 'set'
185185
elif self._is_json_format(config):
186186
return 'json'
@@ -616,15 +616,17 @@ def get_lldp_neighbors_detail(self, interface=''):
616616
return {}
617617
interfaces = lldp_table.get().keys()
618618

619-
old_junos = napalm_base.helpers.convert(
620-
int, self.device.facts.get('version', '0.0').split('.')[0], 0) < 13
621-
619+
# get lldp neighbor by interface rpc for EX Series, QFX Series, J Series
620+
# and SRX Series is get-lldp-interface-neighbors-information,
621+
# and rpc for M, MX, and T Series is get-lldp-interface-neighbors
622+
# ref1: https://apps.juniper.net/xmlapi/operTags.jsp (Junos 13.1 and later)
623+
# ref2: https://www.juniper.net/documentation/en_US/junos12.3/information-products/topic-collections/junos-xml-ref-oper/index.html (Junos 12.3) # noqa
622624
lldp_table.GET_RPC = 'get-lldp-interface-neighbors'
623-
if old_junos:
625+
if self.device.facts.get('personality') not in ('MX', 'M', 'T'):
624626
lldp_table.GET_RPC = 'get-lldp-interface-neighbors-information'
625627

626628
for interface in interfaces:
627-
if old_junos:
629+
if self.device.facts.get('personality') not in ('MX', 'M', 'T'):
628630
lldp_table.get(interface_name=interface)
629631
else:
630632
lldp_table.get(interface_device=interface)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="napalm-junos",
15-
version="0.10.1",
15+
version="0.10.2",
1616
packages=find_packages(),
1717
author="David Barroso, Mircea Ulinic",
1818

test/unit/mocked_data/test_get_lldp_neighbors_detail/facts.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/unit/mocked_data/test_get_lldp_neighbors_detail/normal/expected_result.json renamed to test/unit/mocked_data/test_get_lldp_neighbors_detail/normal_ex_fx_srx/expected_result.json

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
personality: SWITCH

test/unit/mocked_data/test_get_lldp_neighbors_detail/normal/get-lldp-interface-neighbors-information.xml renamed to test/unit/mocked_data/test_get_lldp_neighbors_detail/normal_ex_fx_srx/get-lldp-interface-neighbors-information.xml

File renamed without changes.

test/unit/mocked_data/test_get_lldp_neighbors_detail/normal/get-lldp-neighbors-information.xml renamed to test/unit/mocked_data/test_get_lldp_neighbors_detail/normal_ex_fx_srx/get-lldp-neighbors-information.xml

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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"}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
personality: MX
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<lldp-neighbors-information style="detail">
2+
<lldp-neighbor-information>
3+
<lldp-index>23</lldp-index>
4+
<lldp-ttl>120</lldp-ttl>
5+
<lldp-timemark>Mon Apr 18 10:04:06 2016</lldp-timemark>
6+
<lldp-age>29</lldp-age>
7+
<lldp-local-interface>xe-0/1/0.0</lldp-local-interface>
8+
<lldp-local-parent-interface-name>ae0.0</lldp-local-parent-interface-name>
9+
<lldp-local-port-id>600</lldp-local-port-id>
10+
<lldp-local-port-ageout-count>0</lldp-local-port-ageout-count>
11+
<lldp-remote-chassis-id-subtype>Mac address</lldp-remote-chassis-id-subtype>
12+
<lldp-remote-chassis-id>00:1c:73:ee:c0:46</lldp-remote-chassis-id>
13+
<lldp-remote-port-id-subtype>Interface name</lldp-remote-port-id-subtype>
14+
<lldp-remote-port-id>Ethernet3/2/1</lldp-remote-port-id>
15+
<lldp-remote-port-description>Po1:sw21.tpe01:xe-0/1/0</lldp-remote-port-description>
16+
<lldp-remote-system-name>core05.tpe01</lldp-remote-system-name>
17+
<lldp-system-description>
18+
<lldp-remote-system-description>Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504</lldp-remote-system-description>
19+
</lldp-system-description>
20+
<lldp-remote-system-capabilities-supported>Bridge Router </lldp-remote-system-capabilities-supported>
21+
<lldp-remote-system-capabilities-enabled>Bridge </lldp-remote-system-capabilities-enabled>
22+
<lldp-remote-management-address-type>IPv4</lldp-remote-management-address-type>
23+
<lldp-remote-management-address>199.27.130.35</lldp-remote-management-address>
24+
<lldp-remote-management-address-port-id>2000900</lldp-remote-management-address-port-id>
25+
<lldp-remote-management-address-sub-type>1</lldp-remote-management-address-sub-type>
26+
<lldp-remote-management-address-interface-subtype>ifIndex(2)</lldp-remote-management-address-interface-subtype>
27+
<lldp-remote-management-addr-oid>1.3.6.1.2.1.31.1.1.1.1.2000900</lldp-remote-management-addr-oid>
28+
<lldp-remote-org-def-info-oui>0.80.c2</lldp-remote-org-def-info-oui>
29+
<lldp-remote-org-def-info-subtype>1</lldp-remote-org-def-info-subtype>
30+
<lldp-remote-org-def-info-index>1</lldp-remote-org-def-info-index>
31+
<lldp-remote-org-def-info>0001 </lldp-remote-org-def-info>
32+
<lldp-remote-org-def-info-oui>0.12.f</lldp-remote-org-def-info-oui>
33+
<lldp-remote-org-def-info-subtype>3</lldp-remote-org-def-info-subtype>
34+
<lldp-remote-org-def-info-index>2</lldp-remote-org-def-info-index>
35+
<lldp-remote-org-def-info>03000F4241 </lldp-remote-org-def-info>
36+
<lldp-remote-org-def-info-oui>0.12.f</lldp-remote-org-def-info-oui>
37+
<lldp-remote-org-def-info-subtype>4</lldp-remote-org-def-info-subtype>
38+
<lldp-remote-org-def-info-index>3</lldp-remote-org-def-info-index>
39+
<lldp-remote-org-def-info>2414 </lldp-remote-org-def-info>
40+
</lldp-neighbor-information>
41+
</lldp-neighbors-information>

0 commit comments

Comments
 (0)