コード例 #1
0
 def _retrieve_utif_info(self, context, neutron_port):
     network = self.plugin._core_plugin.get_network(
         context, neutron_port['network_id'])
     result = h_info.UtifInfo(network.get('provider:segmentation_id'),
                              network['name'], network['id'], False,
                              network['tenant_id'], neutron_port['id'],
                              neutron_port['mac_address'],
                              network.get('provider:network_type'))
     return result
コード例 #2
0
 def retrieve_utif_info(self, context, neutron_port):
     plugin = manager.NeutronManager.get_plugin()
     network_id = neutron_port["network_id"]
     network = plugin._get_network(context, network_id)
     is_gw = neutron_port["device_owner"] == "network:router_gateway"
     result = h_info.UtifInfo(vlan=0,
                              network_name=network["name"],
                              network_id=network["id"],
                              is_gw=is_gw,
                              owner_tenant=network["tenant_id"],
                              port_id=neutron_port["id"],
                              mac_address=neutron_port["mac_address"])
     return result
コード例 #3
0
 def retrieve_utif_info(self, context, neutron_port):
     plugin = manager.NeutronManager.get_plugin()
     network = plugin.get_network(context, neutron_port['network_id'])
     is_gw = (
         neutron_port["device_owner"] == constants.DEVICE_OWNER_ROUTER_GW)
     network_type = network.get('provider:network_type')
     if network_type != 'vlan':
         raise exc.UtifInfoError(
             err_msg=_("Network type %s not supported. Please be sure "
                       "that tenant_network_type is vlan") % network_type)
     result = h_info.UtifInfo(network.get('provider:segmentation_id'),
                              network['name'], network['id'], is_gw,
                              network['tenant_id'], neutron_port['id'],
                              neutron_port['mac_address'])
     return result
コード例 #4
0
 def retrieve_utif_info(self, context, neutron_port):
     plugin = manager.NeutronManager.get_plugin()
     session = context.session
     network_id = neutron_port["network_id"]
     network_binding = ovs_db_v2.get_network_binding(session, network_id)
     if not network_binding["segmentation_id"]:
         raise exc.UtifInfoError(
             err_msg=_("No segmentation_id found for the network, "
                       "please be sure that tenant_network_type is vlan"))
     network = plugin._get_network(context, network_id)
     is_gw = neutron_port["device_owner"] == "network:router_gateway"
     result = h_info.UtifInfo(vlan=network_binding["segmentation_id"],
                              network_name=network["name"],
                              network_id=network["id"],
                              is_gw=is_gw,
                              owner_tenant=network["tenant_id"],
                              port_id=neutron_port["id"],
                              mac_address=neutron_port["mac_address"])
     return result