def __init__(self, *args, **kwargs): super(CoscinApp, self).__init__(*args, **kwargs) # The nib is the universal variable containing network configuration and # learned state (so far) nib = NetworkInformationBase() self.nib = nib config_file = os.getenv("COSCIN_CFG_FILE", "coscin_gates_testbed.json") nib.load_config(config_file) hostname = socket.gethostname() on_switch = self.nib.switch_for_controller_host(hostname) if on_switch == None: self.logger.error("The hostname "+hostname+" is not present in a controller_hosts attribute for the switch in "+config_file) sys.exit(1) zookeeper_for_switch = self.nib.zookeeper_for_switch(on_switch) if zookeeper_for_switch == "": self.mc = None else: self.mc = MultipleControllers(self.logger, hostname, zookeeper_for_switch) self.heartbeat_monitor_started = False # Register all handlers self.l2_learning_switch_handler = L2LearningSwitchHandler(nib, self.logger) self.cross_campus_handler = CrossCampusHandler(nib, self.logger) self.arp_handler = ArpHandler(nib, self.logger) self.path_selection_handler = PathSelectionHandler(nib, self.logger)
def __init__(self, config_file='laptop_demo_network.json'): frenetic.App.__init__(self) nib = NetworkInformationBase() self.nib = nib nib.load_config(config_file) self.arp_handler = ArpHandler(self, nib) self.intranet_handler = IntranetHandler(self, nib) self.cross_campus_handler = CrossCampusHandler(self, nib)
def __init__(self, *args, **kwargs): super(L2SwitchApp, self).__init__(*args, **kwargs) # The nib is the universal variable containing network configuration and # learned state (so far) nib = NetworkInformationBase() self.nib = nib nib.load_config(os.getenv("COSCIN_CFG_FILE", "coscin_gates_testbed.json")) hostname = socket.gethostname() on_switch = self.nib.switch_for_controller_host(hostname) zookeeper_for_switch = self.nib.zookeeper_for_switch(on_switch) self.mc = MultipleControllers(self.logger, hostname, zookeeper_for_switch) self.heartbeat_monitor_started = False