Make ios_vlan identify vlans starting with 9 (#42247)
* Make ios_vlan identify vlans starting with 9 * Add unit test for vlan id start with 9
This commit is contained in:
parent
26b0908270
commit
70e33ef92c
3 changed files with 17 additions and 2 deletions
|
@ -218,7 +218,7 @@ def parse_to_logical_rows(out):
|
||||||
if not l:
|
if not l:
|
||||||
"""Skip empty lines."""
|
"""Skip empty lines."""
|
||||||
continue
|
continue
|
||||||
if '0' < l[0] < '9':
|
if '0' < l[0] <= '9':
|
||||||
"""Line starting with a number."""
|
"""Line starting with a number."""
|
||||||
if started_yielding:
|
if started_yielding:
|
||||||
yield cur_row
|
yield cur_row
|
||||||
|
|
|
@ -4,5 +4,6 @@ VLAN Name Status Ports
|
||||||
Gi1/0/52
|
Gi1/0/52
|
||||||
Gi1/0/54
|
Gi1/0/54
|
||||||
2 vlan2 active Gi1/0/6, Gi1/0/7
|
2 vlan2 active Gi1/0/6, Gi1/0/7
|
||||||
|
9 vlan9 active Gi1/0/6
|
||||||
1002 fddi-default act/unsup
|
1002 fddi-default act/unsup
|
||||||
1003 fddo-default act/unsup
|
1003 fddo-default act/unsup
|
|
@ -59,6 +59,12 @@ class TestIosVlanModule(TestIosModule):
|
||||||
]
|
]
|
||||||
self.assertEqual(result['commands'], expected_commands)
|
self.assertEqual(result['commands'], expected_commands)
|
||||||
|
|
||||||
|
def test_ios_vlan_id_startwith_9(self):
|
||||||
|
set_module_args({'vlan_id': '9', 'name': 'vlan9', 'state': 'present'})
|
||||||
|
result = self.execute_module(changed=False)
|
||||||
|
expected_commands = []
|
||||||
|
self.assertEqual(result['commands'], expected_commands)
|
||||||
|
|
||||||
def test_ios_vlan_rename(self):
|
def test_ios_vlan_rename(self):
|
||||||
set_module_args({'vlan_id': '2', 'name': 'test', 'state': 'present'})
|
set_module_args({'vlan_id': '2', 'name': 'test', 'state': 'present'})
|
||||||
result = self.execute_module(changed=True)
|
result = self.execute_module(changed=True)
|
||||||
|
@ -121,6 +127,14 @@ class TestIosVlanModule(TestIosModule):
|
||||||
'state': 'active',
|
'state': 'active',
|
||||||
'vlan_id': '2',
|
'vlan_id': '2',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'vlan9',
|
||||||
|
'interfaces': [
|
||||||
|
'GigabitEthernet1/0/6',
|
||||||
|
],
|
||||||
|
'state': 'active',
|
||||||
|
'vlan_id': '9',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'fddi-default',
|
'name': 'fddi-default',
|
||||||
'interfaces': [],
|
'interfaces': [],
|
||||||
|
|
Loading…
Reference in a new issue