本文整理汇总了Python中quantum.db.api.network_get函数的典型用法代码示例。如果您正苦于以下问题:Python network_get函数的具体用法?Python network_get怎么用?Python network_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了network_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_vifinfo
def delete_vifinfo(self, interface_id):
LOG.debug("delete_vifinfo() called")
port = dbe.get_plugged_port(interface_id)
if self._port_attachable(port):
network = db.network_get(port.network_id)
self._detach(network.tenant_id, network.uuid, port.uuid)
ndb.del_vifinfo(interface_id)
示例2: delete_network
def delete_network(self, tenant_id, net_id):
"""
Deletes the network with the specified network identifier
belonging to the specified tenant.
"""
LOG.debug("LinuxBridgePlugin.delete_network() called")
net = db.network_get(net_id)
if net:
ports_on_net = db.port_list(net_id)
if len(ports_on_net) > 0:
for port in ports_on_net:
if port[const.INTERFACEID]:
raise exc.NetworkInUse(net_id=net_id)
for port in ports_on_net:
self.delete_port(tenant_id, net_id, port[const.UUID])
net_dict = cutil.make_net_dict(net[const.UUID],
net[const.NETWORKNAME],
[], net[const.OPSTATUS])
try:
self._release_vlan_for_tenant(tenant_id, net_id)
cdb.remove_vlan_binding(net_id)
except Exception as excp:
LOG.warning("Exception: %s" % excp)
db.network_update(net_id, tenant_id, {const.OPSTATUS:
OperationalStatus.DOWN})
db.network_destroy(net_id)
return net_dict
# Network not found
raise exc.NetworkNotFound(net_id=net_id)
示例3: get_network
def get_network(self, tenant_id, network_id):
db.validate_network_ownership(tenant_id, network_id)
try:
network = db.network_get(network_id)
except:
raise exc.NetworkNotFound(net_id=network_id)
return network
示例4: add_vifinfo
def add_vifinfo(self, interface_id, datapath_id, port_no, vlan_id=65535):
LOG.debug("add_vifinfo() called")
ndb.add_vifinfo(interface_id, datapath_id, port_no, vlan_id)
port = dbe.get_plugged_port(interface_id)
if self._port_attachable(port):
network = db.network_get(port.network_id)
self._attach(network.tenant_id, network.uuid, port.uuid,
interface_id)
示例5: _get_network
def _get_network(self, tenant_id, network_id):
network = db.network_get(network_id)
# Network must exist and belong to the appropriate tenant.
if network.tenant_id != tenant_id:
LOG.warning("_get_network(): mismatch tenant_id = %s, "
"network_id = %s, network.tenant_id = %s" %
(tenant_id, network_id, network.tenant_id))
raise exc.NetworkNotFound(net_id=network_id)
return network
示例6: get_port_details
def get_port_details(self, tenant_id, net_id, port_id):
"""
This method allows the user to retrieve a remote interface
that is attached to this particular port.
"""
LOG.debug("LinuxBridgePlugin.get_port_details() called")
network = db.network_get(net_id)
port = db.port_get(port_id, net_id)
new_port_dict = cutil.make_port_dict(port)
return new_port_dict
示例7: update_port
def update_port(self, tenant_id, net_id, port_id, **kwargs):
"""
Updates the attributes of a port on the specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.update_port() called")
network = db.network_get(net_id)
self._validate_port_state(kwargs["state"])
port = db.port_update(port_id, net_id, **kwargs)
new_port_dict = cutil.make_port_dict(port)
return new_port_dict
示例8: delete_network
def delete_network(self, tenant_id, net_id):
net = db.network_get(net_id)
# Verify that no attachments are plugged into the network
for port in db.port_list(net_id):
if port.interface_id:
raise q_exc.NetworkInUse(net_id=net_id)
net = db.network_destroy(net_id)
ovs_db.remove_vlan_binding(net_id)
self.vmap.release(net_id)
return self._make_net_dict(str(net.uuid), net.name, [])
示例9: delete_network
def delete_network(self, tenant_id, net_id):
db.validate_network_ownership(tenant_id, net_id)
net = db.network_get(net_id)
# Verify that no attachments are plugged into the network
for port in db.port_list(net_id):
if port.interface_id:
raise q_exc.NetworkInUse(net_id=net_id)
net = db.network_destroy(net_id)
self.driver.delete_network(net)
return self._make_net_dict(str(net.uuid), net.name, [], net.op_status)
示例10: update_network
def update_network(self, tenant_id, net_id, **kwargs):
"""
Updates the symbolic name belonging to a particular
Virtual Network.
"""
LOG.debug("UCSVICPlugin:update_network() called\n")
self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id)
net_dict = cutil.make_net_dict(network[const.UUID],
network[const.NETWORKNAME],
[])
return net_dict
示例11: get_network
def get_network(self, network_id):
"""Get a network"""
net = []
try:
for net in db.network_get(network_id):
LOG.debug("Getting network: %s" % net.uuid)
net_dict = {}
net_dict["tenant-id"] = net.tenant_id
net_dict["net-id"] = str(net.uuid)
net_dict["net-name"] = net.name
net.append(net_dict)
except Exception, exc:
LOG.error("Failed to get network: %s" % str(exc))
示例12: plug_interface
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
"""
Attaches a remote interface to the specified port on the
specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.plug_interface() called")
network = db.network_get(net_id)
port = db.port_get(port_id, net_id)
attachment_id = port[const.INTERFACEID]
if attachment_id:
raise exc.PortInUse(port_id=port_id, net_id=net_id,
att_id=attachment_id)
db.port_set_attachment(port_id, net_id, remote_interface_id)
示例13: unplug_interface
def unplug_interface(self, tenant_id, net_id, port_id):
"""
Detaches a remote interface from the specified port on the
specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.unplug_interface() called")
network = db.network_get(net_id)
port = db.port_get(port_id, net_id)
attachment_id = port[const.INTERFACEID]
if attachment_id == None:
raise exc.InvalidDetach(port_id=port_id, net_id=net_id,
att_id=remote_interface_id)
db.port_unset_attachment(port_id, net_id)
db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
示例14: get_all_ports
def get_all_ports(self, tenant_id, net_id, **kwargs):
"""
Retrieves all port identifiers belonging to the
specified Virtual Network.
"""
LOG.debug("UCSVICPlugin:get_all_ports() called\n")
self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id)
ports_list = network[const.NETWORKPORTS]
ports_on_net = []
for port in ports_list:
port_binding = udb.get_portbinding(port[const.UUID])
ports_on_net.append(port_binding)
return ports_on_net
示例15: get_all_ports
def get_all_ports(self, tenant_id, net_id, **kwargs):
"""
Retrieves all port identifiers belonging to the
specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.get_all_ports() called")
network = db.network_get(net_id)
ports_list = db.port_list(net_id)
ports_on_net = []
for port in ports_list:
new_port = cutil.make_port_dict(port)
ports_on_net.append(new_port)
# This plugin does not perform filtering at the moment
return ports_on_net