def create_port(self, tenant_id, netw_id, port_init_state=None, **params): """ Creates a port on the specified Virtual Network. :returns: a mapping sequence with the following signature: {'port-id': uuid representing the created port on specified quantum network } :raises: exception.NetworkNotFound :raises: exception.StateInvalid """ if not nvplib.check_tenant(self.controller, netw_id, tenant_id): raise exception.NetworkNotFound(net_id=netw_id) params["controller"] = self.controller if not nvplib.check_tenant(self.controller, netw_id, tenant_id): raise exception.NetworkNotFound(net_id=netw_id) result = nvplib.create_port(tenant_id, netw_id, port_init_state, **params) d = {"port-id": result["uuid"], "port-op-status": result["port-op-status"]} LOG.debug("create_port() completed for tenant %s: %s" % (tenant_id, d)) return d
def create_port(self, tenant_id, netw_id, port_init_state=None, **params): """ Creates a port on the specified Virtual Network. :returns: a mapping sequence with the following signature: {'port-id': uuid representing the created port on specified quantum network } :raises: exception.NetworkNotFound :raises: exception.StateInvalid """ if not nvplib.check_tenant(self.controller, netw_id, tenant_id): raise exception.NetworkNotFound(net_id=netw_id) params["controller"] = self.controller if not nvplib.check_tenant(self.controller, netw_id, tenant_id): raise exception.NetworkNotFound(net_id=netw_id) result = nvplib.create_port(tenant_id, netw_id, port_init_state, **params) d = { "port-id": result["uuid"], "port-op-status": result["port-op-status"], } LOG.debug("create_port() completed for tenant %s: %s" % (tenant_id, d)) return d
def create_port(self, context, port): """ Creates a port on the specified Virtual Network. Returns: {"id": uuid represeting the port. "network_id": uuid of network. "tenant_id": tenant_id "mac_address": mac address to use on this port. "admin_state_up": Sets admin state of port. if down, port does not forward packets. "status": dicates whether port is currently operational (limit values to "ACTIVE", "DOWN", "BUILD", and "ERROR"?) "fixed_ips": list of subnet ID's and IP addresses to be used on this port "device_id": identifies the device (e.g., virtual server) using this port. } :raises: exception.NetworkNotFound :raises: exception.StateInvalid """ # Set admin_state_up False since not created in NVP set port["port"]["admin_state_up"] = False # First we allocate port in quantum database try: quantum_db = super(NvpPluginV2, self).create_port(context, port) except Exception as e: raise e # Update fields obtained from quantum db port["port"].update(quantum_db) # We want port to be up in NVP port["port"]["admin_state_up"] = True params = {} params["max_lp_per_bridged_ls"] = \ self.nvp_opts["max_lp_per_bridged_ls"] params["port"] = port["port"] params["clusters"] = self.clusters tenant_id = self._get_tenant_id_for_create(context, port["port"]) try: port["port"], nvp_port_id = nvplib.create_port(tenant_id, **params) nvplib.plug_interface(self.clusters, port["port"]["network_id"], nvp_port_id, "VifAttachment", port["port"]["id"]) except Exception as e: # failed to create port in NVP delete port from quantum_db super(NvpPluginV2, self).delete_port(context, port["port"]["id"]) raise e d = {"port-id": port["port"]["id"], "port-op-status": port["port"]["status"]} LOG.debug("create_port() completed for tenant %s: %s" % (tenant_id, d)) # update port with admin_state_up True port_update = {"port": {"admin_state_up": True}} return super(NvpPluginV2, self).update_port(context, port["port"]["id"], port_update)
def create_port(self, context, port): """ Creates a port on the specified Virtual Network. Returns: {"id": uuid represeting the port. "network_id": uuid of network. "tenant_id": tenant_id "mac_address": mac address to use on this port. "admin_state_up": Sets admin state of port. if down, port does not forward packets. "status": dicates whether port is currently operational (limit values to "ACTIVE", "DOWN", "BUILD", and "ERROR"?) "fixed_ips": list of subnet ID's and IP addresses to be used on this port "device_id": identifies the device (e.g., virtual server) using this port. } :raises: exception.NetworkNotFound :raises: exception.StateInvalid """ # Set admin_state_up False since not created in NVP set port["port"]["admin_state_up"] = False # First we allocate port in quantum database try: quantum_db = super(NvpPluginV2, self).create_port(context, port) except Exception as e: raise e # Update fields obtained from quantum db port["port"].update(quantum_db) # We want port to be up in NVP port["port"]["admin_state_up"] = True params = {} params["max_lp_per_bridged_ls"] = \ self.nvp_opts["max_lp_per_bridged_ls"] params["port"] = port["port"] params["clusters"] = self.clusters tenant_id = self._get_tenant_id_for_create(context, port["port"]) try: port["port"], nvp_port_id = nvplib.create_port(tenant_id, **params) nvplib.plug_interface(self.clusters, port["port"]["network_id"], nvp_port_id, "VifAttachment", port["port"]["id"]) except Exception as e: # failed to create port in NVP delete port from quantum_db super(NvpPluginV2, self).delete_port(context, port["port"]["id"]) raise e d = { "port-id": port["port"]["id"], "port-op-status": port["port"]["status"] } LOG.debug("create_port() completed for tenant %s: %s" % (tenant_id, d)) # update port with admin_state_up True port_update = {"port": {"admin_state_up": True}} return super(NvpPluginV2, self).update_port(context, port["port"]["id"], port_update)