本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch.set_connectionState方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualSwitch.set_connectionState方法的具体用法?Python VirtualSwitch.set_connectionState怎么用?Python VirtualSwitch.set_connectionState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch
的用法示例。
在下文中一共展示了VirtualSwitch.set_connectionState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_network_enabled_event
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import VirtualSwitch [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.VirtualSwitch import set_connectionState [as 别名]
def test_network_enabled_event(self):
cachedHost = VmHost()
cachedHost.id = self.libvirtNetwork.compute_id
vswitch = VirtualSwitch()
vswitch.set_id("11")
vswitch.set_name("vs1")
vswitch.set_connectionState("Inactive")
cachedHost.set_virtualSwitches([vswitch])
vmhost = copy.deepcopy(cachedHost)
vmhost.get_virtualSwitches()[0].set_connectionState("Active")
self.libvirtNetwork._processNetworkEvents(cachedHost, vmhost)
self.assertEquals(vmhost.get_virtualSwitches()[0].
get_connectionState(),
Constants.VIRSWITCH_STATE_ACTIVE)
self.assertEquals(len(test_notifier.NOTIFICATIONS), 1)
msg = test_notifier.NOTIFICATIONS[0]
self.assertEquals(msg['priority'], notifier_api.INFO)
event_type = event_metadata.get_EventMetaData(
event_metadata.EVENT_TYPE_NETWORK_ENABLED)
self.assertEquals(msg['event_type'],
event_type.get_event_fully_qal_name())
payload = msg['payload']
self.assertEquals(payload['entity_type'], 'VirtualSwitch')
self.assertEquals(payload['entity_id'], vswitch.get_id())
self.assertEquals(payload["state"], 'Active')