示例#1
0
    def create_ofc_port(self, tenant_id, network_id, port_id):
        ofc_tenant_id = self._get_ofc_id("ofc_tenant", tenant_id)
        ofc_net_id = self._get_ofc_id("ofc_network", network_id)
        portinfo = ndb.get_portinfo(port_id)
        if not portinfo:
            raise nexc.PortInfoNotFound(id=port_id)

        ofc_port_id = self.driver.create_port(ofc_tenant_id, ofc_net_id,
                                              portinfo, port_id)
        ndb.add_ofc_item(nmodels.OFCPort, ofc_port_id, port_id)
示例#2
0
    def create_ofc_port(self, context, port_id, port):
        ofc_net_id = self._get_ofc_id(context, "ofc_network",
                                      port['network_id'])
        ofc_net_id = self.driver.convert_ofc_network_id(
            context, ofc_net_id, port['tenant_id'])
        portinfo = ndb.get_portinfo(context.session, port_id)
        if not portinfo:
            raise nexc.PortInfoNotFound(id=port_id)

        ofc_port_id = self.driver.create_port(ofc_net_id, portinfo, port_id)
        self._add_ofc_item(context, "ofc_port", port_id, ofc_port_id)
示例#3
0
    def create_ofc_packet_filter(self, tenant_id, network_id, filter_id,
                                 filter_dict):
        ofc_tenant_id = self._get_ofc_id("ofc_tenant", tenant_id)
        ofc_net_id = self._get_ofc_id("ofc_network", network_id)
        in_port_id = filter_dict.get('in_port')
        portinfo = None
        if in_port_id:
            portinfo = ndb.get_portinfo(in_port_id)
            if not portinfo:
                raise nexc.PortInfoNotFound(id=in_port_id)

        ofc_pf_id = self.driver.create_filter(ofc_tenant_id, ofc_net_id,
                                              filter_dict, portinfo, filter_id)
        ndb.add_ofc_item(nmodels.OFCFilter, ofc_pf_id, filter_id)
示例#4
0
    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'])
        ofc_net_id = self.driver.convert_ofc_network_id(
            context, ofc_net_id, filter_dict['tenant_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)

        ofc_pf_id = self.driver.create_filter(ofc_net_id, filter_dict,
                                              portinfo, filter_id)
        self._add_ofc_item(context, "ofc_packet_filter", filter_id, ofc_pf_id)