コード例 #1
0
    def setUp(self):
        super(TestIosFactsModule, self).setUp()
        self.mock_run_commands = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.legacy.base.run_commands"
        )
        self.run_commands = self.mock_run_commands.start()

        self.mock_get_resource_connection = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"
        )
        self.get_resource_connection = (
            self.mock_get_resource_connection.start())

        self.mock_get_capabilities = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.legacy.base.get_capabilities"
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {
            "device_info": {
                "network_os": "ios",
                "network_os_hostname": "an-ios-01",
                "network_os_image": "flash0:/vios-adventerprisek9-m",
                "network_os_model": "WS-C3750-24TS",
                "network_os_version": "15.6(3)M2",
            },
            "network_api": "cliconf",
        }
コード例 #2
0
ファイル: test_ios_facts.py プロジェクト: coll-test/cisco.ios
    def setUp(self):
        super(TestIosFactsModule, self).setUp()
        self.mock_run_commands = patch(
            'ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.legacy.base.run_commands'
        )
        self.run_commands = self.mock_run_commands.start()

        self.mock_get_resource_connection = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection'
        )
        self.get_resource_connection = self.mock_get_resource_connection.start(
        )

        self.mock_get_capabilities = patch(
            'ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.legacy.base.get_capabilities'
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {
            'device_info': {
                'network_os': 'ios',
                'network_os_hostname': 'an-ios-01',
                'network_os_image': 'flash0:/vios-adventerprisek9-m',
                'network_os_model': 'WS-C3750-24TS',
                'network_os_version': '15.6(3)M2'
            },
            'network_api': 'cliconf'
        }
コード例 #3
0
    def setUp(self):
        super(TestIosSystemModule, self).setUp()

        self.mock_get_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_system.get_config')
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_system.load_config')
        self.load_config = self.mock_load_config.start()
コード例 #4
0
    def setUp(self):
        super(TestIosVrfModule, self).setUp()

        self.mock_get_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_vrf.get_config')
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_vrf.load_config')
        self.load_config = self.mock_load_config.start()

        self.mock_exec_command = patch('ansible_collections.cisco.ios.plugins.modules.ios_vrf.exec_command')
        self.exec_command = self.mock_exec_command.start()
コード例 #5
0
    def setUp(self):
        super(TestIosNtpModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_ntp.get_config")
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_ntp.load_config"
        )
        self.load_config = self.mock_load_config.start()
コード例 #6
0
    def setUp(self):
        super(TestIosLoggingModuleIOS12, self).setUp()

        self.mock_get_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_logging.get_config')
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch('ansible_collections.cisco.ios.plugins.modules.ios_logging.load_config')
        self.load_config = self.mock_load_config.start()

        self.mock_get_capabilities = patch('ansible_collections.cisco.ios.plugins.modules.ios_logging.get_capabilities')
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {'device_info': {'network_os_version': '12.1(2)T'}}
コード例 #7
0
    def setUp(self):
        super(TestIosVlanModule, self).setUp()

        self.mock_run_commands = patch(
            "ansible.modules.network.ios._ios_vlan.run_commands"
        )
        self.run_commands = self.mock_run_commands.start()

        self.mock_load_config = patch(
            "ansible.modules.network.ios._ios_vlan.load_config"
        )
        self.load_config = self.mock_load_config.start()
コード例 #8
0
ファイル: test_ios_vlan.py プロジェクト: coll-test/cisco.ios
    def setUp(self):
        super(TestIosVlanModule, self).setUp()

        self.mock_run_commands = patch(
            'ansible_collections.cisco.ios.plugins.modules._ios_vlan.run_commands'
        )
        self.run_commands = self.mock_run_commands.start()

        self.mock_load_config = patch(
            'ansible_collections.cisco.ios.plugins.modules._ios_vlan.load_config'
        )
        self.load_config = self.mock_load_config.start()
コード例 #9
0
    def setUp(self):
        super(TestIosCommandModule, self).setUp()

        self.mock_run_commands = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_command.run_commands",
        )
        self.run_commands = self.mock_run_commands.start()
コード例 #10
0
 def setUp(self):
     self.mock_module = patch.multiple(basic.AnsibleModule,
                                       exit_json=exit_json,
                                       fail_json=fail_json)
     self.mock_module.start()
     self.mock_sleep = patch("time.sleep")
     self.mock_sleep.start()
     set_module_args({})
     self.addCleanup(self.mock_module.stop)
     self.addCleanup(self.mock_sleep.stop)
コード例 #11
0
    def setUp(self):
        super(TestIosLoggingModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_logging.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_logging.load_config"
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_capabilities = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_logging.get_capabilities"
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {
            "device_info": {"network_os_version": "15.6(2)T"}
        }
コード例 #12
0
    def setUp(self):
        super(TestIosAclInterfacesModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config",
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config",
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base."
            "get_resource_connection", )
        self.get_resource_connection_config = self.mock_get_resource_connection_config.start(
        )

        self.mock_get_resource_connection_facts = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base."
            "get_resource_connection", )
        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start(
        )

        self.mock_edit_config = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config",
        )
        self.edit_config = self.mock_edit_config.start()

        self.mock_execute_show_command = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acl_interfaces.acl_interfaces."
            "Acl_interfacesFacts.get_acl_interfaces_data", )
        self.execute_show_command = self.mock_execute_show_command.start()
コード例 #13
0
    def setUp(self):
        super(TestIosOspfV2Module, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config"
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base."
            "get_resource_connection")
        self.get_resource_connection_config = (
            self.mock_get_resource_connection_config.start())

        self.mock_get_resource_connection_facts = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module."
            "get_resource_connection")
        self.get_resource_connection_facts = (
            self.mock_get_resource_connection_facts.start())

        self.mock_edit_config = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config"
        )
        self.edit_config = self.mock_edit_config.start()

        self.mock_execute_show_command = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.ospfv2.ospfv2."
            "Ospfv2Facts.get_ospfv2_data")
        self.execute_show_command = self.mock_execute_show_command.start()
コード例 #14
0
    def setUp(self):
        super(TestIosBgpAddressFamilyModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config"
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base."
            "get_resource_connection")
        self.get_resource_connection_config = (
            self.mock_get_resource_connection_config.start())

        self.mock_get_resource_connection_facts = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base."
            "get_resource_connection")
        self.get_resource_connection_facts = (
            self.mock_get_resource_connection_facts.start())

        self.mock_edit_config = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config"
        )
        self.edit_config = self.mock_edit_config.start()

        self.mock_execute_show_command = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.bgp_address_family.bgp_address_family."
            "Bgp_AddressFamilyFacts.get_bgp_address_family_data")
        self.execute_show_command = self.mock_execute_show_command.start()
コード例 #15
0
    def setUp(self):
        super(TestIosStaticRoutesModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config'
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_resource_connection_config = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.'
            'get_resource_connection')
        self.get_resource_connection_config = self.mock_get_resource_connection_config.start(
        )

        self.mock_get_resource_connection_facts = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.'
            'get_resource_connection')
        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start(
        )

        self.mock_edit_config = patch(
            'ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config'
        )
        self.edit_config = self.mock_edit_config.start()

        self.mock_execute_show_command = patch(
            'ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.static_routes.static_routes.'
            'Static_RoutesFacts.get_static_routes_data')
        self.execute_show_command = self.mock_execute_show_command.start()
コード例 #16
0
    def setUp(self):
        super(TestIosConfigModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_config.get_config",
        )
        self.get_config = self.mock_get_config.start()

        self.mock_get_connection = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_config.get_connection",
        )
        self.get_connection = self.mock_get_connection.start()

        self.conn = self.get_connection()
        self.conn.edit_config = MagicMock()

        self.mock_run_commands = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_config.run_commands",
        )
        self.run_commands = self.mock_run_commands.start()

        self.cliconf_obj = Cliconf(MagicMock())
        self.running_config = load_fixture("ios_config_config.cfg")
コード例 #17
0
    def setUp(self):
        super(TestIosVlansModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config"
        )
        self.load_config = self.mock_load_config.start()

        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base."
            "get_resource_connection")
        self.get_resource_connection_config = (
            self.mock_get_resource_connection_config.start())

        self.mock_get_resource_connection_facts = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts."
            "get_resource_connection")
        self.get_resource_connection_facts = (
            self.mock_get_resource_connection_facts.start())

        self.mock_edit_config = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config"
        )
        self.edit_config = self.mock_edit_config.start()

        self.mock_execute_show_command = patch(
            "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vlans.vlans."
            "VlansFacts.get_vlans_data")
        self.execute_show_command = self.mock_execute_show_command.start()
        self.mock_l2_device_command = patch(
            "ansible_collections.cisco.ios.plugins.modules.ios_vlans._is_l2_device"
        )
        self._l2_device_command = self.mock_l2_device_command.start()
コード例 #18
0
ファイル: test_ios_ping.py プロジェクト: coll-test/cisco.ios
 def setUp(self):
     super(TestIosPingModule, self).setUp()
     self.mock_run_commands = patch(
         'ansible_collections.cisco.ios.plugins.modules.ios_ping.run_commands'
     )
     self.run_commands = self.mock_run_commands.start()
コード例 #19
0
 def setUp(self):
     super(TestIosPingModule, self).setUp()
     self.mock_execute_show_command = patch(
         "ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.ping.ping.Ping.run_command",
     )
     self.execute_show_command = self.mock_execute_show_command.start()