Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    def test_icx_config_replace_block(self):
        lines = ['port-name test string', 'test string']
        parents = ['interface ethernet 1/1/4']
        set_module_args(dict(lines=lines, replace='block', 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,
                                                   diff_replace='block',
                                                   path=parents))

        commands = parents + lines
        self.execute_module(changed=True, commands=commands)