本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch.id方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualSwitch.id方法的具体用法?Python VirtualSwitch.id怎么用?Python VirtualSwitch.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch
的用法示例。
在下文中一共展示了VirtualSwitch.id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_virtual_switch_multiple_save
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_multiple_save(self):
"""Test case to test the modification of VirtualSwitch along with Subnet"""
virtualswitch = VirtualSwitch()
virtualswitch.id = "VS1"
virtualswitch.switchType = "switch"
subnet_id_lst = ["subnet_1", "subnet_2"]
"Add one subnet"
self.__create_subnet(id=subnet_id_lst[0], name=subnet_id_lst[0])
virtualswitch.set_subnetIds(subnet_id_lst)
api.virtual_switch_save(self.admin_context, virtualswitch)
"Update the virtual switch"
virtualswitch.switchType = "switchUpdated"
"Add second subnet"
self.__create_subnet(id=subnet_id_lst[1], name=subnet_id_lst[1])
api.virtual_switch_save(self.admin_context, virtualswitch)
virtualswitches = api.virtual_switch_get_by_ids(self.admin_context, [virtualswitch.id])
self.assertFalse(virtualswitches is None, "VirtualSwitch all returned a list")
self.assertTrue(virtualswitches[0].id == "VS1", "Virtual Switch id mismatch")
self.assertTrue(virtualswitches[0].switchType == "switchUpdated", "Virtual Switch type mismatch")
self.assertTrue(len(virtualswitches[0].subnetIds) >= 0, "Virtual Switch - subnetIds does not exist")
self.assertTrue(
virtualswitches[0].subnetIds[0] in subnet_id_lst, "Virtual Switch - subnetIds is not api output"
)
self.assertTrue(
virtualswitches[0].subnetIds[1] in subnet_id_lst, "Virtual Switch - subnetIds is not api output"
)
示例2: test_virtual_switch_get_by_ids
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_get_by_ids(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = "VS1"
virtualswitch.switchType = "switch"
api.virtual_switch_save(self.admin_context, virtualswitch)
virtualswitches = api.virtual_switch_get_by_ids(self.admin_context, [virtualswitch.id])
self.assertFalse(virtualswitches is None, "VirtualSwitch all returned a list")
self.assertTrue(virtualswitches[0].id == "VS1", "Virtual Switch Id mismatch")
self.assertTrue(virtualswitches[0].switchType == "switch", "Virtual Switch Type mismatch")
示例3: test_virtual_switch_get_all
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_get_all(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = "VS1"
virtualswitch.switchType = "switch"
api.virtual_switch_save(self.admin_context, virtualswitch)
virtualswitches = api.virtual_switch_get_all(self.admin_context)
self.assertFalse(virtualswitches is None, "virtual_switch all returned a none list")
self.assertTrue(len(virtualswitches) == 1, "virtual_switch all returned invalid number of list")
self.assertTrue(virtualswitches[0].id == "VS1", "Virtual Switch Id mismatch")
self.assertTrue(virtualswitches[0].switchType == "switch", "Virtual Switch Type mismatch")
示例4: test_virtual_switch_get_by_ids
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_get_by_ids(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = 'VS1'
virtualswitch.switchType = 'switch'
api.virtual_switch_save(self.admin_context, virtualswitch)
virtualswitches = \
api.virtual_switch_get_by_ids(self.admin_context,
[virtualswitch.id])
self.assertFalse(virtualswitches is None,
'VirtualSwitch all returned a list')
self.assertTrue(
virtualswitches[0].id == 'VS1', 'Virtual Switch Id mismatch')
self.assertTrue(virtualswitches[0].switchType == 'switch',
'Virtual Switch Type mismatch')
示例5: test_virtual_switch_get_all
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_get_all(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = 'VS1'
virtualswitch.switchType = 'switch'
api.virtual_switch_save(self.admin_context, virtualswitch)
virtualswitches = api.virtual_switch_get_all(self.admin_context)
self.assertFalse(virtualswitches is None,
'virtual_switch all returned a none list')
self.assertTrue(len(virtualswitches) == 1,
'virtual_switch all returned invalid number of list')
self.assertTrue(
virtualswitches[0].id == 'VS1', 'Virtual Switch Id mismatch')
self.assertTrue(virtualswitches[0].switchType == 'switch',
'Virtual Switch Type mismatch')
示例6: test_virtual_switch_delete
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_delete(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = "VS1"
virtualswitch.switchType = "switch"
portGroup = PortGroup()
portGroup.set_id("pg-01")
portGroup.set_name("pg-01")
portGroup.set_resourceManagerId("rmId")
portGroup.set_type("portgroup_type")
virtualswitch.add_portGroups(portGroup)
api.virtual_switch_save(self.admin_context, virtualswitch)
# virtualswitchs = api.virtual_switch_get_by_ids([virtualswitch.id])
api.virtual_switch_delete_by_ids(self.admin_context, [virtualswitch.id])
virtualswitchs = api.virtual_switch_get_by_ids(self.admin_context, [virtualswitch.id])
self.assertTrue(virtualswitchs is None or len(virtualswitchs) == 0, "switch not deleted")
示例7: test_virtual_switch_delete
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import id [as 别名]
def test_virtual_switch_delete(self):
virtualswitch = VirtualSwitch()
virtualswitch.id = 'VS1'
virtualswitch.switchType = 'switch'
portGroup = PortGroup()
portGroup.set_id('pg-01')
portGroup.set_name('pg-01')
portGroup.set_resourceManagerId('rmId')
portGroup.set_type('portgroup_type')
virtualswitch.add_portGroups(portGroup)
api.virtual_switch_save(self.admin_context, virtualswitch)
#virtualswitchs = api.virtual_switch_get_by_ids([virtualswitch.id])
api.virtual_switch_delete_by_ids(self.admin_context,
[virtualswitch.id])
virtualswitchs = \
api.virtual_switch_get_by_ids(self.admin_context,
[virtualswitch.id])
self.assertTrue(virtualswitchs is None or len(virtualswitchs)
== 0, 'switch not deleted')