def setUp(self):
        super(TestVyosFirewallInterfacesModule, 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_execute_show_command = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_interfaces.firewall_interfaces.Firewall_interfacesFacts.get_device_data"
        )
        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 2
0
    def setUp(self):
        super(TestVyosConfigModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_config'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_config.load_config'
        )
        self.load_config = self.mock_load_config.start()

        self.mock_run_commands = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_config.run_commands'
        )
        self.run_commands = self.mock_run_commands.start()

        self.mock_get_connection = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_connection'
        )
        self.get_connection = self.mock_get_connection.start()

        self.cliconf_obj = Cliconf(MagicMock())
        self.running_config = load_fixture('vyos_config_config.cfg')

        self.conn = self.get_connection()
        self.conn.edit_config = MagicMock()
        self.running_config = load_fixture('vyos_config_config.cfg')
Ejemplo n.º 3
0
    def setUp(self):
        super(TestVyosBgpglobalModule, self).setUp()

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

        self.mock_execute_show_command_config = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.bgp_global.bgp_global.Bgp_global._get_config"
        )
        self.execute_show_command_config = (
            self.mock_execute_show_command_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_execute_show_command = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.bgp_global.bgp_global.Bgp_globalFacts.get_device_data"
        )

        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 4
0
    def setUp(self):
        super(TestVyosFactsModule, self).setUp()
        self.mock_run_commands = patch(
            'ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.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.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.get_capabilities'
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {
            'device_info': {
                'network_os': 'vyos',
                'network_os_hostname': 'vyos01',
                'network_os_model': 'VMware',
                'network_os_version': 'VyOS 1.1.7'
            },
            'network_api': 'cliconf'
        }
Ejemplo n.º 5
0
    def setUp(self):
        super(TestVyosStaticRoutesModule, 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_execute_show_command = patch(
            'ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data'
        )
        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 6
0
    def setUp(self):
        super(TestVyosFactsModule, self).setUp()
        self.mock_run_commands = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.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.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.get_capabilities"
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {
            "device_info": {
                "network_os": "vyos",
                "network_os_hostname": "vyos01",
                "network_os_model": "VMware",
                "network_os_version": "VyOS 1.1.7",
            },
            "network_api": "cliconf",
        }
Ejemplo n.º 7
0
    def setUp(self):
        super(TestVyosStaticRouteModule, self).setUp()

        self.mock_get_config = patch(
            "ansible.modules.network.vyos.vyos_static_route.get_config")
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible.modules.network.vyos.vyos_static_route.load_config")
        self.load_config = self.mock_load_config.start()
Ejemplo n.º 8
0
    def setUp(self):
        super(TestVyosStaticRouteModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules._vyos_static_route.get_config'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules._vyos_static_route.load_config'
        )
        self.load_config = self.mock_load_config.start()
    def setUp(self):
        super(TestVyosOspfInterfacesModule, self).setUp()
        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"
        )
        self.get_resource_connection_config = (
            self.mock_get_resource_connection_config.start())

        self.mock_execute_show_command = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospf_interfaces.ospf_interfaces.Ospf_interfacesFacts.get_device_data"
        )
        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 10
0
    def setUp(self):
        super(TestVyosUserModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_user.get_config'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            'ansible_collections.vyos.vyos.plugins.modules.vyos_user.load_config'
        )
        self.load_config = self.mock_load_config.start()
Ejemplo n.º 11
0
    def setUp(self):
        super(TestVyosSystemModule, self).setUp()

        self.mock_get_config = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_system.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_system.load_config"
        )
        self.load_config = self.mock_load_config.start()
    def setUp(self):
        super(TestVyosBgpafModule, self).setUp()
        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"
        )
        self.get_resource_connection_config = (
            self.mock_get_resource_connection_config.start())

        self.mock_execute_show_command = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts."
            +
            "bgp_address_family.bgp_address_family.Bgp_address_familyFacts.get_device_data"
        )
        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 13
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)
    def setUp(self):
        super(TestVyosHostnameModule, self).setUp()

        self.mock_get_resource_connection_config = patch(
            "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_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_execute_show_command = patch(
            "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.hostname.hostname.HostnameFacts.get_config"
        )

        self.execute_show_command = self.mock_execute_show_command.start()
Ejemplo n.º 15
0
    def setUp(self):
        super(TestVyosInterfaceModule, self).setUp()
        self.mock_get_config = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_config"
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.load_config"
        )
        self.load_config = self.mock_load_config.start()

        self.mock_execute_interfaces_command = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_interfaces_data"
        )
        self.execute_interfaces_command = (
            self.mock_execute_interfaces_command.start())
        self.mock_execute_lldp_command = patch(
            "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_lldp_neighbor"
        )
        self.execute_lldp_command = self.mock_execute_lldp_command.start()
Ejemplo n.º 16
0
 def setUp(self):
     super(TestVyosCommandModule, self).setUp()
     self.mock_run_commands = patch(
         'ansible_collections.vyos.vyos.plugins.modules.vyos_command.run_commands'
     )
     self.run_commands = self.mock_run_commands.start()
Ejemplo n.º 17
0
 def setUp(self):
     super(TestVyosPingModule, self).setUp()
     self.mock_run_commands = patch(
         "ansible_collections.vyos.vyos.plugins.modules.vyos_ping.run_commands"
     )
     self.run_commands = self.mock_run_commands.start()