def create_filter(self, context, filter_dict, filter_id=None): in_port_id = filter_dict.get('in_port') apply_ports = ndb.get_active_ports_on_ofc( context, filter_dict['network_id'], in_port_id) body = self._generate_body(filter_dict, apply_ports, create=True) res = self.client.post(self.filters_path, body=body) # filter_id passed from a caller is not used. # ofc_filter_id is generated by PFC because the prefix of # filter_id has special meaning and it is internally used. ofc_filter_id = res['id'] return self.filter_path % ofc_filter_id
def create_filter(self, context, filter_dict, filter_id=None): in_port_id = filter_dict.get('in_port') apply_ports = ndb.get_active_ports_on_ofc(context, filter_dict['network_id'], in_port_id) body = self._generate_body(filter_dict, apply_ports, create=True) res = self.client.post(self.filters_path, body=body) # filter_id passed from a caller is not used. # ofc_filter_id is generated by PFC because the prefix of # filter_id has special meaning and it is internally used. ofc_filter_id = res['id'] return self.filter_path % ofc_filter_id
def create_ofc_packet_filter(self, context, filter_id, filter_dict): ofc_net_id = self._get_ofc_id(context, "ofc_network", filter_dict['network_id']) in_port_id = filter_dict.get('in_port') portinfo = None if in_port_id: portinfo = ndb.get_portinfo(context.session, in_port_id) if not portinfo: raise nexc.PortInfoNotFound(id=in_port_id) # Collect ports to be associated with the filter apply_ports = ndb.get_active_ports_on_ofc(context, filter_dict['network_id'], in_port_id) ofc_pf_id = self.driver.create_filter(ofc_net_id, filter_dict, portinfo, filter_id, apply_ports) self._add_ofc_item(context, "ofc_packet_filter", filter_id, ofc_pf_id)
def create_ofc_packet_filter(self, context, filter_id, filter_dict): ofc_net_id = self._get_ofc_id(context, "ofc_network", filter_dict['network_id']) in_port_id = filter_dict.get('in_port') portinfo = None if in_port_id: portinfo = ndb.get_portinfo(context.session, in_port_id) if not portinfo: raise nexc.PortInfoNotFound(id=in_port_id) # Collect ports to be associated with the filter apply_ports = ndb.get_active_ports_on_ofc( context, filter_dict['network_id'], in_port_id) ofc_pf_id = self.driver.create_filter(ofc_net_id, filter_dict, portinfo, filter_id, apply_ports) self._add_ofc_item(context, "ofc_packet_filter", filter_id, ofc_pf_id)