def test_disable_username_login(self): set_module_args(dict(username='******', disabled="login")) commands = ['username anass disable login'] self.execute_module(changed=True, commands=commands)
def test_igmp_port_purge_timeout(self): set_module_args(dict(state='enabled', port_purge_timeout=150)) commands = [ 'ip igmp snooping', 'ip igmp snooping port-purge-timeout 150' ] self.execute_module(changed=True, commands=commands)
def test_igmp_unregistered_multicast_flood(self): set_module_args(dict(state='enabled', unregistered_multicast='flood')) commands = ['ip igmp snooping'] self.execute_module(changed=True, commands=commands)
def test_igmp_version_v3(self): set_module_args(dict(state='enabled', default_version='V3')) commands = ['ip igmp snooping'] self.execute_module(changed=True, commands=commands)
def test_igmp_enable(self): set_module_args(dict(state='enabled')) commands = ['ip igmp snooping'] self.execute_module(changed=True, commands=commands)
def test_ipl_remove(self): self._mlag_enabled = True set_module_args(dict(name="Po1", state='absent')) commands = ['interface port-channel 1 no ipl 1'] self.execute_module(changed=True, commands=commands)
def test_snmp_host_enabled_state_with_change(self): set_module_args(dict(hosts=[dict(name='1.1.1.1', enabled=False)])) commands = ['snmp-server host 1.1.1.1 disable'] self.execute_module(changed=True, commands=commands)
def test_no_change_username_nopass(self): set_module_args(dict(username='******', nopassword=True)) self.execute_module(changed=False)
def test_no_change_full_username(self): set_module_args( dict(username='******', full_name="System Administrator")) self.execute_module(changed=False)
def test_no_change_username_capability(self): set_module_args(dict(username='******', capability="admin")) self.execute_module(changed=False)
def test_no_change_username_disabled(self): set_module_args(dict(username='******', disabled="all")) self.execute_module(changed=False)
def test_disconnect_username(self): set_module_args(dict(username='******', disconnected=True)) commands = ['username anass disconnect'] self.execute_module(changed=True, commands=commands)
def test_change_username_capability(self): set_module_args(dict(username='******', capability="monitor")) commands = ['username anass capability monitor'] self.execute_module(changed=True, commands=commands)
def test_disable_username_password(self): set_module_args(dict(username='******', disabled="password")) commands = ['username anass disable password'] self.execute_module(changed=True, commands=commands)
def test_no_ipl_no_change(self): self._mlag_enabled = False set_module_args(dict(name="Po1", state='absent')) self.execute_module(changed=False)
def test_configure_vxlan_no_change(self): set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], arp_suppression=True)) self.execute_module(changed=False)
def test_ipl_no_change(self): self._mlag_enabled = True set_module_args(dict(name="Po1", state='present', vlan_interface='Vlan 1002', peer_address='10.2.2.2')) self.execute_module(changed=False)
def test_mlag_tunnel_ip_with_change(self): set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.10', vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], arp_suppression=True)) commands = ["interface nve 1 vxlan mlag-tunnel-ip 192.10.10.10"] self.execute_module(changed=True, commands=commands)
def test_snmp_host_enabled_state_no_change(self): set_module_args(dict(hosts=[dict(name='1.1.1.1', enabled=True)])) self.execute_module(changed=False)
def test_vni_vlan_list_with_change(self): set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', vni_vlan_list=[dict(vlan_id=11, vni_id=10011), dict(vlan_id=7, vni_id=10061)], arp_suppression=False)) commands = ["interface nve 1 nve vni 10011 vlan 11", "interface nve 1 nve vni 10061 vlan 7"] self.execute_module(changed=True, commands=commands)
def test_snmp_host_port_no_change(self): set_module_args(dict(hosts=[dict(name='2.2.2.2', notification_type='trap', version='2c', port='5')])) self.execute_module(changed=False)
def test_eric_eccli_command_configure_not_warning(self): commands = ['configure terminal'] set_module_args(dict(commands=commands)) result = self.execute_module() self.assertEqual(result['warnings'], [])
def test_igmp_no_change(self): set_module_args(dict(state='disabled')) self.execute_module(changed=False)
def test_eric_eccli_command_multiple(self): set_module_args(dict(commands=['show version', 'show version'])) result = self.execute_module() self.assertEqual(len(result['stdout']), 2) self.assertTrue( result['stdout'][0].startswith('Ericsson IPOS Version'))
def test_igmp_mrouter_timeout(self): set_module_args(dict(state='enabled', mrouter_timeout=100)) commands = ['ip igmp snooping', 'ip igmp snooping mrouter-timeout 100'] self.execute_module(changed=True, commands=commands)
def test_eric_eccli_command_wait_for(self): wait_for = 'result[0] contains "Ericsson IPOS"' set_module_args(dict(commands=['show version'], wait_for=wait_for)) self.execute_module()
def test_igmp_proxy_reporting_enabled(self): set_module_args(dict(state='enabled', proxy_reporting='enabled')) commands = ['ip igmp snooping', 'ip igmp snooping proxy reporting'] self.execute_module(changed=True, commands=commands)
def test_eric_eccli_command_retries(self): wait_for = 'result[0] contains "test string"' set_module_args( dict(commands=['show version'], wait_for=wait_for, retries=2)) self.execute_module(failed=True) self.assertEqual(self.run_commands.call_count, 2)
def test_access_vlan_no_change(self): set_module_args(dict(name='Eth1/11', access_vlan=1)) self.execute_module(changed=False)
def test_change_username_password_encrypted(self): set_module_args( dict(username='******', password="******", encrypted_password=True)) commands = ['username anass password 7 12345'] self.execute_module(changed=True, commands=commands)