Exemple #1
0
    def setUp(self):
        super(TestJunosScpModule, self).setUp()
        self.mock_get_device = patch('ansible_collections.juniper.junos.plugins.modules.junos_scp.get_device')
        self.get_device = self.mock_get_device.start()

        self.mock_scp = patch('ansible_collections.juniper.junos.plugins.modules.junos_scp.SCP')
        self.scp = self.mock_scp.start()

        self.scp_mock = MagicMock()
        self.scp().__enter__.return_value = self.scp_mock
    def setUp(self):
        super(TestJunosCommandModule, self).setUp()
        self.mock_conn = patch('ansible.module_utils.connection.Connection')
        self.conn = self.mock_conn.start()

        self.mock_netconf = patch('ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.NetconfConnection')
        self.netconf_conn = self.mock_netconf.start()

        self.mock_netconf_rpc = patch('ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection')
        self.netconf_rpc = self.mock_netconf_rpc.start()

        self.mock_exec_rpc = patch('ansible_collections.juniper.junos.plugins.modules.junos_rpc.exec_rpc')
        self.exec_rpc = self.mock_exec_rpc.start()
    def setUp(self):
        super(TestJunosPingModule, self).setUp()

        self.mock_get_connection = patch('ansible_collections.juniper.junos.plugins.modules.junos_ping.get_connection')
        self.get_connection = self.mock_get_connection.start()

        self.conn = self.get_connection()
        self.conn.get = MagicMock()
Exemple #4
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(TestJunosCommandModule, self).setUp()

        self.mock_conn = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.Connection'
        )
        self.conn = self.mock_conn.start()

        self.mock_netconf = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.NetconfConnection'
        )
        self.netconf_conn = self.mock_netconf.start()

        self.mock_exec_rpc = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_command.exec_rpc'
        )
        self.exec_rpc = self.mock_exec_rpc.start()

        self.mock_netconf_rpc = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection'
        )
        self.netconf_rpc = self.mock_netconf_rpc.start()

        self.mock_get_connection = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_command.get_connection'
        )
        self.get_connection = self.mock_get_connection.start()

        self.mock_get_capabilities = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_command.get_capabilities'
        )
        self.get_capabilities = self.mock_get_capabilities.start()
        self.get_capabilities.return_value = {'network_api': 'netconf'}
Exemple #6
0
    def setUp(self):
        super(TestJunosCommandModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.facts.legacy.base.get_configuration'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_netconf = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.NetconfConnection'
        )
        self.netconf_conn = self.mock_netconf.start()

        self.mock_exec_rpc = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.facts.legacy.base.exec_rpc'
        )
        self.exec_rpc = self.mock_exec_rpc.start()

        self.mock_netconf_rpc = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection'
        )
        self.netconf_rpc = self.mock_netconf_rpc.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.juniper.junos.plugins.module_utils.network.junos.facts.legacy.base.get_capabilities'
        )
        self.get_capabilities = self.mock_get_capabilities.start()

        self.get_capabilities.return_value = {
            'device_info': {
                'network_os': 'junos',
                'network_os_hostname': 'vsrx01',
                'network_os_model': 'vsrx',
                'network_os_version': '17.3R1.10'
            },
            'network_api': 'netconf'
        }
Exemple #7
0
    def setUp(self):
        super(TestJunosConfigModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.get_configuration'
        )
        self.get_config = self.mock_get_config.start()

        self.mock_load_config = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.load_config'
        )
        self.load_config = self.mock_load_config.start()

        self.mock_load_configuration = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.load_configuration'
        )
        self.load_configuration = self.mock_load_configuration.start()

        self.mock_lock_configuration = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.lock_configuration'
        )
        self.lock_configuration = self.mock_lock_configuration.start()

        self.mock_unlock_configuration = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.unlock_configuration'
        )
        self.unlock_configuration = self.mock_unlock_configuration.start()

        self.mock_commit_configuration = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.commit_configuration'
        )
        self.commit_configuration = self.mock_commit_configuration.start()

        self.mock_get_diff = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.get_diff'
        )
        self.get_diff = self.mock_get_diff.start()

        self.mock_conn = patch('ansible.module_utils.connection.Connection')
        self.conn = self.mock_conn.start()

        self.mock_netconf = patch(
            'ansible_collections.juniper.junos.plugins.module_utils.network.junos.junos.NetconfConnection'
        )
        self.netconf_conn = self.mock_netconf.start()

        self.mock_exec_rpc = patch(
            'ansible_collections.juniper.junos.plugins.modules.junos_config.exec_rpc'
        )
        self.exec_rpc = self.mock_exec_rpc.start()

        self.mock_netconf_rpc = patch(
            'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection'
        )
        self.netconf_rpc = self.mock_netconf_rpc.start()
Exemple #8
0
 def setUp(self):
     super(TestJunosPackageModule, self).setUp()
     self.mock_get_device = patch('ansible_collections.juniper.junos.plugins.modules.junos_package.get_device')
     self.get_device = self.mock_get_device.start()