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

Add to support the LLDP tlv without system capability #41

Open
wants to merge 2 commits into
base: master
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
8 changes: 7 additions & 1 deletion src/lldp_syncd/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ def get_sys_capability_list(self, if_attributes, if_name, chassis_id):
if 'capability' in if_attributes['chassis']:
capability_list = if_attributes['chassis']['capability']
else:
capability_list = list(if_attributes['chassis'].values())[0]['capability']
for attribute in if_attributes['chassis'].values():
if 'capability' in attribute:
capability_list = attribute['capability']
break
else:
capability_list = []

# {'enabled': ..., 'type': 'capability'}
if isinstance(capability_list, dict):
capability_list = [capability_list]
Expand Down
23 changes: 23 additions & 0 deletions tests/subproc_outputs/interface_only.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@
]
}
},
{
"Ethernet1": {
"via": "LLDP",
"rid": "8",
"age": "0 day, 00:00:01",
"chassis": {
"id": {
"type": "local",
"value": "55663150-3630-2543-4A30-323230424734"
},
"descr": "I'm a little teapot.",
"mgmt-ip": "0.0.0.0"
},
"port": {
"id": {
"type": "mac",
"value": "cc:12:33:44:55:66"
},
"descr": "PCI-E Slot 3, Port 1",
"ttl": "100"
}
}
},
{
"Ethernet100": {
"rid": "1",
Expand Down
6 changes: 5 additions & 1 deletion tests/test_lldpSyncDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,8 @@ def test_remote_sys_capability_list(self):
for interface in interface_list:
(if_name, if_attributes), = interface.items()
capability_list = self.daemon.get_sys_capability_list(if_attributes, if_name, "fake_chassis_id")
self.assertNotEqual(capability_list, [])
if if_name == 'Ethernet1':
self.assertEqual(capability_list, [])
else:
self.assertNotEqual(capability_list, [])