Skip to content

Commit

Permalink
Fixed Bug: 4899
Browse files Browse the repository at this point in the history
Added Configuration Support to Marvin.

1. It provides the basic configuration facilities to marvin.

2. User can just add configuration files for his tests, deployment
              etc, under one config folder before running their tests.
              cs/tools/marvin/marvin/config.
              They can remove all hard coded values from code and separate
              it out as config at this location.
              Either add this to the existing setup.cfg as separate section
              or add new configuration.
3. This will thus removes hard coded tests and separate
              data from tests.

4. This API is provided as an additional facility under
              cloudstackTestClient and users can get the
              configuration object as similar to apiclient,dbconnection
              etc to drive their test.

5. They just add their configuration for a test,
              setup etc,at one single place under configuration dir
              and use "getConfigParser" API of cloudstackTestClient
              It will give them "configObj".They can either pass their own
              config file for parsing to "getConfig" or it will use
              default config file @ config/setup.cfg.
6. They will then get the dictionary of parsed
              configuration and can use it further to drive their tests or
              config drive
7. Test features, can  drive their setups thus removing hard coded
          values. Configuration default file will be under config and as
              setup.cfg.
8. Users can use their own configuration file passed to
              "getConfig" API,once configObj is returned.

Signed-off-by: Santhosh Edukulla <[email protected]>
  • Loading branch information
Santhosh Edukulla authored and Prasanna Santhanam committed Oct 31, 2013
1 parent 4495d45 commit 0b617a1
Show file tree
Hide file tree
Showing 4 changed files with 388 additions and 21 deletions.
18 changes: 18 additions & 0 deletions tools/marvin/marvin/cloudstackTestClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
import asyncJobMgr
import dbConnection
from cloudstackAPI import *
import random
import string
import hashlib
from configGenerator import ConfigManager

'''
@Desc : CloudStackTestClient is encapsulated class for getting various \
Expand Down Expand Up @@ -48,6 +52,17 @@ def __init__(self, mgmtDetails,
self.createDbConnection(dbSvrDetails.dbSvr, dbSvrDetails.port,
dbSvrDetails.user,
dbSvrDetails.passwd, dbSvrDetails.db)
'''
Provides the Configuration Object to users through getConfigParser
The purpose of this object is to parse the config
and provide dictionary of the config so users can
use that configuration.Users can later call getConfig
on this object and it will return the default parsed
config dictionary from default configuration file,
they can overwrite it with providing their own
configuration file as well.
'''
self.configObj = ConfigManager()
self.asyncJobMgr = None
self.id = None
self.defaultWorkerThreads = defaultWorkerThreads
Expand Down Expand Up @@ -154,6 +169,9 @@ def close(self):
def getDbConnection(self):
return self.dbConnection

def getConfigParser(self):
return self.configObj

def getApiClient(self):
self.apiClient.id = self.identifier
return self.apiClient
Expand Down
228 changes: 228 additions & 0 deletions tools/marvin/marvin/config/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# 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": "Sandbox-simulator",
"guestcidraddress": "10.1.1.0/24",
"dns1": "10.147.28.6",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"vlan": "100-200",
"name": "Sandbox-pnet",
"traffictypes": [
{
"typ": "Guest"
},
{
"typ": "Management"
},
{
"typ": "Public"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "VpcVirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "InternalLbVm"
}
],
"isolationmethods": [
"VLAN"
]
}
],
"ipranges": [
{
"startip": "192.168.2.2",
"endip": "192.168.2.200",
"netmask": "255.255.255.0",
"vlan": "50",
"gateway": "192.168.2.1"
}
],
"networktype": "Advanced",
"pods": [
{
"endip": "172.16.15.200",
"name": "POD0",
"startip": "172.16.15.2",
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "C0",
"hypervisor": "simulator",
"hosts": [
{
"username": "root",
"url": "http://sim/c0/h0",
"password": "password"
},
{
"username": "root",
"url": "http://sim/c0/h1",
"password": "password"
}
],
"clustertype": "CloudManaged",
"primaryStorages": [
{
"url": "nfs://10.147.28.6:/export/home/sandbox/primary0",
"name": "PS0"
},
{
"url": "nfs://10.147.28.6:/export/home/sandbox/primary1",
"name": "PS1"
}
]
},
{
"clustername": "C1",
"hypervisor": "simulator",
"hosts": [
{
"username": "root",
"url": "http://sim/c1/h0",
"password": "password"
}
],
"clustertype": "CloudManaged",
"primaryStorages": [
{
"url": "nfs://10.147.28.6:/export/home/sandbox/primary2",
"name": "PS2"
}
]
}
],
"gateway": "172.16.15.1"
}
],
"internaldns1": "10.147.28.6",
"secondaryStorages": [
{
"url": "nfs://10.147.28.6:/export/home/sandbox/secondary",
"provider" : "NFS"
}
]
}
],
"dbSvr": {
"dbSvr": "localhost",
"passwd": "cloud",
"db": "cloud",
"port": 3306,
"user": "cloud"
},
"logger": [
{
"name": "TestClient",
"file": "/tmp/testclient.log"
},
{
"name": "TestCase",
"file": "/tmp/testcase.log"
}
],
"globalConfig": [
{
"name": "network.gc.wait",
"value": "60"
},
{
"name": "storage.cleanup.interval",
"value": "300"
},
{
"name": "vm.op.wait.interval",
"value": "5"
},
{
"name": "default.page.size",
"value": "10000"
},
{
"name": "network.gc.interval",
"value": "60"
},
{
"name": "instance.name",
"value": "QA"
},
{
"name": "workers",
"value": "10"
},
{
"name": "account.cleanup.interval",
"value": "600"
},
{
"name": "guest.domain.suffix",
"value": "sandbox.simulator"
},
{
"name": "expunge.delay",
"value": "60"
},
{
"name": "vm.allocation.algorithm",
"value": "random"
},
{
"name": "expunge.interval",
"value": "60"
},
{
"name": "expunge.workers",
"value": "3"
},
{
"name": "check.pod.cidrs",
"value": "true"
},
{
"name": "secstorage.allowed.internal.sites",
"value": "10.147.28.0/24"
},
{
"name": "direct.agent.load.size",
"value": "1000"
}
],
"mgtSvr": [
{
"mgtSvrIp": "localhost",
"passwd": "password",
"user": "root",
"port": 8096,
"hypervisor": "simulator",
"useHttps": "False",
"certCAPath": "NA",
"certPath": "NA"
}
]
}
Loading

0 comments on commit 0b617a1

Please sign in to comment.