def __init__(self, name, config: Union[Type[RouterConfig], Tuple[Type[RouterConfig], Dict]] = BasicRouterConfig, password='******', lo_addresses: Sequence[Union[str, IPv4Interface, IPv6Interface]] = (), *args, **kwargs): """:param password: The password for the routing daemons vtysh access :param lo_addresses: The list of addresses to set on the loopback interface""" super().__init__(name, config=config, *args, **kwargs) self.password = password # This interface already exists in the node, # so no need to move it node_params_for_lo = ["igp_area"] params = {k: v for k, v in kwargs.items() if k in node_params_for_lo} lo = IPIntf('lo', node=self, port=-1, moveIntfFn=lambda x, y: None, **params) lo.ip = lo_addresses
def __init__(self, name, config=BasicRouterConfig, cwd='/tmp', process_manager=ProcessHelper, use_v4=True, use_v6=True, password='******', *args, **kwargs): """Most of the heavy lifting for this router should happen in the associated config object. :param config: The configuration generator for this router. Either a class or a tuple (class, kwargs) :param cwd: The base directory for temporary files such as configs :param process_manager: The class that will manage all the associated processes for this router :param use_v4: Wether this router has IPv4 :param use_v6: Wether this router has IPv6 :param password: The password for the routing daemons vtysh access""" super(Router, self).__init__(name, *args, **kwargs) self.use_v4 = use_v4 self.use_v6 = use_v6 self.password = password self.cwd = cwd self._old_sysctl = {} try: self.config = config[0](self, **config[1]) except (TypeError, IndexError): self.config = config(self) self._processes = process_manager(self) # This interface already exists in the router, # so no need to move it IPIntf('lo', node=self, moveIntfFn=lambda x, y: None)