Issue parsing port-security when vlan is set
johngriegerjr opened this issue · 1 comments
johngriegerjr commented
Hi - I am running into an issue parsing port-security settings when my configuration has options set after the command switchport port-security maximum
. Two examples I have found that break CCAT are switchport port-security maximum 2 vlan 10-11
and switchport port-security maximum 2 vlan voice
.
The error I am getting is pasted below. Please let me know if there is anything I can do to fix this or work around it. Thank you.
Traceback (most recent call last):
File "ccat.py", line 241, in <module>
port_result = checks.port_security.check(interfaces[iface], vlanmap_result)
File "/home/john/CCAT/checks/port_security.py", line 56, in check
port_sec_check(iface_dct, max_mac, result, [0, 1, 2])
File "/home/john/CCAT/checks/port_security.py", line 14, in port_sec_check
if int(port_sec_dct['maximum'][0]) > max_mac:
ValueError: invalid literal for int() with base 10: '2 vlan 10-11'
johngriegerjr commented
I was able to get this working by replacing line 14 in the checks\port_security.py file with the configuration below. Can someone more Python savvy make this prettier and update the repo?
ps_max_num = (port_sec_dct['maximum'][0]).split()
ps_max_num = (ps_max_num[0])
if int(ps_max_num) > max_mac: