def test_ce_static_route_bfd_changed_true(self):
     srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
     srBfdPara_2 = load_fixture('ce_static_route_bfd', 'srBfdPara_2.txt')
     staticrtbase_1 = load_fixture('ce_static_route_bfd',
                                   'staticrtbase_1.txt')
     staticrtbase_2 = load_fixture('ce_static_route_bfd',
                                   'staticrtbase_2.txt')
     self.get_nc_config.side_effect = (srBfdPara_1, staticrtbase_1,
                                       srBfdPara_2, staticrtbase_2)
     updates = [
         'ip route-static vpn-instance mgnt 255.255.0.0 255.255.252.0 10GE1/0/1 10.10.1.1',
         ' preference 22', ' tag 23', ' track bfd-session 43',
         ' description for a test'
     ]
     config = dict(prefix='255.255.0.0',
                   mask=22,
                   aftype='v4',
                   next_hop='10.10.1.1',
                   nhp_interface='10GE1/0/1',
                   vrf='mgnt',
                   destvrf='_public_',
                   tag=23,
                   description='for a test',
                   pref='22',
                   function_flag='dynamicBFD',
                   min_tx_interval='32',
                   min_rx_interval='23',
                   detect_multiplier='24',
                   bfd_session_name='43')
     set_module_args(config)
     result = self.execute_module(changed=True)
     self.assertEqual(sorted(result['updates']), sorted(updates))
 def test_isis_instance_present(self):
     xml_existing = load_fixture('ce_is_is_instance', 'after.txt')
     xml_end_state = load_fixture('ce_is_is_instance', 'before.txt')
     update = ['undo isis 100']
     self.get_nc_config.side_effect = (xml_existing, xml_end_state)
     config = dict(instance_id=100, vpn_name='__public__', state='absent')
     set_module_args(config)
     result = self.execute_module(changed=True)
     self.assertEquals(sorted(result['updates']), sorted(update))
    def setUp(self):
        super(TestCloudEngineLacpModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_multicast_global.get_nc_config'
        )
        self.get_nc_config = self.mock_get_config.start()

        self.mock_set_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_multicast_global.set_nc_config'
        )
        self.set_nc_config = self.mock_set_config.start()
        self.set_nc_config.return_value = "<ok/>"
        self.before = load_fixture('ce_multicast_global', 'before.txt')
        self.after = load_fixture('ce_multicast_global', 'after.txt')
Пример #4
0
    def setUp(self):
        super(TestCloudEngineLacpModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_is_is_interface.get_nc_config'
        )
        self.get_nc_config = self.mock_get_config.start()

        self.mock_set_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_is_is_interface.set_nc_config'
        )
        self.set_nc_config = self.mock_set_config.start()
        self.set_nc_config.return_value = None

        self.before = load_fixture('ce_is_is_interface',
                                   'before_interface.txt')
        self.after = load_fixture('ce_is_is_interface', 'after_interface.txt')
Пример #5
0
    def setUp(self):
        super(TestCloudEngineLacpModule, self).setUp()

        # self.mock_get_config = patch('ansible.modules.network.cloudengine.ce_lldp.get_nc_config')
        self.mock_get_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_lldp_interface.get_nc_config'
        )
        self.get_nc_config = self.mock_get_config.start()

        self.mock_set_nc_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_lldp_interface.set_nc_config'
        )
        self.set_nc_config = self.mock_set_nc_config.start()
        self.xml_absent = load_fixture('ce_lldp_interface',
                                       'lldp_interface_existing.txt')
        self.xml_present = load_fixture('ce_lldp_interface',
                                        'lldp_interface_changed.txt')
        self.result_ok = load_fixture('ce_lldp_interface', 'result_ok.txt')
Пример #6
0
    def setUp(self):
        super(TestCloudEngineLacpModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_lldp.get_nc_config'
        )
        self.get_nc_config = self.mock_get_config.start()

        self.mock_set_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_lldp.set_nc_config'
        )
        self.set_nc_config = self.mock_set_config.start()
        self.set_nc_config.return_value = None
        xml_existing_1 = load_fixture('ce_lldp', 'ce_lldp_global_00.txt')
        xml_existing_2 = load_fixture('ce_lldp', 'ce_lldp_global_01.txt')
        xml_end_state_1 = load_fixture('ce_lldp', 'ce_lldpSysParameter_00.txt')
        xml_end_state_2 = load_fixture('ce_lldp', 'ce_lldpSysParameter_01.txt')
        self.get_side_effect = (xml_existing_1, xml_existing_2,
                                xml_end_state_1, xml_end_state_2)
        self.result_ok = load_fixture('ce_lldp', 'result_ok.txt')
    def setUp(self):
        super(TestCloudEngineLacpModule, self).setUp()

        self.mock_get_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_static_route_bfd.get_nc_config'
        )
        self.get_nc_config = self.mock_get_config.start()

        self.mock_set_config = patch(
            'ansible_collections.community.network.plugins.modules.network.cloudengine.ce_static_route_bfd.set_nc_config'
        )
        self.set_nc_config = self.mock_set_config.start()
        self.set_nc_config.return_value = load_fixture('ce_lldp',
                                                       'result_ok.txt')
    def test_ce_static_route_bfd_changed_false(self):
        srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
        staticrtbase_1 = load_fixture('ce_static_route_bfd',
                                      'staticrtbase_1.txt')
        self.get_nc_config.side_effect = (srBfdPara_1, srBfdPara_1,
                                          staticrtbase_1, staticrtbase_1)

        config = dict(prefix='255.255.0.0',
                      mask=22,
                      aftype='v4',
                      next_hop='10.10.1.1',
                      nhp_interface='10GE1/0/1',
                      vrf='mgnt',
                      destvrf='_public_',
                      tag=23,
                      description='for a test',
                      pref='22',
                      function_flag='dynamicBFD',
                      min_tx_interval='32',
                      min_rx_interval='23',
                      detect_multiplier='24',
                      bfd_session_name='43')
        set_module_args(config)
        self.execute_module(changed=False)