Github user jburwell commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1578#discussion_r77756715
--- Diff: test/integration/plugins/nuagevsp/nuageTestCase.py ---
@@ -631,195 +753,257 @@ def check_Router_state(self, router, state=None):
self.assertEqual(routers[0].state, state,
"Virtual router is not in the expected state"
)
- self.debug("Successfully validated the deployment and state of
Router - %s" % router.name)
+ self.debug("Successfully validated the deployment and state of
Router "
+ "- %s" % router.name)
- # validate_PublicIPAddress - Validates if the given public IP address
is in the expected state form the list of
- # fetched public IP addresses
- def validate_PublicIPAddress(self, public_ip, network,
static_nat=False, vm=None):
+ # validate_PublicIPAddress - Validates if the given public IP address
is in
+ # the expected state form the list of fetched public IP addresses
+ def validate_PublicIPAddress(self, public_ip, network,
static_nat=False,
+ vm=None):
"""Validates the Public IP Address"""
- self.debug("Validating the assignment and state of public IP
address - %s" % public_ip.ipaddress.ipaddress)
+ self.debug("Validating the assignment and state of public IP
address "
+ "- %s" % public_ip.ipaddress.ipaddress)
public_ips = PublicIPAddress.list(self.api_client,
id=public_ip.ipaddress.id,
networkid=network.id,
isstaticnat=static_nat,
listall=True
)
self.assertEqual(isinstance(public_ips, list), True,
- "List public IP for network should return a valid
list"
+ "List public IP for network should return a "
+ "valid list"
)
- self.assertEqual(public_ips[0].ipaddress,
public_ip.ipaddress.ipaddress,
- "List public IP for network should list the
assigned public IP address"
+ self.assertEqual(public_ips[0].ipaddress,
+ public_ip.ipaddress.ipaddress,
+ "List public IP for network should list the
assigned "
+ "public IP address"
)
self.assertEqual(public_ips[0].state, "Allocated",
"Assigned public IP is not in the allocated state"
)
if static_nat and vm:
self.assertEqual(public_ips[0].virtualmachineid, vm.id,
- "Static NAT rule is not enabled for the VM on
the assigned public IP"
+ "Static NAT rule is not enabled for the VM on
"
+ "the assigned public IP"
)
- self.debug("Successfully validated the assignment and state of
public IP address - %s" %
- public_ip.ipaddress.ipaddress)
+ self.debug("Successfully validated the assignment and state of
public "
+ "IP address - %s" % public_ip.ipaddress.ipaddress)
- # VSD verifications
- # VSD is a programmable policy and analytics engine of Nuage VSP SDN
platform
+ # VSD verifications; VSD is a programmable policy and analytics engine
of
+ # Nuage VSP SDN platform
- # get_externalID_filter - Returns corresponding external ID filter of
the given object in VSD
+ # get_externalID_filter - Returns corresponding external ID filter of
the
+ # given object in VSD
def get_externalID_filter(self, object_id):
ext_id = object_id + "@" + self.cms_id
return self.vsd.set_externalID_filter(ext_id)
# fetch_by_externalID - Returns VSD object with the given external ID
def fetch_by_externalID(self, fetcher, *cs_objects):
- """ Fetches a child object by external id using the given fetcher,
and uuids of the given cloudstack objects.
+ """ Fetches a child object by external id using the given fetcher,
and
+ uuids of the given cloudstack objects.
E.G.
- -
fetch_by_external_id(vsdk.NUSubnet(id="954de425-b860-410b-be09-c560e7dbb474").vms,
cs_vm)
- - fetch_by_external_id(session.user.floating_ips, cs_network,
cs_public_ip)
+ - fetch_by_external_id(vsdk.NUSubnet
+ (id="954de425-b860-410b-be09-c560e7dbb474").vms, cs_vm)
+ - fetch_by_external_id
+ (session.user.floating_ips, cs_network, cs_public_ip)
:param fetcher: VSPK Fetcher to use to find the child entity
:param cs_objects: Cloudstack objects to take the UUID from.
:return: the VSPK object having the correct externalID
"""
- return fetcher.get_first(filter="externalID BEGINSWITH '%s'" %
":".join([o.id for o in cs_objects]))
+ return fetcher.get_first(filter="externalID BEGINSWITH '%s'" %
+ ":".join([o.id for o in
cs_objects]))
- # verify_vsd_network - Verifies the given domain and network/VPC
against the corresponding installed enterprise,
- # domain, zone, and subnet in VSD
+ # verify_vsd_network - Verifies the given CloudStack domain and
network/VPC
+ # against the corresponding installed enterprise, domain, zone, and
subnet
+ # in VSD
def verify_vsd_network(self, domain_id, network, vpc=None):
- self.debug("Verifying the creation and state of Network - %s in
VSD" % network.name)
- vsd_enterprise =
self.vsd.get_enterprise(filter=self.get_externalID_filter(domain_id))
- ext_network_filter = self.get_externalID_filter(vpc.id) if vpc
else self.get_externalID_filter(network.id)
+ self.debug("Verifying the creation and state of Network - %s in
VSD" %
+ network.name)
+ vsd_enterprise = self.vsd.get_enterprise(
+ filter=self.get_externalID_filter(domain_id))
+ ext_network_filter = self.get_externalID_filter(vpc.id) if vpc \
+ else self.get_externalID_filter(network.id)
vsd_domain = self.vsd.get_domain(filter=ext_network_filter)
vsd_zone = self.vsd.get_zone(filter=ext_network_filter)
- vsd_subnet =
self.vsd.get_subnet(filter=self.get_externalID_filter(network.id))
+ vsd_subnet = self.vsd.get_subnet(
+ filter=self.get_externalID_filter(network.id))
self.assertEqual(vsd_enterprise.name, domain_id,
- "VSD enterprise name should match CloudStack
domain uuid"
+ "VSD enterprise name should match CloudStack
domain "
+ "uuid"
)
if vpc:
self.assertEqual(vsd_domain.description, "VPC_" + vpc.name,
- "VSD domain description should match VPC name
in CloudStack"
+ "VSD domain description should match VPC name
in "
+ "CloudStack"
)
self.assertEqual(vsd_zone.description, "VPC_" + vpc.name,
- "VSD zone description should match VPC name
in CloudStack"
+ "VSD zone description should match VPC name
in "
+ "CloudStack"
)
else:
self.assertEqual(vsd_domain.description, network.name,
- "VSD domain description should match network
name in CloudStack"
+ "VSD domain description should match network "
+ "name in CloudStack"
)
self.assertEqual(vsd_zone.description, network.name,
- "VSD zone description should match network
name in CloudStack"
+ "VSD zone description should match network
name "
+ "in CloudStack"
)
self.assertEqual(vsd_subnet.description, network.name,
- "VSD subnet description should match network name
in CloudStack"
+ "VSD subnet description should match network name
in "
+ "CloudStack"
+ )
+ self.debug("Successfully verified the creation and state of
Network "
+ "- %s in VSD" % network.name)
+
+ # verify_vsd_object_status - Verifies the given CloudStack object
status in
+ # VSD
+ def verify_vsd_object_status(self, cs_object, stopped):
+ vsd_object = self.vsd.get_vm(
+ filter=self.get_externalID_filter(cs_object.id))
+ expected_status = cs_object.state.upper() if not stopped \
+ else "DELETE_PENDING"
+ tries = 0
+ while (vsd_object.status != expected_status) and (tries < 3):
+ self.debug("Waiting for the CloudStack object " +
cs_object.name +
+ " to be fully resolved in VSD...")
+ time.sleep(30)
--- End diff --
Please replace with ``utils.wait_until`` which is a more responsive and
robust mechanism to wait until a condition is met.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---