Skip to content

Commit

Permalink
Updated fix for Catalyst 6500 reporting VLAN as N/A (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers authored May 15, 2018
1 parent 90aaa97 commit 38b0132
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 0 deletions.
14 changes: 14 additions & 0 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,8 @@ def get_mac_address_table(self):
RE_MACTABLE_6500_1 = r"^\*\s+{}\s+{}\s+".format(VLAN_REGEX, MAC_REGEX) # 7 fields
RE_MACTABLE_6500_2 = r"^{}\s+{}\s+".format(VLAN_REGEX, MAC_REGEX) # 6 fields
RE_MACTABLE_6500_3 = r"^\s{51}\S+" # Fill down prior
RE_MACTABLE_6500_4 = r"^R\s+{}\s+.*Router".format(VLAN_REGEX, MAC_REGEX) # Router field
RE_MACTABLE_6500_5 = r"^R\s+N/A\s+{}.*Router".format(MAC_REGEX) # Router skipped
RE_MACTABLE_4500_1 = r"^{}\s+{}\s+".format(VLAN_REGEX, MAC_REGEX) # 5 fields
RE_MACTABLE_4500_2 = r"^\s{32,34}\S+" # Fill down prior
RE_MACTABLE_4500_3 = r"^{}\s+{}\s+".format(INT_REGEX, MAC_REGEX) # Matches PHY int
Expand Down Expand Up @@ -1971,6 +1973,18 @@ def process_mac_fields(vlan, mac, mac_type, interface):
vlan, mac, mac_type, interface = line.split()
vlan = '-1'
mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))
elif re.search(RE_MACTABLE_6500_4, line) and len(line.split()) == 7:
line = re.sub(r"^R\s+", "", line)
vlan, mac, mac_type, _, _, interface = line.split()
mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))
continue
elif re.search(RE_MACTABLE_6500_5, line):
line = re.sub(r"^R\s+", "", line)
vlan, mac, mac_type, _, _, interface = line.split()
# Convert 'N/A' VLAN to to 0
vlan = re.sub(r"N/A", "0", vlan)
mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))
continue
elif re.search(r"Total Mac Addresses", line):
continue
elif re.search(r"Multicast Entries", line):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
[
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1111,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1112,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 111,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 112,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1113,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 113,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1114,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 0,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 115,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1115,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1116,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1117,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:08:E2:EE:EB:C7",
"interface": "",
"vlan": 1118,
"static": true,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "D0:23:DB:30:76:61",
"interface": "Po220",
"vlan": 113,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:6E:4E:41",
"interface": "Po220",
"vlan": 1114,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:6D:38:99",
"interface": "Po220",
"vlan": 123,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:6E:57:91",
"interface": "Po220",
"vlan": 1114,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:6D:E5:BD",
"interface": "Po220",
"vlan": 111,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:1C:C4:AE:8C:1A",
"interface": "Po220",
"vlan": 1111,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:6D:3D:E1",
"interface": "Po220",
"vlan": 111,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:50:56:BB:73:4D",
"interface": "Po220",
"vlan": 1112,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:22:64:AE:63:29",
"interface": "Gi111/1/0/3",
"vlan": 1200,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:22:64:AE:63:28",
"interface": "Gi110/1/0/3",
"vlan": 1201,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
},
{
"mac": "00:80:9F:B1:EF:DD",
"interface": "Te1/3/6",
"vlan": 1202,
"static": false,
"active": true,
"moves": -1,
"last_move": -1.0
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Legend: * - primary entry
age - seconds since last seen
n/a - not available

vlan mac address type learn age ports
----+----+---------------+-------+-----+----------+-----------------------------
R 1111 0008.e2ee.ebc7 static No - Router
R 1112 0008.e2ee.ebc7 static No - Router
R 111 0008.e2ee.ebc7 static No - Router
R 112 0008.e2ee.ebc7 static No - Router
R 1113 0008.e2ee.ebc7 static No - Router
R 113 0008.e2ee.ebc7 static No - Router
R 1114 0008.e2ee.ebc7 static No - Router
R N/A 0008.e2ee.ebc7 static No - Router
R 115 0008.e2ee.ebc7 static No - Router
R 1115 0008.e2ee.ebc7 static No - Router
R 1116 0008.e2ee.ebc7 static No - Router
R 1117 0008.e2ee.ebc7 static No - Router
R 1118 0008.e2ee.ebc7 static No - Router
* 113 d023.db30.7661 dynamic Yes 25 Po220
* 1114 0050.566e.4e41 dynamic Yes 230 Po220
* 123 0050.566d.3899 dynamic Yes 230 Po220
* 1114 0050.566e.5791 dynamic Yes 5 Po220
* 111 0050.566d.e5bd dynamic Yes 45 Po220
* 1111 001c.c4ae.8c1a dynamic Yes 5 Po220
* 111 0050.566d.3de1 dynamic Yes 50 Po220
* 1112 0050.56bb.734d dynamic Yes 230 Po220
1200 0022.64ae.6329 dynamic Yes 130 Gi111/1/0/3
1201 0022.64ae.6328 dynamic Yes 70 Gi110/1/0/3
* 1202 0080.9fb1.efdd dynamic Yes 5 Te1/3/6

0 comments on commit 38b0132

Please sign in to comment.