You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/21 14:23:27 UTC

[14/17] make the module structure more relevant and simple

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VirtualRouterElement.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VirtualRouterElement.py b/tools/marvin/marvin/base/VirtualRouterElement.py
new file mode 100644
index 0000000..7b885b9
--- /dev/null
+++ b/tools/marvin/marvin/base/VirtualRouterElement.py
@@ -0,0 +1,53 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import createVirtualRouterElement
+from marvin.cloudstackAPI import listVirtualRouterElements
+from marvin.cloudstackAPI import configureVirtualRouterElement
+
+class VirtualRouterElement(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVirtualRouterElement.createVirtualRouterElementCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        virtualrouterelement = apiclient.createVirtualRouterElement(cmd)
+        return VirtualRouterElement(virtualrouterelement.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        virtualrouterelement = apiclient.listVirtualRouterElements(cmd)
+        return map(lambda e: VirtualRouterElement(e.__dict__), virtualrouterelement)
+
+
+    def configure(self, apiclient, enabled, **kwargs):
+        cmd = configureVirtualRouterElement.configureVirtualRouterElementCmd()
+        cmd.id = self.id
+        cmd.enabled = enabled
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        virtualrouterelement = apiclient.configureVirtualRouterElement(cmd)
+        return virtualrouterelement
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VlanIpRange.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VlanIpRange.py b/tools/marvin/marvin/base/VlanIpRange.py
new file mode 100644
index 0000000..87b5e27
--- /dev/null
+++ b/tools/marvin/marvin/base/VlanIpRange.py
@@ -0,0 +1,52 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import createVlanIpRange
+from marvin.cloudstackAPI import listVlanIpRanges
+from marvin.cloudstackAPI import deleteVlanIpRange
+
+class VlanIpRange(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVlanIpRange.createVlanIpRangeCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vlaniprange = apiclient.createVlanIpRange(cmd)
+        return VlanIpRange(vlaniprange.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVlanIpRanges.listVlanIpRangesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vlaniprange = apiclient.listVlanIpRanges(cmd)
+        return map(lambda e: VlanIpRange(e.__dict__), vlaniprange)
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteVlanIpRange.deleteVlanIpRangeCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vlaniprange = apiclient.deleteVlanIpRange(cmd)
+        return vlaniprange
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/Volume.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/Volume.py b/tools/marvin/marvin/base/Volume.py
new file mode 100644
index 0000000..fdb17bf
--- /dev/null
+++ b/tools/marvin/marvin/base/Volume.py
@@ -0,0 +1,106 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import migrateVolume
+from marvin.cloudstackAPI import createVolume
+from marvin.cloudstackAPI import listVolumes
+from marvin.cloudstackAPI import uploadVolume
+from marvin.cloudstackAPI import attachVolume
+from marvin.cloudstackAPI import detachVolume
+from marvin.cloudstackAPI import extractVolume
+from marvin.cloudstackAPI import deleteVolume
+
+class Volume(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    def migrate(self, apiclient, storageid, volumeid, **kwargs):
+        cmd = migrateVolume.migrateVolumeCmd()
+        cmd.id = self.id
+        cmd.storageid = storageid
+        cmd.volumeid = volumeid
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.migrateVolume(cmd)
+        return volume
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVolume.createVolumeCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.createVolume(cmd)
+        return Volume(volume.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVolumes.listVolumesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.listVolumes(cmd)
+        return map(lambda e: Volume(e.__dict__), volume)
+
+
+    def upload(self, apiclient, url, zoneid, name, format, **kwargs):
+        cmd = uploadVolume.uploadVolumeCmd()
+        cmd.id = self.id
+        cmd.format = format
+        cmd.name = name
+        cmd.url = url
+        cmd.zoneid = zoneid
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.uploadVolume(cmd)
+        return volume
+
+
+    def attach(self, apiclient, virtualmachineid, **kwargs):
+        cmd = attachVolume.attachVolumeCmd()
+        cmd.id = self.id
+        cmd.virtualmachineid = virtualmachineid
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.attachVolume(cmd)
+        return volume
+
+
+    def detach(self, apiclient, **kwargs):
+        cmd = detachVolume.detachVolumeCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.detachVolume(cmd)
+        return volume
+
+
+    def extract(self, apiclient, zoneid, mode, **kwargs):
+        cmd = extractVolume.extractVolumeCmd()
+        cmd.id = self.id
+        cmd.mode = mode
+        cmd.zoneid = zoneid
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.extractVolume(cmd)
+        return volume
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        volume = apiclient.deleteVolume(cmd)
+        return volume
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VpnConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VpnConnection.py b/tools/marvin/marvin/base/VpnConnection.py
new file mode 100644
index 0000000..9d4061f
--- /dev/null
+++ b/tools/marvin/marvin/base/VpnConnection.py
@@ -0,0 +1,61 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import resetVpnConnection
+from marvin.cloudstackAPI import createVpnConnection
+from marvin.cloudstackAPI import listVpnConnections
+from marvin.cloudstackAPI import deleteVpnConnection
+
+class VpnConnection(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    def reset(self, apiclient, **kwargs):
+        cmd = resetVpnConnection.resetVpnConnectionCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnconnection = apiclient.resetVpnConnection(cmd)
+        return vpnconnection
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVpnConnection.createVpnConnectionCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnconnection = apiclient.createVpnConnection(cmd)
+        return VpnConnection(vpnconnection.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnConnections.listVpnConnectionsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnconnection = apiclient.listVpnConnections(cmd)
+        return map(lambda e: VpnConnection(e.__dict__), vpnconnection)
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnconnection = apiclient.deleteVpnConnection(cmd)
+        return vpnconnection
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VpnCustomerGateway.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VpnCustomerGateway.py b/tools/marvin/marvin/base/VpnCustomerGateway.py
new file mode 100644
index 0000000..5c9f499
--- /dev/null
+++ b/tools/marvin/marvin/base/VpnCustomerGateway.py
@@ -0,0 +1,66 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import createVpnCustomerGateway
+from marvin.cloudstackAPI import listVpnCustomerGateways
+from marvin.cloudstackAPI import updateVpnCustomerGateway
+from marvin.cloudstackAPI import deleteVpnCustomerGateway
+
+class VpnCustomerGateway(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpncustomergateway = apiclient.createVpnCustomerGateway(cmd)
+        return VpnCustomerGateway(vpncustomergateway.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpncustomergateway = apiclient.listVpnCustomerGateways(cmd)
+        return map(lambda e: VpnCustomerGateway(e.__dict__), vpncustomergateway)
+
+
+    def update(self, apiclient, ikepolicy, cidrlist, gateway, ipsecpsk, esppolicy, **kwargs):
+        cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd()
+        cmd.id = self.id
+        cmd.cidrlist = cidrlist
+        cmd.esppolicy = esppolicy
+        cmd.gateway = gateway
+        cmd.ikepolicy = ikepolicy
+        cmd.ipsecpsk = ipsecpsk
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpncustomergateway = apiclient.updateVpnCustomerGateway(cmd)
+        return vpncustomergateway
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpncustomergateway = apiclient.deleteVpnCustomerGateway(cmd)
+        return vpncustomergateway
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VpnGateway.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VpnGateway.py b/tools/marvin/marvin/base/VpnGateway.py
new file mode 100644
index 0000000..2f04871
--- /dev/null
+++ b/tools/marvin/marvin/base/VpnGateway.py
@@ -0,0 +1,52 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import createVpnGateway
+from marvin.cloudstackAPI import listVpnGateways
+from marvin.cloudstackAPI import deleteVpnGateway
+
+class VpnGateway(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createVpnGateway.createVpnGatewayCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpngateway = apiclient.createVpnGateway(cmd)
+        return VpnGateway(vpngateway.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnGateways.listVpnGatewaysCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpngateway = apiclient.listVpnGateways(cmd)
+        return map(lambda e: VpnGateway(e.__dict__), vpngateway)
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteVpnGateway.deleteVpnGatewayCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpngateway = apiclient.deleteVpnGateway(cmd)
+        return vpngateway
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/VpnUser.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/VpnUser.py b/tools/marvin/marvin/base/VpnUser.py
new file mode 100644
index 0000000..b60f59c
--- /dev/null
+++ b/tools/marvin/marvin/base/VpnUser.py
@@ -0,0 +1,54 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import addVpnUser
+from marvin.cloudstackAPI import listVpnUsers
+from marvin.cloudstackAPI import removeVpnUser
+
+class VpnUser(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    def add(self, apiclient, username, password, **kwargs):
+        cmd = addVpnUser.addVpnUserCmd()
+        cmd.id = self.id
+        cmd.password = password
+        cmd.username = username
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnuser = apiclient.addVpnUser(cmd)
+        return vpnuser
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnUsers.listVpnUsersCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnuser = apiclient.listVpnUsers(cmd)
+        return map(lambda e: VpnUser(e.__dict__), vpnuser)
+
+
+    def remove(self, apiclient, username, **kwargs):
+        cmd = removeVpnUser.removeVpnUserCmd()
+        cmd.id = self.id
+        cmd.username = username
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        vpnuser = apiclient.removeVpnUser(cmd)
+        return vpnuser
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/Zone.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/Zone.py b/tools/marvin/marvin/base/Zone.py
new file mode 100644
index 0000000..9b6b578
--- /dev/null
+++ b/tools/marvin/marvin/base/Zone.py
@@ -0,0 +1,61 @@
+# 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.
+from marvin.base import CloudStackEntity
+from marvin.cloudstackAPI import createZone
+from marvin.cloudstackAPI import listZones
+from marvin.cloudstackAPI import updateZone
+from marvin.cloudstackAPI import deleteZone
+
+class Zone(CloudStackEntity.CloudStackEntity):
+
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+
+    @classmethod
+    def create(cls, apiclient, factory, **kwargs):
+        cmd = createZone.createZoneCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        zone = apiclient.createZone(cmd)
+        return Zone(zone.__dict__)
+
+
+    @classmethod
+    def list(self, apiclient, **kwargs):
+        cmd = listZones.listZonesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        zone = apiclient.listZones(cmd)
+        return map(lambda e: Zone(e.__dict__), zone)
+
+
+    def update(self, apiclient, **kwargs):
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        zone = apiclient.updateZone(cmd)
+        return zone
+
+
+    def delete(self, apiclient, **kwargs):
+        cmd = deleteZone.deleteZoneCmd()
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        zone = apiclient.deleteZone(cmd)
+        return zone
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/base/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/__init__.py b/tools/marvin/marvin/base/__init__.py
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/tools/marvin/marvin/base/__init__.py
@@ -0,0 +1,16 @@
+# 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.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/common.py b/tools/marvin/marvin/common.py
new file mode 100644
index 0000000..36e4435
--- /dev/null
+++ b/tools/marvin/marvin/common.py
@@ -0,0 +1,566 @@
+# 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.
+"""Common functions
+"""
+
+#Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.remoteSSHClient import remoteSSHClient
+from marvin.utils import *
+
+#Import System modules
+import time
+
+
+def wait_for_cleanup(apiclient, configs=None):
+    """Sleeps till the cleanup configs passed"""
+
+    # Configs list consists of the list of global configs
+    if not isinstance(configs, list):
+        return
+    for config in configs:
+        cmd = listConfigurations.listConfigurationsCmd()
+        cmd.name = config
+        cmd.listall = True
+        try:
+            config_descs = apiclient.listConfigurations(cmd)
+        except Exception as e:
+            raise Exception("Failed to fetch configurations: %s" % e)
+
+        if not isinstance(config_descs, list):
+            raise Exception("List configs didn't returned a valid data")
+
+        config_desc = config_descs[0]
+        # Sleep for the config_desc.value time
+        time.sleep(int(config_desc.value))
+    return
+
+
+def get_domain(apiclient, services=None):
+    "Returns a default domain"
+
+    cmd = listDomains.listDomainsCmd()
+    if services:
+        if "domainid" in services:
+            cmd.id = services["domainid"]
+
+    domains = apiclient.listDomains(cmd)
+
+    if isinstance(domains, list):
+        assert len(domains) > 0
+        return domains[0]
+    else:
+        raise Exception("Failed to find specified domain.")
+
+
+def get_zone(apiclient, services=None):
+    "Returns a default zone"
+
+    cmd = listZones.listZonesCmd()
+    if services:
+        if "zoneid" in services:
+            cmd.id = services["zoneid"]
+
+    zones = apiclient.listZones(cmd)
+
+    if isinstance(zones, list):
+        assert len(zones) > 0, "There are no available zones in the deployment"
+        return zones[0]
+    else:
+        raise Exception("Failed to find specified zone.")
+
+
+def get_pod(apiclient, zoneid, services=None):
+    "Returns a default pod for specified zone"
+
+    cmd = listPods.listPodsCmd()
+    cmd.zoneid = zoneid
+
+    if services:
+        if "podid" in services:
+            cmd.id = services["podid"]
+
+    pods = apiclient.listPods(cmd)
+
+    if isinstance(pods, list):
+        assert len(pods) > 0, "No pods found for zone %s"%zoneid
+        return pods[0]
+    else:
+        raise Exception("Exception: Failed to find specified pod.")
+
+
+def get_template(apiclient, zoneid, ostype, services=None):
+    "Returns a template"
+
+    cmd = listOsTypes.listOsTypesCmd()
+    cmd.description = ostype
+    ostypes = apiclient.listOsTypes(cmd)
+
+    if isinstance(ostypes, list):
+        ostypeid = ostypes[0].id
+    else:
+        raise Exception(
+            "Failed to find OS type with description: %s" % ostype)
+
+    cmd = listTemplates.listTemplatesCmd()
+    cmd.templatefilter = 'featured'
+    cmd.zoneid = zoneid
+
+    if services:
+        if "template" in services:
+            cmd.id = services["template"]
+
+    list_templates = apiclient.listTemplates(cmd)
+
+    if isinstance(list_templates, list):
+        assert len(list_templates) > 0, "received empty response on template of type %s"%ostype
+        for template in list_templates:
+            if template.ostypeid == ostypeid:
+                return template
+
+    raise Exception("Exception: Failed to find template with OSTypeID: %s" %
+                                                                    ostypeid)
+    return
+
+
+def download_systemplates_sec_storage(server, services):
+    """Download System templates on sec storage"""
+
+    try:
+        # Login to management server
+        ssh = remoteSSHClient(
+                                          server["ipaddress"],
+                                          server["port"],
+                                          server["username"],
+                                          server["password"]
+                             )
+    except Exception:
+        raise Exception("SSH access failted for server with IP address: %s" %
+                                                            server["ipaddess"])
+    # Mount Secondary Storage on Management Server
+    cmds = [
+            "mkdir -p %s" % services["mnt_dir"],
+            "mount -t nfs %s:/%s %s" % (
+                                        services["sec_storage"],
+                                        services["path"],
+                                        services["mnt_dir"]
+                                        ),
+            "%s -m %s -u %s -h %s -F" % (
+                                         services["command"],
+                                         services["mnt_dir"],
+                                         services["download_url"],
+                                         services["hypervisor"]
+                                        )
+            ]
+    for c in cmds:
+        result = ssh.execute(c)
+
+    res = str(result)
+
+    # Unmount the Secondary storage
+    ssh.execute("umount %s" % (services["mnt_dir"]))
+
+    if res.count("Successfully installed system VM template") == 1:
+        return
+    else:
+        raise Exception("Failed to download System Templates on Sec Storage")
+    return
+
+
+def wait_for_ssvms(apiclient, zoneid, podid, interval=60):
+    """After setup wait for SSVMs to come Up"""
+
+    time.sleep(interval)
+    timeout = 40
+    while True:
+            list_ssvm_response = list_ssvms(
+                                        apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        zoneid=zoneid,
+                                        podid=podid
+                                        )
+            ssvm = list_ssvm_response[0]
+            if ssvm.state != 'Running':
+                # Sleep to ensure SSVMs are Up and Running
+                time.sleep(interval)
+                timeout = timeout - 1
+            elif ssvm.state == 'Running':
+                break
+            elif timeout == 0:
+                raise Exception("SSVM failed to come up")
+                break
+
+    timeout = 40
+    while True:
+            list_ssvm_response = list_ssvms(
+                                        apiclient,
+                                        systemvmtype='consoleproxy',
+                                        zoneid=zoneid,
+                                        podid=podid
+                                        )
+            cpvm = list_ssvm_response[0]
+            if cpvm.state != 'Running':
+                # Sleep to ensure SSVMs are Up and Running
+                time.sleep(interval)
+                timeout = timeout - 1
+            elif cpvm.state == 'Running':
+                break
+            elif timeout == 0:
+                raise Exception("CPVM failed to come up")
+                break
+    return
+
+
+def download_builtin_templates(apiclient, zoneid, hypervisor, host,
+                                                linklocalip, interval=60):
+    """After setup wait till builtin templates are downloaded"""
+
+    # Change IPTABLES Rules
+    get_process_status(
+                        host["ipaddress"],
+                        host["port"],
+                        host["username"],
+                        host["password"],
+                        linklocalip,
+                        "iptables -P INPUT ACCEPT"
+                    )
+    time.sleep(interval)
+    # Find the BUILTIN Templates for given Zone, Hypervisor
+    list_template_response = list_templates(
+                                    apiclient,
+                                    hypervisor=hypervisor,
+                                    zoneid=zoneid,
+                                    templatefilter='self'
+                                    )
+
+    if not isinstance(list_template_response, list):
+        raise Exception("Failed to download BUILTIN templates")
+
+    # Ensure all BUILTIN templates are downloaded
+    templateid = None
+    for template in list_template_response:
+        if template.templatetype == "BUILTIN":
+                templateid = template.id
+
+    # Sleep to ensure that template is in downloading state after adding
+    # Sec storage
+    time.sleep(interval)
+    while True:
+        template_response = list_templates(
+                                    apiclient,
+                                    id=templateid,
+                                    zoneid=zoneid,
+                                    templatefilter='self'
+                                    )
+        template = template_response[0]
+        # If template is ready,
+        # template.status = Download Complete
+        # Downloading - x% Downloaded
+        # Error - Any other string
+        if template.status == 'Download Complete':
+            break
+
+        elif 'Downloaded' in template.status:
+            time.sleep(interval)
+
+        elif 'Installing' not in template.status:
+            raise Exception("ErrorInDownload")
+
+    return
+
+
+def update_resource_limit(apiclient, resourcetype, account=None,
+                                    domainid=None, max=None, projectid=None):
+    """Updates the resource limit to 'max' for given account"""
+
+    cmd = updateResourceLimit.updateResourceLimitCmd()
+    cmd.resourcetype = resourcetype
+    if account:
+        cmd.account = account
+    if domainid:
+        cmd.domainid = domainid
+    if max:
+        cmd.max = max
+    if projectid:
+        cmd.projectid = projectid
+    apiclient.updateResourceLimit(cmd)
+    return
+
+
+def list_os_types(apiclient, **kwargs):
+    """List all os types matching criteria"""
+
+    cmd = listOsTypes.listOsTypesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listOsTypes(cmd))
+
+
+def list_routers(apiclient, **kwargs):
+    """List all Routers matching criteria"""
+
+    cmd = listRouters.listRoutersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listRouters(cmd))
+
+
+def list_zones(apiclient, **kwargs):
+    """List all Zones matching criteria"""
+
+    cmd = listZones.listZonesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listZones(cmd))
+
+
+def list_networks(apiclient, **kwargs):
+    """List all Networks matching criteria"""
+
+    cmd = listNetworks.listNetworksCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworks(cmd))
+
+
+def list_clusters(apiclient, **kwargs):
+    """List all Clusters matching criteria"""
+
+    cmd = listClusters.listClustersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listClusters(cmd))
+
+
+def list_ssvms(apiclient, **kwargs):
+    """List all SSVMs matching criteria"""
+
+    cmd = listSystemVms.listSystemVmsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSystemVms(cmd))
+
+
+def list_storage_pools(apiclient, **kwargs):
+    """List all storage pools matching criteria"""
+
+    cmd = listStoragePools.listStoragePoolsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listStoragePools(cmd))
+
+
+def list_virtual_machines(apiclient, **kwargs):
+    """List all VMs matching criteria"""
+
+    cmd = listVirtualMachines.listVirtualMachinesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVirtualMachines(cmd))
+
+
+def list_hosts(apiclient, **kwargs):
+    """List all Hosts matching criteria"""
+
+    cmd = listHosts.listHostsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listHosts(cmd))
+
+
+def list_configurations(apiclient, **kwargs):
+    """List configuration with specified name"""
+
+    cmd = listConfigurations.listConfigurationsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listConfigurations(cmd))
+
+
+def list_publicIP(apiclient, **kwargs):
+    """List all Public IPs matching criteria"""
+
+    cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listPublicIpAddresses(cmd))
+
+
+def list_nat_rules(apiclient, **kwargs):
+    """List all NAT rules matching criteria"""
+
+    cmd = listPortForwardingRules.listPortForwardingRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listPortForwardingRules(cmd))
+
+
+def list_lb_rules(apiclient, **kwargs):
+    """List all Load balancing rules matching criteria"""
+
+    cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listLoadBalancerRules(cmd))
+
+
+def list_lb_instances(apiclient, **kwargs):
+    """List all Load balancing instances matching criteria"""
+
+    cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listLoadBalancerRuleInstances(cmd))
+
+
+def list_firewall_rules(apiclient, **kwargs):
+    """List all Firewall Rules matching criteria"""
+
+    cmd = listFirewallRules.listFirewallRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listFirewallRules(cmd))
+
+
+def list_volumes(apiclient, **kwargs):
+    """List all volumes matching criteria"""
+
+    cmd = listVolumes.listVolumesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVolumes(cmd))
+
+
+def list_isos(apiclient, **kwargs):
+    """Lists all available ISO files."""
+
+    cmd = listIsos.listIsosCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listIsos(cmd))
+
+
+def list_snapshots(apiclient, **kwargs):
+    """List all snapshots matching criteria"""
+
+    cmd = listSnapshots.listSnapshotsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSnapshots(cmd))
+
+
+def list_templates(apiclient, **kwargs):
+    """List all templates matching criteria"""
+
+    cmd = listTemplates.listTemplatesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listTemplates(cmd))
+
+
+def list_domains(apiclient, **kwargs):
+    """Lists domains"""
+
+    cmd = listDomains.listDomainsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listDomains(cmd))
+
+
+def list_accounts(apiclient, **kwargs):
+    """Lists accounts and provides detailed account information for
+    listed accounts"""
+
+    cmd = listAccounts.listAccountsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listAccounts(cmd))
+
+
+def list_users(apiclient, **kwargs):
+    """Lists users and provides detailed account information for
+    listed users"""
+
+    cmd = listUsers.listUsersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listUsers(cmd))
+
+
+def list_snapshot_policy(apiclient, **kwargs):
+    """Lists snapshot policies."""
+
+    cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSnapshotPolicies(cmd))
+
+
+def list_events(apiclient, **kwargs):
+    """Lists events"""
+
+    cmd = listEvents.listEventsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listEvents(cmd))
+
+
+def list_disk_offering(apiclient, **kwargs):
+    """Lists all available disk offerings."""
+
+    cmd = listDiskOfferings.listDiskOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listDiskOfferings(cmd))
+
+
+def list_service_offering(apiclient, **kwargs):
+    """Lists all available service offerings."""
+
+    cmd = listServiceOfferings.listServiceOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listServiceOfferings(cmd))
+
+
+def list_vlan_ipranges(apiclient, **kwargs):
+    """Lists all VLAN IP ranges."""
+
+    cmd = listVlanIpRanges.listVlanIpRangesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVlanIpRanges(cmd))
+
+
+def list_usage_records(apiclient, **kwargs):
+    """Lists usage records for accounts"""
+
+    cmd = listUsageRecords.listUsageRecordsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listUsageRecords(cmd))
+
+
+def list_nw_service_prividers(apiclient, **kwargs):
+    """Lists Network service providers"""
+
+    cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworkServiceProviders(cmd))
+
+
+def list_virtual_router_elements(apiclient, **kwargs):
+    """Lists Virtual Router elements"""
+
+    cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVirtualRouterElements(cmd))
+
+
+def list_network_offerings(apiclient, **kwargs):
+    """Lists network offerings"""
+
+    cmd = listNetworkOfferings.listNetworkOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworkOfferings(cmd))
+
+
+def list_resource_limits(apiclient, **kwargs):
+    """Lists resource limits"""
+
+    cmd = listResourceLimits.listResourceLimitsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listResourceLimits(cmd))
+
+def list_vpc_offerings(apiclient, **kwargs):
+    """ Lists VPC offerings """
+
+    cmd = listVPCOfferings.listVPCOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVPCOfferings(cmd))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/AccountFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/AccountFactory.py b/tools/marvin/marvin/factory/AccountFactory.py
new file mode 100644
index 0000000..5b97332
--- /dev/null
+++ b/tools/marvin/marvin/factory/AccountFactory.py
@@ -0,0 +1,46 @@
+# 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.
+
+import hashlib
+from marvin.factory.CloudStackBaseFactory import *
+from marvin.base import Account
+from marvin.utils import random_gen
+
+@factory.use_strategy(new_strategy=factory.BUILD_STRATEGY)
+class AccountFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = Account.Account
+
+    accounttype = 0
+    firstname = factory.Sequence(lambda n: random_gen())
+    lastname = factory.Sequence(lambda n: random_gen())
+    email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname).lower())
+    username = factory.Sequence(lambda n: random_gen())
+
+    # Password Encoding
+    mdf = hashlib.md5()
+    mdf.update('password')
+    password = mdf.hexdigest()
+
+
+class AdminAccountFactory(AccountFactory):
+    accounttype = 1
+
+
+class DomainAdminFactory(AccountFactory):
+    accounttype = 2
+    domainid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/AutoScalePolicyFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/AutoScalePolicyFactory.py b/tools/marvin/marvin/factory/AutoScalePolicyFactory.py
new file mode 100644
index 0000000..ad2640e
--- /dev/null
+++ b/tools/marvin/marvin/factory/AutoScalePolicyFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import AutoScalePolicy
+
+class AutoScalePolicyFactory(factory.Factory):
+
+    FACTORY_FOR = AutoScalePolicy
+
+    action = None
+    conditionids = None
+    duration = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/AutoScaleVmGroupFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/AutoScaleVmGroupFactory.py b/tools/marvin/marvin/factory/AutoScaleVmGroupFactory.py
new file mode 100644
index 0000000..6756230
--- /dev/null
+++ b/tools/marvin/marvin/factory/AutoScaleVmGroupFactory.py
@@ -0,0 +1,28 @@
+# 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.
+import factory
+from marvin.base import AutoScaleVmGroup
+class AutoScaleVmGroupFactory(factory.Factory):
+
+    FACTORY_FOR = AutoScaleVmGroup
+
+    lbruleid = None
+    maxmembers = None
+    minmembers = None
+    scaledownpolicyids = None
+    scaleuppolicyids = None
+    vmprofileid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/AutoScaleVmProfileFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/AutoScaleVmProfileFactory.py b/tools/marvin/marvin/factory/AutoScaleVmProfileFactory.py
new file mode 100644
index 0000000..9e932b5
--- /dev/null
+++ b/tools/marvin/marvin/factory/AutoScaleVmProfileFactory.py
@@ -0,0 +1,25 @@
+# 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.
+import factory
+from marvin.base import AutoScaleVmProfile
+class AutoScaleVmProfileFactory(factory.Factory):
+
+    FACTORY_FOR = AutoScaleVmProfile
+
+    serviceofferingid = None
+    templateid = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/CloudStackBaseFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/CloudStackBaseFactory.py b/tools/marvin/marvin/factory/CloudStackBaseFactory.py
new file mode 100644
index 0000000..499dbc2
--- /dev/null
+++ b/tools/marvin/marvin/factory/CloudStackBaseFactory.py
@@ -0,0 +1,55 @@
+# 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.
+
+import factory
+import inspect
+
+CREATORS = ["create", "deploy"]
+
+
+class CloudStackBaseFactory(factory.Factory):
+    ABSTRACT_FACTORY = True
+
+    @classmethod
+    def _build(cls, target_class, *args, **kwargs):
+        if len(args) == 0:
+            return target_class(kwargs)
+        return target_class(*args, **kwargs)
+
+    @classmethod
+    def _create(cls, target_class, *args, **kwargs):
+        if cls.apiclient:
+            members = inspect.getmembers(target_class,
+                predicate=inspect.ismethod)
+            creators = filter(lambda x: x[0] in CREATORS, members)
+            assert creators, "How do I bring this guy into existence?"
+            assert inspect.ismethod(creators[0][1])
+            creator = creators[0][1]
+            return creator(cls.apiclient, factory=cls._build(target_class,
+                *args, **kwargs))
+        else:
+            cls._build(target_class, *args, **kwargs)
+
+    @classmethod
+    def _adjust_kwargs(cls, **kwargs):
+        if "apiclient" in kwargs:
+            cls.apiclient = kwargs["apiclient"]
+            clean_kwargs = dict((k, v) for k, v in kwargs.iteritems()
+                if k != "apiclient")
+            return clean_kwargs
+        else:
+            return kwargs
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/ClusterFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/ClusterFactory.py b/tools/marvin/marvin/factory/ClusterFactory.py
new file mode 100644
index 0000000..d411bbb
--- /dev/null
+++ b/tools/marvin/marvin/factory/ClusterFactory.py
@@ -0,0 +1,24 @@
+import factory
+from marvin.base import Cluster
+from marvin.factory import CloudStackBaseFactory
+from marvin.utils import random_gen
+
+class ClusterFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = Cluster
+
+    clustername = None
+    clustertype = None
+    hypervisor = None
+    podid = None
+    zoneid = None
+
+class XenClusterFactory(ClusterFactory):
+    clustername = factory.Sequence(lambda n: "xencluster" + random_gen())
+    clustertype = "XenServer"
+    hypervisor = "XenServer"
+
+class KvmClusterFactory(ClusterFactory):
+    clustername = factory.Sequence(lambda n: "kvmcluster" + random_gen())
+    clustertype = "KVM"
+    hypervisor = "KVM"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/ConditionFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/ConditionFactory.py b/tools/marvin/marvin/factory/ConditionFactory.py
new file mode 100644
index 0000000..534fc75
--- /dev/null
+++ b/tools/marvin/marvin/factory/ConditionFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import Condition
+
+class ConditionFactory(factory.Factory):
+
+    FACTORY_FOR = Condition
+
+    counterid = None
+    relationaloperator = None
+    threshold = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/CounterFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/CounterFactory.py b/tools/marvin/marvin/factory/CounterFactory.py
new file mode 100644
index 0000000..7dd16bb
--- /dev/null
+++ b/tools/marvin/marvin/factory/CounterFactory.py
@@ -0,0 +1,25 @@
+# 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.
+import factory
+from marvin.base import Counter
+class CounterFactory(factory.Factory):
+
+    FACTORY_FOR = Counter
+
+    name = None
+    source = None
+    value = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/DiskOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/DiskOfferingFactory.py b/tools/marvin/marvin/factory/DiskOfferingFactory.py
new file mode 100644
index 0000000..dd14d74
--- /dev/null
+++ b/tools/marvin/marvin/factory/DiskOfferingFactory.py
@@ -0,0 +1,42 @@
+# 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.
+import factory
+from marvin.factory.CloudStackBaseFactory import *
+from marvin.base import DiskOffering
+from marvin.utils import random_gen
+
+class DiskOfferingFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = DiskOffering.DiskOffering
+
+    displaytext = factory.Sequence(lambda n : "DiskOffering" + random_gen())
+    name = factory.Sequence(lambda n : "DiskOffering" + random_gen())
+
+
+class SharedDiskOfferingFactory(DiskOfferingFactory):
+
+    displaytext = "SharedDiskOffering"
+    name = factory.Sequence(lambda n : "SharedDiskOffering" + random_gen())
+    storagetype = "shared"
+    disksize = 10 #MB
+
+class LocalDiskOfferingFactory(DiskOfferingFactory):
+
+    displaytext = "LocalDiskOffering"
+    name = factory.Sequence(lambda n : "LocalDiskOffering" + random_gen())
+    storagetype = "local"
+    disksize = 10 #MB

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/DomainFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/DomainFactory.py b/tools/marvin/marvin/factory/DomainFactory.py
new file mode 100644
index 0000000..3924fd3
--- /dev/null
+++ b/tools/marvin/marvin/factory/DomainFactory.py
@@ -0,0 +1,24 @@
+# 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.
+import factory
+from marvin.base import Domain
+from marvin.utils import random_gen
+class DomainFactory(factory.Factory):
+
+    FACTORY_FOR = Domain
+
+    name = factory.Sequence(lambda n : "Domain" + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/EgressFirewallRuleFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/EgressFirewallRuleFactory.py b/tools/marvin/marvin/factory/EgressFirewallRuleFactory.py
new file mode 100644
index 0000000..7e56745
--- /dev/null
+++ b/tools/marvin/marvin/factory/EgressFirewallRuleFactory.py
@@ -0,0 +1,24 @@
+# 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.
+import factory
+from marvin.base import EgressFirewallRule
+class EgressFirewallRuleFactory(factory.Factory):
+
+    FACTORY_FOR = EgressFirewallRule
+
+    networkid = None
+    protocol = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/FirewallRuleFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/FirewallRuleFactory.py b/tools/marvin/marvin/factory/FirewallRuleFactory.py
new file mode 100644
index 0000000..d833205
--- /dev/null
+++ b/tools/marvin/marvin/factory/FirewallRuleFactory.py
@@ -0,0 +1,38 @@
+# 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.
+
+from marvin.base import FirewallRule
+from marvin.factory import CloudStackBaseFactory
+
+class FirewallRuleFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = FirewallRule.FirewallRule
+
+    ipaddressid = None
+    protocol = None
+
+class SshFirewallRuleFactory(FirewallRuleFactory):
+    protocol = 'tcp'
+    startport = 22
+    endport = 22
+    cidrlist = '0.0.0.0/0'
+
+class HttpFirewallRuleFactory(FirewallRuleFactory):
+    protocol = 'tcp'
+    startport = 80
+    endport = 80
+    cidrlist = '0.0.0.0/0'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/HostFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/HostFactory.py b/tools/marvin/marvin/factory/HostFactory.py
new file mode 100644
index 0000000..458b8ad
--- /dev/null
+++ b/tools/marvin/marvin/factory/HostFactory.py
@@ -0,0 +1,30 @@
+from marvin.base import Host
+from marvin.factory import CloudStackBaseFactory
+
+class HostFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = Host
+
+    hypervisor = None
+    password = None
+    podid = None
+    url = None
+    username = None
+    zoneid = None
+
+
+class XenserverHostFactory(HostFactory):
+
+    hypervisor = 'XenServer'
+    password = 'password'
+    username = 'root'
+
+
+class KvmHostFactory(HostFactory):
+
+    hypervisor = 'KVM'
+    password = 'password'
+    username = 'root'
+
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/InstanceGroupFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/InstanceGroupFactory.py b/tools/marvin/marvin/factory/InstanceGroupFactory.py
new file mode 100644
index 0000000..376a2a4
--- /dev/null
+++ b/tools/marvin/marvin/factory/InstanceGroupFactory.py
@@ -0,0 +1,27 @@
+# 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.
+import factory
+from marvin.base import InstanceGroup
+from marvin.factory import CloudStackBaseFactory
+from marvin.common import random_gen
+
+
+class InstanceGroupFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = InstanceGroup.InstanceGroup
+
+    name = factory.Sequence(lambda n : 'instance_group_' + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/IpAddressFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/IpAddressFactory.py b/tools/marvin/marvin/factory/IpAddressFactory.py
new file mode 100644
index 0000000..6c14e9a
--- /dev/null
+++ b/tools/marvin/marvin/factory/IpAddressFactory.py
@@ -0,0 +1,24 @@
+# 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.
+import factory
+from marvin.base import IpAddress
+
+
+class IpAddressFactory(factory.Factory):
+
+    FACTORY_FOR = IpAddress.IpAddress
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/IpForwardingRuleFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/IpForwardingRuleFactory.py b/tools/marvin/marvin/factory/IpForwardingRuleFactory.py
new file mode 100644
index 0000000..900e2b4
--- /dev/null
+++ b/tools/marvin/marvin/factory/IpForwardingRuleFactory.py
@@ -0,0 +1,25 @@
+# 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.
+import factory
+from marvin.base import IpForwardingRule
+class IpForwardingRuleFactory(factory.Factory):
+
+    FACTORY_FOR = IpForwardingRule
+
+    ipaddressid = None
+    protocol = None
+    startport = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/IsoFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/IsoFactory.py b/tools/marvin/marvin/factory/IsoFactory.py
new file mode 100644
index 0000000..11f6e55
--- /dev/null
+++ b/tools/marvin/marvin/factory/IsoFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import Iso
+class IsoFactory(factory.Factory):
+
+    FACTORY_FOR = Iso.Iso
+
+    displaytext = None
+    name = None
+    url = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/LBHealthCheckPolicyFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/LBHealthCheckPolicyFactory.py b/tools/marvin/marvin/factory/LBHealthCheckPolicyFactory.py
new file mode 100644
index 0000000..cd0913e
--- /dev/null
+++ b/tools/marvin/marvin/factory/LBHealthCheckPolicyFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import LBHealthCheckPolicy
+
+class LBHealthCheckPolicyFactory(factory.Factory):
+
+    FACTORY_FOR = LBHealthCheckPolicy.LBHealthCheckPolicy
+
+    lbruleid = None
+    methodname = None
+    name = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/LBStickinessPolicyFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/LBStickinessPolicyFactory.py b/tools/marvin/marvin/factory/LBStickinessPolicyFactory.py
new file mode 100644
index 0000000..eab0d61
--- /dev/null
+++ b/tools/marvin/marvin/factory/LBStickinessPolicyFactory.py
@@ -0,0 +1,25 @@
+# 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.
+import factory
+from marvin.base import LBStickinessPolicy
+class LBStickinessPolicyFactory(factory.Factory):
+
+    FACTORY_FOR = LBStickinessPolicy
+
+    lbruleid = None
+    methodname = None
+    name = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/LoadBalancerRuleFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/LoadBalancerRuleFactory.py b/tools/marvin/marvin/factory/LoadBalancerRuleFactory.py
new file mode 100644
index 0000000..84151f3
--- /dev/null
+++ b/tools/marvin/marvin/factory/LoadBalancerRuleFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import LoadBalancerRule
+class LoadBalancerRuleFactory(factory.Factory):
+
+    FACTORY_FOR = LoadBalancerRule
+
+    algorithm = None
+    name = None
+    privateport = None
+    publicport = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/NetworkACLFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/NetworkACLFactory.py b/tools/marvin/marvin/factory/NetworkACLFactory.py
new file mode 100644
index 0000000..4b69977
--- /dev/null
+++ b/tools/marvin/marvin/factory/NetworkACLFactory.py
@@ -0,0 +1,24 @@
+# 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.
+import factory
+from marvin.base import NetworkACL
+class NetworkACLFactory(factory.Factory):
+
+    FACTORY_FOR = NetworkACL
+
+    networkid = None
+    protocol = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/NetworkFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/NetworkFactory.py b/tools/marvin/marvin/factory/NetworkFactory.py
new file mode 100644
index 0000000..0144648
--- /dev/null
+++ b/tools/marvin/marvin/factory/NetworkFactory.py
@@ -0,0 +1,26 @@
+# 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.
+import factory
+from marvin.base import Network
+class NetworkFactory(factory.Factory):
+
+    FACTORY_FOR = Network
+
+    displaytext = None
+    name = None
+    networkofferingid = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/NetworkOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/NetworkOfferingFactory.py b/tools/marvin/marvin/factory/NetworkOfferingFactory.py
new file mode 100644
index 0000000..191e6a5
--- /dev/null
+++ b/tools/marvin/marvin/factory/NetworkOfferingFactory.py
@@ -0,0 +1,85 @@
+# 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.
+import factory
+from marvin.factory.CloudStackBaseFactory import *
+from marvin.base import NetworkOffering
+from marvin.utils import random_gen
+
+class NetworkOfferingFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = NetworkOffering.NetworkOffering
+
+    displaytext = "Network Offering"
+    guestiptype = "Isolated"
+    name = "Network Offering"
+    supportedservices = "Dhcp,Dns,SourceNat,PortForwarding"
+    traffictype = "GUEST"
+
+
+class DefaultIsolatedNetworkOfferingWithSourceNatServiceFactory(NetworkOfferingFactory):
+    #FIXME: Service Capability Lists with CapabilityTypes (ElasticIP, RvR etc) needs handling
+
+    displaytext = factory.Sequence(lambda n : "DefaultIsolatedNetworkOfferingWithSourceNatService" + random_gen())
+    name = factory.Sequence(lambda n : "DefaultIsolatedNetworkOfferingWithSourceNatService" + random_gen())
+    supportedservices = "Lb,Dns,PortForwarding,StaticNat,Dhcp,Firewall,Vpn,UserData,SourceNat"
+    traffictype = "GUEST"
+    availability = "Optional"
+    guestiptype = "Isolated"
+
+    specifyVlan = False
+    specifyIpRanges = False
+    isPersistent = False
+    conserveMode = True
+
+    serviceProviderList = []
+    for service in map(lambda l: l.strip(' '), supportedservices.split(',')):
+        serviceProviderList.append(
+            {
+                'service': service,
+                'provider': 'VirtualRouter'
+            }
+        )
+
+
+class DefaultSharedNetworkOfferingWithSGServiceFactory(NetworkOfferingFactory):
+
+    displaytext = factory.Sequence(lambda n : "DefaultSharedNetworkOfferingWithSGService" + random_gen())
+    name = factory.Sequence(lambda n : "DefaultSharedNetworkOfferingWithSGService" + random_gen())
+    availability = "Optional"
+    supportedservices = "SecurityGroup,Dns,Dhcp,UserData"
+    guestiptype = "Shared"
+    traffictype = "GUEST"
+
+    specifyVlan = True
+    specifyIpRanges = True
+    isPersistent = False
+    conserveMode = True
+
+    serviceProviderList = []
+    for service in map(lambda l: l.strip(' '), supportedservices.split(',')):
+        if service == 'SecurityGroup':
+            provider = 'SecurityGroupProvider'
+        else:
+            provider = 'VirtualRouter'
+        serviceProviderList.append(
+            {
+                'service': service,
+                'provider': provider
+            }
+        )
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/NetworkServiceProviderFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/NetworkServiceProviderFactory.py b/tools/marvin/marvin/factory/NetworkServiceProviderFactory.py
new file mode 100644
index 0000000..ba85e4b
--- /dev/null
+++ b/tools/marvin/marvin/factory/NetworkServiceProviderFactory.py
@@ -0,0 +1,8 @@
+import factory
+from marvin.base import NetworkServiceProvider
+class NetworkServiceProviderFactory(factory.Factory):
+
+    FACTORY_FOR = NetworkServiceProvider
+
+    name = None
+    physicalnetworkid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/NiciraNvpDeviceFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/NiciraNvpDeviceFactory.py b/tools/marvin/marvin/factory/NiciraNvpDeviceFactory.py
new file mode 100644
index 0000000..4cc3709
--- /dev/null
+++ b/tools/marvin/marvin/factory/NiciraNvpDeviceFactory.py
@@ -0,0 +1,11 @@
+import factory
+from marvin.base import NiciraNvpDevice
+class NiciraNvpDeviceFactory(factory.Factory):
+
+    FACTORY_FOR = NiciraNvpDevice
+
+    hostname = None
+    password = None
+    physicalnetworkid = None
+    transportzoneuuid = None
+    username = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/OsCategoriesFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/OsCategoriesFactory.py b/tools/marvin/marvin/factory/OsCategoriesFactory.py
new file mode 100644
index 0000000..7ecb7ed
--- /dev/null
+++ b/tools/marvin/marvin/factory/OsCategoriesFactory.py
@@ -0,0 +1,5 @@
+import factory
+from marvin.base import OsCategories
+class OsCategoriesFactory(factory.Factory):
+
+    FACTORY_FOR = OsCategories

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/OsTypesFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/OsTypesFactory.py b/tools/marvin/marvin/factory/OsTypesFactory.py
new file mode 100644
index 0000000..6e344ba
--- /dev/null
+++ b/tools/marvin/marvin/factory/OsTypesFactory.py
@@ -0,0 +1,5 @@
+import factory
+from marvin.base import OsTypes
+class OsTypesFactory(factory.Factory):
+
+    FACTORY_FOR = OsTypes

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/PhysicalNetworkFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/PhysicalNetworkFactory.py b/tools/marvin/marvin/factory/PhysicalNetworkFactory.py
new file mode 100644
index 0000000..5f104a8
--- /dev/null
+++ b/tools/marvin/marvin/factory/PhysicalNetworkFactory.py
@@ -0,0 +1,24 @@
+# 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.
+import factory
+from marvin.base import PhysicalNetwork
+class PhysicalNetworkFactory(factory.Factory):
+
+    FACTORY_FOR = PhysicalNetwork
+
+    name = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/PodFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/PodFactory.py b/tools/marvin/marvin/factory/PodFactory.py
new file mode 100644
index 0000000..49e350b
--- /dev/null
+++ b/tools/marvin/marvin/factory/PodFactory.py
@@ -0,0 +1,27 @@
+# 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.
+import factory
+from marvin.base import Pod
+class PodFactory(factory.Factory):
+
+    FACTORY_FOR = Pod
+
+    gateway = None
+    name = None
+    netmask = None
+    startip = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/PortForwardingRuleFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/PortForwardingRuleFactory.py b/tools/marvin/marvin/factory/PortForwardingRuleFactory.py
new file mode 100644
index 0000000..e2339d4
--- /dev/null
+++ b/tools/marvin/marvin/factory/PortForwardingRuleFactory.py
@@ -0,0 +1,27 @@
+# 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.
+import factory
+from marvin.base import PortForwardingRule
+class PortForwardingRuleFactory(factory.Factory):
+
+    FACTORY_FOR = PortForwardingRule
+
+    ipaddressid = None
+    privateport = None
+    protocol = None
+    publicport = None
+    virtualmachineid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/factory/PrivateGatewayFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/PrivateGatewayFactory.py b/tools/marvin/marvin/factory/PrivateGatewayFactory.py
new file mode 100644
index 0000000..ddc6200
--- /dev/null
+++ b/tools/marvin/marvin/factory/PrivateGatewayFactory.py
@@ -0,0 +1,27 @@
+# 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.
+import factory
+from marvin.base import PrivateGateway
+class PrivateGatewayFactory(factory.Factory):
+
+    FACTORY_FOR = PrivateGateway
+
+    gateway = None
+    ipaddress = None
+    netmask = None
+    vlan = None
+    vpcid = None