Merge pull request #1458 from cloudsadhu/cloudsadhulocal

BUG-ID:CLOUDSTACK-9331:added code in marvin frame&new config file for advBaremetal support  Added code  in marvin framework&new config file  to support baremetal advanced testcases

* pr/1458:
  BUG-ID:CLOUDSTACK-9331:added code in marvin frame&new config file to support baremetal advanced testcases

Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
Will Stevens 2016-04-25 15:55:08 -04:00
commit 939e448227
2 changed files with 245 additions and 4 deletions

View File

@ -0,0 +1,208 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
{
"zones": [
{
"name": "ZoneBaremetal",
"guestcidraddress": "10.1.1.0/24",
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
}
],
"dns1": "10.x.x.x",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"name": "Sandbox-pnet",
"vlan": "1020-1025",
"traffictypes": [
{
"typ": "Guest"
},
{
"typ": "Management"
},
{
"typ": "Public"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
}
]
}
],
"ipranges": [
{
"startip": "10.x.x.x",
"endip": "10.x.x.x",
"netmask": "255.255.255.0",
"vlan": "1220",
"gateway": "10.x.x.1"
}
],
"networktype": "Advanced",
"pods": [
{
"endip": "10.x.x.x",
"name": "POD01",
"startip": "10.x.x.x",
"netmask": "255.255.255.192",
"vmwaredc":{"name":"dc-baremetal","vcenter":"10.x.x.x","username":"Administrator@vsphere.local","password":"Password"},
"clusters": [
{
"clustername": "10.x.x.x/dc-baremetal/cluster1",
"hypervisor": "VmWare",
"username": "Administrator@vsphere.local",
"clustertype": "ExternalManaged",
"password": "Password",
"url": "http://10.x.x.x/dc-baremetal/cluster1",
"hosts": [
{
"username": "root",
"url": "http://10.x.x.x",
"password": "password"
},
{
"username": "root",
"url": "http://10.x.x.x",
"password": "password"
}
],
"primaryStorages": [
{
"url": "nfs://10.x.x.x:/export/home/primary",
"name": "PS0"
}
]
},
{
"clustername": "C1",
"hypervisor": "BareMetal",
"hosts": [
{
"username": "root",
"url": "http://10.x.x.x",
"password": "password",
"hostmac": "xx:xx:xx:xx:xx:xx",
"cpunumber": "1",
"cpuspeed": "1000",
"memory": "1024",
"hosttags": "host15"
}
],
"clustertype": "CloudManaged"
}
],
"gateway": "10.x.x.x"
}
],
"internaldns1": "10.x.x.x",
"baremetalrcturl": "http://10.x.x.x/baremetal/baremetalrct.json",
"secondaryStorages": [
{
"url": "nfs://10.x.x.x:/export/home/secondary",
"provider": "nfs",
"name":"secondary"
}
]
}
],
"logger": {
"LogFolderPath": "/tmp/"
},
"dbSvr": {
"dbSvr": "10.22.13.12",
"passwd": "password",
"db": "cloud",
"port": 3306,
"user": "root"
},
"globalConfig": [
{
"name": "network.gc.wait",
"value": "60"
},
{
"name": "storage.cleanup.interval",
"value": "30"
},
{
"name": "account.cleanup.interval",
"value": "60"
},
{
"name": "secstorage.allowed.internal.sites",
"value": "10.x.x.0/24"
},
{
"name": "vm.op.wait.interval",
"value": "5"
},
{
"name": "network.gc.interval",
"value": "60"
},
{
"name": "guest.domain.suffix",
"value": "auto.advanced"
},
{
"name": "expunge.delay",
"value": "60"
},
{
"name": "vm.allocation.algorithm",
"value": "userdispersing"
},
{
"name": "expunge.interval",
"value": "60"
},
{
"name": "instance.name",
"value": "QA"
},
{
"name": "expunge.workers",
"value": "3"
},
{
"name": "baremetal.internal.storage.server.ip",
"value": "10.2.1.2"
},
{
"name": "check.pod.cidrs",
"value": "true"
}
],
"mgtSvr": [
{
"mgtSvrIp": "10.22.10.12",
"port": 8096,
"user": "root",
"password": "password",
"hypervisor": "vmware"
}
]
}

View File

@ -133,6 +133,12 @@ class DeployDataCenters(object):
hostcmd.username = host.username
hostcmd.zoneid = zoneId
hostcmd.hypervisor = hypervisor
if hostcmd.hypervisor.lower() == "baremetal":
hostcmd.hostmac=host.hostmac
hostcmd.cpunumber=host.cpunumber
hostcmd.cpuspeed=host.cpuspeed
hostcmd.memory=host.memory
hostcmd.hosttags=host.hosttags
ret = self.__apiClient.addHost(hostcmd)
if ret:
self.__tcRunLogger.debug("=== Add Host Successful ===")
@ -164,6 +170,25 @@ class DeployDataCenters(object):
self.__tcRunLogger.exception("=== Adding VmWare DC Failed===")
self.__cleanAndExit()
def addBaremetalRct(self, config):
networktype= config.zones[0].networktype
baremetalrcturl= config.zones[0].baremetalrcturl
if networktype is None or baremetalrcturl is None:
return
if networktype.lower()=="advanced":
try:
brctcmd = addBaremetalRct.addBaremetalRctCmd()
brctcmd.baremetalrcturl=baremetalrcturl
ret = self.__apiClient.addBaremetalRct(brctcmd)
if ret.id:
self.__tcRunLogger.debug("=== Adding Baremetal Rct file Successful===")
self.__addToCleanUp("BaremetalRct", ret.id)
except Exception as e:
print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
self.__tcRunLogger.exception("=== Adding Baremetal Rct file Failed===")
self.__cleanAndExit()
def createClusters(self, clusters, zoneId, podId, vmwareDc=None):
try:
if clusters is None:
@ -193,10 +218,12 @@ class DeployDataCenters(object):
self.addHosts(cluster.hosts, zoneId, podId, clusterId,
cluster.hypervisor)
self.waitForHost(zoneId, clusterId)
self.createPrimaryStorages(cluster.primaryStorages,
zoneId,
podId,
clusterId)
if cluster.hypervisor.lower() != "baremetal":
self.createPrimaryStorages(cluster.primaryStorages,
zoneId,
podId,
clusterId)
except Exception as e:
print "Exception Occurred %s" % GetDetailExceptionInfo(e)
self.__tcRunLogger.exception("====Cluster %s Creation Failed"
@ -888,6 +915,12 @@ class DeployDataCenters(object):
self.__persistDcConfig()
print "\n====Deploy DC Successful====="
self.__tcRunLogger.debug("\n====Deploy DC Successful====")
'''
Upload baremetalSwitch configuration(.rct) file if enabled zone has baremetal isolated network.
'''
self.addBaremetalRct(self.__config)
self.__tcRunLogger.debug("\n==== AddbaremetalRct Successful====")
return SUCCESS
except Exception as e:
print "\nException Occurred Under deploy :%s" % \