当前位置: 首页>>代码示例>>Python>>正文


Python VirtualSwitch.set_subnetIds方法代码示例

本文整理汇总了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"
        )
开发者ID:emonty,项目名称:healthnmon,代码行数:30,代码来源:test_virtual_switch_db_api.py


注:本文中的healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch.set_subnetIds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。