Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support getting auto-negotiated speed on junos #967

Merged
merged 3 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion napalm/junos/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,11 @@ def _convert_to_dict(interfaces):
match_mtu = re.search(r"(\w+)", str(iface_data["mtu"]) or "")
mtu = napalm.base.helpers.convert(int, match_mtu.group(0), 0)
result[iface]["mtu"] = mtu
match = re.search(r"(\d+)(\w*)", iface_data["speed"] or "")
match = re.search(r"(\d+|[Aa]uto)(\w*)", iface_data["speed"] or "")
if match and match.group(1).lower() == "auto":
match = re.search(
r"(\d+)(\w*)", iface_data["negotiated_speed"] or ""
)
if match is None:
continue
speed_value = napalm.base.helpers.convert(int, match.group(1), -1)
Expand Down
2 changes: 2 additions & 0 deletions napalm/junos/utils/junos_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ junos_iface_view:
last_flapped: { interface-flapped/@seconds: int }
#mode: logical-interface/address-family/address-family-name
speed: speed
negotiated_speed: ethernet-autonegotiation/link-partner-speed
mtu: mtu
mac_address: current-physical-address

Expand All @@ -34,6 +35,7 @@ junos_logical_iface_view:
description: { description: unicode }
last_flapped: { ../interface-flapped/@seconds: int }
speed: ../speed
negotiated_speed: ../ethernet-autonegotiation/link-partner-speed
mtu: ../mtu
mac_address: ../current-physical-address

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"last_flapped": 17193266,
"mac_address": "54:E0:32:80:68:83",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/0.0": {
"description": "",
Expand All @@ -123,7 +123,7 @@
"last_flapped": 17193266,
"mac_address": "54:E0:32:80:68:83",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/1": {
"description": "",
Expand Down Expand Up @@ -492,7 +492,7 @@
"last_flapped": 12710488,
"mac_address": "54:E0:32:80:68:B1",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/46.0": {
"description": "",
Expand All @@ -501,7 +501,7 @@
"last_flapped": 12710488,
"mac_address": "54:E0:32:80:68:B1",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/47": {
"description": "",
Expand All @@ -510,7 +510,7 @@
"last_flapped": 12710487,
"mac_address": "54:E0:32:80:68:B2",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/47.0": {
"description": "",
Expand All @@ -519,7 +519,7 @@
"last_flapped": 12710487,
"mac_address": "54:E0:32:80:68:B2",
"mtu": 1514,
"speed": -1
"speed": 1000
},
"ge-0/0/5": {
"description": "",
Expand Down