Commit Graph

21210 Commits

Author SHA1 Message Date
Prasanna Santhanam ccf23b829b marvin_refactor: separate write from generation
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:18 +05:30
Prasanna Santhanam 97ed47b4d6 marvin_refactor: Fixes from conflicts during rebase
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:18 +05:30
Prasanna Santhanam 65118c8f02 marvin_refactor: If there are no required arguments
the else block isn't required.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:18 +05:30
Prasanna Santhanam 42c30f59a7 marvin_refactor: Exposing the entity that an API acts upon from API discovery
eg: dedicatePublicIpRange acts on VlanIpRange entities. So does listVlanIpRanges,

listapisresponse: {
    count: 1,
    api: [
    {
        name: "dedicatePublicIpRange",
        description: "Dedicates a Public IP range to an account",
        isasync: false,
        related: "listVlanIpRanges",
        params: [],
        response: [],
        entity: "VlanIpRange"
     }
    ]
  }
}

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:18 +05:30
Prasanna Santhanam 5ecdcd9ec1 marvin_refactor: ldapConfig - > config, Ldap
And the With preposition transformer

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:18 +05:30
Prasanna Santhanam 940e9f1d7c marvin_refactor: workaround inflect bug
inflect makes IpAddress -> IpAddres when singularizing.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:17 +05:30
Prasanna Santhanam 901af0080e marvin_refactor: transform based on prepositions to auto-generate
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:17 +05:30
Prasanna Santhanam db16fd7854 marvin_refactor: improve the entity auto-generator with error checks
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:17 +05:30
Prasanna Santhanam b3112fd45a marvin_refactor: Chain subFactory calls
SubFactories now can call in a nested fashion to populate attributes in
dependant entities.
2013-10-31 13:54:17 +05:30
Prasanna Santhanam ba6b1119f3 marvin_refactor: changes to the entity_generator
adding support for capturing plurals
adding filtering for non-conforming entities
adding more error checking in entity.action {return}

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:17 +05:30
Prasanna Santhanam 90381913c5 marvin_refactor: adding doc strings to jsonHelper 2013-10-31 13:54:17 +05:30
Prasanna Santhanam 6815d03037 marvin_refactor: The SubFactory with SelfAttribute carrying the apiclient 2013-10-31 13:54:17 +05:30
Prasanna Santhanam ee39b31339 marvin_refactor: ipaddress factories
ipaddress doesn't require id to associate but only when disassociate
2013-10-31 13:54:17 +05:30
Prasanna Santhanam 048352f2f6 marvin_refactor: AccountFactory doesn't need hashing
SHA encryption is applied by the server
2013-10-31 13:54:17 +05:30
Prasanna Santhanam d84535ee10 marvin_refactor: Working around CLOUDSTACK-2126
Marvin deserializes by matching attributes of the response with the
responseObject expected. In case the object's attributes don't mirror
the response Marvin assumes the response is invalid and can't return a
proper first class entity. This makes it difficult for tests to
reference the object's attributes in a sensible way.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:16 +05:30
Prasanna Santhanam 7c60c563d1 marvin_refactor: make the module structure more relevant and simple
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:16 +05:30
Prasanna Santhanam 580aa13e25 marvin_refactor: SubFactory or RelatedFactory
Can't make up my mind!!???
2013-10-31 13:54:16 +05:30
Prasanna Santhanam 7663f620e0 marvin_refactor: use _adjust_kwargs for cleaning
_adjust_kwargs is useful for any pre-generation cleaning of **kwargs by
factory_boy
2013-10-31 13:54:16 +05:30
Prasanna Santhanam a8f7364127 marvin_refactor: register is the real create
createTemplateCmd does a template of a VM
while
registerTemplateCmd does the actual creation of the template in CS
2013-10-31 13:54:16 +05:30
Prasanna Santhanam b862772e46 marvin_refactor: decode the response as first class python object
createAccountResponse is now an instance of createAccountResponse and
not just a plain dict.

TODO:
1. nested entities don't work yet.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:16 +05:30
Prasanna Santhanam c6f0876fe9 marvin_refactor: one shot creation of factories
Build phase will init the bare minimum object required to make the web
request to the mgmt server

Create phase will make the actual request and fill the attributes of the
entity after recieving the response

This allows for one shot creation of the entity using:
EntityFactory.create(apiclient)

over two steps:
factory = EntityFactory()
entity = Entity.create(apiclient, factory)

TODO:
Figure out howto perform related factory creation.
eg: UserFactory.create() inits AccountFactory.create()

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam 0af09a4843 marvin_refactor: call the EntityFactory simply factory 2013-10-31 13:54:15 +05:30
Prasanna Santhanam 414bf4f625 marvin_refactor: subfactory support for users
UserFactory will call on AccountFactory when it needs to be
instantiated.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam c1fd1eb0f6 marvin_refactor: adding isolation methods l3/vlan/gre
also some defaults for factories:
cluster, domain, user, vpn, zone

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam 47807e8452 marvin_refactor: Fix merge issues with remoteAccessVPNResponse, and server
Duplicated methods creep in from bad merge

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam a2ecc162cf marvin_refactor: fix the setup.py for marvin to include factories
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam ea9019abd8 marvin_refactor: remove redundant assignment
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam d2b3c7f100 marvin_refactor: not all factories are required.
Factories are reqd. for entities that come into existense through the
process of a CLoudStack API create command. Some entities are added from
external sources for which factories are not reqd.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:15 +05:30
Prasanna Santhanam aa4651bcc3 marvin_refactor: removing redundant entities
Some entities do not conform to the CRUD format and define extra verbs -
eg: markDefaultNicForVirtualMachine, ldapConfig, ldapRemove etc.

These are refactored and combined into their respective entities.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam cb35216f80 marvin_refactor: working virtulmachine test
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam dcd96afd16 marvin_refactor: sg offering test
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam 0f8a9ae4b9 marvin_refactor: actions on entity object require id for performing the action
For eg:
1. nf = NetworkOffering.create(apiClient, NetworkOfferingFactory())
2. nf.update(apiClient, state='Enabled')

Operation #2 requires that nf's id be supplied to enable the network
offering

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam b4ecf77de2 marvin_refactor: Factories for DiskOffering, ServiceOffering
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam e0968d6937 marvin_refactor: VNS device APIs, VMSnapshot APIs, changes to factory creation
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam e88d2fcf5d simulator: removing cyclic dependency from simulator
The database creator caused a cyclic dependecny in the simulator which
is removed with this commit. Additionally the simulator profile is now
merged with developer profile and a test for server health is included

Steps to run:
$ mvn -Pdeveloper clean install
$ mvn -Pdeveloper -pl developer -Ddeploydb
$ mvn -Pdeveloper -pl developer -Ddeploydb-simulator
$ mvn -pl client jetty:run

To deploy an adv. zone and test the server health:
$ mvn -Pdeveloper,marvin -Dmarvin.config=`find . -name simulator.cfg` -pl :cloud-marvin test
2013-10-31 13:54:14 +05:30
Prasanna Santhanam 9c78bd5bc6 removing unused commented dependencies
removing the spring related dependencies that were commented out.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:14 +05:30
Prasanna Santhanam 940c0508df new pom for dbcreator classes
reuse the setup as a cloudstack-setup-db project
2013-10-31 13:54:14 +05:30
Prasanna Santhanam 776124914b marvin_refactor: create takes factories not reqd args
- Let all entities inherit from CloudStackEntity
- create and list are classmethods since they work without need for an
  entity to exist
- create takes only factories by default. no need for long param list.
    Entitiy.create(apiclient) will give entity out of default factory
- Use entityFactory.attributes() to init entities

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam dda9ae28f3 marvin_refactor: factories for each api entity
factories will help define default test data for each entity. So a

Account.create(apiclient) returns a default account
VirtualMachine.deploy(apiclient) returns a virtualmachine etc

WIP: only skeletons, no flesh

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam a5bd827c24 marvin_refactor: update the entity dict but not through optional kwargs
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam 35c7c5713a marvin_refactor: fixing unittests
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam 5ee671fc9a marvin_refactor: base dict object updated as **kwargs from factory
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam f0b9b274ee marvin_refactor: VNS device APIs, VMSnapshot APIs, changes to factory creation
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam 676997c8a3 simulator: removing cyclic dependency from simulator
The database creator caused a cyclic dependecny in the simulator which
is removed with this commit. Additionally the simulator profile is now
merged with developer profile and a test for server health is included

Steps to run:
$ mvn -Pdeveloper clean install
$ mvn -Pdeveloper -pl developer -Ddeploydb
$ mvn -Pdeveloper -pl developer -Ddeploydb-simulator
$ mvn -pl client jetty:run

To deploy an adv. zone and test the server health:
$ mvn -Pdeveloper,marvin -Dmarvin.config=`find . -name simulator.cfg` -pl :cloud-marvin test
2013-10-31 13:54:13 +05:30
Prasanna Santhanam c7a46a8995 removing unused commented dependencies
removing the spring related dependencies that were commented out.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:13 +05:30
Prasanna Santhanam ae49eb9d27 marvin_factories: inherit from ABSTRACT_FACTORY
This is done to remove dependency on an ORM.

+ Additional APIs from multiple ip per nic.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:12 +05:30
Prasanna Santhanam fa00dc9f9b marvin_refactor: add body to all the entities in base
- don't do package import of cloudstackentity
- create() and list() method will return obj(s) of type(Entity)

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:12 +05:30
Prasanna Santhanam 93438f2df0 marvin_refactor: create takes factories not reqd args
- Let all entities inherit from CloudStackEntity
- create and list are classmethods since they work without need for an
  entity to exist
- create takes only factories by default. no need for long param list.
    Entitiy.create(apiclient) will give entity out of default factory
- Use entityFactory.attributes() to init entities

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:12 +05:30
Prasanna Santhanam 23a2042df0 marvin_refactor: fixing the imports
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:12 +05:30
Prasanna Santhanam 6ffe0c42a8 marvin_refactor: split base into multiple modules
Each entity goes into its own module
Append ASF license header to the entity

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-10-31 13:54:12 +05:30