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_lines_w_parents(self): lines = ['no shutdown'] parents = ['interface GigabitEthernet 1/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)) commands = ['interface GigabitEthernet 1/1', 'no shutdown'] self.execute_module(changed=True, commands=commands)
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)