nxos_vlan refactor to support non structured output (#43805)

* nxos_vlan refactor to support non structured output

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* unittest fix

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* minor fixes

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* use check_rc

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* address review comment

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* remove additional return statement

* address Nate's review

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-08-10 21:03:56 +05:30 committed by GitHub
commit 96346938ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 197 additions and 147 deletions

View file

@ -0,0 +1,4 @@
vlan 1
mode ce
state active
no shutdown

View file

@ -1,18 +0,0 @@
{
"TABLE_vlanbrief": {
"ROW_vlanbrief": {
"vlanshowbr-vlanid": 16777216,
"vlanshowbr-vlanid-utf": 1,
"vlanshowbr-vlanname": "default",
"vlanshowbr-vlanstate": "active",
"vlanshowbr-shutstate": "noshutdown"
}
},
"TABLE_mtuinfo": {
"ROW_mtuinfo": {
"vlanshowinfo-vlanid": 1,
"vlanshowinfo-media-type": "enet",
"vlanshowinfo-vlanmode": "ce-vlan"
}
}
}

View file

@ -0,0 +1,11 @@
{
"TABLE_vlanbriefxbrief": {
"ROW_vlanbriefxbrief": {
"vlanshowbr-vlanid": 16777216,
"vlanshowbr-vlanid-utf": 1,
"vlanshowbr-vlanname": "default",
"vlanshowbr-vlanstate": "active",
"vlanshowbr-shutstate": "noshutdown"
}
}
}

View file

@ -42,16 +42,11 @@ class TestNxosVlanModule(TestNxosModule):
self.mock_get_config = patch('ansible.modules.network.nxos.nxos_vlan.get_config')
self.get_config = self.mock_get_config.start()
self.mock_get_capabilities = patch('ansible.modules.network.nxos.nxos_vlan.get_capabilities')
self.get_capabilities = self.mock_get_capabilities.start()
self.get_capabilities.return_value = {'network_api': 'cliconf'}
def tearDown(self):
super(TestNxosVlanModule, self).tearDown()
self.mock_run_commands.stop()
self.mock_load_config.stop()
self.mock_get_config.stop()
self.mock_get_capabilities.stop()
def load_fixtures(self, commands=None, device=''):
def load_from_file(*args, **kwargs):