diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index e3c559054c1..d006002ae0f 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -112,7 +112,7 @@ class CSConnection(object): timeout -= 5 self.logger.debug("=== JobId:%s is Still Processing, " "Will TimeOut in:%s ====" % (str(jobid), - str(timeout))) + str(timeout))) end_time = time.time() tot_time = int(start_time - end_time) self.logger.debug( diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index 1e135060a5b..53d48ab10d7 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -421,7 +421,7 @@ class CSTestClient(object): ''' if self.__asyncJobMgr is None: self.__asyncJobMgr = asyncJobMgr(self.__apiClient, - self.__dbConnection) + self.__dbConnection) return self.__asyncJobMgr.submitCmdsAndWait(cmds, workers) def submitJob(self, job, ntimes=1, nums_threads=10, interval=1): @@ -431,7 +431,7 @@ class CSTestClient(object): ''' if self.__asyncJobMgr is None: self.__asyncJobMgr = asyncJobMgr(self.__apiClient, - self.__dbConnection) + self.__dbConnection) self.__asyncJobMgr.submitJobExecuteNtimes(job, ntimes, nums_threads, interval) @@ -443,5 +443,5 @@ class CSTestClient(object): ''' if self.__asyncJobMgr is None: self.__asyncJobMgr = asyncJobMgr(self.__apiClient, - self.__dbConnection) + self.__dbConnection) self.__asyncJobMgr.submitJobs(jobs, nums_threads, interval) diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py index 4096a4446c8..4d44c58ade9 100644 --- a/tools/marvin/marvin/codes.py +++ b/tools/marvin/marvin/codes.py @@ -62,7 +62,9 @@ BASIC_ZONE = "basic" ISOLATED_NETWORK = "ISOLATED" SHARED_NETWORK = "SHARED" VPC_NETWORK = "VPC" -ERROR_NO_HOST_FOR_MIGRATION = "Could not find suitable host for migration, please ensure setup has required no. of hosts" +ERROR_NO_HOST_FOR_MIGRATION = \ + "Could not find suitable host for migration, " \ + "please ensure setup has required no. of hosts" NAT_RULE = "nat rule" STATIC_NAT_RULE = "static nat rule" UNKNOWN = "UNKNOWN" diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 67acc770080..1410e6fadf3 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -1,563 +1,573 @@ test_data = { - "region": { - "regionid": "2", - "regionname": "Region2", - "regionendpoint": "http://region2:8080/client" - }, - "zone": "NA", - "hypervisor": "XenServer", - "vdomain": { + "region": { + "regionid": "2", + "regionname": "Region2", + "regionendpoint": "http://region2:8080/client" + }, + "zone": "NA", + "hypervisor": "XenServer", + "deleteDC": True, + "vdomain": { "name": "domain" - }, - "email" : "test@test.com", - "gateway" : "172.1.1.1", - "netmask" : "255.255.255.0", - "startip" : "172.1.1.10", - "endip" : "172.1.1.20", - "regionid" : "1", - "vlan" :"10", - "isportable" : "true", - - "project": { + }, + "email": "test@test.com", + "gateway": "172.1.1.1", + "netmask": "255.255.255.0", + "startip": "172.1.1.10", + "endip": "172.1.1.20", + "regionid": "1", + "vlan": "10", + "isportable": "true", + + "project": { "name": "Project", - "displaytext": "Test project" - }, - "account": { - "email": "test-account@test.com", - "firstname": "test", - "lastname": "test", - "username": "test-account", - "password": "password" - }, - "small": { - "displayname": "testserver", - "username": "root", - "password": "password", - "ssh_port": 22, - "hypervisor": "XenServer", - "privateport": 22, - "publicport": 22, - "protocol": 'TCP', - }, - "medium": { - "displayname": "testserver", - "username": "root", - "password": "password", - "ssh_port": 22, - "hypervisor": 'XenServer', - "privateport": 22, - "publicport": 22, - "protocol": 'TCP', - }, - "service_offering": { - "name": "Tiny Instance", - "displaytext": "Tiny Instance", - "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs - }, - "service_offerings": { - "name": "Tiny Instance", + "displaytext": "Test project" + }, + "account": { + "email": "test-account@test.com", + "firstname": "test", + "lastname": "test", + "username": "test-account", + "password": "password" + }, + "small": { + "displayname": "testserver", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": "XenServer", + "privateport": 22, + "publicport": 22, + "protocol": 'TCP', + }, + "medium": { + "displayname": "testserver", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": 'XenServer', + "privateport": 22, + "publicport": 22, + "protocol": 'TCP', + }, + "service_offering": { + "name": "Tiny Instance", + "displaytext": "Tiny Instance", + "cpunumber": 1, + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs + }, + "service_offerings": { + "name": "Tiny Instance", + "displaytext": "Tiny Instance", + "cpunumber": 1, + "cpuspeed": 100, + "memory": 128, + + "tiny": { + "name": "Tiny Instance", "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, "memory": 128, - - "tiny": { - "name": "Tiny Instance", - "displaytext": "Tiny Instance", - "cpunumber": 1, - "cpuspeed": 100, - "memory": 128, - }, - "small": { - "name": "Small Instance", - "displaytext": "Small Instance", - "cpunumber": 1, - "cpuspeed": 100, - "memory": 256 - }, - "medium": { - "name": "Medium Instance", - "displaytext": "Medium Instance", - "cpunumber": 1, - "cpuspeed": 100, - "memory": 256, - }, - "big": { - "name": "BigInstance", - "displaytext": "BigInstance", - "cpunumber": 1, - "cpuspeed": 100, - "memory": 512, - } }, - "disk_offering": { - "name": "Disk offering", - "displaytext": "Disk offering", - "disksize": 1 + "small": { + "name": "Small Instance", + "displaytext": "Small Instance", + "cpunumber": 1, + "cpuspeed": 100, + "memory": 256 }, - 'resized_disk_offering': { - "displaytext": "Resized", - "name": "Resized", - "disksize": 3 + "medium": { + "name": "Medium Instance", + "displaytext": "Medium Instance", + "cpunumber": 1, + "cpuspeed": 100, + "memory": 256, }, - "network": { - "name": "Test Network", - "displaytext": "Test Network", - "acltype": "Account", - }, - "network2": { - "name": "Test Network Shared", - "displaytext": "Test Network Shared", - "vlan" :1201, - "gateway" :"172.16.15.1", - "netmask" :"255.255.255.0", - "startip" :"172.16.15.21", - "endip" :"172.16.15.41", - "acltype": "Account", - }, - "network_offering": { - "name": 'Test Network offering', - "displaytext": 'Test Network offering', - "guestiptype": 'Isolated', - "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding', - "traffictype": 'GUEST', - "availability": 'Optional', - "serviceProviderList" : { + "big": { + "name": "BigInstance", + "displaytext": "BigInstance", + "cpunumber": 1, + "cpuspeed": 100, + "memory": 512, + } + }, + "disk_offering": { + "name": "Disk offering", + "displaytext": "Disk offering", + "disksize": 1 + }, + 'resized_disk_offering': { + "displaytext": "Resized", + "name": "Resized", + "disksize": 3 + }, + "network": { + "name": "Test Network", + "displaytext": "Test Network", + "acltype": "Account", + }, + "network2": { + "name": "Test Network Shared", + "displaytext": "Test Network Shared", + "vlan": 1201, + "gateway": "172.16.15.1", + "netmask": "255.255.255.0", + "startip": "172.16.15.21", + "endip": "172.16.15.41", + "acltype": "Account", + }, + "network_offering": { + "name": 'Test Network offering', + "displaytext": 'Test Network offering', + "guestiptype": 'Isolated', + "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding', + "traffictype": 'GUEST', + "availability": 'Optional', + "serviceProviderList": { "Dhcp": 'VirtualRouter', - "Dns": 'VirtualRouter', - "SourceNat": 'VirtualRouter', - "PortForwarding": 'VirtualRouter', - }, + "Dns": 'VirtualRouter', + "SourceNat": 'VirtualRouter', + "PortForwarding": 'VirtualRouter', }, - "nw_off_isolated_persistent":{ - "name": 'Test Nw off isolated persistent', - "displaytext": 'Test Nw off isolated persistent', - "guestiptype": 'Isolated', - "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding', - "traffictype": 'GUEST', - "isPersistent":'True', - "availability": 'Optional', - "serviceProviderList" : { + }, + "nw_off_isolated_persistent": { + "name": 'Test Nw off isolated persistent', + "displaytext": 'Test Nw off isolated persistent', + "guestiptype": 'Isolated', + "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding', + "traffictype": 'GUEST', + "isPersistent": 'True', + "availability": 'Optional', + "serviceProviderList": { "Dhcp": 'VirtualRouter', - "Dns": 'VirtualRouter', - "SourceNat": 'VirtualRouter', - "PortForwarding": 'VirtualRouter', - }, + "Dns": 'VirtualRouter', + "SourceNat": 'VirtualRouter', + "PortForwarding": 'VirtualRouter', }, - "isolated_network_offering": { - "name": "Network offering-DA services", - "displaytext": "Network offering-DA services", - "guestiptype": "Isolated", - "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat", - "traffictype": "GUEST", - "availability": "Optional'", - "serviceProviderList": { + }, + "isolated_network_offering": { + "name": "Network offering-DA services", + "displaytext": "Network offering-DA services", + "guestiptype": "Isolated", + "supportedservices": + "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat", + "traffictype": "GUEST", + "availability": "Optional'", + "serviceProviderList": { "Dhcp": "VirtualRouter", - "Dns": "VirtualRouter", - "SourceNat": "VirtualRouter", - "PortForwarding": "VirtualRouter", - "Vpn": "VirtualRouter", - "Firewall": "VirtualRouter", - "Lb": "VirtualRouter", - "UserData": "VirtualRouter", - "StaticNat": "VirtualRouter" - } - }, - "isolated_network": { - "name": "Isolated Network", - "displaytext": "Isolated Network" - }, - "virtual_machine": { - "displayname": "Test VM", - "username": "root", - "password": "password", - "ssh_port": 22, - "privateport": 22, - "publicport": 22, - "protocol": "TCP", - "affinity": { - "name": "webvms", - "type": "host anti-affinity", - }, - }, - "virtual_machine2" : { - "name" : "testvm2", - "displayname" : "Test VM2", - }, - "server_without_disk": { - "displayname": "Test VM-No Disk", - "username": "root", - "password": "password", - "ssh_port": 22, - "hypervisor": 'XenServer', - "privateport": 22, - "publicport": 22, - "protocol": 'TCP', - }, - "shared_network": { - "name": "MySharedNetwork - Test", - "displaytext": "MySharedNetwork", - "vlan" : "", - "gateway" :"", - "netmask" :"", - "startip" :"", - "endip" :"", - "acltype" : "Domain", - "scope":"all" - }, - "shared_network_offering_sg": { - "name": "MySharedOffering-sg", - "displaytext": "MySharedOffering-sg", - "guestiptype": "Shared", - "supportedservices": "Dhcp,Dns,UserData,SecurityGroup", - "specifyVlan" : "False", - "specifyIpRanges" : "False", - "traffictype": "GUEST", - "serviceProviderList" : { - "Dhcp": "VirtualRouter", - "Dns": "VirtualRouter", - "UserData": "VirtualRouter", - "SecurityGroup": "SecurityGroupProvider" - } - }, - "shared_network_sg": { - "name": "Shared-Network-SG-Test", - "displaytext": "Shared-Network_SG-Test", - "networkofferingid":"1", - "vlan" : "", - "gateway" :"", - "netmask" :"255.255.255.0", - "startip" :"", - "endip" :"", - "acltype" : "Domain", - "scope":"all" - }, - "vpc_offering": { - "name": "VPC off", - "displaytext": "VPC off", - "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL" - }, - "vpc": { - "name": "TestVPC", - "displaytext": "TestVPC", - "cidr": "10.0.0.1/24" - }, - "clusters": { - 0: { - "clustername": "Xen Cluster", - "clustertype": "CloudManaged", - "hypervisor": "XenServer", - }, - 1: { - "clustername": "KVM Cluster", - "clustertype": "CloudManaged", - "hypervisor": "KVM", - }, - 2: { - "hypervisor": 'VMware', - "clustertype": 'ExternalManaged', - "username": 'administrator', - "password": 'fr3sca', - "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1', - "clustername": 'VMWare Cluster', - }, - }, - "hosts": { - "xenserver": { - "hypervisor": 'XenServer', - "clustertype": 'CloudManaged', - "url": 'http://192.168.100.211', - "username": "root", - "password": "fr3sca", - }, - "kvm": { - "hypervisor": 'KVM', - "clustertype": 'CloudManaged', - "url": 'http://192.168.100.212', - "username": "root", - "password": "fr3sca", - }, - "vmware": { - "hypervisor": 'VMware', - "clustertype": 'ExternalManaged', - "url": 'http://192.168.100.203', - "username": "administrator", - "password": "fr3sca", - }, - }, - "network_offering_shared": { - "name": 'Test Network offering shared', - "displaytext": 'Test Network offering Shared', - "guestiptype": 'Shared', - "supportedservices": 'Dhcp,Dns,UserData', - "traffictype": 'GUEST', - "specifyVlan" : "True", - "specifyIpRanges" : "True", - "serviceProviderList" : { - "Dhcp": 'VirtualRouter', - "Dns": 'VirtualRouter', - "UserData": 'VirtualRouter', - }, - }, - "nw_off_persistent_RVR":{ - "name": 'Network offering-RVR services', - "displaytext": 'Network off-RVR services', - "guestiptype": 'Isolated', - "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Firewall,Lb,UserData,StaticNat', - "traffictype": 'GUEST', - "isPersistent":'True', - "availability": 'Optional', - "serviceProviderList": { - "Vpn": 'VirtualRouter', - "Dhcp": 'VirtualRouter', - "Dns": 'VirtualRouter', - "SourceNat": 'VirtualRouter', - "PortForwarding": 'VirtualRouter', - "Firewall": 'VirtualRouter', - "Lb": 'VirtualRouter', - "UserData": 'VirtualRouter', - "StaticNat": 'VirtualRouter', - }, - "serviceCapabilityList": { - "SourceNat": { - "SupportedSourceNatTypes": "peraccount", - "RedundantRouter": "true", - }, - "lb": { - "SupportedLbIsolation": "dedicated" - }, - }, - }, - "nw_off_isolated_persistent_netscaler":{ - "name": 'Netscaler', - "displaytext": 'Netscaler', - "guestiptype": 'Isolated', - "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat', - "traffictype": 'GUEST', - "isPersistent":'True', - "availability": 'Optional', - "serviceProviderList": { - "Dhcp": 'VirtualRouter', - "Dns": 'VirtualRouter', - "SourceNat": 'VirtualRouter', - "PortForwarding": 'VirtualRouter', - "Vpn": 'VirtualRouter', - "Firewall": 'VirtualRouter', - "Lb": 'Netscaler', - "UserData": 'VirtualRouter', - "StaticNat": 'VirtualRouter', - }, - - }, - "nw_off_persistent_VPCVR_NoLB":{ - "name": 'VPC Network offering', - "displaytext": 'VPC Network off', - "guestiptype": 'Isolated', - "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL', - "traffictype": 'GUEST', - "availability": 'Optional', - "isPersistent":'True', - "useVpc": 'on', - "serviceProviderList": { - "Vpn": 'VpcVirtualRouter', - "Dhcp": 'VpcVirtualRouter', - "Dns": 'VpcVirtualRouter', - "SourceNat": 'VpcVirtualRouter', - "PortForwarding": 'VpcVirtualRouter', - "UserData": 'VpcVirtualRouter', - "StaticNat": 'VpcVirtualRouter', - "NetworkACL": 'VpcVirtualRouter' - }, - - }, - "network_offering_internal_lb": { - "name": "Network offering for internal lb service", - "displaytext": "Network offering for internal lb service", - "guestiptype": "Isolated", - "traffictype": "Guest", - "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL", - "serviceProviderList": { - "Dhcp": "VpcVirtualRouter", - "Dns": "VpcVirtualRouter", - "Vpn": "VpcVirtualRouter", - "UserData": "VpcVirtualRouter", - "Lb": "InternalLbVM", - "SourceNat": "VpcVirtualRouter", - "StaticNat": "VpcVirtualRouter", - "PortForwarding": "VpcVirtualRouter", - "NetworkACL": "VpcVirtualRouter", - }, - "serviceCapabilityList": { - "SourceNat": {"SupportedSourceNatTypes": "peraccount"}, - "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"} - } - }, - "natrule": { - "privateport": 22, - "publicport": 2222, - "protocol": "TCP" - }, - "lbrule": { - "name": "SSH", - "alg": "roundrobin", - "privateport": 22, - "publicport": 2222, - "protocol": 'TCP' - }, - - "iso1": { - "displaytext": "Test ISO 1", - "name": "ISO 1", - "url": "http://people.apache.org/~tsp/dummy.iso", - "isextractable": True, - "isfeatured": True, - "ispublic": True, - "ostype": "CentOS 5.6 (64-bit)", - }, - "iso2": { - "displaytext": "Test ISO 2", - "name": "ISO 2", - "url": "http://people.apache.org/~tsp/dummy.iso", - "isextractable": True, - "isfeatured": True, - "ispublic": True, - "ostype": "CentOS 5.6 (64-bit)", - "mode": 'HTTP_DOWNLOAD', - }, - "isfeatured": True, - "ispublic": True, - "isextractable": True, - "bootable": True, - "passwordenabled": True, - - "template": { - "displaytext": "xs", - "name": "xs", - "passwordenabled": False, - }, - "template_2": { - "displaytext": "Public Template", - "name": "Public template", - "ostype": "CentOS 5.6 (64-bit)", - "isfeatured": True, - "ispublic": True, - "isextractable": True, - "mode": "HTTP_DOWNLOAD", - }, - "templatefilter": 'self', - - "templates": { - "displaytext": 'Template', - "name": 'Template', - "ostype": "CentOS 5.3 (64-bit)", - "templatefilter": 'self', - }, - "security_group" : { "name": "custom_Sec_Grp" }, - "ingress_rule": { - "protocol": "TCP", - "startport": "22", - "endport": "22", - "cidrlist": "0.0.0.0/0" - }, - "ostype": "CentOS 5.6 (64-bit)", - "sleep": 90, - "timeout": 10, - "page": 1, - "pagesize": 2, - "listall":'true', - "advanced_sg": { - "zone": { - "name": "", - "dns1": "8.8.8.8", - "internaldns1": "192.168.100.1", - "networktype": "Advanced", - "securitygroupenabled": "true" - }, - "securitygroupenabled": "true" - }, - "vlan": "10", - "portableiprange_vlan": { - "part": ["4090-4091", "4092-4095"], - "full": "4090-4095" - }, - "nfs": { - "url": "nfs://nfs/export/automation/1/testprimary", - "name": "Primary XEN" - }, - "iscsi": { - "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1", - "name": "Primary iSCSI" - }, - "volume": {"diskname": "Test Volume"}, - "custom_volume": { - "customdisksize": 1, - "diskname": "Custom disk", - }, - "upload_volume": { - "diskname": "UploadVol", - "format": "VHD", - "url": "http://10.147.28.7/templates/393d3550-05ef-330f-9b8c-745b0e699759.vhd", - "checksum": "", - }, - "recurring_snapshot": { - "maxsnaps": 2, - "timezone": "US/Arizona", - }, - "volume_offerings": { - 0: {"diskname": "TestDiskServ"}, - }, - "diskdevice": ['/dev/vdc', '/dev/vdb', '/dev/hdb', '/dev/hdc', '/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1' ], - - #test_vpc_vpn.py - "vpn_user": { - "username": "test", - "password": "password", - }, - "vpc": { - "name": "vpc_vpn", - "displaytext": "vpc-vpn", - "cidr": "10.1.1.0/24" - }, - "ntwk": { - "name": "tier1", - "displaytext": "vpc-tier1", - "gateway" : "10.1.1.1", - "netmask" : "255.255.255.192" - }, - "vpc2": { - "name": "vpc2_vpn", - "displaytext": "vpc2-vpn", - "cidr": "10.2.1.0/24" - }, - "ntwk2": { - "name": "tier2", - "displaytext": "vpc-tier2", - "gateway" : "10.2.1.1", - "netmask" : "255.255.255.192" - }, - "server": { - "displayname": "TestVM", - "username": "root", - "password": "password", - "ssh_port": 22, - "hypervisor": 'XenServer', - "privateport": 22, - "publicport": 22, - "protocol": 'TCP' + "Dns": "VirtualRouter", + "SourceNat": "VirtualRouter", + "PortForwarding": "VirtualRouter", + "Vpn": "VirtualRouter", + "Firewall": "VirtualRouter", + "Lb": "VirtualRouter", + "UserData": "VirtualRouter", + "StaticNat": "VirtualRouter" + } + }, + "isolated_network": { + "name": "Isolated Network", + "displaytext": "Isolated Network" + }, + "virtual_machine": { + "displayname": "Test VM", + "username": "root", + "password": "password", + "ssh_port": 22, + "privateport": 22, + "publicport": 22, + "protocol": "TCP", + "affinity": { + "name": "webvms", + "type": "host anti-affinity", }, + }, + "virtual_machine2": { + "name": "testvm2", + "displayname": "Test VM2", + }, + "server_without_disk": { + "displayname": "Test VM-No Disk", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": 'XenServer', "privateport": 22, "publicport": 22, "protocol": 'TCP', - "forvirtualnetwork": "true", + }, + "shared_network": { + "name": "MySharedNetwork - Test", + "displaytext": "MySharedNetwork", + "vlan": "", + "gateway": "", + "netmask": "", + "startip": "", + "endip": "", + "acltype": "Domain", + "scope": "all" + }, + "shared_network_offering_sg": { + "name": "MySharedOffering-sg", + "displaytext": "MySharedOffering-sg", + "guestiptype": "Shared", + "supportedservices": "Dhcp,Dns,UserData,SecurityGroup", + "specifyVlan": "False", + "specifyIpRanges": "False", + "traffictype": "GUEST", + "serviceProviderList": { + "Dhcp": "VirtualRouter", + "Dns": "VirtualRouter", + "UserData": "VirtualRouter", + "SecurityGroup": "SecurityGroupProvider" + } + }, + "shared_network_sg": { + "name": "Shared-Network-SG-Test", + "displaytext": "Shared-Network_SG-Test", + "networkofferingid": "1", + "vlan": "", + "gateway": "", + "netmask": "255.255.255.0", + "startip": "", + "endip": "", + "acltype": "Domain", + "scope": "all" + }, + "vpc_offering": { + "name": "VPC off", + "displaytext": "VPC off", + "supportedservices": + "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL" + }, + "vpc": { + "name": "TestVPC", + "displaytext": "TestVPC", + "cidr": "10.0.0.1/24" + }, + "clusters": { + 0: { + "clustername": "Xen Cluster", + "clustertype": "CloudManaged", + "hypervisor": "XenServer", + }, + 1: { + "clustername": "KVM Cluster", + "clustertype": "CloudManaged", + "hypervisor": "KVM", + }, + 2: { + "hypervisor": 'VMware', + "clustertype": 'ExternalManaged', + "username": 'administrator', + "password": 'fr3sca', + "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1', + "clustername": 'VMWare Cluster', + }, + }, + "hosts": { + "xenserver": { + "hypervisor": 'XenServer', + "clustertype": 'CloudManaged', + "url": 'http://192.168.100.211', + "username": "root", + "password": "fr3sca", + }, + "kvm": { + "hypervisor": 'KVM', + "clustertype": 'CloudManaged', + "url": 'http://192.168.100.212', + "username": "root", + "password": "fr3sca", + }, + "vmware": { + "hypervisor": 'VMware', + "clustertype": 'ExternalManaged', + "url": 'http://192.168.100.203', + "username": "administrator", + "password": "fr3sca", + }, + }, + "network_offering_shared": { + "name": 'Test Network offering shared', + "displaytext": 'Test Network offering Shared', + "guestiptype": 'Shared', + "supportedservices": 'Dhcp,Dns,UserData', + "traffictype": 'GUEST', + "specifyVlan": "True", + "specifyIpRanges": "True", + "serviceProviderList": { + "Dhcp": 'VirtualRouter', + "Dns": 'VirtualRouter', + "UserData": 'VirtualRouter', + }, + }, + "nw_off_persistent_RVR": { + "name": 'Network offering-RVR services', + "displaytext": 'Network off-RVR services', + "guestiptype": 'Isolated', + "supportedservices": + 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Firewall,Lb,UserData,StaticNat', + "traffictype": 'GUEST', + "isPersistent": 'True', + "availability": 'Optional', + "serviceProviderList": { + "Vpn": 'VirtualRouter', + "Dhcp": 'VirtualRouter', + "Dns": 'VirtualRouter', + "SourceNat": 'VirtualRouter', + "PortForwarding": 'VirtualRouter', + "Firewall": 'VirtualRouter', + "Lb": 'VirtualRouter', + "UserData": 'VirtualRouter', + "StaticNat": 'VirtualRouter', + }, + "serviceCapabilityList": { + "SourceNat": { + "SupportedSourceNatTypes": "peraccount", + "RedundantRouter": "true", + }, + "lb": { + "SupportedLbIsolation": "dedicated" + }, + }, + }, + "nw_off_isolated_persistent_netscaler": { + "name": 'Netscaler', + "displaytext": 'Netscaler', + "guestiptype": 'Isolated', + "supportedservices": + 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat', + "traffictype": 'GUEST', + "isPersistent": 'True', + "availability": 'Optional', + "serviceProviderList": { + "Dhcp": 'VirtualRouter', + "Dns": 'VirtualRouter', + "SourceNat": 'VirtualRouter', + "PortForwarding": 'VirtualRouter', + "Vpn": 'VirtualRouter', + "Firewall": 'VirtualRouter', + "Lb": 'Netscaler', + "UserData": 'VirtualRouter', + "StaticNat": 'VirtualRouter', + }, + + }, + "nw_off_persistent_VPCVR_NoLB": { + "name": 'VPC Network offering', + "displaytext": 'VPC Network off', + "guestiptype": 'Isolated', + "supportedservices": + 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL', + "traffictype": 'GUEST', + "availability": 'Optional', + "isPersistent": 'True', + "useVpc": 'on', + "serviceProviderList": { + "Vpn": 'VpcVirtualRouter', + "Dhcp": 'VpcVirtualRouter', + "Dns": 'VpcVirtualRouter', + "SourceNat": 'VpcVirtualRouter', + "PortForwarding": 'VpcVirtualRouter', + "UserData": 'VpcVirtualRouter', + "StaticNat": 'VpcVirtualRouter', + "NetworkACL": 'VpcVirtualRouter' + }, + + }, + "network_offering_internal_lb": { + "name": "Network offering for internal lb service", + "displaytext": "Network offering for internal lb service", + "guestiptype": "Isolated", + "traffictype": "Guest", + "supportedservices": + "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL", + "serviceProviderList": { + "Dhcp": "VpcVirtualRouter", + "Dns": "VpcVirtualRouter", + "Vpn": "VpcVirtualRouter", + "UserData": "VpcVirtualRouter", + "Lb": "InternalLbVM", + "SourceNat": "VpcVirtualRouter", + "StaticNat": "VpcVirtualRouter", + "PortForwarding": "VpcVirtualRouter", + "NetworkACL": "VpcVirtualRouter", + }, + "serviceCapabilityList": { + "SourceNat": {"SupportedSourceNatTypes": "peraccount"}, + "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"} + } + }, + "natrule": { + "privateport": 22, + "publicport": 2222, + "protocol": "TCP" + }, + "lbrule": { + "name": "SSH", + "alg": "roundrobin", + "privateport": 22, + "publicport": 2222, + "protocol": 'TCP' + }, + + "iso1": { + "displaytext": "Test ISO 1", + "name": "ISO 1", + "url": "http://people.apache.org/~tsp/dummy.iso", + "isextractable": True, + "isfeatured": True, + "ispublic": True, + "ostype": "CentOS 5.6 (64-bit)", + }, + "iso2": { + "displaytext": "Test ISO 2", + "name": "ISO 2", + "url": "http://people.apache.org/~tsp/dummy.iso", + "isextractable": True, + "isfeatured": True, + "ispublic": True, + "ostype": "CentOS 5.6 (64-bit)", + "mode": 'HTTP_DOWNLOAD', + }, + "isfeatured": True, + "ispublic": True, + "isextractable": True, + "bootable": True, + "passwordenabled": True, + + "template": { + "displaytext": "xs", + "name": "xs", + "passwordenabled": False, + }, + "template_2": { + "displaytext": "Public Template", + "name": "Public template", + "ostype": "CentOS 5.6 (64-bit)", + "isfeatured": True, + "ispublic": True, + "isextractable": True, + "mode": "HTTP_DOWNLOAD", + }, + "templatefilter": 'self', + + "templates": { + "displaytext": 'Template', + "name": 'Template', + "ostype": "CentOS 5.3 (64-bit)", + "templatefilter": 'self', + }, + "security_group": {"name": "custom_Sec_Grp"}, + "ingress_rule": { + "protocol": "TCP", + "startport": "22", + "endport": "22", + "cidrlist": "0.0.0.0/0" + }, + "ostype": "CentOS 5.6 (64-bit)", + "sleep": 90, + "timeout": 10, + "page": 1, + "pagesize": 2, + "listall": 'true', + "advanced_sg": { + "zone": { + "name": "", + "dns1": "8.8.8.8", + "internaldns1": "192.168.100.1", + "networktype": "Advanced", + "securitygroupenabled": "true" + }, + "securitygroupenabled": "true" + }, + "vlan": "10", + "portableiprange_vlan": { + "part": ["4090-4091", "4092-4095"], + "full": "4090-4095" + }, + "nfs": { + "url": "nfs://nfs/export/automation/1/testprimary", + "name": "Primary XEN" + }, + "iscsi": { + "url": + "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1", + "name": "Primary iSCSI" + }, + "volume": {"diskname": "Test Volume"}, + "custom_volume": { "customdisksize": 1, - "diskname": "Test Volume", - "portableIpRange": { - "gateway" : "10.223.252.195", - "netmask" : "255.255.255.192", - "startip" : "10.223.252.196", - "endip" : "10.223.252.197", - "vlan" : "1001" - } + "diskname": "Custom disk", + }, + "upload_volume": { + "diskname": "UploadVol", + "format": "VHD", + "url": + "http://10.147.28.7/templates/393d3550-05ef-330f-9b8c-745b0e699759.vhd", + "checksum": "", + }, + "recurring_snapshot": { + "maxsnaps": 2, + "timezone": "US/Arizona", + }, + "volume_offerings": { + 0: {"diskname": "TestDiskServ"}, + }, + "diskdevice": ['/dev/vdc', '/dev/vdb', '/dev/hdb', '/dev/hdc', + '/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1'], + + # test_vpc_vpn.py + "vpn_user": { + "username": "test", + "password": "password", + }, + "vpc": { + "name": "vpc_vpn", + "displaytext": "vpc-vpn", + "cidr": "10.1.1.0/24" + }, + "ntwk": { + "name": "tier1", + "displaytext": "vpc-tier1", + "gateway": "10.1.1.1", + "netmask": "255.255.255.192" + }, + "vpc2": { + "name": "vpc2_vpn", + "displaytext": "vpc2-vpn", + "cidr": "10.2.1.0/24" + }, + "ntwk2": { + "name": "tier2", + "displaytext": "vpc-tier2", + "gateway": "10.2.1.1", + "netmask": "255.255.255.192" + }, + "server": { + "displayname": "TestVM", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": 'XenServer', + "privateport": 22, + "publicport": 22, + "protocol": 'TCP' + }, + "privateport": 22, + "publicport": 22, + "protocol": 'TCP', + "forvirtualnetwork": "true", + "customdisksize": 1, + "diskname": "Test Volume", + "portableIpRange": { + "gateway": "10.223.252.195", + "netmask": "255.255.255.192", + "startip": "10.223.252.196", + "endip": "10.223.252.197", + "vlan": "1001" + } } diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index 8e39e73123e..de0e11b9c41 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -32,6 +32,7 @@ from marvin.cloudstackException import ( from marvin.cloudstackAPI import * from marvin.codes import (FAILED, SUCCESS) from marvin.lib.utils import (random_gen) +from marvin.config.test_data import test_data from sys import exit import os import pickle @@ -78,11 +79,15 @@ class DeployDataCenters(object): "\n=== Data Center Settings are dumped to %s===" % dc_file_path) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred while persisting DC Settings: %s" % \ + GetDetailExceptionInfo(e) def __cleanAndExit(self): try: - print "\n===Deploy DC Failed, So Cleaning to Exit===" + print "\n===deploy dc failed, so cleaning the created entries===" + if not test_data.get("deleteDC", None): + print "\n=== Deploy DC Clean Up flag not set. So, exiting ===" + exit(1) self.__tcRunLogger.debug( "===Deploy DC Failed, So Cleaning to Exit===") remove_dc_obj = DeleteDataCenters(self.__testClient, @@ -100,7 +105,8 @@ class DeployDataCenters(object): "===Removing DataCenter Successful===") exit(1) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred during DC CleanUp: %s" % \ + GetDetailExceptionInfo(e) def __addToCleanUp(self, type, id): if type not in self.__cleanUp.keys(): @@ -152,7 +158,7 @@ class DeployDataCenters(object): self.__tcRunLogger.debug("=== Adding VmWare DC Successful===") self.__addToCleanUp("VmwareDc", ret.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.exception("=== Adding VmWare DC Failed===") self.__cleanAndExit() @@ -213,6 +219,8 @@ class DeployDataCenters(object): sleep(timeout) retry = retry - 1 except Exception as e: + print "\nException Occurred:%s" %\ + GetDetailExceptionInfo(e) self.__tcRunLogger.exception("=== List Hosts Failed===") self.__cleanAndExit() @@ -239,7 +247,7 @@ class DeployDataCenters(object): "=== Creating Storage Pool Successful===") self.__addToCleanUp("StoragePool", ret.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("=== Create Storage Pool Failed===") self.__cleanAndExit() @@ -272,7 +280,7 @@ class DeployDataCenters(object): self.createClusters(pod.clusters, zoneId, podId, vmwareDc=pod.vmwaredc) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("====Pod: %s Creation " "Failed=====" % str(pod.name)) @@ -308,7 +316,7 @@ class DeployDataCenters(object): "=== Creating Vlan Ip Range Successful===") self.__addToCleanUp("VlanIpRange", ret.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("=== Create Vlan Ip Range Failed===") self.__cleanAndExit() @@ -338,7 +346,7 @@ class DeployDataCenters(object): "===Add Image Store Successful===") self.__addToCleanUp("ImageStore", ret.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("=== Add Image Store Failed===") self.__cleanAndExit() @@ -367,7 +375,7 @@ class DeployDataCenters(object): "===Creating Secondary StagingStore Successful===") self.__addToCleanUp("SecondaryStagingStore", ret.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("=== Creating " "SecondaryStagingStorage Failed===") @@ -422,7 +430,7 @@ class DeployDataCenters(object): self.addTrafficTypes(phynetwrk.id, net.traffictypes) return phynetwrk except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.exception("====Physical Network " "Creation Failed=====") self.__cleanAndExit() @@ -438,7 +446,7 @@ class DeployDataCenters(object): ret = self.__apiClient.updatePhysicalNetwork(upnet) return ret except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("====Update Physical Network Failed=====") self.__cleanAndExit() @@ -454,7 +462,7 @@ class DeployDataCenters(object): self.__tcRunLogger.debug( "===Update Network Service Provider Successfull===") except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception( "====Update Network Service Provider Failed=====") @@ -574,7 +582,7 @@ class DeployDataCenters(object): "type" % device) self.enableProvider(result.id) except Exception as e: - print "Exception Occurred %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("====List Network " "Service Providers Failed=====") @@ -603,7 +611,7 @@ class DeployDataCenters(object): self.__addToCleanUp("TrafficType", ret.id) return ret except Exception as e: - print "Exception Occurred : %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.\ exception("==== Add TrafficType Failed=====") self.__cleanAndExit() @@ -618,7 +626,7 @@ class DeployDataCenters(object): self.__tcRunLogger.debug("==== Enable Zone SuccessFul=====") return ret except Exception as e: - print "Exception Occurred : %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.exception("==== Enable Zone Failed=====") self.__cleanAndExit() @@ -632,7 +640,7 @@ class DeployDataCenters(object): self.__tcRunLogger.debug("=== Update Zone SuccessFul===") return ret except Exception as e: - print "Exception Occurred : %s" % GetDetailExceptionInfo(e) + print "Exception Occurred: %s" % GetDetailExceptionInfo(e) self.__tcRunLogger.exception("==== Update Zone Failed=====") self.__cleanAndExit() @@ -661,6 +669,7 @@ class DeployDataCenters(object): except Exception as e: print "\nException Occurred under createZone : %s" % \ GetDetailExceptionInfo(e) + self.__tcRunLogger.exception("====Create Zone Failed ===") return FAILED def createZones(self, zones): @@ -768,6 +777,7 @@ class DeployDataCenters(object): return except Exception as e: print "\nException Occurred %s" % GetDetailExceptionInfo(e) + self.__tcRunLogger.exception("==== Create Zones Failed ===") def isEipElbZone(self, zone): if (zone.networktype == "Basic" @@ -1017,14 +1027,14 @@ class DeleteDataCenters: if __name__ == "__main__": ''' - @Desc : 1. This facility is mainly to deploy - DataCenter by using this module as script - by using the input provided configuration. - EX: python deployDataCenter.py -i - 2. Removes a DataCenter as well by providing - the input file - EX: python deployDataCenter.py -i - -r + @Desc : This module facilitates the following: + 1. Deploying DataCenter by using the input provided + configuration. + EX: python deployDataCenter.py -i + 2. Removes a created DataCenter by providing + the input configuration file and data center settings file + EX: python deployDataCenter.py -i + -r ''' parser = OptionParser() parser.add_option("-i", "--input", action="store", @@ -1045,7 +1055,7 @@ if __name__ == "__main__": print "\n==== For DeployDataCenter: Please Specify a " \ "Valid Input Configuration File====" print "\n==== For DeleteDataCenters: Please Specify a " \ - "Valid DC Exported Configuration Settings or File====" + "Valid Input Configuration File and DC Settings====" exit(1) ''' @@ -1067,9 +1077,12 @@ if __name__ == "__main__": log_folder_path = log_obj.getLogFolderPath() tc_run_logger = log_obj.getLogger() else: - print "\nLog Creation Failed. Please Check" + print "\n===Log Creation Failed. Please Check===" exit(1) + ''' + Step2 : Create Test Client + ''' obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr, logger=tc_run_logger) if obj_tc_client and obj_tc_client.createTestClient() == FAILED: diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py index 9b4dd19ce86..6168987797f 100644 --- a/tools/marvin/marvin/marvinLog.py +++ b/tools/marvin/marvin/marvinLog.py @@ -143,7 +143,8 @@ class MarvinLog: if test_module_name is None: temp_path = temp_ts + "_" + random_gen() else: - temp_path = str(test_module_name) + "__" + str(temp_ts) + "_" + random_gen() + temp_path = str(test_module_name) + \ + "__" + str(temp_ts) + "_" + random_gen() temp_dir = "MarvinLogs" if ((log_cfg is not None) and diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py index e63198585b7..ae839e83d33 100644 --- a/tools/marvin/marvin/marvinPlugin.py +++ b/tools/marvin/marvin/marvinPlugin.py @@ -278,18 +278,17 @@ class MarvinPlugin(Plugin): src = self.__logFolderPath log_cfg = self.__parsedConfig.logger tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs" + dst = tmp + "//" + random_gen() mod_name = "test_suite" if self.__testModName: mod_name = self.__testModName.split(".") if len(mod_name) > 2: mod_name = mod_name[-2] - if mod_name: dst = tmp + "/" + mod_name + "_" + random_gen() - else: - dst = tmp + "//" + random_gen() cmd = "mv " + src + " " + dst os.system(cmd) - print "===Final Results: %s===" % str(dst) + print "===final results are now copied to: %s===" % str(dst) except Exception, e: - print "=== Exception occurred under finalize :%s"%str(GetDetailExceptionInfo(e)) + print "=== Exception occurred under finalize :%s ===" % \ + str(GetDetailExceptionInfo(e)) diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py index fb4e18b4608..611c8b5312c 100644 --- a/tools/marvin/marvin/sshClient.py +++ b/tools/marvin/marvin/sshClient.py @@ -40,10 +40,17 @@ from contextlib import closing class SshClient(object): ''' - Added timeout flag for ssh connect calls.Default to 3.0 seconds + @Desc : SSH Library for Marvin. + Facilitates SSH,SCP services to marvin users + @Input: host: Host to connect + port: port on host to connect + user: Username to be used for connecting + passwd: Password for connection + retries and delay applies for establishing connection + timeout : Applies while executing command ''' - def __init__(self, host, port, user, passwd, retries=20, delay=30, + def __init__(self, host, port, user, passwd, retries=60, delay=10, log_lvl=logging.DEBUG, keyPairFiles=None, timeout=10.0): self.host = None self.port = 22 @@ -73,7 +80,7 @@ class SshClient(object): if port is not None and port >= 0: self.port = port if self.createConnection() == FAILED: - raise internalError("Connection Failed") + raise internalError("SSH Connection Failed") def execute(self, command): stdin, stdout, stderr = self.ssh.exec_command(command) @@ -147,7 +154,7 @@ class SshClient(object): "createConnection: %s" % except_msg) self.retryCnt = self.retryCnt - 1 time.sleep(self.delay) - return ret + return ret def runCommand(self, command): ''' diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py index 91606423c76..4c775ad6144 100644 --- a/tools/marvin/setup.py +++ b/tools/marvin/setup.py @@ -42,12 +42,14 @@ setup(name="Marvin", author_email="Edison.Su@citrix.com", maintainer="Prasanna Santhanam", maintainer_email="tsp@apache.org", - long_description="Marvin is the Apache CloudStack python client written around the unittest framework", + long_description="Marvin is the Apache CloudStack python " + "client written around the unittest framework", platforms=("Any",), url="https://builds.apache.org/job/cloudstack-marvin/", packages=["marvin", "marvin.cloudstackAPI", "marvin.lib", "marvin.config", "marvin.sandbox", - "marvin.sandbox.advanced", "marvin.sandbox.advancedsg", "marvin.sandbox.basic"], + "marvin.sandbox.advanced", "marvin.sandbox.advancedsg", + "marvin.sandbox.basic"], license="LICENSE.txt", install_requires=[ "mysql-connector-python",