mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Multiple fixes to the testClient to accomodate further changes to 3.0 APIs
reviewed-by: Kishan * Revert back to old guestCidrAddress * Add default traffic types * fixed typo when creating physical network, specifid wrong zone * correctly specifying the guest VLAN as part of updating physical network
This commit is contained in:
		
							parent
							
								
									d4a180f097
								
							
						
					
					
						commit
						1b8a23f5be
					
				| @ -209,7 +209,13 @@ class deployDataCenters(): | |||||||
|         traffic_type = addTrafficType.addTrafficTypeCmd() |         traffic_type = addTrafficType.addTrafficTypeCmd() | ||||||
|         traffic_type.physicalnetworkid = physical_network_id |         traffic_type.physicalnetworkid = physical_network_id | ||||||
|         traffic_type.traffictype = traffictype |         traffic_type.traffictype = traffictype | ||||||
|         self.apiClient.addTrafficType(traffic_type) |         return self.apiClient.addTrafficType(traffic_type) | ||||||
|  | 
 | ||||||
|  |     def enableZone(self, zoneid, allocation_state="Enabled"): | ||||||
|  |         zoneCmd = updateZone.updateZoneCmd() | ||||||
|  |         zoneCmd.id = zoneid | ||||||
|  |         zoneCmd.allocationstate = allocation_state | ||||||
|  |         return self.apiClient.updateZone(zoneCmd) | ||||||
| 
 | 
 | ||||||
|     def createZones(self, zones): |     def createZones(self, zones): | ||||||
|         for zone in zones: |         for zone in zones: | ||||||
| @ -221,22 +227,19 @@ class deployDataCenters(): | |||||||
|             createzone.name = zone.name |             createzone.name = zone.name | ||||||
|             createzone.securitygroupenabled = zone.securitygroupenabled |             createzone.securitygroupenabled = zone.securitygroupenabled | ||||||
|             createzone.networktype = zone.networktype |             createzone.networktype = zone.networktype | ||||||
|  |             createzone.guestcidraddress = zone.guestcidraddress | ||||||
| 
 | 
 | ||||||
|             zoneresponse = self.apiClient.createZone(createzone) |             zoneresponse = self.apiClient.createZone(createzone) | ||||||
|             zoneId = zoneresponse.id |             zoneId = zoneresponse.id | ||||||
| 
 | 
 | ||||||
|             phynetwrk = self.createPhysicalNetwork(zone.name + "-pnet", \ |             phynetwrk = self.createPhysicalNetwork(zone.name + "-pnet", \ | ||||||
|                                                    zoneId, zone.vlan) |                                                    zoneId) | ||||||
| 
 | 
 | ||||||
|             if zone.networktype == "Advanced": |             self.addTrafficTypes(phynetwrk.id, ["Guest", "Public", \ | ||||||
|                 self.addTrafficTypes(phynetwrk.id, ["Guest", "Public", \ |  | ||||||
|                                                     "Management"]) |                                                     "Management"]) | ||||||
|             elif zone.networktype == "Basic": |  | ||||||
|                 self.addTrafficTypes(phynetwrk.id, ["Guest", "Public", \ |  | ||||||
|                                                     "Management", "Storage"]) |  | ||||||
| 
 | 
 | ||||||
|             self.configureProviders(phynetwrk, zone) |             self.configureProviders(phynetwrk, zone) | ||||||
|             self.updatePhysicalNetwork(phynetwrk.id, "Enabled") |             self.updatePhysicalNetwork(phynetwrk.id, "Enabled", vlan=zone.vlan) | ||||||
| 
 | 
 | ||||||
|             if zone.networktype == "Basic": |             if zone.networktype == "Basic": | ||||||
|                 listnetworkoffering = \ |                 listnetworkoffering = \ | ||||||
|  | |||||||
| @ -1,273 +1,65 @@ | |||||||
| { | { | ||||||
|     "zones": [ |     "zones": [ | ||||||
|         { |         { | ||||||
|             "name": "Sandbox-Simulator",  |             "name": "Sandbox-simulator",  | ||||||
|             "guestcidraddress": "10.1.1.0/24",  |             "guestcidraddress": "10.1.1.0/24",  | ||||||
|             "dns2": "10.223.110.254",  |             "providers": [ | ||||||
|             "dns1": "4.2.2.2",  |                 { | ||||||
|             "vlan": "100-300",  |                     "broadcastdomainrange": "ZONE",  | ||||||
|  |                     "name": "VirtualRouter" | ||||||
|  |                 } | ||||||
|  |             ],  | ||||||
|  |             "dns1": "10.147.28.6",  | ||||||
|  |             "vlan": "100-500",  | ||||||
|             "ipranges": [ |             "ipranges": [ | ||||||
|                 { |                 { | ||||||
|                     "startip": "172.1.2.2",  |                     "startip": "172.2.1.2",  | ||||||
|                     "endip": "172.1.2.200",  |                     "endip": "172.2.1.252",  | ||||||
|                     "netmask": "255.255.255.0",  |                     "netmask": "255.255.255.0",  | ||||||
|                     "vlan": "30",  |                     "vlan": "30",  | ||||||
|                     "gateway": "172.1.2.1" |                     "gateway": "172.2.1.1" | ||||||
|                 } |                 } | ||||||
|             ],  |             ],  | ||||||
|             "networktype": "Advanced",  |             "networktype": "Advanced",  | ||||||
|             "pods": [ |             "pods": [ | ||||||
|                 { |                 { | ||||||
|                     "endip": "172.1.1.200",  |                     "endip": "172.1.2.252",  | ||||||
|                     "name": "POD0",  |                     "name": "POD0",  | ||||||
|                     "startip": "172.1.1.2",  |                     "startip": "172.1.2.2",  | ||||||
|                     "netmask": "255.255.255.0",  |                     "netmask": "255.255.255.0",  | ||||||
|                     "clusters": [ |                     "clusters": [ | ||||||
|                         { |                         { | ||||||
|                             "clustername": "POD1-CLUSTER1",  |                             "clustername": "C0",  | ||||||
|                             "hypervisor": "Simulator",  |                             "hypervisor": "simulator",  | ||||||
|                             "hosts": [ |                             "hosts": [ | ||||||
|                                 { |                                 { | ||||||
|                                     "username": "root",  |                                     "username": "root",  | ||||||
|                                     "url": "http://sim/test-1",  |                                     "url": "http://sim",  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-2",  |  | ||||||
|                                     "password": "password" |                                     "password": "password" | ||||||
|                                 } |                                 } | ||||||
|                             ],  |                             ],  | ||||||
|                             "clustertype": "CloudManaged",  |                             "clustertype": "CloudManaged",  | ||||||
|                             "primaryStorages": [ |                             "primaryStorages": [ | ||||||
|                                 { |                                 { | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/1",  |                                     "url": "nfs://172.2.2.6:/export/home/primary",  | ||||||
|                                     "name": "spool1" |                                     "name": "PS0" | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER2",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-3",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-4",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/2",  |  | ||||||
|                                     "name": "spool2" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER3",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-5",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-6",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/3",  |  | ||||||
|                                     "name": "spool3" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER4",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-7",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-8",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/4",  |  | ||||||
|                                     "name": "spool4" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER5",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-9",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-10",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/5",  |  | ||||||
|                                     "name": "spool5" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER6",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-11",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-12",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/6",  |  | ||||||
|                                     "name": "spool6" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER7",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-13",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-14",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/7",  |  | ||||||
|                                     "name": "spool7" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER8",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-15",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-16",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/8",  |  | ||||||
|                                     "name": "spool8" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER9",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-17",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-18",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/9",  |  | ||||||
|                                     "name": "spool9" |  | ||||||
|                                 } |  | ||||||
|                             ] |  | ||||||
|                         },  |  | ||||||
|                         { |  | ||||||
|                             "clustername": "POD1-CLUSTER10",  |  | ||||||
|                             "hypervisor": "Simulator",  |  | ||||||
|                             "hosts": [ |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-19",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 },  |  | ||||||
|                                 { |  | ||||||
|                                     "username": "root",  |  | ||||||
|                                     "url": "http://sim/test-20",  |  | ||||||
|                                     "password": "password" |  | ||||||
|                                 } |  | ||||||
|                             ],  |  | ||||||
|                             "clustertype": "CloudManaged",  |  | ||||||
|                             "primaryStorages": [ |  | ||||||
|                                 { |  | ||||||
|                                     "url": "nfs://172.16.24.32/export/path/10",  |  | ||||||
|                                     "name": "spool10" |  | ||||||
|                                 } |                                 } | ||||||
|                             ] |                             ] | ||||||
|                         } |                         } | ||||||
|                     ],  |                     ],  | ||||||
|                     "gateway": "172.1.1.1" |                     "gateway": "172.1.2.1" | ||||||
|                 } |                 } | ||||||
|             ],  |             ],  | ||||||
|             "internaldns1": "10.147.28.6",  |             "internaldns1": "10.147.28.6",  | ||||||
|             "internaldns2": "10.223.110.254",  |  | ||||||
|             "secondaryStorages": [ |             "secondaryStorages": [ | ||||||
|                 { |                 { | ||||||
|                     "url": "nfs://172.16.25.32/secondary/path" |                     "url": "nfs://172.2.2.6:/export/home/secondary" | ||||||
|                 } |                 } | ||||||
|             ] |             ] | ||||||
|         } |         } | ||||||
|     ],  |     ],  | ||||||
|     "dbSvr": { |     "dbSvr": { | ||||||
|         "dbSvr": "10.147.28.40",  |         "dbSvr": "localhost",  | ||||||
|         "passwd": "cloud",  |         "passwd": "cloud",  | ||||||
|         "db": "cloud",  |         "db": "cloud",  | ||||||
|         "port": 3306,  |         "port": 3306,  | ||||||
| @ -285,61 +77,61 @@ | |||||||
|     ],  |     ],  | ||||||
|     "globalConfig": [ |     "globalConfig": [ | ||||||
|         { |         { | ||||||
|             "name": "use.user.concentrated.pod.allocation",  |             "name": "storage.cleanup.interval",  | ||||||
|             "value": "false" |             "value": "300" | ||||||
|  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "vm.op.wait.interval",  | ||||||
|  |             "value": "5" | ||||||
|         },  |         },  | ||||||
|         { |         { | ||||||
|             "name": "default.page.size",  |             "name": "default.page.size",  | ||||||
|             "value": "10000" |             "value": "10000" | ||||||
|         },  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "instance.name",  | ||||||
|  |             "value": "QA" | ||||||
|  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "workers",  | ||||||
|  |             "value": "10" | ||||||
|  |         },  | ||||||
|         { |         { | ||||||
|             "name": "direct.agent.load.size",  |             "name": "direct.agent.load.size",  | ||||||
|             "value": "1000" |             "value": "1000" | ||||||
|         },  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "account.cleanup.interval",  | ||||||
|  |             "value": "600" | ||||||
|  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "guest.domain.suffix",  | ||||||
|  |             "value": "sandbox.simulator" | ||||||
|  |         },  | ||||||
|         { |         { | ||||||
|             "name": "expunge.delay",  |             "name": "expunge.delay",  | ||||||
|             "value": "60" |             "value": "60" | ||||||
|         },  |         },  | ||||||
|         { |         { | ||||||
|             "name": "vm.allocation.algorithm",  |             "name": "vm.allocation.algorithm",  | ||||||
|             "value": "random" |             "value": "userdispersing" | ||||||
|         },  |  | ||||||
|         { |  | ||||||
|             "name": "check.pod.cidrs",  |  | ||||||
|             "value": "false" |  | ||||||
|         },  |  | ||||||
|         { |  | ||||||
|             "name": "instance.name",  |  | ||||||
|             "value": "SIMQA" |  | ||||||
|         },  |  | ||||||
|         { |  | ||||||
|             "name": "workers",  |  | ||||||
|             "value": "10" |  | ||||||
|         },  |  | ||||||
|         { |  | ||||||
|             "name": "vm.op.wait.interval",  |  | ||||||
|             "value": "5" |  | ||||||
|         },  |  | ||||||
|         { |  | ||||||
|             "name": "guest.domain.suffix",  |  | ||||||
|             "value": "sandbox.simulator" |  | ||||||
|         },  |         },  | ||||||
|         { |         { | ||||||
|             "name": "expunge.interval",  |             "name": "expunge.interval",  | ||||||
|             "value": "60" |             "value": "60" | ||||||
|         },  |         },  | ||||||
|         { |  | ||||||
|             "name": "linkLocalIp.nums",  |  | ||||||
|             "value": "10" |  | ||||||
|         },  |  | ||||||
|         { |         { | ||||||
|             "name": "expunge.workers",  |             "name": "expunge.workers",  | ||||||
|             "value": "3" |             "value": "3" | ||||||
|  |         },  | ||||||
|  |         { | ||||||
|  |             "name": "check.pod.cidrs",  | ||||||
|  |             "value": "true" | ||||||
|         } |         } | ||||||
|     ],  |     ],  | ||||||
|     "mgtSvr": [ |     "mgtSvr": [ | ||||||
|         { |         { | ||||||
|             "mgtSvrIp": "10.147.28.40",  |             "mgtSvrIp": "localhost",  | ||||||
|             "port": 8096 |             "port": 8096 | ||||||
|         } |         } | ||||||
|     ] |     ] | ||||||
|  | |||||||
| @ -31,10 +31,7 @@ def describeResources(config): | |||||||
|     z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor')) |     z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor')) | ||||||
|     z.networktype = 'Advanced' |     z.networktype = 'Advanced' | ||||||
|     z.guestcidraddress = '10.1.1.0/24' |     z.guestcidraddress = '10.1.1.0/24' | ||||||
| 
 |     z.vlan = config.get('cloudstack','guest.vlan') | ||||||
|     prov = provider() |  | ||||||
|     prov.vlan = config.get('cloudstack','guest.vlan') |  | ||||||
|     z.providers.append(prov) |  | ||||||
| 
 | 
 | ||||||
|     p = pod() |     p = pod() | ||||||
|     p.name = 'POD0' |     p.name = 'POD0' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user