本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch.set_subnetIds方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualSwitch.set_subnetIds方法的具体用法?Python VirtualSwitch.set_subnetIds怎么用?Python VirtualSwitch.set_subnetIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch
的用法示例。
在下文中一共展示了VirtualSwitch.set_subnetIds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_virtual_switch_multiple_save
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import set_subnetIds [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"
)