diff --git a/src/lldp_syncd/conventions.py b/src/lldp_syncd/conventions.py index bbf06e4..20f0a07 100644 --- a/src/lldp_syncd/conventions.py +++ b/src/lldp_syncd/conventions.py @@ -87,8 +87,8 @@ class LldpSystemCapabilitiesMap(int, Enum): other = 0 repeater = 1 bridge = 2 - wlanAccessPoint = 3 + wlan = 3 router = 4 telephone = 5 - docsisCableDevice = 6 - stationOnly = 7 + docsis = 6 + station = 7 diff --git a/src/lldp_syncd/daemon.py b/src/lldp_syncd/daemon.py index 442b678..f8eabdd 100644 --- a/src/lldp_syncd/daemon.py +++ b/src/lldp_syncd/daemon.py @@ -148,10 +148,10 @@ def parse_sys_capabilities(self, capability_list, enabled=False): for capability in capability_list: try: if (not enabled) or capability["enabled"]: - sys_cap |= 128 >> LldpSystemCapabilitiesMap[capability["type"].lower()] + sys_cap |= 1 << LldpSystemCapabilitiesMap[capability["type"].lower()] except KeyError: logger.debug("Unknown capability {}".format(capability["type"])) - return "%0.2X 00" % sys_cap + return "00 %0.2X" % sys_cap def __init__(self, update_interval=None): super(LldpSyncDaemon, self).__init__() diff --git a/tests/mock_tables/LLDP_ENTRY_TABLE.json b/tests/mock_tables/LLDP_ENTRY_TABLE.json index 065ea41..26492ee 100644 --- a/tests/mock_tables/LLDP_ENTRY_TABLE.json +++ b/tests/mock_tables/LLDP_ENTRY_TABLE.json @@ -1,8 +1,8 @@ { "LLDP_ENTRY_TABLE:Ethernet100": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -15,8 +15,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet4": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -29,8 +29,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet104": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -43,8 +43,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet0": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -57,8 +57,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet108": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -71,8 +71,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet8": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -99,8 +99,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet92": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -113,8 +113,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet124": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -127,8 +127,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet120": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -141,8 +141,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet40": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -155,8 +155,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet44": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -169,8 +169,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet48": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -183,8 +183,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet24": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -197,8 +197,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet68": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -211,8 +211,8 @@ }, "LLDP_ENTRY_TABLE:eth0": { "lldp_rem_index": 2, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm going to need you to come in on saturday", @@ -225,8 +225,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet20": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -239,8 +239,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet60": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -253,8 +253,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet64": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -267,8 +267,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet112": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -281,8 +281,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet116": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -295,8 +295,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet84": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -309,8 +309,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet80": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -323,8 +323,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet88": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -337,8 +337,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet52": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -351,8 +351,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet76": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -365,8 +365,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet56": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -379,8 +379,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet72": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -393,8 +393,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet32": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -407,8 +407,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet28": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -421,8 +421,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet36": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -435,8 +435,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet16": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -449,8 +449,8 @@ }, "LLDP_ENTRY_TABLE:Ethernet12": { "lldp_rem_index": 1, - "lldp_rem_sys_cap_enabled": "28 00", - "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_sys_cap_enabled": "00 14", + "lldp_rem_sys_cap_supported": "00 14", "lldp_rem_port_id_subtype": 5, "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", @@ -467,7 +467,7 @@ "lldp_loc_sys_name": "arc-switch1025", "lldp_loc_sys_desc": "Debian GNU/Linux 8 (jessie) Linux 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64", "lldp_loc_man_addr": "10.1.0.32,fc00:1::32", - "lldp_loc_sys_cap_supported": "28 00", - "lldp_loc_sys_cap_enabled": "28 00" + "lldp_loc_sys_cap_supported": "00 14", + "lldp_loc_sys_cap_enabled": "00 14" } -} \ No newline at end of file +} diff --git a/tests/subproc_outputs/lldpctl.json b/tests/subproc_outputs/lldpctl.json index efba411..0e64538 100644 --- a/tests/subproc_outputs/lldpctl.json +++ b/tests/subproc_outputs/lldpctl.json @@ -19,14 +19,6 @@ { "type": "Router", "enabled": true - }, - { - "type": "Wlan", - "enabled": false - }, - { - "type": "Station", - "enabled": false } ], "descr": "Debian GNU/Linux 8 (jessie) Linux 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64", diff --git a/tests/subproc_outputs/lldpctl_single_loc_mgmt_ip.json b/tests/subproc_outputs/lldpctl_single_loc_mgmt_ip.json index 90be9eb..66a0056 100644 --- a/tests/subproc_outputs/lldpctl_single_loc_mgmt_ip.json +++ b/tests/subproc_outputs/lldpctl_single_loc_mgmt_ip.json @@ -16,14 +16,6 @@ { "type": "Router", "enabled": true - }, - { - "type": "Wlan", - "enabled": false - }, - { - "type": "Station", - "enabled": false } ], "descr": "Debian GNU/Linux 8 (jessie) Linux 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64",