def load_static_rules(self): """ Load static rules from json file specified in config """ valid_entries = defaultdict(list) for switch in Configuration.get('switches'): if "static_rules" in switch and Configuration.get( 'static_rules') == True: data = Configuration.load(switch['static_rules'])["entries"] for entry in data: if entry['table'] != "ingress.ipv4_c.ipv4": continue e = TableEntry( switch=entry["switch"], match_fields={ "hdr.ipv4.dstAddr": (str(entry["match_fields"][0]), int(entry["match_fields"][1])), "meta.ports.status": (BierComputation.id_to_bitstring( id=int(entry["match_fields"][2])), int(entry["match_fields"][3])) }, action_name=entry["action_name"], action_params={"port": int(entry["action_params"])}, priority=1) TableEntryManager.handle_table_entry( self.table_manager, table_name=entry["table"], table_entry=e) valid_entries[entry["switch"]].append(e.match_fields) Log.async_info("Static rules for IPv4 loaded.") return valid_entries
def setPortMonitor(self, config_file=None): Log.info("Set port monitor") self.pm.setupProtection(Configuration.load(config_file))
def setFlood(self, config_file=None): Log.info("Set flood mc group") self.mc.setFlood(Configuration.load(config_file))
def setMirrorSession(self, config_file=None): Log.info("Set mirror session") self.mirror.setMirrorSession(Configuration.load(config_file))
def setPorts(self, config_file=None): Log.info("Set ports") self.pc.setPorts(Configuration.load(config_file))