本文整理汇总了Python中neutron.tests.functional.agent.linux.base.get_rand_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_rand_name函数的具体用法?Python get_rand_name怎么用?Python get_rand_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_rand_name函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_db_find_column_type_list
def test_db_find_column_type_list(self):
"""Fixate output for vsctl/native ovsdb_interface.
Makes sure that db_find search queries give the same result for both
implementations.
"""
bridge_name = base.get_rand_name(prefix=net_helpers.BR_PREFIX)
self.addCleanup(self.ovs.delete_bridge, bridge_name)
br = self.ovs.add_bridge(bridge_name)
port_name = base.get_rand_name(prefix=net_helpers.PORT_PREFIX)
br.add_port(port_name)
self.ovs.set_db_attribute('Port', port_name, 'tag', 42)
# wrap list/find in transaction so we get a single isolated snapshot
with self.ovs.ovsdb.transaction(check_error=True) as txn:
tags = txn.add(self.ovs.ovsdb.db_list('Port', columns=['tag']))
len_0_list = txn.add(self.ovs.ovsdb.db_find(
'Port', ('tag', '!=', []), columns=['tag']))
single_value = txn.add(self.ovs.ovsdb.db_find(
'Port', ('tag', '=', 42), columns=['tag']))
# Make sure that there is data to query.
# It should be, but let's be a little paranoid here as otherwise
# the test has no sense
tags_present = [t for t in tags.result if t['tag'] != []]
self.assertTrue(tags_present)
tags_42 = [t for t in tags_present if t['tag'] == 42]
self.assertEqual(tags_42, single_value.result)
self.assertItemsEqual(len_0_list.result, tags_present)
开发者ID:gotostack,项目名称:neutron,代码行数:29,代码来源:test_ovs_lib.py
示例2: generate_device_details
def generate_device_details(self, name=None, ip_cidr=None,
mac_address=None, namespace=None):
return Device(name or base.get_rand_name(),
ip_cidr or '240.0.0.1/24',
mac_address or
utils.get_random_mac('fa:16:3e:00:00:00'.split(':')),
namespace or base.get_rand_name())
开发者ID:afori,项目名称:neutron,代码行数:7,代码来源:test_ip_lib.py
示例3: generate_device_details
def generate_device_details(self, name=None, ip_cidrs=None,
mac_address=None, namespace=None):
return Device(name or base.get_rand_name(),
ip_cidrs or ["%s/24" % TEST_IP],
mac_address or
utils.get_random_mac('fa:16:3e:00:00:00'.split(':')),
namespace or base.get_rand_name())
开发者ID:kodarkI,项目名称:neutron,代码行数:7,代码来源:test_ip_lib.py
示例4: test_db_find_column_type_list
def test_db_find_column_type_list(self):
"""Fixate output for vsctl/native ovsdb_interface.
Makes sure that db_find search queries give the same result for both
implementations.
"""
bridge_name = base.get_rand_name(prefix=net_helpers.BR_PREFIX)
self.addCleanup(self.ovs.delete_bridge, bridge_name)
br = self.ovs.add_bridge(bridge_name)
port_name = base.get_rand_name(prefix=net_helpers.PORT_PREFIX)
br.add_port(port_name)
self.ovs.set_db_attribute('Port', port_name, 'tag', 42)
tags = self.ovs.ovsdb.db_list('Port', columns=['tag']).execute()
# Make sure that there is data to query.
# It should be, but let's be a little paranoid here as otherwise
# the test has no sense
tags_present = [t for t in tags if t['tag'] != []]
self.assertTrue(tags_present)
tags_42 = [t for t in tags_present if t['tag'] == 42]
single_value = self.ovs.ovsdb.db_find(
'Port', ('tag', '=', 42), columns=['tag']).execute()
self.assertEqual(tags_42, single_value)
len_0_list = self.ovs.ovsdb.db_find(
'Port', ('tag', '!=', []), columns=['tag']).execute()
self.assertEqual(tags_present, len_0_list)
开发者ID:21atlas,项目名称:neutron,代码行数:25,代码来源:test_ovs_lib.py
示例5: create_ovs_vif_port
def create_ovs_vif_port(self, iface_id=None, mac=None,
iface_field='iface-id'):
if iface_id is None:
iface_id = base.get_rand_name()
if mac is None:
mac = base.get_rand_name()
attrs = ('external_ids', {iface_field: iface_id, 'attached-mac': mac})
port_name, ofport = self.create_ovs_port(attrs)
return ovs_lib.VifPort(port_name, ofport, iface_id, mac, self.br)
开发者ID:gotostack,项目名称:neutron,代码行数:9,代码来源:test_ovs_lib.py
示例6: create_ovs_vif_port
def create_ovs_vif_port(self, iface_id=None, mac=None,
iface_field='iface-id'):
if iface_id is None:
iface_id = base.get_rand_name()
if mac is None:
mac = base.get_rand_name()
attrs = {
'external_ids:%s' % iface_field: iface_id,
'external_ids:attached-mac': mac
}
port_name, ofport = self.create_ovs_port(*attrs.items())
return ovs_lib.VifPort(port_name, ofport, iface_id, mac, self.br)
开发者ID:noironetworks,项目名称:neutron2,代码行数:12,代码来源:test_ovs_lib.py
示例7: setUp
def setUp(self):
super(OVSAgentTestFramework, self).setUp()
agent_rpc = ('neutron.plugins.ml2.drivers.openvswitch.agent.'
'ovs_neutron_agent.OVSPluginApi')
mock.patch(agent_rpc).start()
mock.patch('neutron.agent.rpc.PluginReportStateAPI').start()
self.br_int = base.get_rand_name(n_const.DEVICE_NAME_MAX_LEN,
prefix='br-int')
self.br_tun = base.get_rand_name(n_const.DEVICE_NAME_MAX_LEN,
prefix='br-tun')
patch_name_len = n_const.DEVICE_NAME_MAX_LEN - len("-patch-tun")
self.patch_tun = "%s-patch-tun" % self.br_int[:patch_name_len]
self.patch_int = "%s-patch-int" % self.br_tun[:patch_name_len]
self.ovs = ovs_lib.BaseOVS()
self.config = self._configure_agent()
self.driver = interface.OVSInterfaceDriver(self.config)
开发者ID:Gin077,项目名称:neutron,代码行数:16,代码来源:test_l2_ovs_agent.py
示例8: test_bridge_lifecycle_baseovs
def test_bridge_lifecycle_baseovs(self):
name = base.get_rand_name(prefix=net_helpers.BR_PREFIX)
self.addCleanup(self.ovs.delete_bridge, name)
br = self.ovs.add_bridge(name)
self.assertEqual(br.br_name, name)
self.assertTrue(self.ovs.bridge_exists(name))
self.ovs.delete_bridge(name)
self.assertFalse(self.ovs.bridge_exists(name))
开发者ID:gotostack,项目名称:neutron,代码行数:8,代码来源:test_ovs_lib.py
示例9: test_dummy_exists
def test_dummy_exists(self):
namespace = self.useFixture(net_helpers.NamespaceFixture())
dev_name = base.get_rand_name()
device = namespace.ip_wrapper.add_dummy(dev_name)
self.addCleanup(self._safe_delete_device, device)
self._check_for_device_name(namespace.ip_wrapper, dev_name, True)
device.link.delete()
self._check_for_device_name(namespace.ip_wrapper, dev_name, False)
开发者ID:Lily913,项目名称:neutron,代码行数:8,代码来源:test_ip_lib.py
示例10: test_bridge_lifecycle_ovsbridge
def test_bridge_lifecycle_ovsbridge(self):
name = base.get_rand_name(prefix=net_helpers.BR_PREFIX)
br = ovs_lib.OVSBridge(name)
self.assertEqual(br.br_name, name)
# Make sure that instantiating an OVSBridge does not actually create
self.assertFalse(self.ovs.bridge_exists(name))
self.addCleanup(self.ovs.delete_bridge, name)
br.create()
self.assertTrue(self.ovs.bridge_exists(name))
br.destroy()
self.assertFalse(self.ovs.bridge_exists(name))
开发者ID:gotostack,项目名称:neutron,代码行数:11,代码来源:test_ovs_lib.py
示例11: _create_test_port_dict
def _create_test_port_dict(self):
return {'id': uuidutils.generate_uuid(),
'mac_address': utils.get_random_mac(
'fa:16:3e:00:00:00'.split(':')),
'fixed_ips': [{
'ip_address': '10.%d.%d.%d' % (
random.randint(3, 254),
random.randint(3, 254),
random.randint(3, 254))}],
'vif_name': base.get_rand_name(
self.driver.DEV_NAME_LEN, self.driver.DEV_NAME_PREFIX)}
开发者ID:dhanunjaya,项目名称:neutron,代码行数:11,代码来源:base.py
示例12: setUp
def setUp(self):
super(IpsetBase, self).setUp()
self.src_ns, self.dst_ns = self.prepare_veth_pairs()
self.ipset_name = base.get_rand_name(MAX_IPSET_NAME_LENGTH, 'set-')
self.icmp_accept_rule = ('-p icmp -m set --match-set %s src -j ACCEPT'
% self.ipset_name)
self.ipset = self._create_ipset_manager_and_set(self.dst_ns,
self.ipset_name)
self.addCleanup(self.ipset._destroy, self.ipset_name)
self.dst_iptables = iptables_manager.IptablesManager(
namespace=self.dst_ns.namespace)
self._add_iptables_ipset_rules()
self.addCleanup(self._remove_iptables_ipset_rules)
self.pinger = helpers.Pinger(self.src_ns)
开发者ID:kongseokhwan,项目名称:kulcloud-iitp-neutron,代码行数:16,代码来源:test_ipset.py
示例13: setUp
def setUp(self):
super(IpsetBase, self).setUp()
bridge = self.useFixture(net_helpers.VethBridgeFixture()).bridge
self.source, self.destination = self.useFixture(
machine_fixtures.PeerMachines(bridge)).machines
self.ipset_name = base.get_rand_name(MAX_IPSET_NAME_LENGTH, 'set-')
self.icmp_accept_rule = ('-p icmp -m set --match-set %s src -j ACCEPT'
% self.ipset_name)
self.ipset = self._create_ipset_manager_and_set(
ip_lib.IPWrapper(self.destination.namespace), self.ipset_name)
self.addCleanup(self.ipset._destroy, self.ipset_name)
self.dst_iptables = iptables_manager.IptablesManager(
namespace=self.destination.namespace)
self._add_iptables_ipset_rules()
self.addCleanup(self._remove_iptables_ipset_rules)
开发者ID:21atlas,项目名称:neutron,代码行数:18,代码来源:test_ipset.py
注:本文中的neutron.tests.functional.agent.linux.base.get_rand_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论