def test_add_alias(self, mocked_execute, mocked_get_alias): mocked_get_alias.return_value = False mocked_execute.return_value = (0, Mock(), Mock()) util.add_alias('10.0.0.1/32', 'eth1') cmd = ['/bin/ip', 'addr', 'add', '10.0.0.1/32', 'dev', 'eth1', 'label', 'eth1:1'] mocked_execute.assert_called_once_with(cmd)
def _setup(self): # TODO(retr0h): log print 'addresses to add' own_addresses = util.get_own_addresses(self._get_servers(), self._config.aliases) for address in own_addresses: print address interface = self._config.interface util.add_alias(address, interface)