Skip to content

Commit d40b8a6

Browse files
authored
confutils: portmode regexp string fixup (#846)
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent 8ecbd95 commit d40b8a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

suzieq/shared/confutils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def _get_swport_interfaces_iosy(conf: CiscoConfParse,
132132

133133
pm_dict = {}
134134
if what == 'access':
135-
for intf in conf.find_objects_w_child('^interface ', '.*access'):
135+
for intf in conf.find_objects_w_child(r'^interface ',
136+
r'^\s+switchport.*access'):
136137
ifname = intf.text.split('interface')[1].strip()
137138
acc_vlan = intf.re_match_iter_typed(r'^.*vlan\s+(\d+)')
138139
if acc_vlan.isnumeric():
@@ -141,7 +142,8 @@ def _get_swport_interfaces_iosy(conf: CiscoConfParse,
141142
pm_dict[ifname] = 0
142143

143144
if what == 'trunk':
144-
for intf in conf.find_objects_w_child('^interface', '.*trunk'):
145+
for intf in conf.find_objects_w_child(r'^interface',
146+
r'^\s+switchport.*trunk'):
145147
ifname = intf.text.split('interface')[1].strip()
146148
nvlan = intf.re_match_iter_typed(r'.*native vlan\s+(\d+)',
147149
default='1')

0 commit comments

Comments
 (0)