mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-11 03:31:29 -07:00
Add mtu option nxos_interface feature idea (#32680)
* Add mtu option nxos_interface feature idea Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add unit test for mtu feature Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
b0e7c71716
commit
e4052c1261
5 changed files with 222 additions and 2 deletions
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"TABLE_interface": {
|
||||
"ROW_interface": {
|
||||
"interface": "Ethernet2/5",
|
||||
"state": "down",
|
||||
"state_rsn_desc": "Administratively down",
|
||||
"admin_state": "down",
|
||||
"share_state": "Dedicated",
|
||||
"eth_hw_desc": "Ethernet",
|
||||
"eth_hw_addr": "0000.0000.002f",
|
||||
"eth_bia_addr": "0000.0000.0000",
|
||||
"eth_mtu": "1500",
|
||||
"eth_bw": 1000000,
|
||||
"eth_dly": 10,
|
||||
"eth_reliability": "255",
|
||||
"eth_txload": "1",
|
||||
"eth_rxload": "1",
|
||||
"medium": "broadcast",
|
||||
"eth_mode": "routed",
|
||||
"eth_duplex": "auto",
|
||||
"eth_speed": "auto-speed",
|
||||
"eth_beacon": "off",
|
||||
"eth_autoneg": "off",
|
||||
"eth_in_flowctrl": "off",
|
||||
"eth_out_flowctrl": "off",
|
||||
"eth_mdix": "off",
|
||||
"eth_swt_monitor": "off",
|
||||
"eth_ethertype": "0x8100",
|
||||
"eth_eee_state": "n/a",
|
||||
"eth_link_flapped": "never",
|
||||
"eth_clear_counters": "never",
|
||||
"eth_reset_cntr": 0,
|
||||
"eth_load_interval1_rx": 0,
|
||||
"eth_inrate1_bits": 0,
|
||||
"eth_inrate1_pkts": 0,
|
||||
"eth_load_interval1_tx": 0,
|
||||
"eth_outrate1_bits": 0,
|
||||
"eth_outrate1_pkts": 0,
|
||||
"eth_inrate1_summary_bits": "0 bps",
|
||||
"eth_inrate1_summary_pkts": "0 pps",
|
||||
"eth_outrate1_summary_bits": "0 bps",
|
||||
"eth_outrate1_summary_pkts": "0 pps",
|
||||
"eth_load_interval2_rx": 0,
|
||||
"eth_inrate2_bits": 0,
|
||||
"eth_inrate2_pkts": 0,
|
||||
"eth_load_interval2_tx": 0,
|
||||
"eth_outrate2_bits": 0,
|
||||
"eth_outrate2_pkts": 0,
|
||||
"eth_inrate2_summary_bits": "0 bps",
|
||||
"eth_inrate2_summary_pkts": "0 pps",
|
||||
"eth_outrate2_summary_bits": "0 bps",
|
||||
"eth_outrate2_summary_pkts": "0 pps",
|
||||
"eth_inucast": 0,
|
||||
"eth_inmcast": 0,
|
||||
"eth_inbcast": 0,
|
||||
"eth_inpkts": 0,
|
||||
"eth_inbytes": 0,
|
||||
"eth_jumbo_inpkts": 0,
|
||||
"eth_storm_supp": 0,
|
||||
"eth_runts": 0,
|
||||
"eth_giants": 0,
|
||||
"eth_crc": 0,
|
||||
"eth_nobuf": 0,
|
||||
"eth_inerr": 0,
|
||||
"eth_frame": 0,
|
||||
"eth_overrun": 0,
|
||||
"eth_underrun": 0,
|
||||
"eth_ignored": 0,
|
||||
"eth_watchdog": 0,
|
||||
"eth_bad_eth": 0,
|
||||
"eth_bad_proto": 0,
|
||||
"eth_in_ifdown_drops": 0,
|
||||
"eth_dribble": 0,
|
||||
"eth_indiscard": 0,
|
||||
"eth_inpause": 0,
|
||||
"eth_outucast": 0,
|
||||
"eth_outmcast": 0,
|
||||
"eth_outbcast": 0,
|
||||
"eth_outpkts": 0,
|
||||
"eth_outbytes": 0,
|
||||
"eth_jumbo_outpkts": 0,
|
||||
"eth_outerr": 0,
|
||||
"eth_coll": 0,
|
||||
"eth_deferred": 0,
|
||||
"eth_latecoll": 0,
|
||||
"eth_lostcarrier": 0,
|
||||
"eth_nocarrier": 0,
|
||||
"eth_babbles": 0,
|
||||
"eth_outdiscard": 0,
|
||||
"eth_outpause": 0
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"TABLE_interface": {
|
||||
"ROW_interface": [
|
||||
{
|
||||
"interface": "mgmt0",
|
||||
"name": "OOB Management",
|
||||
"state": "connected",
|
||||
"vlan": "routed",
|
||||
"duplex": "full",
|
||||
"speed": "a-1000",
|
||||
"type": "--"
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/1",
|
||||
"name": "to nxos9k01",
|
||||
"state": "connected",
|
||||
"vlan": "routed",
|
||||
"duplex": "full",
|
||||
"speed": "1000",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/2",
|
||||
"name": "to nxos9k02",
|
||||
"state": "connected",
|
||||
"vlan": "routed",
|
||||
"duplex": "full",
|
||||
"speed": "1000",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/3",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/4",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/5",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/6",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/7",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
},
|
||||
{
|
||||
"interface": "Ethernet2/8",
|
||||
"state": "disabled",
|
||||
"vlan": "routed",
|
||||
"duplex": "auto",
|
||||
"speed": "auto",
|
||||
"type": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
!Command: show running-config interface Ethernet2/5
|
||||
!Time: Fri Nov 10 05:50:59 2017
|
||||
|
||||
version 7.3(0)D1(1)
|
||||
|
||||
interface Ethernet2/5
|
||||
shutdown
|
||||
no switchport
|
||||
mac-address 0000.0000.002f
|
||||
|
|
@ -42,7 +42,22 @@ class TestNxosInterfaceModule(TestNxosModule):
|
|||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, device=''):
|
||||
module_name = self.module.__name__.rsplit('.', 1)[1]
|
||||
|
||||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
|
||||
for command in commands:
|
||||
if type(command) == dict:
|
||||
command = command['command']
|
||||
filename = str(command).split(' | ')[0].replace(' ', '_').replace('/', '_')
|
||||
print(filename)
|
||||
output.append(load_fixture(module_name, filename))
|
||||
return output
|
||||
|
||||
self.load_config.return_value = None
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_nxos_interface_up(self):
|
||||
set_module_args(dict(interface='loopback0'))
|
||||
|
@ -58,3 +73,8 @@ class TestNxosInterfaceModule(TestNxosModule):
|
|||
set_module_args(dict(interface='loopback0', state='absent'))
|
||||
result = self.execute_module(changed=False)
|
||||
self.assertEqual(result['commands'], [])
|
||||
|
||||
def test_nxos_interface_mtu_change(self):
|
||||
set_module_args(dict(interface='Ethernet2/5', mtu=1606, state='present'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['interface Ethernet2/5', 'mtu 1606', 'no shutdown'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue