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

Improve logic to decide interface states #31

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions napalm_mos/mos.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ def _parse_mm_speed(speed):
# A L1 device doesn't really have a line protocol.
# Let's say an rx signal means line protocol is up for now.
if values["rx"].startswith("up"):
interfaces[interface]["is_up"] = True
interfaces[interface]["is_up"] = "no link" not in values["rx"]
interfaces[interface]["is_enabled"] = True
else:
interfaces[interface]["is_up"] = False
if "shutdown" in values["rx"]:
if values["rx"].startswith("down") or "shutdown" in values["rx"]:
interfaces[interface]["is_enabled"] = False
else:
interfaces[interface]["is_enabled"] = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,68 @@
"mac_address": "",
"speed": 0.0,
"mtu": -1
},
"et17": {
"description": "",
"is_enabled": true,
"is_up": true,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et18": {
"description": "",
"is_enabled": true,
"is_up": true,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et19": {
"description": "",
"is_enabled": true,
"is_up": false,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et20": {
"description": "",
"is_enabled": false,
"is_up": false,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et21": {
"description": "",
"is_enabled": false,
"is_up": false,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et22": {
"description": "",
"is_enabled": false,
"is_up": false,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
},
"et23": {
"description": "",
"is_enabled": false,
"is_up": false,
"last_flapped": 0.0,
"mac_address": "",
"mtu": -1,
"speed": 10000.0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,76 @@
"source": "",
"mode": "",
"speed": ""
},
"et17": {
"name": "",
"rx": "up (link)",
"tx": "up <- et1",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et18": {
"name": "",
"rx": "up (link)",
"tx": "up (link)",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et19": {
"name": "",
"rx": "up (no link)",
"tx": "up <- et1",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et20": {
"name": "",
"rx": "down (no signal)",
"tx": "up <- et1",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et21": {
"name": "",
"rx": "down (shutdown)",
"tx": "down (shutdown) <- et1",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et22": {
"name": "",
"rx": "down (shutdown)",
"tx": "down (no source)",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
},
"et23": {
"name": "",
"rx": "(shutdown)",
"tx": "(shutdown)",
"loopback": "",
"type": "NOT PRESENT",
"source": "et1",
"mode": "",
"speed": "10G"
}
}
}