def test_iosxr_config_lines_w_parents(self): lines = ['shutdown'] parents = ['interface GigabitEthernet0/0'] set_module_args(dict(lines=lines, parents=parents)) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = iosxr_config.get_candidate(module) self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff( candidate_config, self.running_config)) commands = ['interface GigabitEthernet0/0', 'shutdown'] self.execute_module(changed=True, commands=commands)
def test_voss_config_ipv6(self): lines = ['ip address 1 1.1.1.1/255.255.255.255', 'ipv6 interface address 2011:0:0:0:0:0:0:1/128'] parents = ['interface loopback 1'] set_module_args(dict(lines=lines, parents=parents)) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = voss_config.get_candidate_config(module) self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config)) self.execute_module(changed=False)
def test_voss_config_match_exact(self): lines = ['name "ServerA"', 'vlacp enable', 'no shutdown'] parents = ['interface GigabitEthernet 1/1'] set_module_args(dict(lines=lines, parents=parents, match='exact')) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = voss_config.get_candidate_config(module) self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='exact', path=parents)) commands = parents + lines self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_replace_block(self): lines = ['name "ServerB"', 'test string'] parents = ['interface GigabitEthernet 1/2'] set_module_args(dict(lines=lines, replace='block', parents=parents)) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = voss_config.get_candidate_config(module) self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_replace='block', path=parents)) commands = parents + lines self.execute_module(changed=True, commands=commands)
def test_icx_config_lines_w_parents(self): lines = ['disable'] parents = ['interface ethernet 1/1/4'] set_module_args(dict(lines=lines, parents=parents)) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = icx_config.get_candidate_config(module) self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff( candidate_config, self.running_config)) commands = ['interface ethernet 1/1/4', 'disable'] self.execute_module(changed=True, commands=commands)
def test_iosxr_config_match_none(self): lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string'] parents = ['interface GigabitEthernet0/0'] set_module_args(dict(lines=lines, parents=parents, match='none')) commands = parents + lines module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = iosxr_config.get_candidate(module) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='none', path=parents)) self.execute_module(changed=True, commands=commands, sort=False)
def test_icx_config_match_none_block(self): lines = ['speed-duplex 10-full', 'port-name test-interface-4'] parents = ['interface ethernet 1/1/4'] set_module_args(dict(lines=lines, parents=parents, match='none')) module = MagicMock() module.params = {'lines': lines, 'parents': parents, 'src': None} candidate_config = icx_config.get_candidate_config(module) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='none', path=parents)) commands = parents + lines self.execute_module(changed=True, commands=commands, sort=False)