本文整理汇总了Python中quantum.db.api.network_list函数的典型用法代码示例。如果您正苦于以下问题:Python network_list函数的具体用法?Python network_list怎么用?Python network_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了network_list函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _verify_show_network_details
def _verify_show_network_details(self):
# Verification - get raw result from db
nw = db.network_list(self.tenant_id)[0]
network = {'id': nw.uuid,
'name': nw.name,
'op-status': nw.op_status}
port_list = db.port_list(nw.uuid)
if not port_list:
network['ports'] = [{'id': '<none>',
'state': '<none>',
'attachment': {'id': '<none>'}}]
else:
network['ports'] = []
for port in port_list:
network['ports'].append({'id': port.uuid,
'state': port.state,
'attachment': {'id':
port.interface_id
or '<none>'}})
# Fill CLI template
output = cli.prepare_output('show_net_detail',
self.tenant_id,
dict(network=network),
self.version)
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:28,代码来源:test_cli.py
示例2: get_all_networks
def get_all_networks(self, tenant_id, **kwargs):
nets = []
for x in db.network_list(tenant_id):
LOG.debug("Adding network: %s" % x.uuid)
nets.append(self._make_net_dict(str(x.uuid), x.name,
None, x.op_status))
return nets
开发者ID:jkoelker,项目名称:quantum,代码行数:7,代码来源:ovs_quantum_plugin.py
示例3: _verify_list_networks
def _verify_list_networks(self):
# Verification - get raw result from db
nw_list = db.network_list(self.tenant_id)
networks = [dict(id=nw.uuid, name=nw.name) for nw in nw_list]
# Fill CLI template
output = cli.prepare_output('list_nets', self.tenant_id,
dict(networks=networks))
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:10,代码来源:test_cli.py
示例4: _verify_show_network
def _verify_show_network(self):
# Verification - get raw result from db
nw = db.network_list(self.tenant_id)[0]
network = dict(id=nw.uuid, name=nw.name)
# Fill CLI template
output = cli.prepare_output('show_net', self.tenant_id,
dict(network=network))
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:10,代码来源:test_cli.py
示例5: _verify_update_network
def _verify_update_network(self):
# Verification - get raw result from db
nw_list = db.network_list(self.tenant_id)
network_data = {'id': nw_list[0].uuid,
'name': nw_list[0].name}
# Fill CLI template
output = cli.prepare_output('update_net', self.tenant_id,
dict(network=network_data))
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:11,代码来源:test_cli.py
示例6: _verify_delete_network
def _verify_delete_network(self, network_id):
# Verification - get raw result from db
nw_list = db.network_list(self.tenant_id)
if len(nw_list) != 0:
self.fail("DB should not contain any network")
# Fill CLI template
output = cli.prepare_output('delete_net', self.tenant_id,
dict(network_id=network_id))
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:11,代码来源:test_cli.py
示例7: _verify_create_network
def _verify_create_network(self):
# Verification - get raw result from db
nw_list = db.network_list(self.tenant_id)
if len(nw_list) != 1:
self.fail("No network created")
network_id = nw_list[0].uuid
# Fill CLI template
output = cli.prepare_output('create_net', self.tenant_id,
dict(network_id=network_id))
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:12,代码来源:test_cli.py
示例8: test_delete_network
def test_delete_network(self):
try:
db.network_create(self.tenant_id, self.network_name_1)
network_id = db.network_list(self.tenant_id)[0]['uuid']
cli.delete_net(self.client, self.tenant_id, network_id)
except:
LOG.exception("Exception caught: %s", sys.exc_info())
self.fail("test_delete_network failed due to an exception")
LOG.debug("Operation completed. Verifying result")
LOG.debug(self.fake_stdout.content)
self._verify_delete_network(network_id)
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:12,代码来源:test_cli.py
示例9: get_all_networks
def get_all_networks(self, tenant_id):
"""
Returns a dictionary containing all
<network_uuid, network_name> for
the specified tenant.
"""
LOG.debug("get_all_networks() called")
networks = []
for network in db.network_list(tenant_id):
network_item = {'net-id': network.uuid, 'net-name': network.name}
networks.append(network_item)
return networks
开发者ID:yasuhito,项目名称:quantum-nec-of-plugin,代码行数:12,代码来源:nec_plugin.py
示例10: get_all_networks
def get_all_networks(self, tenant_id):
"""
Returns a dictionary containing all
<network_uuid, network_name> for
the specified tenant.
"""
LOG.debug("FakePlugin.get_all_networks() called")
nets = []
for net in db.network_list(tenant_id):
net_item = {"net-id": str(net.uuid), "net-name": net.name}
nets.append(net_item)
return nets
开发者ID:pestrunk,项目名称:quantum-1,代码行数:12,代码来源:SamplePlugin.py
示例11: get_all_networks
def get_all_networks(self, tenant_id):
"""Get all networks"""
nets = []
try:
for net in db.network_list(tenant_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
nets.append(net_dict)
except Exception, exc:
LOG.error("Failed to get all networks: %s" % str(exc))
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:13,代码来源:test_database.py
示例12: get_all_networks
def get_all_networks(self, tenant_id, **kwargs):
"""
Returns a dictionary containing all <network_uuid, network_name> for
the specified tenant using local persistent store.
:param tenant_id: unique identifier for the tenant whose networks
are being retrieved by this method
:param **kwargs: options to be passed to the plugin. The following
keywork based-options can be specified:
filter_opts - options for filtering network list
:returns: a list of mapping sequences with the following signature:
[ {'net-id': uuid that uniquely identifies
the particular quantum network,
'net-name': a human-readable name associated
with network referenced by net-id
'net-op-status': network op_status
},
....
{'net-id': uuid that uniquely identifies the
particular quantum network,
'net-name': a human-readable name associated
with network referenced by net-id
'net-op-status': network op_status
}
]
:raises: None
"""
LOG.debug("QuantumRestProxy: get_all_networks() called")
filter_fn = None
filter_opts = kwargs.get('filter_opts', None)
if filter_opts is not None and len(filter_opts) > 0:
filter_fn = self.filter_net
LOG.debug("QuantumRestProxy: filter_opts ignored: %s" %
filter_opts)
nets = []
for net in db.network_list(tenant_id):
if filter_fn is not None and \
filter_fn(filter_opts, net) is None:
continue
net_item = {
'net-id': str(net.uuid),
'net-name': net.name,
'net-op-status': net.op_status,
}
nets.append(net_item)
return nets
开发者ID:mobilipia,项目名称:quantum-restproxy,代码行数:48,代码来源:plugins.py
示例13: _verify_list_networks_details_name_filter
def _verify_list_networks_details_name_filter(self, name):
# Verification - get raw result from db
nw_list = db.network_list(self.tenant_id)
nw_filtered = []
for nw in nw_list:
if nw.name == name:
nw_filtered.append(nw)
networks = [dict(id=nw.uuid, name=nw.name) for nw in nw_filtered]
# Fill CLI template
output = cli.prepare_output('list_nets_detail',
self.tenant_id,
dict(networks=networks),
self.version)
# Verify!
# Must add newline at the end to match effect of print call
self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:codeoedoc,项目名称:python-quantumclient,代码行数:16,代码来源:test_cli.py
示例14: get_all_networks
def get_all_networks(self, tenant_id, **kwargs):
"""
Returns a dictionary containing all
<network_uuid, network_name> for
the specified tenant.
"""
LOG.debug("UCSVICPlugin:get_all_networks() called\n")
self._set_ucsm(kwargs[const.DEVICE_IP])
networks_list = db.network_list(tenant_id)
new_networks_list = []
for network in networks_list:
new_network_dict = cutil.make_net_dict(network[const.UUID],
network[const.NETWORKNAME],
[])
new_networks_list.append(new_network_dict)
return new_networks_list
开发者ID:Blackspan,项目名称:quantum,代码行数:17,代码来源:cisco_ucs_plugin_v2.py
示例15: get_all_networks
def get_all_networks(self, tenant_id, **kwargs):
"""
Returns a dictionary containing all
<network_uuid, network_name> for
the specified tenant.
"""
LOG.debug("LinuxBridgePlugin.get_all_networks() called")
networks_list = db.network_list(tenant_id)
new_networks_list = []
for network in networks_list:
new_network_dict = cutil.make_net_dict(network[const.UUID],
network[const.NETWORKNAME],
[], network[const.OPSTATUS])
new_networks_list.append(new_network_dict)
# This plugin does not perform filtering at the moment
return new_networks_list
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:17,代码来源:LinuxBridgePlugin.py
示例16: get_all_networks
def get_all_networks(self, tenant_id, **kwargs):
"""
Returns a dictionary containing all
<network_uuid, network_name> for
the specified tenant.
"""
LOG.debug("FakePlugin.get_all_networks() called")
filter_opts = kwargs.get('filter_opts', None)
if not filter_opts is None and len(filter_opts) > 0:
LOG.debug("filtering options were passed to the plugin"
"but the Fake plugin does not support them")
nets = []
for net in db.network_list(tenant_id):
net_item = {'net-id': str(net.uuid),
'net-name': net.name,
'net-op-status': net.op_status}
nets.append(net_item)
return nets
开发者ID:AsylumCorp,项目名称:quantum,代码行数:18,代码来源:SamplePlugin.py
注:本文中的quantum.db.api.network_list函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论