本文整理汇总了Python中test_common_utils.create_test_st函数的典型用法代码示例。如果您正苦于以下问题:Python create_test_st函数的具体用法?Python create_test_st怎么用?Python create_test_st使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_test_st函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_single_vm_port_tuple_create
def test_single_vm_port_tuple_create(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:public-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:fake-vn-uuid')
st = test_utils.create_test_st(name='fake-st-uuid',
intf_list=[['right', True], ['left', True]], version='2')
si = test_utils.create_test_si(name='fake-si-uuid', count=1,
intf_list=['public-vn', 'fake-vn-uuid'])
si.service_template = 'fake-st-uuid'
pt = test_utils.create_test_port_tuple(
'fake-domain:fake-project:fake-si-uuid:fake-port-tuple',
'fake-si-uuid')
vmi = test_utils.create_test_vmi('fake-domain:fake-project:fake-vmi-uuid-left', pt)
vmi.params = {}
vmi.params['service_interface_type'] = 'left'
vmi = test_utils.create_test_vmi('fake-domain:fake-project:fake-vmi-uuid-right', pt)
vmi.params = {}
vmi.params['service_interface_type'] = 'right'
self.pt_agent.update_port_tuple(pt_id='fake-port-tuple')
self.mocked_vnc.ref_update.assert_any_call('instance-ip',
'fake-iip-uuid', 'virtual-machine-interface', 'fake-vmi-uuid-left',
None, 'ADD')
self.mocked_vnc.ref_update.assert_any_call('instance-ip',
'fake-iip-uuid', 'virtual-machine-interface', 'fake-vmi-uuid-right',
None, 'ADD')
self.mocked_vnc.ref_update.assert_any_call('service-instance',
'fake-si-uuid', 'instance-ip', 'fake-iip-uuid', None, 'ADD',
ServiceInterfaceTag('left'))
self.mocked_vnc.ref_update.assert_any_call('service-instance',
'fake-si-uuid', 'instance-ip', 'fake-iip-uuid', None, 'ADD',
ServiceInterfaceTag('right'))
开发者ID:VikaSliusarchuk,项目名称:contrail-controller,代码行数:35,代码来源:test_port_tuple.py
示例2: test_virtual_machine_exists
def test_virtual_machine_exists(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_security_group('fake-domain:fake-project:default')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'servers' and oper == 'create':
nova_vm = test_utils.FakeNovaServer(kwargs['name'], kwargs['name'])
return nova_vm
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
self.mocked_vnc.virtual_machine_create = test_utils.vm_create
self.vm_manager.create_service(st, si)
self.log_mock.log_info.assert_any_call(test_utils.AnyStringWith('Launching VM :'))
self.log_mock.log_info.assert_any_call(test_utils.AnyStringWith('Created VM :'))
self.log_mock.log_info.assert_any_call(test_utils.AnyStringWith(si.name))
self.log_mock.reset_mock()
self.vm_manager.create_service(st, si)
self.assertTrue(self.log_mock.log_info.call_count, 1)
开发者ID:secof,项目名称:contrail-controller,代码行数:30,代码来源:test_virtual_machine_manager.py
示例3: test_vrouter_instance_create
def test_vrouter_instance_create(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network(
'fake-domain:fake-project:mgmt-vn')
test_utils.create_test_virtual_network(
'fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network(
'fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(
name='vrouter-template',
virt_type='vrouter-instance',
intf_list=[['management', False], ['left', False],
['right', False]])
si = test_utils.create_test_si(
name='vr-instance',
count=1,
vr_id='fake-vr-id',
intf_list=['mgmt-vn', 'left-vn', 'right-vn'])
self.vrouter_manager.create_service(st, si)
self.mocked_vnc.virtual_machine_create.assert_any_call(
test_utils.VMObjMatcher(1))
self.mocked_vnc.virtual_router_update.assert_any_call(
test_utils.VRObjMatcher(['fake-vm-uuid']))
开发者ID:jenklin,项目名称:contrail-controller,代码行数:25,代码来源:test_vrouter_instance_manager.py
示例4: test_missing_image_in_template
def test_missing_image_in_template(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
st.params['image_name'] = None
self.vm_manager.create_service(st, si)
self.log_mock.log_error.assert_called_with("Image not present in %s" % ((':').join(st.fq_name)))
开发者ID:DreamLab,项目名称:contrail-controller,代码行数:14,代码来源:test_virtual_machine_manager.py
示例5: test_svc_monitor_vm_delayed_vn_add
def test_svc_monitor_vm_delayed_vn_add(self):
st = test_utils.create_test_st(name="fake-template", virt_type="virtual-machine", intf_list=[["left", True]])
si = test_utils.create_test_si(name="fake-instance", count=1, intf_list=["left-vn"])
si = config_db.ServiceInstanceSM.get("fake-instance")
si.service_template = "fake-template"
st = config_db.ServiceTemplateSM.get("fake-template")
config_db.VirtualNetworkSM._cassandra.read = self.cassandra_vn_read
self._svc_monitor.vm_manager = mock.MagicMock()
self._svc_monitor._vnc_subscribe_callback(vn_add_info)
self._svc_monitor.vm_manager.create_service.assert_called_with(st, si)
self.assertTrue(si.launch_count == 1)
match_str = "SI %s creation success" % (":").join(si.fq_name)
ServiceMonitorLogger.log_info.assert_any_call(match_str)
开发者ID:numansiddique,项目名称:contrail-controller,代码行数:14,代码来源:test_svc_monitor.py
示例6: test_network_config_validation
def test_network_config_validation(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
st.params['interface_type'] = []
self.vm_manager.create_service(st, si)
self.log_mock.log_notice.assert_called_with("Interface list empty for ST %s SI %s" %
((':').join(st.fq_name), (':').join(si.fq_name)))
开发者ID:DreamLab,项目名称:contrail-controller,代码行数:15,代码来源:test_virtual_machine_manager.py
示例7: test_snat_instance_create
def test_snat_instance_create(self):
test_utils.create_test_project("fake-domain:fake-project")
test_utils.create_test_virtual_network("fake-domain:fake-project:public-vn")
test_utils.create_test_virtual_network("fake-domain:fake-project:fake-vn-uuid")
test_utils.create_test_security_group("fake-domain:fake-project:default")
st = test_utils.create_test_st(
name="snat-template", virt_type="network-namespace", intf_list=[["right", True], ["left", True]]
)
si = test_utils.create_test_si(name="snat-instance", count=2, intf_list=["public-vn", "fake-vn-uuid"])
self.netns_manager.create_service(st, si)
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(1))
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(2))
self.assertEqual(si.vn_info[1]["net-id"], "fake-domain:fake-project:fake-vn-uuid")
开发者ID:jenklin,项目名称:contrail-controller,代码行数:15,代码来源:test_snat.py
示例8: test_snat_instance_create
def test_snat_instance_create(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:public-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:fake-vn-uuid')
test_utils.create_test_security_group('fake-domain:fake-project:default')
st = test_utils.create_test_st(name='snat-template',
virt_type='network-namespace',
intf_list=[['right', True], ['left', True]])
si = test_utils.create_test_si(name='snat-instance', count=2,
intf_list=['public-vn', 'fake-vn-uuid'])
self.netns_manager.create_service(st, si)
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(1))
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(2))
self.assertEqual(si.vn_info[1]['net-id'], 'fake-domain:fake-project:fake-vn-uuid')
开发者ID:piotrkasprzyk,项目名称:contrail-controller,代码行数:16,代码来源:test_snat.py
示例9: __create_test_si
def __create_test_si(self, name=None):
"""
Create and return a fake/test service-instance(SI).
The SI is created per schema hierarchy which involves
creation of test domain, project and service-template.
"""
# Create test project.
test_utils.create_test_project('fake-domain:fake-project')
# Create two VN's for the SI.
test_utils.create_test_virtual_network(
'fake-domain:fake-project:public-vn')
test_utils.create_test_virtual_network(
'fake-domain:fake-project:fake-vn-uuid')
# Create a service-template.
st = test_utils.create_test_st(name='fake-st-uuid',
intf_list=[['right', True],
['left', True]],
version='2')
# Create test service-instance.
if not name:
name = 'fake-si-uuid'
si = test_utils.create_test_si(name=name,
count=1,
intf_list=['public-vn',
'fake-vn-uuid'])
# Add service-template reference in service-instance.
si.service_template = 'fake-st-uuid'
# Mock the update call on this service instance.
#
# This being a test service instance, we do not want this
# SI being updated from config db.
si.update = mock.MagicMock()
return si
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:42,代码来源:test_port_tuple.py
示例10: test_missing_image_in_nova
def test_missing_image_in_nova(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_security_group('fake-domain:fake-project:default')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'images' and oper == 'find':
return None
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
self.vm_manager.create_service(st, si)
self.log_mock.log_error.assert_called_with("Image not found %s" % si.image)
开发者ID:secof,项目名称:contrail-controller,代码行数:21,代码来源:test_virtual_machine_manager.py
示例11: test_nova_vm_create_fail
def test_nova_vm_create_fail(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_security_group('fake-domain:fake-project:default')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'servers' and oper == 'create':
return None
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
self.vm_manager.create_service(st, si)
self.log_mock.log_error.assert_any_call(test_utils.AnyStringWith('Nova vm create failed'))
开发者ID:secof,项目名称:contrail-controller,代码行数:21,代码来源:test_virtual_machine_manager.py
示例12: test_missing_flavor_in_template
def test_missing_flavor_in_template(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'flavors' and oper == 'find':
return None
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
st.params['flavor'] = None
self.vm_manager.create_service(st, si)
self.log_mock.log_error.assert_called_with(test_utils.AnyStringWith("Flavor not found"))
开发者ID:DreamLab,项目名称:contrail-controller,代码行数:21,代码来源:test_virtual_machine_manager.py
示例13: test_virtual_machine_static_routes
def test_virtual_machine_static_routes(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_security_group('fake-domain:fake-project:default')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True, True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'servers' and oper == 'create':
nova_vm = test_utils.FakeNovaServer('fake-vm-uuid', kwargs['name'])
return nova_vm
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
self.vm_manager.create_service(st, si)
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(1))
self.mocked_vnc.virtual_machine_create.assert_any_call(test_utils.VMObjMatcher(2))
开发者ID:secof,项目名称:contrail-controller,代码行数:23,代码来源:test_virtual_machine_manager.py
示例14: test_availability_zone_setting
def test_availability_zone_setting(self):
test_utils.create_test_project('fake-domain:fake-project')
test_utils.create_test_virtual_network('fake-domain:fake-project:left-vn')
test_utils.create_test_virtual_network('fake-domain:fake-project:right-vn')
st = test_utils.create_test_st(name='vm-template',
virt_type='virtual-machine',
intf_list=[['management', False], ['left', True], ['right', False]])
si = test_utils.create_test_si(name='vm-instance', count=2,
intf_list=['', 'left-vn', 'right-vn'])
def nova_oper(resource, oper, proj_name, **kwargs):
if resource == 'servers' and oper == 'create':
nova_vm = test_utils.FakeNovaServer('fake-vm-uuid', kwargs['name'])
return nova_vm
else:
return mock.MagicMock()
self.nova_mock.oper = nova_oper
st.params['availability_zone_enable'] = True
si.params['availability_zone'] = 'test-availability-zone'
self.vm_manager.create_service(st, si)
self.assertTrue(si.availability_zone, 'test-availability-zone')
开发者ID:DreamLab,项目名称:contrail-controller,代码行数:23,代码来源:test_virtual_machine_manager.py
注:本文中的test_common_utils.create_test_st函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论