Fix flake8 errors with eos_acl_interfaces (#67695)
Theses were exposed by our collections testing. Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
059a193dff
commit
74e948e6e4
3 changed files with 10 additions and 21 deletions
|
@ -14,12 +14,10 @@ created
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import re
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
||||||
from ansible.module_utils.network.common.utils import to_list, dict_diff, search_obj_in_list
|
from ansible.module_utils.network.common.utils import to_list, search_obj_in_list
|
||||||
from ansible.module_utils.network.common.utils import remove_empties
|
|
||||||
from ansible.module_utils.network.eos.facts.facts import Facts
|
from ansible.module_utils.network.eos.facts.facts import Facts
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -404,12 +404,6 @@ def main():
|
||||||
|
|
||||||
:returns: the result form module invocation
|
:returns: the result form module invocation
|
||||||
"""
|
"""
|
||||||
required_if = [('state', 'merged', ('config',)),
|
|
||||||
('state', 'replaced', ('config',)),
|
|
||||||
('state', 'overridden', ('config',)),
|
|
||||||
('state', 'rendered', ('config',)),
|
|
||||||
('state', 'parsed', ('running_config',))]
|
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=Acl_interfacesArgs.argument_spec,
|
module = AnsibleModule(argument_spec=Acl_interfacesArgs.argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,8 @@ __metaclass__ = type
|
||||||
|
|
||||||
from units.compat.mock import patch
|
from units.compat.mock import patch
|
||||||
from ansible.modules.network.eos import eos_acl_interfaces
|
from ansible.modules.network.eos import eos_acl_interfaces
|
||||||
from ansible.module_utils.network.eos.config.acl_interfaces.acl_interfaces import add_commands
|
|
||||||
from units.modules.utils import set_module_args
|
from units.modules.utils import set_module_args
|
||||||
from .eos_module import TestEosModule, load_fixture
|
from .eos_module import TestEosModule, load_fixture
|
||||||
import itertools
|
|
||||||
|
|
||||||
|
|
||||||
class TestEosAclInterfacesModule(TestEosModule):
|
class TestEosAclInterfacesModule(TestEosModule):
|
||||||
|
@ -99,7 +97,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
commands = ['interface GigabitEthernet0/0', 'ip access-group aclv401 in',
|
commands = ['interface GigabitEthernet0/0', 'ip access-group aclv401 in',
|
||||||
'ip access-group aclv402 out', 'ipv6 access-group aclv601 in', 'interface GigabitEthernet0/1',
|
'ip access-group aclv402 out', 'ipv6 access-group aclv601 in', 'interface GigabitEthernet0/1',
|
||||||
'ip access-group aclv401 in']
|
'ip access-group aclv401 in']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_merged_idempotent(self):
|
def test_eos_acl_interfaces_merged_idempotent(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -120,7 +118,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
acls=[dict(name="aclv601", direction="in")])
|
acls=[dict(name="aclv601", direction="in")])
|
||||||
])
|
])
|
||||||
], state="merged"))
|
], state="merged"))
|
||||||
result = self.execute_module(changed=False, commands=[])
|
self.execute_module(changed=False, commands=[])
|
||||||
|
|
||||||
def test_eos_acl_interfaces_replaced(self):
|
def test_eos_acl_interfaces_replaced(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -139,7 +137,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in',
|
commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in',
|
||||||
'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out',
|
'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out',
|
||||||
'ip access-group aclv401 in']
|
'ip access-group aclv401 in']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_replaced_idempotent(self):
|
def test_eos_acl_interfaces_replaced_idempotent(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -155,7 +153,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
acls=[dict(name="aclv601", direction="out")])
|
acls=[dict(name="aclv601", direction="out")])
|
||||||
]),
|
]),
|
||||||
], state="replaced"))
|
], state="replaced"))
|
||||||
result = self.execute_module(changed=False, commands=[])
|
self.execute_module(changed=False, commands=[])
|
||||||
|
|
||||||
def test_eos_acl_interfaces_overridden(self):
|
def test_eos_acl_interfaces_overridden(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -175,7 +173,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out',
|
'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out',
|
||||||
'ip access-group aclv401 in', 'interface GigabitEthernet0/1',
|
'ip access-group aclv401 in', 'interface GigabitEthernet0/1',
|
||||||
'no ipv6 access-group aclv601 in']
|
'no ipv6 access-group aclv601 in']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_overridden_idempotent(self):
|
def test_eos_acl_interfaces_overridden_idempotent(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -199,7 +197,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
], state="overridden"))
|
], state="overridden"))
|
||||||
result = self.execute_module(changed=False, commands=[])
|
self.execute_module(changed=False, commands=[])
|
||||||
|
|
||||||
def test_eos_acl_interfaces_deletedafi(self):
|
def test_eos_acl_interfaces_deletedafi(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -209,7 +207,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
dict(afi="ipv6")])
|
dict(afi="ipv6")])
|
||||||
], state="deleted"))
|
], state="deleted"))
|
||||||
commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out']
|
commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_deletedint(self):
|
def test_eos_acl_interfaces_deletedint(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -218,7 +216,7 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
], state="deleted"))
|
], state="deleted"))
|
||||||
commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out',
|
commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out',
|
||||||
'no ip access-group aclv404 in']
|
'no ip access-group aclv404 in']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_deletedacl(self):
|
def test_eos_acl_interfaces_deletedacl(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
|
@ -233,13 +231,12 @@ class TestEosAclInterfacesModule(TestEosModule):
|
||||||
])
|
])
|
||||||
], state="deleted"))
|
], state="deleted"))
|
||||||
commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in']
|
commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in']
|
||||||
result = self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_acl_interfaces_gathered(self):
|
def test_eos_acl_interfaces_gathered(self):
|
||||||
set_module_args(
|
set_module_args(
|
||||||
dict(state="gathered"))
|
dict(state="gathered"))
|
||||||
result = self.execute_module(changed=False, filename='eos_acl_interfaces_config.cfg')
|
result = self.execute_module(changed=False, filename='eos_acl_interfaces_config.cfg')
|
||||||
commands = []
|
|
||||||
gathered_list = [{'access_groups': [{'acls': [{'direction': 'in', 'name': 'aclv404'}], 'afi': 'ipv4'},
|
gathered_list = [{'access_groups': [{'acls': [{'direction': 'in', 'name': 'aclv404'}], 'afi': 'ipv4'},
|
||||||
{'acls': [{'direction': 'out', 'name': 'aclv601'}], 'afi': 'ipv6'}],
|
{'acls': [{'direction': 'out', 'name': 'aclv601'}], 'afi': 'ipv6'}],
|
||||||
'name': 'GigabitEthernet0/0'},
|
'name': 'GigabitEthernet0/0'},
|
||||||
|
|
Loading…
Reference in a new issue