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


Python VirtualSwitch.id方法代码示例

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

示例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")
开发者ID:emonty,项目名称:healthnmon,代码行数:11,代码来源:test_virtual_switch_db_api.py

示例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")
开发者ID:emonty,项目名称:healthnmon,代码行数:12,代码来源:test_virtual_switch_db_api.py

示例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')
开发者ID:rakrup,项目名称:healthnmon,代码行数:16,代码来源:test_virtual_switch_db_api.py

示例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')
开发者ID:rakrup,项目名称:healthnmon,代码行数:16,代码来源:test_virtual_switch_db_api.py

示例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")
开发者ID:emonty,项目名称:healthnmon,代码行数:20,代码来源:test_virtual_switch_db_api.py

示例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')
开发者ID:rakrup,项目名称:healthnmon,代码行数:24,代码来源:test_virtual_switch_db_api.py


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