You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/05/29 14:34:02 UTC
[1/3] CLOUDSTACK-6282-Added Autometed test for network APIs after
incorporating review comments
Repository: cloudstack
Updated Branches:
refs/heads/master e9af5f44a -> cdf4047ce
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdf4047c/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 52be02d..0a5762d 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -41,6 +41,13 @@ test_data = {
"name": "Project",
"displaytext": "Test project"
},
+ "private_gateway": {
+ "ipaddress": "172.16.1.2",
+ "gateway": "172.16.1.1",
+ "netmask": "255.255.255.0",
+ "vlan":"10",
+ "name":"test_private_gateway"
+ },
"account": {
"email": "test-account@test.com",
"firstname": "test",
@@ -72,8 +79,8 @@ test_data = {
"name": "Tiny Instance",
"displaytext": "Tiny Instance",
"cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
+ "cpuspeed": 100, # in MHz
+ "memory": 128, # In MBs
},
"service_offerings": {
"name": "Tiny Instance",
@@ -109,7 +116,16 @@ test_data = {
"cpunumber": 1,
"cpuspeed": 100,
"memory": 512,
- }
+ },
+ "hasmall": {
+ "name": "HA Small Instance",
+ "displaytext": "HA Small Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 256,
+ "hosttags": "ha",
+ "offerha": True,
+ },
},
"disk_offering": {
"name": "Disk offering",
@@ -237,6 +253,18 @@ test_data = {
"name": "Isolated Network",
"displaytext": "Isolated Network"
},
+ "netscaler_VPX": {
+ "ipaddress": "10.223.240.174",
+ "username": "nsroot",
+ "password": "nsroot",
+ "networkdevicetype": "NetscalerVPXLoadBalancer",
+ "publicinterface": "1/1",
+ "privateinterface": "1/2",
+ "numretries": 2,
+ "lbdevicededicated": "True",
+ "lbdevicecapacity": 2,
+ "port": 22
+ },
"network_without_acl": {
"name": "TestNetwork",
"displaytext": "TestNetwork",
@@ -539,6 +567,26 @@ test_data = {
"NetworkACL": "VpcVirtualRouter"
}
},
+ "nw_offering_shared_persistent": {
+ "name": "Network offering for Shared Persistent Network",
+ "displaytext": "Network offering-DA services",
+ "guestiptype": "Shared",
+ "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
+ "traffictype": "GUEST",
+ "availability": "Optional",
+ "ispersistent": "True",
+ "serviceProviderList": {
+ "Dhcp": "VirtualRouter",
+ "Dns": "VirtualRouter",
+ "SourceNat": "VirtualRouter",
+ "PortForwarding": "VirtualRouter",
+ "Vpn": "VirtualRouter",
+ "Firewall": "VirtualRouter",
+ "Lb": "VirtualRouter",
+ "UserData": "VirtualRouter",
+ "StaticNat": "VirtualRouter"
+ }
+ },
"fwrule": {
"startport": 22,
"endport": 22,
@@ -590,8 +638,8 @@ test_data = {
},
"network_acl_rule": {
- "protocol":"TCP",
- "traffictype":"ingress",
+ "protocol":"TCP",
+ "traffictype":"ingress",
"cidrlist":"0.0.0.0/0",
"startport":"1",
"endport":"1"
@@ -631,6 +679,12 @@ test_data = {
"publicport": 2222,
"protocol": 'TCP'
},
+ "icmprule": {
+ "icmptype":-1,
+ "icmpcode":-1,
+ "cidrlist": "0.0.0.0/0",
+ "protocol": "ICMP"
+ },
"iso": {
"displaytext": "Test ISO",
"name": "ISO",
@@ -707,6 +761,7 @@ test_data = {
"page": 1,
"pagesize": 2,
"listall": 'true',
+ "host_password": "password",
"advanced_sg": {
"zone": {
"name": "",
@@ -807,14 +862,14 @@ test_data = {
"name": "Sparse Type Disk offering",
"displaytext":
"Sparse Type Disk offering",
- "disksize": 1, # in GB
+ "disksize": 1, # in GB
"provisioningtype": "sparse"
},
"fat": {
"name": "Fat Type Disk offering",
"displaytext":
"Fat Type Disk offering",
- "disksize": 1, # in GB
+ "disksize": 1, # in GB
"provisioningtype": "fat"
},
"sparse_disk_offering": {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdf4047c/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index a301e25..d9c4fae 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -83,7 +83,7 @@ class Domain:
cmd = listDomains.listDomainsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listDomains(cmd))
@@ -115,7 +115,7 @@ class Account:
cmd.accountid = "-".join([services["accountUUID"], random_gen()])
if "userUUID" in services:
- cmd.userid = "-".join([services["userUUID"],random_gen()])
+ cmd.userid = "-".join([services["userUUID"], random_gen()])
if domainid:
@@ -138,7 +138,7 @@ class Account:
cmd = listAccounts.listAccountsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listAccounts(cmd))
def disable(self, apiclient, lock=False):
@@ -166,7 +166,7 @@ class User:
cmd.lastname = services["lastname"]
if "userUUID" in services:
- cmd.userid = "-".join([services["userUUID"],random_gen()])
+ cmd.userid = "-".join([services["userUUID"], random_gen()])
cmd.password = services["password"]
cmd.username = "-".join([services["username"], random_gen()])
@@ -188,7 +188,7 @@ class User:
cmd = listUsers.listUsersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listUsers(cmd))
@classmethod
@@ -577,7 +577,7 @@ class VirtualMachine:
returnValue = [FAIL, "VM state not trasited to %s,\
operation timed out" % state]
- while timeout>0:
+ while timeout > 0:
try:
projectid = None
if hasattr(self, "projectid"):
@@ -684,7 +684,7 @@ class VirtualMachine:
cmd = detachIso.detachIsoCmd()
cmd.virtualmachineid = self.id
return apiclient.detachIso(cmd)
-
+
def scale_virtualmachine(self, apiclient, serviceOfferingId):
""" Scale up of service offering for the Instance"""
cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
@@ -707,7 +707,7 @@ class VirtualMachine:
cmd = listVirtualMachines.listVirtualMachinesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVirtualMachines(cmd))
def resetPassword(self, apiclient):
@@ -862,7 +862,7 @@ class Volume:
cmd = listVolumes.listVolumesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVolumes(cmd))
def resize(self, apiclient, **kwargs):
@@ -929,7 +929,7 @@ class Volume:
@classmethod
def extract(cls, apiclient, volume_id, zoneid, mode):
"""Extracts the volume"""
-
+
cmd = extractVolume.extractVolumeCmd()
cmd.id = volume_id
cmd.zoneid = zoneid
@@ -976,7 +976,7 @@ class Snapshot:
cmd = listSnapshots.listSnapshotsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listSnapshots(cmd))
@@ -1212,7 +1212,7 @@ class Template:
cmd = listTemplates.listTemplatesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listTemplates(cmd))
@@ -1343,7 +1343,7 @@ class Iso:
cmd = listIsos.listIsosCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listIsos(cmd))
@@ -1402,7 +1402,7 @@ class PublicIPAddress:
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listPublicIpAddresses(cmd))
@@ -1464,7 +1464,7 @@ class NATRule:
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listPortForwardingRules(cmd))
@@ -1527,7 +1527,7 @@ class StaticNATRule:
cmd = listIpForwardingRules.listIpForwardingRulesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listIpForwardingRules(cmd))
@classmethod
@@ -1594,7 +1594,7 @@ class EgressFireWallRule:
cmd = listEgressFirewallRules.listEgressFirewallRulesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listEgressFirewallRules(cmd))
@@ -1641,7 +1641,7 @@ class FireWallRule:
cmd = listFirewallRules.listFirewallRulesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listFirewallRules(cmd))
class Autoscale:
@@ -1716,7 +1716,7 @@ class Autoscale:
return(apiclient.listAutoScaleVmProfiles(cmd))
@classmethod
- def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, templateid,
+ def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, templateid,
autoscaleuserid=None, destroyvmgraceperiod=None, counterparam=None):
"""creates Autoscale VM Profile."""
@@ -1749,7 +1749,7 @@ class Autoscale:
return(apiclient.updateAutoScaleVmProfile(cmd))
@classmethod
- def createAutoscaleVmGroup(cls, apiclient, lbruleid, minmembers, maxmembers,
+ def createAutoscaleVmGroup(cls, apiclient, lbruleid, minmembers, maxmembers,
scaledownpolicyids, scaleuppolicyids, vmprofileid, interval=None):
"""creates Autoscale VM Group."""
@@ -1866,7 +1866,7 @@ class ServiceOffering:
cmd = listServiceOfferings.listServiceOfferingsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listServiceOfferings(cmd))
@@ -1909,7 +1909,7 @@ class DiskOffering:
cmd = listDiskOfferings.listDiskOfferingsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listDiskOfferings(cmd))
@@ -1988,7 +1988,7 @@ class NetworkOffering:
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetworkOfferings(cmd))
@@ -2023,7 +2023,7 @@ class SnapshotPolicy:
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listSnapshotPolicies(cmd))
class Hypervisor:
@@ -2039,7 +2039,7 @@ class Hypervisor:
cmd = listHypervisors.listHypervisorsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listHypervisors(cmd))
@@ -2155,7 +2155,7 @@ class LoadBalancerRule:
cmd.lbruleid = lbruleid
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return apiclient.listLBStickinessPolicies(cmd)
@classmethod
@@ -2165,7 +2165,7 @@ class LoadBalancerRule:
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listLoadBalancerRules(cmd))
@classmethod
@@ -2229,7 +2229,7 @@ class Cluster:
cmd = listClusters.listClustersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listClusters(cmd))
@@ -2346,7 +2346,7 @@ class Host:
cmd = listHosts.listHostsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listHosts(cmd))
@classmethod
@@ -2356,7 +2356,7 @@ class Host:
cmd = findHostsForMigration.findHostsForMigrationCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.findHostsForMigration(cmd))
@classmethod
@@ -2427,7 +2427,7 @@ class StoragePool:
cmd = listStoragePools.listStoragePoolsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listStoragePools(cmd))
@classmethod
@@ -2437,7 +2437,7 @@ class StoragePool:
cmd = findStoragePoolsForMigration.findStoragePoolsForMigrationCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.findStoragePoolsForMigration(cmd))
class Network:
@@ -2529,7 +2529,7 @@ class Network:
cmd = listNetworks.listNetworksCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetworks(cmd))
@@ -2606,7 +2606,7 @@ class NetworkACL:
cmd = listNetworkACLs.listNetworkACLsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetworkACLs(cmd))
@@ -2653,7 +2653,7 @@ class NetworkACLList:
cmd = listNetworkACLLists.listNetworkACLListsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetworkACLLists(cmd))
@@ -2683,6 +2683,49 @@ class Vpn:
cmd.openfirewall = openfirewall
return Vpn(apiclient.createRemoteAccessVpn(cmd).__dict__)
+ @classmethod
+ def createVpnGateway(cls, apiclient, vpcid):
+ """Create VPN Gateway """
+ cmd = createVpnGateway.createVpnGatewayCmd()
+ cmd.vpcid = vpcid
+ return (apiclient.createVpnGateway(cmd).__dict__)
+
+ @classmethod
+ def createVpnConnection(cls, apiclient, s2scustomergatewayid, s2svpngatewayid):
+ """Create VPN Connection """
+ cmd = createVpnConnection.createVpnConnectionCmd()
+ cmd.s2scustomergatewayid = s2scustomergatewayid
+ cmd.s2svpngatewayid = s2svpngatewayid
+ return (apiclient.createVpnGateway(cmd).__dict__)
+
+ @classmethod
+ def resetVpnConnection(cls, apiclient, id):
+ """Reset VPN Connection """
+ cmd = resetVpnConnection.resetVpnConnectionCmd()
+ cmd.id = id
+ return (apiclient.resetVpnConnection(cmd).__dict__)
+
+ @classmethod
+ def deleteVpnConnection(cls, apiclient, id):
+ """Delete VPN Connection """
+ cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+ cmd.id = id
+ return (apiclient.deleteVpnConnection(cmd).__dict__)
+
+ @classmethod
+ def listVpnGateway(cls, apiclient, **kwargs):
+ """List all VPN Gateways matching criteria"""
+ cmd = listVpnGateways.listVpnGatewaysCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ return(apiclient.listVpnGateways(cmd))
+
+ @classmethod
+ def listVpnConnection(cls, apiclient, **kwargs):
+ """List all VPN Connections matching criteria"""
+ cmd = listVpnConnections.listVpnConnectionsCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ return(apiclient.listVpnConnections(cmd))
+
def delete(self, apiclient):
"""Delete remote VPN access"""
@@ -2697,7 +2740,7 @@ class Vpn:
cmd = listRemoteAccessVpns.listRemoteAccessVpnsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listRemoteAccessVpns(cmd))
@@ -2743,7 +2786,7 @@ class VpnUser:
cmd = listVpnUsers.listVpnUsersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVpnUsers(cmd))
@@ -2795,7 +2838,7 @@ class Zone:
cmd = listZones.listZonesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listZones(cmd))
@@ -2832,7 +2875,7 @@ class Pod:
cmd = listPods.listPodsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return apiclient.listPods(cmd)
@@ -2873,7 +2916,7 @@ class PublicIpRange:
cmd = listVlanIpRanges.listVlanIpRangesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVlanIpRanges(cmd))
@classmethod
@@ -2933,7 +2976,7 @@ class PortablePublicIpRange:
cmd = listPortableIpRanges.listPortableIpRangesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listPortableIpRanges(cmd))
class SecondaryStagingStore:
@@ -2969,7 +3012,7 @@ class SecondaryStagingStore:
cmd = listSecondaryStagingStores.listSecondaryStagingStoresCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listSecondaryStagingStores(cmd))
@@ -3006,7 +3049,7 @@ class ImageStore:
cmd = listImageStores.listImageStoresCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listImageStores(cmd))
@@ -3078,7 +3121,7 @@ class PhysicalNetwork:
cmd = listDedicatedGuestVlanRanges.listDedicatedGuestVlanRangesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return apiclient.listDedicatedGuestVlanRanges(cmd)
@classmethod
@@ -3088,7 +3131,7 @@ class PhysicalNetwork:
cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return map(lambda pn: PhysicalNetwork(
pn.__dict__), apiclient.listPhysicalNetworks(cmd))
@@ -3205,7 +3248,7 @@ class SecurityGroup:
cmd = listSecurityGroups.listSecurityGroupsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listSecurityGroups(cmd))
@@ -3278,7 +3321,7 @@ class VpnCustomerGateway:
cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVpnCustomerGateways(cmd))
@@ -3357,7 +3400,7 @@ class Project:
cmd = listProjectAccounts.listProjectAccountsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listProjectAccounts(cmd))
@classmethod
@@ -3367,7 +3410,7 @@ class Project:
cmd = listProjects.listProjectsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listProjects(cmd))
@@ -3405,7 +3448,7 @@ class ProjectInvitation:
cmd = listProjectInvitations.listProjectInvitationsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listProjectInvitations(cmd))
@@ -3428,9 +3471,15 @@ class Configurations:
cmd = listConfigurations.listConfigurationsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listConfigurations(cmd))
+ @classmethod
+ def listCapabilities(cls, apiclient, **kwargs):
+ """Lists capabilities"""
+ cmd = listCapabilities.listCapabilitiesCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ return(apiclient.listCapabilities(cmd))
class NetScaler:
"""Manage external netscaler device"""
@@ -3498,7 +3547,7 @@ class NetScaler:
cmd = listNetscalerLoadBalancers.listNetscalerLoadBalancersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetscalerLoadBalancers(cmd))
@@ -3550,7 +3599,7 @@ class NetworkServiceProvider:
cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNetworkServiceProviders(cmd))
@@ -3605,7 +3654,7 @@ class Router:
cmd = listRouters.listRoutersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listRouters(cmd))
@@ -3651,7 +3700,7 @@ class Tag:
cmd = listTags.listTagsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listTags(cmd))
@@ -3707,7 +3756,7 @@ class VpcOffering:
cmd = listVPCOfferings.listVPCOfferingsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVPCOfferings(cmd))
def delete(self, apiclient):
@@ -3778,7 +3827,7 @@ class VPC:
cmd = listVPCs.listVPCsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVPCs(cmd))
@@ -3790,7 +3839,7 @@ class PrivateGateway:
@classmethod
def create(cls, apiclient, gateway, ipaddress, netmask, vlan, vpcid,
- physicalnetworkid=None):
+ physicalnetworkid=None, aclid=None):
"""Create private gateway"""
cmd = createPrivateGateway.createPrivateGatewayCmd()
@@ -3801,6 +3850,8 @@ class PrivateGateway:
cmd.vpcid = vpcid
if physicalnetworkid:
cmd.physicalnetworkid = physicalnetworkid
+ if aclid:
+ cmd.aclid = aclid
return PrivateGateway(apiclient.createPrivateGateway(cmd).__dict__)
@@ -3818,7 +3869,7 @@ class PrivateGateway:
cmd = listPrivateGateways.listPrivateGatewaysCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listPrivateGateways(cmd))
@@ -3851,7 +3902,7 @@ class AffinityGroup:
cmd = listAffinityGroups.listAffinityGroupsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return apiclient.listAffinityGroups(cmd)
class StaticRoute:
@@ -3882,7 +3933,7 @@ class StaticRoute:
cmd = listStaticRoutes.listStaticRoutesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listStaticRoutes(cmd))
@@ -3916,7 +3967,7 @@ class VNMC:
cmd = listCiscoVnmcResources.listCiscoVnmcResourcesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listCiscoVnmcResources(cmd))
@@ -3960,7 +4011,7 @@ class SSHKeyPair:
cmd = listSSHKeyPairs.listSSHKeyPairsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listSSHKeyPairs(cmd))
@@ -3974,7 +4025,7 @@ class Capacities:
cmd = listCapacity.listCapacityCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listCapacity(cmd))
@@ -3988,7 +4039,7 @@ class Alert:
cmd = listAlerts.listAlertsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listAlerts(cmd))
@@ -4034,7 +4085,7 @@ class InstanceGroup:
cmd = listInstanceGroups.listInstanceGroupsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return (apiclient.listInstanceGroups(cmd))
def startInstances(self, apiclient):
@@ -4108,7 +4159,7 @@ class ASA1000V:
cmd = listCiscoAsa1000vResources.listCiscoAsa1000vResourcesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listCiscoAsa1000vResources(cmd))
class VmSnapshot:
@@ -4128,27 +4179,25 @@ class VmSnapshot:
if description:
cmd.description = description
return VmSnapshot(apiclient.createVMSnapshot(cmd).__dict__)
-
+
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listVMSnapshot.listVMSnapshotCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listVMSnapshot(cmd))
-
+
@classmethod
def revertToSnapshot(cls, apiclient, vmsnapshotid):
cmd = revertToVMSnapshot.revertToVMSnapshotCmd()
cmd.vmsnapshotid = vmsnapshotid
-
return apiclient.revertToVMSnapshot(cmd)
-
+
@classmethod
def deleteVMSnapshot(cls, apiclient, vmsnapshotid):
cmd = deleteVMSnapshot.deleteVMSnapshotCmd()
cmd.vmsnapshotid = vmsnapshotid
-
return apiclient.deleteVMSnapshot(cmd)
class Region:
@@ -4174,7 +4223,7 @@ class Region:
cmd = listRegions.listRegionsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
region = apiclient.listRegions(cmd)
return region
@@ -4274,7 +4323,7 @@ class ApplicationLoadBalancer:
cmd = listLoadBalancers.listLoadBalancersCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listLoadBalancerRules(cmd))
class Resources:
@@ -4290,7 +4339,7 @@ class Resources:
cmd = listResourceLimits.listResourceLimitsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listResourceLimits(cmd))
@classmethod
@@ -4308,7 +4357,7 @@ class Resources:
cmd = updateResourceCount.updateResourceCountCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
return(apiclient.updateResourceCount(cmd))
-
+
class NIC:
"""NIC related API"""
def __init__(self, items):
@@ -4337,9 +4386,9 @@ class NIC:
cmd = listNics.listNicsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return(apiclient.listNics(cmd))
-
+
class IAMGroup:
def __init__(self, items):
self.__dict__.update(items)
@@ -4368,7 +4417,8 @@ class IAMGroup:
cmd = listIAMGroups.listIAMGroupsCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
+ return apiclient.listIAMGroups(cmd)
def addAccount(self, apiclient, accts):
"""Add accounts to iam group"""
@@ -4430,7 +4480,7 @@ class IAMPolicy:
cmd = listIAMPolicies.listIAMPoliciesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
- cmd.listall=True
+ cmd.listall = True
return apiclient.listIAMPoliciesCmd(cmd)
def addPermission(self, apiclient, permission):
@@ -4476,13 +4526,12 @@ class SimulatorMock:
"""Manage simulator mock lifecycle"""
def __init__(self, items):
self.__dict__.update(items)
-
+
@classmethod
def create(cls, apiclient, command, zoneid=None, podid=None,
clusterid=None, hostid=None, value="result:fail",
count=None, jsonresponse=None):
"""Creates simulator mock"""
-
cmd = configureSimulator.configureSimulatorCmd()
cmd.zoneid = zoneid
cmd.podid = podid
@@ -4498,17 +4547,15 @@ class SimulatorMock:
return SimulatorMock(simulatormock.__dict__)
except Exception as e:
raise e
-
+
def delete(self, apiclient):
"""Removes simulator mock"""
-
cmd = cleanupSimulatorMock.cleanupSimulatorMockCmd()
cmd.id = self.id
return apiclient.cleanupSimulatorMock(cmd)
-
+
def query(self, apiclient):
"""Queries simulator mock"""
-
cmd = querySimulatorMock.querySimulatorMockCmd()
cmd.id = self.id
try:
[3/3] git commit: updated refs/heads/master to cdf4047
Posted by ta...@apache.org.
CLOUDSTACK-6282-Added Autometed test for network APIs after incorporating review comments
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cdf4047c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cdf4047c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cdf4047c
Branch: refs/heads/master
Commit: cdf4047ce823edcdd73f9a1562abc9c27f473557
Parents: e9af5f4
Author: monism <mo...@citrix.com>
Authored: Thu May 29 11:37:10 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Thu May 29 18:03:12 2014 +0530
----------------------------------------------------------------------
.../component/test_escalations_networks.py | 2594 ++++++++++++++++++
tools/marvin/marvin/config/test_data.py | 69 +-
tools/marvin/marvin/lib/base.py | 221 +-
3 files changed, 2790 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
[2/3] CLOUDSTACK-6282-Added Autometed test for network APIs after
incorporating review comments
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdf4047c/test/integration/component/test_escalations_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_networks.py b/test/integration/component/test_escalations_networks.py
new file mode 100644
index 0000000..2bf5735
--- /dev/null
+++ b/test/integration/component/test_escalations_networks.py
@@ -0,0 +1,2594 @@
+# 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 Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
+from nose.plugins.attrib import attr
+from time import sleep
+
+class TestNetworks_1(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ try:
+ cls._cleanup = []
+ cls.testClient = super(TestNetworks_1, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+ cls.test_data = cls.testClient.getParsedTestDataConfig()
+ # Get Domain, Zone, Template
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.test_data["ostype"]
+ )
+ if cls.zone.localstorageenabled:
+ cls.storagetype = 'local'
+ cls.test_data["service_offerings"]["tiny"]["storagetype"] = 'local'
+ else:
+ cls.storagetype = 'shared'
+ cls.test_data["service_offerings"]["tiny"]["storagetype"] = 'shared'
+
+ cls.test_data['mode'] = cls.zone.networktype
+ cls.test_data["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+ cls.test_data["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.test_data["virtual_machine"]["template"] = cls.template.id
+ cls.test_data["network_without_acl"]["zoneid"] = cls.zone.id
+ # Create Network offering
+ cls.network_offering = NetworkOffering.create(
+ cls.api_client,
+ cls.test_data["network_offering_vlan"],
+ )
+ # Enable Network offering
+ cls.network_offering.update(cls.api_client, state='Enabled')
+ cls.test_data["network_without_acl"]["networkoffering"] = cls.network_offering.id
+ cls.service_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.test_data["service_offerings"]["tiny"]
+ )
+ # Creating Disk offering, Service Offering and Account
+ cls.account = Account.create(
+ cls.api_client,
+ cls.test_data["account"],
+ domainid=cls.domain.id
+ )
+ # Getting authentication for user in newly created Account
+ cls.user = cls.account.user[0]
+ cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+ cls.account_network = Network.create(
+ cls.userapiclient,
+ cls.test_data["network_without_acl"],
+ cls.account.name,
+ cls.account.domainid
+ )
+ cls._cleanup.append(cls.account_network)
+ cls._cleanup.append(cls.account)
+ cls._cleanup.append(cls.service_offering)
+ cls._cleanup.append(cls.network_offering)
+ except Exception as e:
+ cls.tearDownClass()
+ raise Exception("Warning: Exception in setup : %s" % e)
+ return
+
+ def setUp(self):
+
+ self.apiClient = self.testClient.getApiClient()
+ self.cleanup = []
+
+ def tearDown(self):
+ # Clean up, terminate the created volumes
+ cleanup_resources(self.apiClient, self.cleanup)
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+
+ def __verify_values(self, expected_vals, actual_vals):
+ """
+ @summary: Function to verify expected and actual values
+ Step1: Initializing return flag to True
+ Step2: Verifying length of expected and actual dictionaries is matching.
+ If not matching returning false
+ Step3: Listing all the keys from expected dictionary
+ Step4: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+ If not making return flag to False
+ Step5: returning the return flag after all the values are verified
+ """
+ return_flag = True
+
+ if len(expected_vals) != len(actual_vals):
+ return False
+
+ keys = expected_vals.keys()
+ for i in range(0, len(expected_vals)):
+ exp_val = expected_vals[keys[i]]
+ act_val = actual_vals[keys[i]]
+ if exp_val == act_val:
+ return_flag = return_flag and True
+ else:
+ return_flag = return_flag and False
+ self.debug("expected Value: %s, is not matching with actual value: %s" % (
+ exp_val,
+ act_val
+ ))
+ return return_flag
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_01_list_networks_pagination(self):
+ """
+ @Desc: Test List Networks pagination
+ @Steps
+ Step1 : Listing the networks for a user
+ Step2 : Verifying listed networks for account created at class level
+ Step3 : If number of networks is less than (pagesize 1), then creating them
+ Step4 : Listing the networks again
+ Step5 : Verifying for the length of the networks that it is (pagesize 1)
+ Step6 : Listing and verifying all the networks in page1
+ Step7 : Listing and verifying all the networks in page2
+ Step8 : Verifying that on page 2 only 1 network is present and the network on page 2 is not present in page1
+ """
+ list_zones = Zone.list(
+ self.userapiclient,
+ id=self.zone.id
+ )
+ status = validateList(list_zones)
+ self.assertEquals(PASS, status[0], "No Zones found for a given id")
+ self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
+ # Listing the networks for a user
+ list_networks_before = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # Verifying listed networks for account created at class level
+ if list_networks_before is None:
+ self.assertEqual(
+ len(list_networks_before),
+ 0,
+ "Network create failed at class level"
+ )
+ # If number of networks is less than (pagesize 1), then creating network
+ elif len(list_networks_before) == 1:
+ for i in range(0, (self.test_data["pagesize"])):
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ )
+ self.cleanup.append(network_created)
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":list_zones[0].id,
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ else:
+ self.assertEqual(
+ len(list_networks_before),
+ 1,
+ "more than 1 network created at class level"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ len(list_networks_after),
+ (self.test_data["pagesize"] + 1),
+ "Number of networks created is not matching expected"
+ )
+ # Listing all the networks in page1
+ list_networks_page1 = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=1,
+ pagesize=self.test_data["pagesize"]
+ )
+ status = validateList(list_networks_page1)
+ self.assertEquals(PASS, status[0], "No networks found at page 1")
+ self.assertEqual(
+ len(list_networks_page1),
+ self.test_data["pagesize"],
+ "List network response is not matching with the page size length for page 1"
+ )
+ # Listing all the networks in page2
+ list_networks_page2 = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=2,
+ pagesize=self.test_data["pagesize"]
+ )
+ status = validateList(list_networks_page2)
+ self.assertEquals(PASS, status[0], "No networks found at page 2")
+ self.assertEqual(
+ len(list_networks_page2),
+ 1,
+ "List network response is not matching with the page size length for page 2"
+ )
+ network_page2 = list_networks_page2[0]
+ for i in range(0, len(list_networks_page1)):
+ network_page1 = list_networks_page1[i]
+ self.assertNotEquals(
+ network_page2.id,
+ network_page1.id,
+ "Network listed in page 2 is also listed in page 1"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_02_create_network_without_sourcenat(self):
+ """
+ @Desc: Test create network if supported services doesn't have sourcenat
+ @Steps
+ Step1 : Create Network Offering without sourcenat
+ Step2 : Enable network offering
+ Step3 : Create network with sourcenat diasbled network offering
+ Step4 : Verifying that it raises an exception
+ """
+ # Create Network offering specifically sourcenat disabled
+ network_offering_without_sourcenat = NetworkOffering.create(
+ self.apiClient,
+ self.test_data["network_offering_without_sourcenat"],
+ )
+ if network_offering_without_sourcenat is None:
+ self.fail("Creation of network offering without sourcenat failed")
+ self.cleanup.append(network_offering_without_sourcenat)
+ # Enable network offering
+ network_offering_without_sourcenat.update(self.apiClient, state='Enabled')
+ self.test_data["network_without_acl"]["networkoffering"] = network_offering_without_sourcenat.id
+ # Network create call raise an exception
+ with self.assertRaises(Exception):
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ )
+ if network_created is not None:
+ self.cleanup.append(network_created)
+ self.test_data["network_without_acl"]["networkoffering"] = self.network_offering.id
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_03_list_vpc_pagination(self):
+ """
+ @Desc: Test create vpc with network domain as parameter
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPCs without network domain based on page size
+ Step4 : Verify count of VPCs created
+ Step5 : Listing all the VPCs in page1
+ Step6 : Listing all the VPCs in page2
+ Step7 : Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
+ Step8 : Deleting a single vpc and verifying that vpc does not exists on page 2
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # verify no vpc is present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ for i in range(0, (self.test_data["pagesize"] + 1)):
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ if(i < (self.test_data["pagesize"])):
+ self.cleanup.append(vpc_1)
+ # verify vpc is created and not none
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ # Verify VPC name with test data
+ self.assertNotEquals(
+ -1,
+ vpc_1.name.find(self.test_data["vpc"]["name"]),
+ "VPC name not matched"
+ )
+ # verify zone with test data
+ self.assertEquals(
+ self.zone.id,
+ vpc_1.zoneid,
+ "Zone is not matching in the vpc created"
+ )
+ # Asserting for the length of the VPCs
+ vpc_count_after = VPC.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(vpc_count_after)
+ self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(
+ len(vpc_count_after),
+ (self.test_data["pagesize"] + 1),
+ "Number of VPCs created is not matching expected"
+ )
+ # Listing all the VPCs in page1
+ list_vpcs_page1 = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=1,
+ pagesize=self.test_data["pagesize"]
+ )
+ status = validateList(list_vpcs_page1)
+ self.assertEquals(PASS, status[0], "No vpcs found in Page 1")
+ self.assertEqual(
+ len(list_vpcs_page1),
+ self.test_data["pagesize"],
+ "List vpc response is not matching with the page size length for page 1"
+ )
+ # Listing all the vpcs in page2
+ list_vpcs_page2 = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=2,
+ pagesize=self.test_data["pagesize"]
+ )
+ status = validateList(list_vpcs_page2)
+ self.assertEquals(PASS, status[0], "No vpc found in Page 2")
+ self.assertEqual(
+ 1,
+ len(list_vpcs_page2),
+ "List VPCs response is not matching with the page size length for page 2"
+ )
+ vpc_page2 = list_vpcs_page2[0]
+ # Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
+ for i in range(0, len(list_vpcs_page1)):
+ vpc_page1 = list_vpcs_page1[i]
+ self.assertNotEquals(
+ vpc_page2.id,
+ vpc_page1.id,
+ "VPC listed in page 2 is also listed in page 1"
+ )
+ # Deleting a single vpc and verifying that vpc does not exists on page 2
+ VPC.delete(vpc_1, self.userapiclient)
+ list_vpc_response = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=2,
+ pagesize=self.test_data["pagesize"]
+ )
+ self.assertEqual(
+ list_vpc_response,
+ None,
+ "vpc was not deleted"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_04_create_vpc_with_networkdomain(self):
+ """
+ @Desc: Test create vpc with network domain as parameter
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPC
+ Step4 : List VPC and verify that count is increased by 1
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs for newly created user
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # No VPCs should be present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc_network_domain"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ self.cleanup.append(vpc_1)
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(vpc_list)
+ self.assertEquals(PASS, status[0], "VPC is not created")
+ self.assertEquals(
+ vpc_count_before + 1,
+ len(vpc_list),
+ "VPC is not created"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_05_list_network_offerings_with_and_without_vpc(self):
+ """
+ @Desc: Test list network offerings for vpc true and false parameters
+ @Steps
+ Step1 : List network offering
+ Step2 : Create network offering with default setting of vpc = false
+ Step3 : List network offering
+ Step4 : Verify that count is incremented by 1
+ Step5 : List network offering with additional parameter of vpc = true
+ Step6 : Verify that its count is same as step 1
+ Step7 : List network offering with additional parameter of vpc = false
+ Step8 : Verify that its count is same as step 3
+ """
+ # List all network offering
+ network_offering_before_count = NetworkOffering.list(self.userapiclient)
+ status = validateList(network_offering_before_count)
+ self.assertEquals(PASS, status[0], "Default network offering not present")
+ # List network offering for vpc = true
+ network_offering_vpc_true_before_count = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="true",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_true_before_count)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+ # List network offering
+ network_offering_vpc_false_before_count = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="false",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_false_before_count)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+ # Create network Offering
+ network_offering = NetworkOffering.create(
+ self.apiClient,
+ self.test_data["network_offering_vlan"],
+ )
+ self.assertIsNotNone(network_offering, "Network offering is not created")
+ # Enable Network offering
+ network_offering.update(self.apiClient, state='Enabled')
+ self.cleanup.append(network_offering)
+ # List network offering
+ network_offering_after_count = NetworkOffering.list(self.userapiclient)
+ status = validateList(network_offering_after_count)
+ self.assertEquals(PASS, status[0], "Network Offering list results in null")
+ # Verify that count is incremented by 1
+ self.assertEquals(
+ len(network_offering_before_count) + 1,
+ len(network_offering_after_count),
+ "Network offering is not created"
+ )
+ # List network offering with additional parameter of vpc = true
+ network_offering_vpc_true_after_count = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="true",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_true_after_count)
+ self.assertEquals(PASS, status[0], "Network Offering list results in null")
+ # Verify that its count is same as step 1
+ self.assertEquals(
+ len(network_offering_vpc_true_before_count),
+ len(network_offering_vpc_true_after_count),
+ "Default Network offering is created with vpc as true"
+ )
+ # List network offering with additional parameter of vpc = false
+ network_offering_vpc_false_after_count = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="false",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_false_after_count)
+ self.assertEquals(PASS, status[0], "Network Offering list results in null")
+ # Verify that its count is same as step 3
+ self.assertEquals(
+ len(network_offering_vpc_false_before_count) + 1,
+ len(network_offering_vpc_false_after_count),
+ "Default Network offering is not created with vpc as false"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_06_create_network_in_vpc(self):
+ """
+ @Desc: Test create network in vpc and verify VPC name
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPC
+ Step4 : List VPC and verify that count is increased by 1
+ Step5 : Create network
+ Step6 : List VPCs for specific network created in vpc
+ Step7 : Verify vpc name matches for newly created vpc name and name from vpc list
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient,
+ isdefault="true",
+ )
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs for newly created user
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # No VPCs should be present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(vpc_list)
+ self.assertEquals(PASS, status[0], "VPC is not created")
+ self.assertEquals(
+ vpc_count_before + 1,
+ len(vpc_list),
+ "VPC is not created"
+ )
+ # Listing the networks for a user
+ list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ # List network offering for vpc = true
+ network_offering_vpc_true_list = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="true",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_true_list)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+ # Listing networks in VPC
+ list_networks_in_vpc = Network.list(self.userapiclient,
+ vpcid=vpc_1.id
+ )
+ self.assertIsNone(list_networks_in_vpc, "Networks found for newly created VPC")
+ # If number of networks is 1, then creating network
+ if len(list_networks_before) == 1:
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_1.id,
+ gateway=self.test_data["ntwk"]["gateway"],
+ netmask=self.test_data["ntwk"]["netmask"],
+ domainid=self.domain.id,
+ accountid=self.account.name,
+ )
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ self.cleanup.append(network_created)
+ self.cleanup.append(vpc_1)
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":self.test_data["network_without_acl"]["zoneid"],
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ else:
+ self.assertEqual(
+ len(list_networks_before),
+ 1,
+ "more than 1 network created at class level"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 2,
+ len(list_networks_after),
+ "Number of networks created is not matching expected"
+ )
+ # Listing networks in VPC after creation of network
+ list_networks_in_vpc = Network.list(self.userapiclient,
+ vpcid=vpc_1.id
+ )
+ status = validateList(list_networks_in_vpc)
+ self.assertEquals(PASS, status[0], "No networks found in vpc")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 1,
+ len(list_networks_in_vpc),
+ "Number of networks created in vpc is not matching expected"
+ )
+ # List VPCs for specific network created in vpc
+ vpc_list = VPC.list(
+ self.userapiclient,
+ id=network_created.vpcid
+ )
+ # verify no vpc is present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(PASS, status[0], "VPCs not found.")
+ # verify vpc name matches for newly created vpc name and vpc list name
+ self.assertEqual(
+ vpc_1.name,
+ vpc_list[0].name,
+ "VPC names not matching"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_07_create_delete_network(self):
+ """
+ @Desc: Test delete network
+ @Steps
+ Step1 : Create Network
+ Step2 : Verify Network is created
+ Step3 : Delete Network
+ Step4 : Verify network is deleted
+ """
+ # Listing the networks for a user
+ list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ # List network offering for vpc = false
+ network_offering_vpc_false_list = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="false",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_false_list)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+ # If number of networks is 1, then creating network
+ if len(list_networks_before) == 1:
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ networkofferingid=network_offering_vpc_false_list[0].id,
+ )
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":self.test_data["network_without_acl"]["zoneid"],
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ else:
+ self.assertEqual(
+ len(list_networks_before),
+ 1,
+ "more than 1 network created at class level"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 2,
+ len(list_networks_after),
+ "Number of networks created is not matching expected"
+ )
+ # Delete Network
+ Network.delete(network_created, self.userapiclient)
+ # List Networks
+ list_networks_after_delete = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(list_networks_after_delete)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(
+ 1,
+ len(list_networks_after_delete),
+ "Number of networks created is not matching expected"
+ )
+ # Verify deleted network is not present
+ self.assertNotEquals(
+ network_created.id,
+ list_networks_after_delete[0].id,
+ "Deleted network present"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_08_update_network(self):
+ """
+ @Desc: Test update network
+ @Steps
+ Step1 : Create Network
+ Step2 : Verify Network is created
+ Step3 : Update Network name, display text and network domain
+ Step4 : Verify network is updated
+ """
+ # Listing the networks for a user
+ list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ self.assertEquals(
+ 1,
+ len(list_networks_before),
+ "More than 1 network created at class level"
+ )
+ # List network offering for vpc = false
+ network_offering_vpc_false_list = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="false",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_false_list)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+ # creating network
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ networkofferingid=network_offering_vpc_false_list[0].id,
+ )
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ self.cleanup.append(network_created)
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":self.test_data["network_without_acl"]["zoneid"],
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 2,
+ len(list_networks_after),
+ "Number of networks created is not matching expected"
+ )
+ # Update Network
+ network_updated = Network.update(network_created,
+ self.userapiclient,
+ name="NewNetworkName",
+ displaytext="NewNetworkDisplayText",
+ networkdomain="cs13cloud.internal.new"
+ )
+ # List Networks
+ list_networks_after_update = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after_update)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(
+ 2,
+ len(list_networks_after_update),
+ "Number of networks created is not matching expected"
+ )
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "name":"NewNetworkName",
+ "displaytext":"NewNetworkDisplayText",
+ "networkdomain":"cs13cloud.internal.new"
+ }
+ actual_dict = {
+ "name":network_updated.name,
+ "displaytext":network_updated.displaytext,
+ "networkdomain":network_updated.networkdomain
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_09_list_virtual_machines_single_network(self):
+ """
+ @Desc: Test update network
+ @Steps
+ Step1 : Create Network
+ Step2 : Verify Network is created
+ Step3 : Create Virtual Machine as per page size
+ Step4 : Verify list Virtual machines and pagination
+ """
+ # Listing the networks for a user
+ list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ # Create Virtual Machine
+ # Listing all the instances for a user
+ list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed instances for account created at class level
+ self.assertIsNone(
+ list_instances_before,
+ "Virtual Machine already exists for newly created user"
+ )
+ # If number of instances are less than (pagesize 1), then creating them
+ for i in range(0, (self.test_data["pagesize"] + 1)):
+ vm_created = VirtualMachine.create(
+ self.userapiclient,
+ self.test_data["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkids=list_networks_before[0].id,
+ serviceofferingid=self.service_offering.id,
+ )
+ self.assertIsNotNone(
+ vm_created,
+ "VM creation failed"
+ )
+ if(i < (self.test_data["pagesize"])):
+ self.cleanup.append(vm_created)
+
+ self.assertEqual(
+ self.test_data["virtual_machine"]["displayname"],
+ vm_created.displayname,
+ "Newly created VM name and the test data VM name are not matching"
+ )
+ # Listing all the instances again after creating VM's
+ list_instances_after = VirtualMachine.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ networkid=list_networks_before[0].id
+ )
+ status = validateList(list_instances_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Listing of instances after creation failed"
+ )
+ # Verifying the length of the instances is (page size 1)
+ self.assertEqual(
+ len(list_instances_after),
+ (self.test_data["pagesize"] + 1),
+ "Number of instances created is not matching as expected"
+ )
+ # Listing all the volumes in page1
+ list_instances_page1 = VirtualMachine.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=1,
+ pagesize=self.test_data["pagesize"],
+ networkid=list_networks_before[0].id
+ )
+ status = validateList(list_instances_page1)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Listing of instances in page1 failed"
+ )
+ # Verifying that the length of the instances in page 1 is (page size)
+ self.assertEqual(
+ self.test_data["pagesize"],
+ len(list_instances_page1),
+ "List VM response is not matching with the page size length for page 1"
+ )
+ # Listing all the VM's in page2
+ list_instances_page2 = VirtualMachine.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=2,
+ pagesize=self.test_data["pagesize"],
+ networkid=list_networks_before[0].id
+ )
+ status = validateList(list_instances_page2)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Listing of instances in page2 failed"
+ )
+ # Verifying that the length of the VM's in page 2 is 1
+ self.assertEqual(
+ 1,
+ len(list_instances_page2),
+ "List VM response is not matching with the page size length for page 2"
+ )
+ instance_page2 = list_instances_page2[0]
+ # Deleting a single VM
+ VirtualMachine.delete(vm_created, self.userapiclient)
+ # Listing the VM's in page 2
+ list_instance_response = VirtualMachine.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ page=2,
+ pagesize=self.test_data["pagesize"],
+ networkid=list_networks_before[0].id
+ )
+ # verifying that VM does not exists on page 2
+ self.assertEqual(
+ list_instance_response,
+ None,
+ "VM was not deleted"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_10_list_networks_in_vpc(self):
+ """
+ @Desc: Test list networks in vpc and verify VPC name
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPC
+ Step4 : List VPC and verify that count is increased by 1
+ Step5 : Create network
+ Step6 : List Networks in created vpc
+ Step7 : Verify network name matches for newly created network name and name from network list
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs for newly created user
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # No VPCs should be present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(vpc_list)
+ self.assertEquals(PASS, status[0], "VPC is not created")
+ self.assertEquals(
+ vpc_count_before + 1,
+ len(vpc_list),
+ "VPC is not created"
+ )
+ # Listing the networks for a user
+ list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ # List network offering for vpc = true
+ network_offering_vpc_true_list = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="true",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_true_list)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+ # If number of networks is 1, then creating network
+ if len(list_networks_before) == 1:
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_1.id,
+ gateway=self.test_data["ntwk"]["gateway"],
+ netmask=self.test_data["ntwk"]["netmask"]
+ )
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ self.cleanup.append(network_created)
+ self.cleanup.append(vpc_1)
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":self.test_data["network_without_acl"]["zoneid"],
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ else:
+ self.assertEqual(
+ len(list_networks_before),
+ 1,
+ "more than 1 network created at class level"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 2,
+ len(list_networks_after),
+ "Number of networks created is not matching expected"
+ )
+ # Listing the networks
+ list_networks_in_vpc = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"],
+ vpcid=vpc_1.id
+ )
+ status = validateList(list_networks_in_vpc)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Verify network name matches for newly created network name and name from network list
+ self.assertEqual(
+ network_created.name,
+ list_networks_in_vpc[0].name,
+ "Network names not matching"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_11_update_vpc(self):
+ """
+ @Desc: Test create vpc with network domain as parameter
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPCs
+ Step4 : Verify count of VPCs created
+ Step5 : Update VPC name and display text
+ Step6 : Verify name and display text is updated
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # verify no vpc is present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ self.cleanup.append(vpc_1)
+ # verify vpc is created and not none
+ # Verify VPC name with test data
+ self.assertNotEquals(
+ -1,
+ vpc_1.name.find(self.test_data["vpc"]["name"]),
+ "VPC name not matched"
+ )
+ # verify zone with test data
+ self.assertEquals(
+ self.zone.id,
+ vpc_1.zoneid,
+ "Zone is not matching in the vpc created"
+ )
+ # Asserting for the length of the VPCs
+ vpc_count_after = VPC.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(vpc_count_after)
+ self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(
+ 1,
+ len(vpc_count_after),
+ "Number of VPCs created is not matching expected"
+ )
+ # Update VPC
+ vpc_updated = VPC.update(
+ vpc_1,
+ self.userapiclient,
+ name="NewVPCName",
+ displaytext="NewVPCDisplayText",
+ )
+ # List Networks
+ list_vpcs_after_update = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(list_vpcs_after_update)
+ self.assertEquals(PASS, status[0], "No vpcs found using list call")
+ self.assertEqual(
+ 1,
+ len(list_vpcs_after_update),
+ "Number of vpcs created is not matching expected"
+ )
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "name":"NewVPCName",
+ "displaytext":"NewVPCDisplayText",
+ }
+ actual_dict = {
+ "name":vpc_updated.name,
+ "displaytext":vpc_updated.displaytext,
+ }
+ vpc_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ vpc_status,
+ "Listed vpc details are not as expected"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_12_list_create_delete_networkACL(self):
+ """
+ @Desc: Test create network in vpc and verify VPC name
+ @Steps
+ Step1 : List VPC Offering
+ Step2 : List VPCs for newly created user
+ Step3 : Create VPC
+ Step4 : List VPC and verify that count is increased by 1
+ Step5 : Create network
+ Step6 : Verify network is created
+ Step7 : List Network ACLs
+ Step8 : Create Network ACL
+ Step9 : Verify NetworkACL is created
+ Step10 : Delete NetworkACL
+ Step11 : Verify NetworkACL is deleted
+ """
+ # List VPC Offering
+ vpc_offs_list = VpcOffering.list(self.userapiclient,
+ isdefault="true",
+ )
+ if vpc_offs_list is None:
+ self.fail("Default VPC offerings not found")
+ else:
+ vpc_offs = vpc_offs_list[0]
+ # List VPCs for newly created user
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # No VPCs should be present for newly created user
+ status = validateList(vpc_list)
+ self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ vpc_count_before = 0
+ vpc_1 = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ vpcofferingid=vpc_offs.id,
+ zoneid=self.zone.id,
+ )
+ self.assertIsNotNone(vpc_1, "VPC is not created")
+ # List VPCs
+ vpc_list = VPC.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(vpc_list)
+ self.assertEquals(PASS, status[0], "VPC is not created")
+ self.assertEquals(
+ vpc_count_before + 1,
+ len(vpc_list),
+ "VPC is not created"
+ )
+ # Listing the networks for a user
+ list_networks_before = Network.list(
+ self.userapiclient,
+ listall=self.test_data["listall"]
+ )
+ # Verifying listed networks for account created at class level
+ self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+ # List network offering for vpc = true
+ network_offering_vpc_true_list = NetworkOffering.list(
+ self.userapiclient,
+ forvpc="true",
+ zoneid=self.zone.id,
+ guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+ supportedServices="SourceNat",
+ specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+ state="Enabled"
+ )
+ status = validateList(network_offering_vpc_true_list)
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+ # Listing networks in VPC
+ list_networks_in_vpc = Network.list(self.userapiclient,
+ vpcid=vpc_1.id
+ )
+ self.assertIsNone(list_networks_in_vpc, "Networks found for newly created VPC")
+ # If number of networks is 1, then creating network
+ if len(list_networks_before) == 1:
+ network_created = Network.create(
+ self.userapiclient,
+ self.test_data["network_without_acl"],
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_1.id,
+ gateway=self.test_data["ntwk"]["gateway"],
+ netmask=self.test_data["ntwk"]["netmask"],
+ domainid=self.domain.id,
+ accountid=self.account.name,
+ )
+ self.cleanup.append(network_created)
+ self.cleanup.append(vpc_1)
+ self.assertIsNotNone(
+ network_created,
+ "Network is not created"
+ )
+ # Creating expected and actual values dictionaries
+ expected_dict = {
+ "id":self.test_data["network_without_acl"]["zoneid"],
+ "name":self.test_data["network_without_acl"]["name"],
+ }
+ actual_dict = {
+ "id":network_created.zoneid,
+ "name":network_created.name,
+ }
+ network_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ network_status,
+ "Listed network details are not as expected"
+ )
+ else:
+ self.assertEqual(
+ len(list_networks_before),
+ 1,
+ "more than 1 network created at class level"
+ )
+ # Listing the networks
+ list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"])
+ status = validateList(list_networks_after)
+ self.assertEquals(PASS, status[0], "No networks found using list call")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 2,
+ len(list_networks_after),
+ "Number of networks created is not matching expected"
+ )
+ # Listing networks in VPC after creation of network
+ list_networks_in_vpc = Network.list(self.userapiclient,
+ vpcid=vpc_1.id
+ )
+ status = validateList(list_networks_in_vpc)
+ self.assertEquals(PASS, status[0], "No networks found in vpc")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 1,
+ len(list_networks_in_vpc),
+ "Number of networks created in vpc is not matching expected"
+ )
+ # List VPCs for specific network created in vpc
+ vpc_list = VPC.list(
+ self.userapiclient,
+ id=network_created.vpcid
+ )
+ # List Network ACLs
+ list_network_acl = NetworkACL.list(
+ self.userapiclient,
+ networkid=network_created.id
+ )
+ self.assertIsNone(list_network_acl, "ACL list is not empty for newly created network")
+ # Create NetworkACL
+ network_acl_created = NetworkACL.create(
+ self.userapiclient,
+ self.test_data["network_acl_rule"],
+ networkid=network_created.id
+ )
+ self.assertIsNotNone(
+ network_acl_created,
+ "NetworkACL is not created"
+ )
+ # List Network ACL
+ list_network_acl = NetworkACL.list(
+ self.userapiclient,
+ networkid=network_created.id
+ )
+ status = validateList(list_network_acl)
+ self.assertEquals(PASS, status[0], "No networks acls found after creating")
+ # Asserting for the length of the networks
+ self.assertEqual(
+ 1,
+ len(list_network_acl),
+ "Number of networks acls reated is not matching expected"
+ )
+ # Delete Network ACL
+ NetworkACL.delete(network_acl_created, self.userapiclient)
+ # List Network ACL
+ list_network_acl = NetworkACL.list(
+ self.userapiclient,
+ networkid=network_created.id
+ )
+ self.assertIsNone(list_network_acl, "ACL list is not empty for newly created network")
+ return
+
+class TestNetworks_2(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ try:
+ cls._cleanup = []
+ cls.testClient = super(TestNetworks_2, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+ cls.test_data = cls.testClient.getParsedTestDataConfig()
+ # Get Domain, Zone, Template
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.test_data["ostype"]
+ )
+ cls.test_data['mode'] = cls.zone.networktype
+ cls.account = Account.create(
+ cls.api_client,
+ cls.test_data["account"],
+ domainid=cls.domain.id
+ )
+ # Getting authentication for user in newly created Account
+ cls.user = cls.account.user[0]
+ cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+ cls._cleanup.append(cls.account)
+ except Exception as e:
+ cls.tearDownClass()
+ raise Exception("Warning: Exception in setup : %s" % e)
+ return
+
+ def setUp(self):
+
+ self.apiClient = self.testClient.getApiClient()
+ self.cleanup = []
+
+ def tearDown(self):
+ # Clean up, terminate the created volumes
+ cleanup_resources(self.apiClient, self.cleanup)
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+
+ def __verify_values(self, expected_vals, actual_vals):
+ """
+ @summary: Function to verify expected and actual values
+ Step1: Initializing return flag to True
+ Step1: Verifying length of expected and actual dictionaries is matching.
+ If not matching returning false
+ Step2: Listing all the keys from expected dictionary
+ Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+ If not making return flag to False
+ Step4: returning the return flag after all the values are verified
+ """
+ return_flag = True
+
+ if len(expected_vals) != len(actual_vals):
+ return False
+
+ keys = expected_vals.keys()
+ for i in range(0, len(expected_vals)):
+ exp_val = expected_vals[keys[i]]
+ act_val = actual_vals[keys[i]]
+ if exp_val == act_val:
+ return_flag = return_flag and True
+ else:
+ return_flag = return_flag and False
+ self.debug("expected Value: %s, is not matching with actual value: %s" % (
+ exp_val,
+ act_val
+ ))
+ return return_flag
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_13_list_vpc_byid(self):
+ """
+ @summary: Test List VPC with Id
+ @Steps
+ Step1: Listing all the vpc for a user before creating a vpc
+ Step2: Verifying no VPCs are listed
+ Step3: Creating a vpc
+ Step4: Listing the vpc for a user after creating a vpc
+ Step5: Verifying the list vpc size is increased by 1
+ Step6: Listing the vpc by specifying vpc ID
+ Step7: Verifying the list vpc size is 1
+ Step8: Verifying the details of the vpc
+ """
+ # Listing all the vpc's for a user
+ list_vpc_before = VPC.list(self.userapiclient)
+ # Verifying No VPCs are listed
+ self.assertIsNone(
+ list_vpc_before,
+ "Vpc listed for newly created user"
+ )
+ # Listing VPC Offerings
+ list_vpc_offering = VpcOffering.list(self.userapiclient)
+ status = validateList(list_vpc_offering)
+ self.assertEquals(PASS, status[0], "list vpc offering is none")
+ # Creating a vpc
+ vpc_created = VPC.create(
+ self.userapiclient,
+ self.test_data["vpc"],
+ list_vpc_offering[0].id,
+ self.zone.id
+ )
+ self.assertIsNotNone(vpc_created, "VPC Creation Failed")
+ self.cleanup.append(vpc_created)
+ # Listing the vpc for a user after creating a vpc
+ list_vpc_after = VPC.list(self.userapiclient)
+ status = validateList(list_vpc_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "list VPC not as expected"
+ )
+ # Verifying the list vpc size is increased by 1
+ self.assertEquals(
+ 1,
+ len(list_vpc_after),
+ "list VPC not equal as expected"
+ )
+ # List the vpc by specifying vpc ID
+ list_vpc_byid = VPC.list(
+ self.userapiclient,
+ id=vpc_created.id,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(list_vpc_byid)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "list VPC not as expected"
+ )
+ # Verifying the list vpc size is 1
+ self.assertEquals(
+ 1,
+ len(list_vpc_byid),
+ "list VPC not equal as expected"
+ )
+ # Verifying the details of the vpc
+ expected_dict = {
+ "cidr":self.test_data["vpc"]["cidr"],
+ "id":vpc_created.id,
+ "displaytext":vpc_created.displaytext,
+ "account":self.account.name,
+ "domain":vpc_created.domain,
+ "domainid":self.domain.id,
+ "name":vpc_created.name
+ }
+ actual_dict = {
+ "cidr":str(list_vpc_byid[0].cidr),
+ "id":list_vpc_byid[0].id,
+ "displaytext":list_vpc_byid[0].displaytext,
+ "account":list_vpc_byid[0].account,
+ "domain":list_vpc_byid[0].domain,
+ "domainid":list_vpc_byid[0].domainid,
+ "name":list_vpc_byid[0].name
+ }
+ list_vpc_status = self.__verify_values(
+ expected_dict,
+ actual_dict
+ )
+ self.assertEqual(
+ True,
+ list_vpc_status,
+ "Listed VPC details are not as expected"
+ )
+ return
+
+ @attr(tags=["advanced", "provisioning"])
+ def test_14_list_public_ipadress_by_associated_networkid(self):
+ """
+ @summary: Test List Public IPAddress with associatednetworkid
+ @Steps
+ Step1: Listing all the public ipadresses for a user before creating a public ipaddress
+ Step2: Verifying no Public ipaddress are listed
+ Step3: Creating a network
+ Step4: Associating public ipaddress for network created in step3
+ Step5: Listing the public ipaddress for a user after creating a public ipaddress
+ Step6: Verifying the list public ipaddress size is increased by 1
+ Step7: Listing the public ipaddress by specifying associatednetworkid
+ Step8: Verifying the list public ipaddress size is 1
+ Step9: Verifying the details of the public ipaddress
+ """
+ # Listing all the public ipadresses for a user
+ list_public_ipadress_before = PublicIPAddress.list(self.userapiclient)
+ # Verifying No VPCs are listed
+ self.assertIsNone(
+ list_public_ipadress_before,
+ "Public ipaddresses listed for newly created user"
+ )
+ # Listing Network Offerings
+ network_offerings_list = NetworkOffering.list(
+ self.apiClient,
+ forvpc="false",
+ guestiptype="Isolated",
+ state="Enabled",
+ supportedServices="SourceNat",
+ zoneid=self.zone.id
+ )
+ self.assertIsNotNone(
+ network_offerings_list,
+ "Isolated Network Offerings with sourceNat enabled are not found"
+ )
+ # Creating a Network
+ network = Network.create(
+ self.userapiclient,
+ self.test_data["network"],
+ accountid=self.account.name,
+ domainid=self.domain.id,
+ networkofferingid=network_offerings_list[0].id,
+ zoneid=self.zone.id
+ )
+ self.assertIsNotNone(
+ network,
+ "Network creation failed"
+ )
+ self.cleanup.append(network)
+ # Associating public ipaddress for network created
+ public_ipaddress_created = PublicIPAddress.create(
+ self.userapiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.domain.id,
+ networkid=network.id
+ )
+ self.assertIsNotNone(
+ public_ipaddress_created,
+ "Failed to Associate Public IpAddress for Network"
+ )
+ # Listing the public ipaddress for a user after associating a public ipaddress for network
+ list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
+ status = validateList(list_public_ipaddress_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "list Public IPAddress not as expected"
+ )
+ # Verifying the list public ipaddress size is increased by 1
+ self.assertEquals(
+ 1,
+ len(list_public_ipaddress_after),
+ "list Public IPAddress not equal as expected"
+ )
+ # List the public ipaddress by specifying public ipaddress ID
+ list_public_ipaddress_byid = PublicIPAddress.list(
+ self.userapiclient,
+ associatednetworkid=network.id,
+ listall=self.test_data["listall"]
+ )
+ status = validateList(list_public_ipaddress_byid)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "list
<TRUNCATED>