本文整理汇总了Python中quantum.db.api.port_create函数的典型用法代码示例。如果您正苦于以下问题:Python port_create函数的具体用法?Python port_create怎么用?Python port_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了port_create函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_list_ports
def test_list_ports(self):
try:
# Pre-populate data for testing using db api
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
db.port_create(network_id)
db.port_create(network_id)
cli.list_ports(self.client, self.tenant_id, network_id)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_list_ports failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_list_ports(network_id)
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:15,代码来源:test_cli.py
示例2: _create_target
def _create_target(self):
tenant_id = "tenant1"
net_name = "network1"
self.vif_id = "vif1"
net = db.network_create(tenant_id, net_name)
self.port = db.port_create(net.uuid)
db.port_set_attachment(self.port.uuid, net.uuid, self.vif_id)
开发者ID:yasuhito,项目名称:quantum-nec-of-plugin,代码行数:7,代码来源:test_db.py
示例3: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
"""
Creates a port on the specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.create_port() called")
port = db.port_create(net_id, port_state,
op_status=OperationalStatus.DOWN)
unique_port_id_string = port[const.UUID]
new_port_dict = cutil.make_port_dict(port)
return new_port_dict
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:10,代码来源:LinuxBridgePlugin.py
示例4: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
"""
Creates a port on the specified Virtual Network.
"""
LOG.debug("FakePlugin.create_port() called")
# verify net_id
self._get_network(tenant_id, net_id)
port = db.port_create(net_id, port_state)
port_item = {'port-id': str(port.uuid)}
return port_item
开发者ID:asomya,项目名称:quantum,代码行数:10,代码来源:SamplePlugin.py
示例5: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
"""
Creates a port on the specified Virtual Network.
"""
LOG.debug("LinuxBridgePlugin.create_port() called")
db.validate_network_ownership(tenant_id, net_id)
port = db.port_create(net_id, port_state,
op_status=OperationalStatus.DOWN)
new_port_dict = cutil.make_port_dict(port)
return new_port_dict
开发者ID:LuizOz,项目名称:quantum,代码行数:10,代码来源:LinuxBridgePlugin.py
示例6: test_show_network_details
def test_show_network_details(self):
iface_id = "flavor crystals"
try:
# Load some data into the datbase
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
port = db.port_create(network_id)
port_id = port['uuid']
db.port_set_attachment(port_id, network_id, iface_id)
port = db.port_create(network_id)
cli.show_net_detail(self.client,
self.tenant_id,
network_id,
self.version)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_show_network_details failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_show_network_details()
开发者ID:bhuvan,项目名称:python-quantumclient,代码行数:21,代码来源:test_cli.py
示例7: create_port
def create_port(self, net_id):
"""Add a port"""
port_dict = {}
try:
port = db.port_create(net_id)
LOG.debug("Creating port %s" % port.uuid)
port_dict["port-id"] = str(port.uuid)
port_dict["net-id"] = str(port.network_id)
port_dict["int-id"] = port.interface_id
port_dict["state"] = port.state
return port_dict
except Exception, exc:
LOG.error("Failed to create port: %s" % str(exc))
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:13,代码来源:test_database.py
示例8: create_port
def create_port(self, tenant_id, network_id, port_state=None):
"""
Creates a port on the specified Virtual Network.
"""
LOG.debug("create_port() called")
# verify network_id
self._get_network(tenant_id, network_id)
port_state_up = None
if port_state:
self._validate_port_state(port_state)
port_state_up = port_state.upper()
port = db.port_create(network_id, port_state_up)
LOG.debug("create_port(): port state is %s" % port.state)
return {'port-id': port.uuid}
开发者ID:yasuhito,项目名称:quantum-nec-of-plugin,代码行数:14,代码来源:nec_plugin.py
示例9: test_update_port
def test_update_port(self):
try:
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
port = db.port_create(network_id)
port_id = port['uuid']
# Default state is DOWN - change to ACTIVE.
cli.update_port(self.client, self.tenant_id, network_id,
port_id, 'state=ACTIVE')
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_update_port failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_update_port(network_id, port_id)
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:16,代码来源:test_cli.py
示例10: test_show_port_no_attach
def test_show_port_no_attach(self):
network_id = None
port_id = None
try:
# Pre-populate data for testing using db api
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
port = db.port_create(network_id)
port_id = port['uuid']
cli.show_port(self.client, self.tenant_id, network_id, port_id)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_show_port_no_attach failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_show_port(network_id, port_id)
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:17,代码来源:test_cli.py
示例11: TestRuijieVlanUnsetting
def TestRuijieVlanUnsetting():
db.clear_db()
net = db.network_create("miaosf", "net1")
port = db.port_create(net.uuid)
db.port_set_attachment(port.uuid, net.uuid, "intf_id")
ruijie_db.add_ruijie_switch_eth_binding("192.168.21.35", "0050.56bc.0003", "GigabitEthernet 3/0/20");
ruijie_db.add_ruijie_vm_eth_binding("intf_id", "0050.56bc.0003");
ovs_db.add_vlan_binding(200, net.uuid)
ruijie_vlan.set_ruijie_vlan("intf_id", net.uuid)
binding = ruijie_db.get_ruijie_vlan_binding("192.168.21.35", "GigabitEthernet 3/0/20", 200)
if binding == []:
assert 0
ruijie_vlan.unset_ruijie_vlan(net.uuid, port.uuid)
binding = ruijie_db.get_ruijie_vlan_binding("192.168.21.35", "GigabitEthernet 3/0/20", 200)
if binding != []:
assert 0
开发者ID:bestsharp,项目名称:rgos_quantum_plugin,代码行数:18,代码来源:test_db.py
示例12: test_unplug_iface
def test_unplug_iface(self):
network_id = None
port_id = None
try:
# Load some data into the datbase
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
port = db.port_create(net['uuid'])
port_id = port['uuid']
db.port_set_attachment(port_id, network_id, "test_iface_id")
cli.unplug_iface(self.client, self.tenant_id, network_id, port_id)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_plug_iface failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_unplug_iface(network_id, port_id)
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:18,代码来源:test_cli.py
示例13: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
"""
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
"""
LOG.debug("QuantumRestProxy: create_port() called")
self.get_network(tenant_id, net_id)
# Update DB
port = db.port_create(net_id, port_state,
op_status=OperationalStatus.DOWN)
port_id = str(port.uuid)
# create on networl ctrl
try:
resource = '/tenants/%s/networks/%s/ports' % (
tenant_id, net_id)
data = {
"port": {
"id": port_id,
"state": port_state,
}
}
ret = self.servers.post(resource, data)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
LOG.error(
'QuantumRestProxy: Unable to create remote port: %s' %
e.message)
db.port_destroy(port_id, net_id)
raise
return self.make_port_dict(port)
开发者ID:mobilipia,项目名称:quantum-restproxy,代码行数:40,代码来源:plugins.py
示例14: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
LOG.debug("PRUTH: Creating port with network_id: %s" % net_id)
neuca_tenant_id = self.config.get("NEUCA", "neuca_tenant_id")
if tenant_id != neuca_tenant_id:
db.validate_network_ownership(tenant_id, net_id)
#new_mac = None
#else:
#new_mac = str(quantum.common.utils.generate_mac())
# pass
port = db.port_create(net_id, port_state,
op_status=OperationalStatus.DOWN)
LOG.debug("PRUTH: neuca_tenant_id: %s, net_id: %s, interface_id: %s" % (neuca_tenant_id, net_id, port.interface_id))
LOG.debug("PRUTH: kwargs:%s" % (str(kwargs)))
neuca_db.add_port_properties(port.uuid,None,None)
return self._make_port_dict(port)
开发者ID:RENCI-NRIG,项目名称:neuca-agent,代码行数:22,代码来源:neuca_quantum_plugin.py
示例15: test_show_iface_with_attach
def test_show_iface_with_attach(self):
network_id = None
port_id = None
iface_id = "flavor crystals"
try:
# Pre-populate data for testing using db api
net = db.network_create(self.tenant_id, self.network_name_1)
network_id = net['uuid']
port = db.port_create(network_id)
port_id = port['uuid']
db.port_set_attachment(port_id, network_id, iface_id)
cli.show_iface(self.client,
self.tenant_id,
network_id,
port_id,
self.version)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_show_iface_with_attach failed due" +
" to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_show_iface(network_id, port_id)
开发者ID:bhuvan,项目名称:python-quantumclient,代码行数:24,代码来源:test_cli.py
示例16: create_port
def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
LOG.debug("Creating port with network_id: %s" % net_id)
db.validate_network_ownership(tenant_id, net_id)
port = db.port_create(net_id, port_state,
op_status=OperationalStatus.DOWN)
return self._make_port_dict(port)
开发者ID:jkoelker,项目名称:quantum,代码行数:6,代码来源:ovs_quantum_plugin.py
示例17: create_port
def create_port(self, tenant_id, net_id, port_state=None):
LOG.debug("Creating port with network_id: %s" % net_id)
port = db.port_create(net_id, port_state)
return self._make_port_dict(str(port.uuid), port.state,
port.network_id, port.interface_id)
开发者ID:Oneiroi,项目名称:quantum,代码行数:5,代码来源:ovs_quantum_plugin.py
注:本文中的quantum.db.api.port_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论