本文整理汇总了Python中marvin.lib.base.Network.update方法的典型用法代码示例。如果您正苦于以下问题:Python Network.update方法的具体用法?Python Network.update怎么用?Python Network.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Network
的用法示例。
在下文中一共展示了Network.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_03_Update_Network_with_Domain
# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import update [as 别名]
def test_03_Update_Network_with_Domain(self):
""" Verify update NetworkDomain for InternalDns on Isolated Network
"""
# Validate the following
# 1. Create an Isolated network - network1 (10.1.1.1/24) by using DNS
# network offering.
# 2. Deploy vm1 in network1.
# 3. Verify dhcp option 06 and 0f for subnet
# 4. Verify dhcp option 06,15 and 0f for vm Interface.
# 5. Update Network domain and verify it is properly updated
# update Network Domain at zone level
cmd = updateZone.updateZoneCmd()
cmd.id = self.zone.id
cmd.domain = "isolated.com"
self.apiclient.updateZone(cmd)
self.debug("Creating and enabling Nuage Vsp Isolated Network "
"offering...")
network_offering = self.create_NetworkOffering(
self.dnsdata["isolated_network_offering"])
self.validate_NetworkOffering(network_offering, state="Enabled")
network_1 = self.create_Network(network_offering)
vm_1 = self.create_VM(network_1)
# VSD verification
self.verify_vsd_network(self.domain.id, network_1)
self.verify_vsd_vm(vm_1)
# Internal DNS check point on VSD
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(self.DOMAINNAME, "isolated.com", network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "isolated.com", nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
update_response = Network.update(
network_1, self.apiclient, id=network_1.id,
networkdomain="update.com", changecidr=False)
completeoutput = str(update_response).strip('[]')
self.debug("network update response is " + completeoutput)
self.assertEqual("update.com", update_response.networkdomain,
"Network Domain is not updated as expected"
)
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "update.com", nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
示例2: test_04_Update_Network_with_Domain
# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import update [as 别名]
def test_04_Update_Network_with_Domain(self):
""" Verify update NetworkDomain for InternalDns on Isolated Network
with ping VM
"""
# Validate the following
# 1. Create an Isolated network - network1 (10.1.1.1/24) by using DNS
# network offering.
# 2. Deploy vm1 in network1.
# 3. Verify dhcp option 06 and 0f for subnet
# 4. Verify dhcp option 06,15 and 0f for vm Interface.
# 5. Update Network domain and verify it is properly updated
# update Network Domain at zone level
cmd = updateZone.updateZoneCmd()
cmd.id = self.zone.id
cmd.domain = "isolated.com"
self.apiclient.updateZone(cmd)
self.debug("Creating and enabling Nuage Vsp Isolated Network "
"offering...")
network_offering = self.create_NetworkOffering(
self.dnsdata["isolated_network_offering"])
self.validate_NetworkOffering(network_offering, state="Enabled")
network_1 = self.create_Network(network_offering)
vm_1 = self.create_VM(network_1)
# VSD verification
self.verify_vsd_network(self.domain.id, network_1)
self.verify_vsd_vm(vm_1)
# Internal DNS check point on VSD
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "isolated.com", network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "isolated.com", nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
update_response = Network.update(
network_1, self.apiclient, id=network_1.id,
networkdomain="update.com", changecidr=False)
completeoutput = str(update_response).strip('[]')
self.debug("network update response is " + completeoutput)
self.assertEqual("update.com", update_response.networkdomain,
"Network Domain is not updated as expected"
)
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "update.com", nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
# stop and start VM to get new DHCP option
try:
vm_1.stop(self.apiclient)
except Exception as e:
self.fail("Failed to stop the virtual instances, %s" % e)
self.test_data["virtual_machine"]["displayname"] = "vm2"
self.test_data["virtual_machine"]["name"] = "vm2"
vm_2 = self.create_VM(network_1)
self.test_data["virtual_machine"]["displayname"] = "vm1"
self.test_data["virtual_machine"]["name"] = "vm1"
self.verify_vsd_vm(vm_2)
for nic in vm_2.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, "update.com", nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)
try:
vm_1.start(self.apiclient)
except Exception as e:
self.fail("Failed to start the virtual instances, %s" % e)
public_ip_1 = self.acquire_PublicIPAddress(network_1)
self.create_and_verify_fw(vm_1, public_ip_1, network_1)
vm_public_ip = public_ip_1.ipaddress.ipaddress
try:
vm_1.ssh_ip = vm_public_ip
vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
vm_1.username = self.test_data["virtual_machine"]["username"]
vm_1.password = self.test_data["virtual_machine"]["password"]
self.debug("SSHing into VM: %s with %s" %
(vm_1.ssh_ip, vm_1.password))
ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)
except Exception as e:
self.fail("SSH into VM failed with exception: %s " % e)
cmd = 'ping -c 2 vm2'
#.........这里部分代码省略.........
示例3: test_05_Update_Network_with_Domain
# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import update [as 别名]
def test_05_Update_Network_with_Domain(self):
""" Verify update NetworkDomain for InternalDns on Isolated Network
with ping VM
"""
# Validate the following
# 1. Create an Isolated network - network1 (10.1.1.1/24) by using DNS
# network offering.
# 2. Deploy vm1 in network1.
# 3. Verify dhcp option 06 and 0f for subnet
# 4. Verify dhcp option 06,15 and 0f for vm Interface.
# 5. Update Network domain and verify it is properly updated
# update Network Domain at zone level
cmd = updateZone.updateZoneCmd()
cmd.id = self.zone.id
cmd.domain = ISOLATED_DOMAIN_NAME
self.apiclient.updateZone(cmd)
self.debug("Creating and enabling Nuage Vsp Isolated Network "
"offering...")
network_offering = self.create_NetworkOffering(
self.dnsdata["isolated_network_offering"])
self.validate_NetworkOffering(network_offering, state="Enabled")
network_1 = self.create_Network(network_offering)
vm_1 = self.create_VM(network_1)
# VSD verification
self.verify_vsd_network(self.domain.id, network_1)
self.verify_vsd_vm(vm_1)
# Internal DNS check point on VSD
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, ISOLATED_DOMAIN_NAME, network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, ISOLATED_DOMAIN_NAME, nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
update_response = Network.update(
network_1, self.apiclient, id=network_1.id,
networkdomain=UPDATED_DOMAIN_NAME, changecidr=False)
completeoutput = str(update_response).strip('[]')
self.debug("network update response is " + completeoutput)
self.assertEqual(UPDATED_DOMAIN_NAME, update_response.networkdomain,
"Network Domain is not updated as expected"
)
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
self.verify_vsd_dhcp_option(self.DOMAINNAME, UPDATED_DOMAIN_NAME, network_1)
for nic in vm_1.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, UPDATED_DOMAIN_NAME, nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
# stop and start VM to get new DHCP option
try:
vm_1.stop(self.apiclient)
except Exception as e:
self.fail("Failed to stop the virtual instances, %s" % e)
self.test_data["virtual_machine"]["displayname"] = "vm2"
self.test_data["virtual_machine"]["name"] = "vm2"
vm_2 = self.create_VM(network_1)
self.test_data["virtual_machine"]["displayname"] = "vm1"
self.test_data["virtual_machine"]["name"] = "vm1"
self.verify_vsd_vm(vm_2)
for nic in vm_2.nic:
self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
self.verify_vsd_dhcp_option(
self.DOMAINNAME, UPDATED_DOMAIN_NAME, nic, True)
self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)
try:
vm_1.start(self.apiclient)
except Exception as e:
self.fail("Failed to start the virtual instances, %s" % e)
public_ip_1 = self.acquire_PublicIPAddress(network_1)
self.create_and_verify_fw(vm_1, public_ip_1, network_1)
self.vm_verify_ping(vm_1, public_ip_1, vm_2, UPDATED_DOMAIN_NAME)