def _delete_flow(self, flow_stat, sid, ip_addr, version): cookie, mask = (flow_stat.cookie, flows.OVS_COOKIE_MATCH_ALL) match = _generate_rule_match(sid, ip_addr, flow_stat.cookie, version, Direction(flow_stat.match[DIRECTION_REG])) flows.delete_flow(self._datapath, self.tbl_num, match, cookie=cookie, cookie_mask=mask)
def _remove_extra_flows(self, extra_flows): msg_list = [] for flow in extra_flows: if DIRECTION_REG in flow.match: direction = Direction(flow.match.get(DIRECTION_REG, None)) else: direction = None match = MagmaMatch(imsi=flow.match.get(IMSI_REG, None), direction=direction) self.logger.debug('Sending msg for deletion -> %s', flow.match.get('reg1', None)) msg_list.append( flows.get_delete_flow_msg( self._datapath, self.tbl_num, match, cookie=flow.cookie, cookie_mask=flows.OVS_COOKIE_MATCH_ALL)) if msg_list: chan = self._msg_hub.send(msg_list, self._datapath) self._wait_for_responses(chan, len(msg_list))