本文整理汇总了Python中neutron.tests.unit.vmware.nsx_method函数的典型用法代码示例。如果您正苦于以下问题:Python nsx_method函数的具体用法?Python nsx_method怎么用?Python nsx_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nsx_method函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _mock_port_mapping_db_calls
def _mock_port_mapping_db_calls(self, ret_value):
# Mock relevant db calls
# This will allow for avoiding setting up the plugin
# for creating db entries
mock.patch(nsx_method("get_nsx_switch_and_port_id", module_name="dbexts.db"), return_value=ret_value).start()
mock.patch(nsx_method("add_neutron_nsx_port_mapping", module_name="dbexts.db")).start()
mock.patch(nsx_method("delete_neutron_nsx_port_mapping", module_name="dbexts.db")).start()
开发者ID:penesoft,项目名称:neutron,代码行数:7,代码来源:test_nsx_utils.py
示例2: _mock_sec_group_mapping_db_calls
def _mock_sec_group_mapping_db_calls(self, ret_value):
mock.patch(nsx_method('get_nsx_security_group_id',
module_name='dbexts.db'),
return_value=ret_value).start()
mock.patch(nsx_method('add_neutron_nsx_security_group_mapping',
module_name='dbexts.db')).start()
self.addCleanup(mock.patch.stopall)
开发者ID:Doude,项目名称:neutron,代码行数:7,代码来源:test_nsx_utils.py
示例3: _mock_router_mapping_db_calls
def _mock_router_mapping_db_calls(self, ret_value):
# Mock relevant db calls
# This will allow for avoiding setting up the plugin
# for creating db entries
mock.patch(nsx_method('get_nsx_router_id',
module_name='dbexts.db'),
return_value=ret_value).start()
mock.patch(nsx_method('add_neutron_nsx_router_mapping',
module_name='dbexts.db')).start()
开发者ID:Doude,项目名称:neutron,代码行数:9,代码来源:test_nsx_utils.py
示例4: test_get_nsx_switch_and_port_id_no_mappings_returns_none
def test_get_nsx_switch_and_port_id_no_mappings_returns_none(self):
# This test verifies that the function return (None, None) if the
# mappings are not found both in the db and the backend
ret_value = None, None
self._mock_port_mapping_db_calls(ret_value)
with mock.patch(nsx_method("query_lswitch_lports", module_name="nsxlib.switch"), return_value=[]):
self._verify_get_nsx_switch_and_port_id(None, None)
开发者ID:penesoft,项目名称:neutron,代码行数:7,代码来源:test_nsx_utils.py
示例5: test_get_nsx_sec_profile_id_no_mapping_returns_None
def test_get_nsx_sec_profile_id_no_mapping_returns_None(self):
# This test verifies that the function returns None if the mapping
# are not found both in the db and in the backend
self._mock_sec_group_mapping_db_calls(None)
with mock.patch(nsx_method('query_security_profiles',
module_name='nsxlib.secgroup'),
return_value=[]):
self._verify_get_nsx_sec_profile_id(None)
开发者ID:Doude,项目名称:neutron,代码行数:8,代码来源:test_nsx_utils.py
示例6: test_get_nsx_switch_ids_no_mapping_returns_None
def test_get_nsx_switch_ids_no_mapping_returns_None(self):
# This test verifies that the function returns None if the mappings
# are not found both in the db and in the backend
self._mock_network_mapping_db_calls(None)
with mock.patch(nsx_method('get_lswitches',
module_name='nsxlib.switch'),
return_value=[]):
self._verify_get_nsx_switch_ids(None)
开发者ID:Doude,项目名称:neutron,代码行数:8,代码来源:test_nsx_utils.py
示例7: test_get_nsx_router_id_no_mapping_returns_None
def test_get_nsx_router_id_no_mapping_returns_None(self):
# This test verifies that the function returns None if the mapping
# are not found both in the db and in the backend
self._mock_router_mapping_db_calls(None)
with mock.patch(vmware.nsx_method('query_lrouters',
module_name='nsxlib.router'),
return_value=[]):
self._verify_get_nsx_router_id(None)
开发者ID:aaaaatoz,项目名称:neutron,代码行数:8,代码来源:test_nsx_utils.py
示例8: test_get_nsx_sec_profile_id_no_db_mapping
def test_get_nsx_sec_profile_id_no_db_mapping(self):
# This test is representative of the case where db mappings where not
# found for a given security profile identifier
exp_sec_prof_uuid = uuidutils.generate_uuid()
self._mock_sec_group_mapping_db_calls(None)
with mock.patch(nsx_method('query_security_profiles',
module_name='nsxlib.secgroup'),
return_value=[{'uuid': exp_sec_prof_uuid}]):
self._verify_get_nsx_sec_profile_id(exp_sec_prof_uuid)
开发者ID:Doude,项目名称:neutron,代码行数:9,代码来源:test_nsx_utils.py
示例9: test_get_nsx_router_id_no_db_mapping
def test_get_nsx_router_id_no_db_mapping(self):
# This test is representative of the case where db mappings where not
# found for a given port identifier
exp_lr_uuid = uuidutils.generate_uuid()
self._mock_router_mapping_db_calls(None)
with mock.patch(nsx_method('query_lrouters',
module_name='nsxlib.router'),
return_value=[{'uuid': exp_lr_uuid}]):
self._verify_get_nsx_router_id(exp_lr_uuid)
开发者ID:Doude,项目名称:neutron,代码行数:9,代码来源:test_nsx_utils.py
示例10: test_get_nsx_switch_ids_no_db_mapping
def test_get_nsx_switch_ids_no_db_mapping(self):
# This test is representative of the case where db mappings where not
# found for a given network identifier
exp_ls_uuids = [uuidutils.generate_uuid()]
self._mock_network_mapping_db_calls(None)
with mock.patch(nsx_method('get_lswitches',
module_name='nsxlib.switch'),
return_value=[{'uuid': uuid}
for uuid in exp_ls_uuids]):
self._verify_get_nsx_switch_ids(exp_ls_uuids)
开发者ID:Doude,项目名称:neutron,代码行数:10,代码来源:test_nsx_utils.py
示例11: test_get_nsx_switch_and_port_id_only_port_db_mapping
def test_get_nsx_switch_and_port_id_only_port_db_mapping(self):
# This test is representative of the case in which a port with a nvp
# db mapping in the havana db was upgraded to icehouse
exp_ls_uuid = uuidutils.generate_uuid()
exp_lp_uuid = uuidutils.generate_uuid()
ret_value = None, exp_lp_uuid
self._mock_port_mapping_db_calls(ret_value)
with mock.patch(
nsx_method("query_lswitch_lports", module_name="nsxlib.switch"),
return_value=[{"uuid": exp_lp_uuid, "_relations": {"LogicalSwitchConfig": {"uuid": exp_ls_uuid}}}],
):
self._verify_get_nsx_switch_and_port_id(exp_ls_uuid, exp_lp_uuid)
开发者ID:penesoft,项目名称:neutron,代码行数:12,代码来源:test_nsx_utils.py
示例12: test_get_nsx_switch_and_port_id_no_db_mapping
def test_get_nsx_switch_and_port_id_no_db_mapping(self):
# This test is representative of the case where db mappings where not
# found for a given port identifier
exp_ls_uuid = uuidutils.generate_uuid()
exp_lp_uuid = uuidutils.generate_uuid()
ret_value = None, None
self._mock_port_mapping_db_calls(ret_value)
with mock.patch(
nsx_method("query_lswitch_lports", module_name="nsxlib.switch"),
return_value=[{"uuid": exp_lp_uuid, "_relations": {"LogicalSwitchConfig": {"uuid": exp_ls_uuid}}}],
):
self._verify_get_nsx_switch_and_port_id(exp_ls_uuid, exp_lp_uuid)
开发者ID:penesoft,项目名称:neutron,代码行数:12,代码来源:test_nsx_utils.py
示例13: test_get_nsx_switch_and_port_id_only_port_db_mapping
def test_get_nsx_switch_and_port_id_only_port_db_mapping(self):
# This test is representative of the case in which a port with a nsx
# db mapping in the havana db was upgraded to icehouse
exp_ls_uuid = uuidutils.generate_uuid()
exp_lp_uuid = uuidutils.generate_uuid()
ret_value = None, exp_lp_uuid
self._mock_port_mapping_db_calls(ret_value)
with mock.patch(vmware.nsx_method('query_lswitch_lports',
module_name='nsxlib.switch'),
return_value=[{'uuid': exp_lp_uuid,
'_relations': {
'LogicalSwitchConfig': {
'uuid': exp_ls_uuid}
}}]):
self._verify_get_nsx_switch_and_port_id(exp_ls_uuid, exp_lp_uuid)
开发者ID:aaaaatoz,项目名称:neutron,代码行数:15,代码来源:test_nsx_utils.py
示例14: test_get_nsx_switch_and_port_id_no_db_mapping
def test_get_nsx_switch_and_port_id_no_db_mapping(self):
# This test is representative of the case where db mappings where not
# found for a given port identifier
exp_ls_uuid = uuidutils.generate_uuid()
exp_lp_uuid = uuidutils.generate_uuid()
ret_value = None, None
self._mock_port_mapping_db_calls(ret_value)
with mock.patch(vmware.nsx_method('query_lswitch_lports',
module_name='nsxlib.switch'),
return_value=[{'uuid': exp_lp_uuid,
'_relations': {
'LogicalSwitchConfig': {
'uuid': exp_ls_uuid}
}}]):
self._verify_get_nsx_switch_and_port_id(exp_ls_uuid, exp_lp_uuid)
开发者ID:aaaaatoz,项目名称:neutron,代码行数:15,代码来源:test_nsx_utils.py
注:本文中的neutron.tests.unit.vmware.nsx_method函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论