def _get_MEs(self): me_list = [] rma = RegisteredMatchActions() for key in self.match.keys(): me_list.append(rma.lookup(self.match.keys()[1])) return me_list
def __init__(self, datapath, match, action, priority=1, table=0, postmatch=None): self.match = match self.action = action self.postmatch = postmatch self.priority = priority # Initialize tracking structures self.trackers = {} # Register with MCM self.mcm = NetAssayMCM() self.mcm.register_NAMA(self) self.vmac = self.mcm.get_vmac(str(self.match) + str(self.postmatch)) self.mcmtable = self.mcm.get_table() self.subtable = table self.datapath = datapath self.cookie = self.mcm.get_cookie() # Install rule in MCM's table for future action self.install_mcm_table_match() #TODO: Single ME now. Need changes to handle multiple MEs for a single NAMA # Create the new rule with the ME. # self.MEs = self._get_MEs() # self.MErules = self._create_ME_rules() # self._register_with_MEs() # FOR A SINGLE RULE ONLY rma = RegisteredMatchActions() self.ME = rma.lookup(self.match.keys()[0]) self.MErule = self.ME.new_rule(self.match[self.match.keys()[0]], self.add_rule, self.remove_rule) self.mcm.logger.info("Created NAMA on switch " + str(self.datapath.id) + " for: " + str(self.match))