本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.Vm.add_vmNetAdapters方法的典型用法代码示例。如果您正苦于以下问题:Python Vm.add_vmNetAdapters方法的具体用法?Python Vm.add_vmNetAdapters怎么用?Python Vm.add_vmNetAdapters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类healthnmon.resourcemodel.healthnmonResourceModel.Vm
的用法示例。
在下文中一共展示了Vm.add_vmNetAdapters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vm_netadpater_save
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import add_vmNetAdapters [as 别名]
def test_vm_netadpater_save(self):
vm = Vm()
vm.id = 'VM1'
vmNetAdapter = VmNetAdapter()
vmNetAdapter.set_id('netAdapter-01')
vmNetAdapter.set_name('netAdapter-01')
vmNetAdapter.set_addressType('assigned')
vmNetAdapter.set_adapterType('E1000')
vmNetAdapter.set_switchType('vSwitch')
vmNetAdapter.set_macAddress('00:50:56:81:1c:d0')
vmNetAdapter.add_ipAddresses('1.1.1.1')
vmNetAdapter.set_networkName('br100')
vmNetAdapter.set_vlanId(0)
vm.add_vmNetAdapters(vmNetAdapter)
healthnmon_db_api.vm_save(get_admin_context(), vm)
virual_machines = \
healthnmon_db_api.vm_get_by_ids(get_admin_context(), ['VM1'
])
vm_from_db = virual_machines[0]
netAdapters = vm_from_db.get_vmNetAdapters()
netAdapter = netAdapters[0]
self.assertTrue(vmNetAdapter.get_id() == netAdapter.get_id())
healthnmon_db_api.vm_delete_by_ids(get_admin_context(), [vm.id])
vms = healthnmon_db_api.vm_get_by_ids(get_admin_context(),
[vm.id])
self.assertTrue(vms is None or len(vms) == 0, 'VM not deleted')