cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [05/50] [abbrv] git commit: updated refs/heads/marvin_refactor to b784012
Date Mon, 18 Nov 2013 08:50:12 GMT
marvin_refactor: Some renames to organize data and entities

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/526a9d60
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/526a9d60
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/526a9d60

Branch: refs/heads/marvin_refactor
Commit: 526a9d6043c97b1dc6f3f4864bff9ea9aa3c71b8
Parents: 6a260ce
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Tue Sep 3 21:55:57 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Thu Oct 31 13:54:21 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/base/CloudStackEntity.py    | 25 -------
 tools/marvin/marvin/base/__init__.py            | 16 -----
 tools/marvin/marvin/codegenerator.py            |  2 +-
 tools/marvin/marvin/cs_entity_generator.py      | 45 +++++-------
 tools/marvin/marvin/data/__init__.py            | 16 -----
 tools/marvin/marvin/data/account.py             | 38 ----------
 tools/marvin/marvin/data/cluster.py             | 30 --------
 tools/marvin/marvin/data/diskoffering.py        | 34 ---------
 tools/marvin/marvin/data/firewallrule.py        | 30 --------
 tools/marvin/marvin/data/host.py                | 31 ---------
 tools/marvin/marvin/data/networkoffering.py     | 73 --------------------
 tools/marvin/marvin/data/serviceoffering.py     | 27 --------
 tools/marvin/marvin/data/template.py            | 25 -------
 tools/marvin/marvin/data/user.py                | 50 --------------
 tools/marvin/marvin/data/vm.py                  | 34 ---------
 tools/marvin/marvin/data/zone.py                | 33 ---------
 tools/marvin/marvin/entity/__init__.py          | 16 +++++
 tools/marvin/marvin/entity/cloudstackentity.py  | 25 +++++++
 tools/marvin/marvin/factory/data/__init__.py    | 16 +++++
 tools/marvin/marvin/factory/data/account.py     | 38 ++++++++++
 tools/marvin/marvin/factory/data/cluster.py     | 30 ++++++++
 .../marvin/marvin/factory/data/diskoffering.py  | 34 +++++++++
 .../marvin/marvin/factory/data/firewallrule.py  | 30 ++++++++
 tools/marvin/marvin/factory/data/host.py        | 31 +++++++++
 .../marvin/factory/data/networkoffering.py      | 73 ++++++++++++++++++++
 .../marvin/factory/data/serviceoffering.py      | 27 ++++++++
 tools/marvin/marvin/factory/data/template.py    | 25 +++++++
 tools/marvin/marvin/factory/data/user.py        | 50 ++++++++++++++
 tools/marvin/marvin/factory/data/vm.py          | 34 +++++++++
 tools/marvin/marvin/factory/data/zone.py        | 33 +++++++++
 tools/marvin/marvin/test/test_factories.py      | 42 ++++-------
 tools/marvin/marvin/utils.py                    |  2 +-
 tools/marvin/pom.xml                            |  2 +-
 tools/marvin/setup.py                           |  3 +-
 34 files changed, 498 insertions(+), 522 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/base/CloudStackEntity.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/CloudStackEntity.py b/tools/marvin/marvin/base/CloudStackEntity.py
deleted file mode 100644
index b7091de..0000000
--- a/tools/marvin/marvin/base/CloudStackEntity.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.
-
-cloudstack_version = "4.2.0"
-
-class CloudStackEntity(object):
-
-    __version__ = cloudstack_version
-
-    def getVersion(self):
-        return self.__version__

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/base/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/base/__init__.py b/tools/marvin/marvin/base/__init__.py
deleted file mode 100644
index 13a8339..0000000
--- a/tools/marvin/marvin/base/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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/526a9d60/tools/marvin/marvin/codegenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index 3607436..2a6f50d 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -487,4 +487,4 @@ response=json' % options.endpoint
 
     if options.entity:
         entities = get_actionable_entities()
-        write_entity_classes(entities, "base")
+        write_entity_classes(entities, "entity")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/cs_entity_generator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cs_entity_generator.py b/tools/marvin/marvin/cs_entity_generator.py
index b2cf3c5..c3cda0c 100644
--- a/tools/marvin/marvin/cs_entity_generator.py
+++ b/tools/marvin/marvin/cs_entity_generator.py
@@ -261,9 +261,8 @@ def write_entity_classes(entities, module=None):
     for entity, actions in entities.iteritems():
         body = []
         imports = []
-        imports.append('from CloudStackEntity import CloudStackEntity')
+        imports.append('from cloudstackentity import CloudStackEntity')
         body.append('class %s(CloudStackEntity):' % entity)
-        #TODO: Add docs for entity
         body.append('\n\n')
         body.append(tabspace + 'def __init__(self, items):')
         body.append(tabspace * 2 + 'self.__dict__.update(items)')
@@ -280,6 +279,7 @@ def write_entity_classes(entities, module=None):
                         action, ', '.join(list(set(no_id_args)))))
                 else:
                     body.append(tabspace + 'def %s(self, apiclient, **kwargs):' % (action))
+                #TODO: Add docs for entity
                 # doc to explain what possible args go into **kwargs
                 body.append(tabspace * 2 + '"""Placeholder for docstring')
                 body.append(tabspace * 2 + 'optional arguments (**kwargs): [%s]"""' % ', '.join(details['optionals']))
@@ -335,7 +335,7 @@ def write_entity_classes(entities, module=None):
             os.makedirs("%s" % module_path)
         with open("%s/__init__.py" % (module_path), "w") as writer:
             writer.write(LICENSE)
-        with open("%s/%s.py" % (module_path, entity), "w") as writer:
+        with open("%s/%s.py" % (module_path, entity.lower()), "w") as writer:
             writer.write(LICENSE)
             writer.write(code)
 
@@ -365,31 +365,20 @@ def write_entity_factory(entity, actions, module=None):
     if not os.path.exists(module_path):
         os.makedirs(module_path)
 
-    if os.path.exists("%s/%sFactory.py" % (module_path, entity)):
-        for arg in factory_defaults:
-            code += tabspace + '%s = None\n' % arg
-        with open("%s/%sFactory.py" % (module_path, entity), "r") as reader:
-            rcode = reader.read()
-            if rcode.find(code) > 0:
-                return
-        with open("%s/%sFactory.py" % (module_path, entity), "a") as writer:
-            writer.write(code)
-    else:
-        code += 'import factory\n'
-        code += 'from marvin.base import %s\n' % entity
-        code += 'from CloudStackBaseFactory import CloudStackBaseFactory'
-        code += '\n'
-        code += 'class %sFactory(CloudStackBaseFactory):' % entity
-        code += '\n\n'
-        code += tabspace + 'FACTORY_FOR = %s.%s\n\n' % (entity, entity)
-        for arg in factory_defaults:
-            code += tabspace + '%s = None\n' % arg
-        with open("%s/__init__.py" % (module_path), "w") as writer:
-            writer.write(LICENSE)
-        with open("%s/%sFactory.py" % (module_path, entity), "w") as writer:
-            writer.write(LICENSE)
-            writer.write(code)
+    code += 'from marvin.entity.%s import %s\n' % (entity.lower(), entity)
+    code += 'from cloudstackbasefactory import CloudStackBaseFactory'
+    code += '\n'
+    code += 'class %sFactory(CloudStackBaseFactory):' % entity
+    code += '\n\n'
+    code += tabspace + 'FACTORY_FOR = %s\n\n' % entity
+    for arg in factory_defaults:
+        code += tabspace + '%s = None\n' % arg
+    with open("%s/__init__.py" % (module_path), "w") as writer:
+        writer.write(LICENSE)
+    with open("%s/%s.py" % (module_path, entity.lower()), "w") as writer:
+        writer.write(LICENSE)
+        writer.write(code)
 
 if __name__ == '__main__':
     entities = get_actionable_entities()
-    write_entity_classes(entities, 'base')
+    write_entity_classes(entities, 'entity')

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/__init__.py b/tools/marvin/marvin/data/__init__.py
deleted file mode 100644
index d216be4..0000000
--- a/tools/marvin/marvin/data/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/account.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/account.py b/tools/marvin/marvin/data/account.py
deleted file mode 100644
index 1041cfe..0000000
--- a/tools/marvin/marvin/data/account.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.AccountFactory import AccountFactory
-from marvin.utils import random_gen
-
-class UserAccountFactory(AccountFactory):
-
-    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 = 'password'
-
-
-class AdminAccountFactory(UserAccountFactory):
-    accounttype = 1
-
-
-class DomainAdminFactory(UserAccountFactory):
-    accounttype = 2
-    domainid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/cluster.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/cluster.py b/tools/marvin/marvin/data/cluster.py
deleted file mode 100644
index f4641cf..0000000
--- a/tools/marvin/marvin/data/cluster.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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.utils import random_gen
-from marvin.factory.ClusterFactory import ClusterFactory
-
-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/526a9d60/tools/marvin/marvin/data/diskoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/diskoffering.py b/tools/marvin/marvin/data/diskoffering.py
deleted file mode 100644
index 88ae7cb..0000000
--- a/tools/marvin/marvin/data/diskoffering.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.DiskOfferingFactory import DiskOfferingFactory
-from marvin.utils import 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/526a9d60/tools/marvin/marvin/data/firewallrule.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/firewallrule.py b/tools/marvin/marvin/data/firewallrule.py
deleted file mode 100644
index 1707347..0000000
--- a/tools/marvin/marvin/data/firewallrule.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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.factory.FirewallRuleFactory import FirewallRuleFactory
-
-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/526a9d60/tools/marvin/marvin/data/host.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/host.py b/tools/marvin/marvin/data/host.py
deleted file mode 100644
index c8b4ab7..0000000
--- a/tools/marvin/marvin/data/host.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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.factory.HostFactory import HostFactory
-
-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/526a9d60/tools/marvin/marvin/data/networkoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/networkoffering.py b/tools/marvin/marvin/data/networkoffering.py
deleted file mode 100644
index 8d80631..0000000
--- a/tools/marvin/marvin/data/networkoffering.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# 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.NetworkOfferingFactory import NetworkOfferingFactory
-from marvin.utils import random_gen
-
-
-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/526a9d60/tools/marvin/marvin/data/serviceoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/serviceoffering.py b/tools/marvin/marvin/data/serviceoffering.py
deleted file mode 100644
index a56d4e5..0000000
--- a/tools/marvin/marvin/data/serviceoffering.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.ServiceOfferingFactory import ServiceOfferingFactory
-from marvin.utils import random_gen
-
-class SmallServiceOfferingFactory(ServiceOfferingFactory):
-    cpunumber = 1
-    cpuspeed = 100 #Mhz
-    memory = 100 #MB
-    displaytext = "Small Service Offering"
-    name = factory.Sequence(lambda n: "SmallServiceOffering" + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/template.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/template.py b/tools/marvin/marvin/data/template.py
deleted file mode 100644
index 033835b..0000000
--- a/tools/marvin/marvin/data/template.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.factory.TemplateFactory import TemplateFactory
-
-class DefaultBuiltInTemplateFactory(TemplateFactory):
-    ostype = 'CentOS 5.3 (64-bit)'
-    displaytext = 'CentOS 5.3 (64-bit)'
-    name = 'CentOS 5.3 (64-bit)'
-    format = 'VHD'
-    hypervisor = 'XenServer'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/user.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/user.py b/tools/marvin/marvin/data/user.py
deleted file mode 100644
index 13c4db2..0000000
--- a/tools/marvin/marvin/data/user.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# 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.UserFactory import UserFactory
-from marvin.data.account import UserAccountFactory
-from marvin.utils import random_gen
-
-class UserFactory(UserFactory):
-
-    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 = 'password'
-    account = factory.SubFactory(UserAccountFactory,
-        apiclient=factory.SelfAttribute('..apiclient'),
-        accounttype=0,
-        firstname=factory.SelfAttribute('..firstname'),
-        lastname=factory.SelfAttribute('..lastname'),
-        email=factory.SelfAttribute('..email'),
-        password=factory.SelfAttribute('..password'),
-        username=factory.SelfAttribute('..username'),
-    )
-
-class AdminUserFactory(UserFactory):
-
-    account = factory.SubFactory(UserAccountFactory,
-        apiclient=factory.SelfAttribute('..apiclient'),
-        accounttype=1,
-        firstname=factory.SelfAttribute('..firstname'),
-        lastname=factory.SelfAttribute('..lastname'),
-        email=factory.SelfAttribute('..email'),
-        password=factory.SelfAttribute('..password'),
-        username=factory.SelfAttribute('..username'),
-    )

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/vm.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/vm.py b/tools/marvin/marvin/data/vm.py
deleted file mode 100644
index 66f15a3..0000000
--- a/tools/marvin/marvin/data/vm.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.VirtualMachineFactory import VirtualMachineFactory
-from marvin.utils import random_gen
-
-
-class VirtualMachineIsolatedNetwork(VirtualMachineFactory):
-    """
-    Create a virtualmachine in an isolated network typically in an advanced zone
-
-    Uses a serviceoffering of tinyInstance
-    Uses a builtin template available
-    Deploys in the first zone available
-    """
-
-    serviceofferingid = None
-    templateid = None
-    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/data/zone.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/data/zone.py b/tools/marvin/marvin/data/zone.py
deleted file mode 100644
index f4a278a..0000000
--- a/tools/marvin/marvin/data/zone.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.ZoneFactory import ZoneFactory
-from marvin.utils import random_gen
-
-class AdvancedZoneFactory(ZoneFactory):
-    name = factory.Sequence(lambda n: "advzone" + random_gen())
-    networktype = "Advanced"
-    dns1 = "8.8.8.8"
-    internaldns1 = "8.8.8.8"
-
-
-class BasicZoneFactory(ZoneFactory):
-    name = factory.Sequence(lambda n: "basiczone" + random_gen())
-    networktype = "Basic"
-    dns1 = "8.8.8.8"
-    internaldns1 = "8.8.8.8"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/entity/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/entity/__init__.py b/tools/marvin/marvin/entity/__init__.py
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/tools/marvin/marvin/entity/__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/526a9d60/tools/marvin/marvin/entity/cloudstackentity.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/entity/cloudstackentity.py b/tools/marvin/marvin/entity/cloudstackentity.py
new file mode 100644
index 0000000..b7091de
--- /dev/null
+++ b/tools/marvin/marvin/entity/cloudstackentity.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.
+
+cloudstack_version = "4.2.0"
+
+class CloudStackEntity(object):
+
+    __version__ = cloudstack_version
+
+    def getVersion(self):
+        return self.__version__

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/__init__.py b/tools/marvin/marvin/factory/data/__init__.py
new file mode 100644
index 0000000..d216be4
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/__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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/account.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/account.py b/tools/marvin/marvin/factory/data/account.py
new file mode 100644
index 0000000..1041cfe
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/account.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.
+
+import factory
+from marvin.factory.AccountFactory import AccountFactory
+from marvin.utils import random_gen
+
+class UserAccountFactory(AccountFactory):
+
+    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 = 'password'
+
+
+class AdminAccountFactory(UserAccountFactory):
+    accounttype = 1
+
+
+class DomainAdminFactory(UserAccountFactory):
+    accounttype = 2
+    domainid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/cluster.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/cluster.py b/tools/marvin/marvin/factory/data/cluster.py
new file mode 100644
index 0000000..f4641cf
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/cluster.py
@@ -0,0 +1,30 @@
+# 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.utils import random_gen
+from marvin.factory.ClusterFactory import ClusterFactory
+
+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/526a9d60/tools/marvin/marvin/factory/data/diskoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/diskoffering.py b/tools/marvin/marvin/factory/data/diskoffering.py
new file mode 100644
index 0000000..88ae7cb
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/diskoffering.py
@@ -0,0 +1,34 @@
+# 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.DiskOfferingFactory import DiskOfferingFactory
+from marvin.utils import 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/526a9d60/tools/marvin/marvin/factory/data/firewallrule.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/firewallrule.py b/tools/marvin/marvin/factory/data/firewallrule.py
new file mode 100644
index 0000000..1707347
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/firewallrule.py
@@ -0,0 +1,30 @@
+# 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.factory.FirewallRuleFactory import FirewallRuleFactory
+
+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/526a9d60/tools/marvin/marvin/factory/data/host.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/host.py b/tools/marvin/marvin/factory/data/host.py
new file mode 100644
index 0000000..c8b4ab7
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/host.py
@@ -0,0 +1,31 @@
+# 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.factory.HostFactory import HostFactory
+
+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/526a9d60/tools/marvin/marvin/factory/data/networkoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/networkoffering.py b/tools/marvin/marvin/factory/data/networkoffering.py
new file mode 100644
index 0000000..8d80631
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/networkoffering.py
@@ -0,0 +1,73 @@
+# 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.NetworkOfferingFactory import NetworkOfferingFactory
+from marvin.utils import random_gen
+
+
+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/526a9d60/tools/marvin/marvin/factory/data/serviceoffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/serviceoffering.py b/tools/marvin/marvin/factory/data/serviceoffering.py
new file mode 100644
index 0000000..a56d4e5
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/serviceoffering.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.factory.ServiceOfferingFactory import ServiceOfferingFactory
+from marvin.utils import random_gen
+
+class SmallServiceOfferingFactory(ServiceOfferingFactory):
+    cpunumber = 1
+    cpuspeed = 100 #Mhz
+    memory = 100 #MB
+    displaytext = "Small Service Offering"
+    name = factory.Sequence(lambda n: "SmallServiceOffering" + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/template.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/template.py b/tools/marvin/marvin/factory/data/template.py
new file mode 100644
index 0000000..033835b
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/template.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.
+
+from marvin.factory.TemplateFactory import TemplateFactory
+
+class DefaultBuiltInTemplateFactory(TemplateFactory):
+    ostype = 'CentOS 5.3 (64-bit)'
+    displaytext = 'CentOS 5.3 (64-bit)'
+    name = 'CentOS 5.3 (64-bit)'
+    format = 'VHD'
+    hypervisor = 'XenServer'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/user.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/user.py b/tools/marvin/marvin/factory/data/user.py
new file mode 100644
index 0000000..ee84644
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/user.py
@@ -0,0 +1,50 @@
+# 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.UserFactory import UserFactory
+from marvin.factory.data.account import UserAccountFactory
+from marvin.utils import random_gen
+
+class UserFactory(UserFactory):
+
+    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 = 'password'
+    account = factory.SubFactory(UserAccountFactory,
+        apiclient=factory.SelfAttribute('..apiclient'),
+        accounttype=0,
+        firstname=factory.SelfAttribute('..firstname'),
+        lastname=factory.SelfAttribute('..lastname'),
+        email=factory.SelfAttribute('..email'),
+        password=factory.SelfAttribute('..password'),
+        username=factory.SelfAttribute('..username'),
+    )
+
+class AdminUserFactory(UserFactory):
+
+    account = factory.SubFactory(UserAccountFactory,
+        apiclient=factory.SelfAttribute('..apiclient'),
+        accounttype=1,
+        firstname=factory.SelfAttribute('..firstname'),
+        lastname=factory.SelfAttribute('..lastname'),
+        email=factory.SelfAttribute('..email'),
+        password=factory.SelfAttribute('..password'),
+        username=factory.SelfAttribute('..username'),
+    )

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/vm.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/vm.py b/tools/marvin/marvin/factory/data/vm.py
new file mode 100644
index 0000000..66f15a3
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/vm.py
@@ -0,0 +1,34 @@
+# 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.VirtualMachineFactory import VirtualMachineFactory
+from marvin.utils import random_gen
+
+
+class VirtualMachineIsolatedNetwork(VirtualMachineFactory):
+    """
+    Create a virtualmachine in an isolated network typically in an advanced zone
+
+    Uses a serviceoffering of tinyInstance
+    Uses a builtin template available
+    Deploys in the first zone available
+    """
+
+    serviceofferingid = None
+    templateid = None
+    zoneid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/factory/data/zone.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/factory/data/zone.py b/tools/marvin/marvin/factory/data/zone.py
new file mode 100644
index 0000000..f4a278a
--- /dev/null
+++ b/tools/marvin/marvin/factory/data/zone.py
@@ -0,0 +1,33 @@
+# 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.ZoneFactory import ZoneFactory
+from marvin.utils import random_gen
+
+class AdvancedZoneFactory(ZoneFactory):
+    name = factory.Sequence(lambda n: "advzone" + random_gen())
+    networktype = "Advanced"
+    dns1 = "8.8.8.8"
+    internaldns1 = "8.8.8.8"
+
+
+class BasicZoneFactory(ZoneFactory):
+    name = factory.Sequence(lambda n: "basiczone" + random_gen())
+    networktype = "Basic"
+    dns1 = "8.8.8.8"
+    internaldns1 = "8.8.8.8"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/test/test_factories.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/test/test_factories.py b/tools/marvin/marvin/test/test_factories.py
index 23a6580..5ce8c13 100644
--- a/tools/marvin/marvin/test/test_factories.py
+++ b/tools/marvin/marvin/test/test_factories.py
@@ -20,22 +20,22 @@ import logging
 
 from marvin.cloudstackTestClient import cloudstackTestClient
 
-from marvin.data.account import UserAccountFactory, AdminAccountFactory, DomainAdminFactory
-from marvin.data.serviceoffering import *
-from marvin.data.template import *
-from marvin.data.user import *
-from marvin.data.networkoffering import *
+from marvin.factory.data.account import UserAccountFactory, AdminAccountFactory, DomainAdminFactory
+from marvin.factory.data.serviceoffering import *
+from marvin.factory.data.template import *
+from marvin.factory.data.user import *
+from marvin.factory.data.networkoffering import *
 
 from marvin.factory.VirtualMachineFactory import *
 
-from marvin.base.ServiceOffering import ServiceOffering
-from marvin.base.Zone import Zone
-from marvin.base.Account import Account
-from marvin.base.Template import Template
-from marvin.base.User import User
-from marvin.base.Network import Network
+from marvin.entity.serviceoffering import ServiceOffering
+from marvin.entity.zone import Zone
+from marvin.entity.account import Account
+from marvin.entity.template import Template
+from marvin.entity.user import User
+from marvin.entity.network import Network
 
-from marvin.base.IpAddress import IpAddress
+from marvin.entity.ipaddress import IpAddress
 class BuildVsCreateStrategyTest(unittest.TestCase):
     def setUp(self):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
@@ -160,7 +160,7 @@ class IpAddressFactoryTest(unittest.TestCase):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
 
     def tearDown(self):
-        pass
+        self.vm.destroy(apiclient=self.apiClient)
 
     def test_associateIpAddressToNetwork(self):
         accnt = UserAccountFactory.create(apiclient=self.apiClient)
@@ -171,7 +171,7 @@ class IpAddressFactoryTest(unittest.TestCase):
         template = Template.list(apiclient=self.apiClient, templatefilter="featured")
         self.assert_(len(template) > 0)
         zones = Zone.list(apiclient=self.apiClient)
-        vm = VirtualMachineFactory.create(
+        self.vm = VirtualMachineFactory.create(
             apiclient=self.apiClient,
             serviceofferingid = service[0].id,
             templateid = template[0].id,
@@ -182,18 +182,4 @@ class IpAddressFactoryTest(unittest.TestCase):
         firstip = all_ips[0]
         networks = Network.list(apiclient=self.apiClient, account = accnt.name, domainid = accnt.domainid)
         firstip.associate(apiclient=self.apiClient, networkid = networks[0].id)
-        vm.destroy(apiclient=self.apiClient)
-
-
-class VirtualMachineTest(unittest.TestCase):
-    """
-    Test virtualmachine lifecycle using factories
-    """
-    def setUp(self):
-        self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
-
-    def tearDown(self):
-        pass
 
-    def test_virtualmachinedeploy(self):
-        pass
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/marvin/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/utils.py b/tools/marvin/marvin/utils.py
index 3170ea7..fcfa338 100644
--- a/tools/marvin/marvin/utils.py
+++ b/tools/marvin/marvin/utils.py
@@ -242,7 +242,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
     @return: True if snapshot is found, False otherwise
     """
 
-    from base import ImageStore, Snapshot
+    from entity import ImageStore, Snapshot
     secondaryStores = ImageStore.list(apiclient, zoneid=zoneid)
 
     assert isinstance(secondaryStores, list), "Not a valid response for listImageStores"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index 2b4f360..25909b3 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -142,7 +142,7 @@
                     <argument>install</argument>
                     <argument>--upgrade</argument>
                     <!-- TODO: Fix Marvin versioning here -->
-                    <argument>Marvin-0.1.0.tar.gz</argument>
+                    <argument>Marvin-0.2.0.tar.gz</argument>
                   </arguments>
                 </configuration>
               </execution>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526a9d60/tools/marvin/setup.py
----------------------------------------------------------------------
diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py
index 5e9b125..b499671 100644
--- a/tools/marvin/setup.py
+++ b/tools/marvin/setup.py
@@ -42,7 +42,8 @@ setup(name="Marvin",
     maintainer_email="tsp@apache.org",
     long_description="Marvin is the Apache CloudStack python client written around the unittest framework",
     platforms=("Any",),
-    packages=["marvin", "marvin.cloudstackAPI", "marvin.base", "marvin.factory",
+    packages=["marvin", "marvin.cloudstackAPI", "marvin.entity", "marvin.factory", "marvin.factory.data",
+              "marvin.docs", "marvin.generate", "marvin.legacy", "marvin.sandbox",
               "marvin.sandbox.advanced", "marvin.sandbox.advancedsg", "marvin.sandbox.basic"],
     license="LICENSE.txt",
     install_requires=[


Mime
View raw message