本文整理匯總了Python中vnc_api.vnc_api.VirtualMachineInterface.set_display_name方法的典型用法代碼示例。如果您正苦於以下問題:Python VirtualMachineInterface.set_display_name方法的具體用法?Python VirtualMachineInterface.set_display_name怎麽用?Python VirtualMachineInterface.set_display_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vnc_api.vnc_api.VirtualMachineInterface
的用法示例。
在下文中一共展示了VirtualMachineInterface.set_display_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_cannot_update_sub_interface_vlan_tag
# 需要導入模塊: from vnc_api.vnc_api import VirtualMachineInterface [as 別名]
# 或者: from vnc_api.vnc_api.VirtualMachineInterface import set_display_name [as 別名]
def test_cannot_update_sub_interface_vlan_tag(self):
project = Project('%s-project' % self.id())
self.api.project_create(project)
vn = VirtualNetwork('%s-vn' % self.id(), parent_obj=project)
self.api.virtual_network_create(vn)
vmi = VirtualMachineInterface('%s-vmi' % self.id(), parent_obj=project)
vmi.set_virtual_network(vn)
self.api.virtual_machine_interface_create(vmi)
vmi42 = VirtualMachineInterface('%s-vmi42' % self.id(),
parent_obj=project)
vmi42.set_virtual_machine_interface_properties(
VMIPT(sub_interface_vlan_tag=42))
vmi42.set_virtual_network(vn)
self.api.virtual_machine_interface_create(vmi42)
# if we don't touch VMI props, we can update the VMI with or without
# VLAN ID
vmi.set_display_name('new vmi name')
self.api.virtual_machine_interface_update(vmi)
vmi42.set_display_name('new vmi42 name')
self.api.virtual_machine_interface_update(vmi42)
# if we change VMI props without specifying anything, we can update the
# VMI if VLAN ID is not set or 0
vmi.set_virtual_machine_interface_properties(None)
self.api.virtual_machine_interface_update(vmi)
vmi.set_virtual_machine_interface_properties(
VMIPT(sub_interface_vlan_tag=None))
self.api.virtual_machine_interface_update(vmi)
# if we change VMI props without specifying anything, we cannot update
# the VMI if VLAN ID is not 0
vmi42.set_virtual_machine_interface_properties(None)
self.assertRaises(BadRequest,
self.api.virtual_machine_interface_update,
vmi42)
vmi42.set_virtual_machine_interface_properties(
VMIPT(sub_interface_vlan_tag=None))
self.assertRaises(BadRequest,
self.api.virtual_machine_interface_update,
vmi42)
# if we update VMI VLAN ID to the same VLAN ID, no error raised
vmi.set_virtual_machine_interface_properties(
VMIPT(sub_interface_vlan_tag=0))
self.api.virtual_machine_interface_update(vmi)
vmi42.set_virtual_machine_interface_properties(
VMIPT(sub_interface_vlan_tag=42))
self.api.virtual_machine_interface_update(vmi42)