def addaddr(self, addr: str) -> None: """ Add address. :param addr: address to add :return: nothing """ addr = utils.validate_ip(addr) self.addrlist.append(addr)
def addaddr(self, addr: str) -> None: """ Add address to to network interface. :param addr: address to add :return: nothing :raises CoreCommandError: when there is a command exception """ addr = utils.validate_ip(addr) if self.up: self.net_client.create_address(self.name, addr) self.interface.addaddr(addr)
def addaddr(self, ifindex: int, addr: str) -> None: """ Add an address to an interface. :param ifindex: index of interface to add address to :param addr: address to add :return: nothing """ addr = utils.validate_ip(addr) interface = self._netif[ifindex] if self.up: self.net_client.create_address(interface.name, addr) interface.addaddr(addr)
def addaddr(self, ifindex: int, addr: str) -> None: """ Add interface address. :param ifindex: index of interface to add address to :param addr: address to add to interface :return: nothing """ addr = utils.validate_ip(addr) interface = self._netif[ifindex] interface.addaddr(addr) if self.up: # ipv4 check broadcast = None if netaddr.valid_ipv4(addr): broadcast = "+" self.node_net_client.create_address(interface.name, addr, broadcast)
def test_validate_ip_exception(self, data: str): with pytest.raises(CoreError): utils.validate_ip("")
def test_validate_ip(self, data: str, expected: str): value = utils.validate_ip(data) assert value == expected