Update gbpfunctest to account for auto-ptg - Redux
A test in the gbpfunctest functional test suite occassionally fails in the aim gate job. This is because it does not take into consideration the presense of an auto-ptg in addition to a PTG that it creates. It tries to check if the PTG that it created is assocaited with the relevant L2P or not by scrapping the output of the show command. If the created PTG is the first in the displayed list of PTGs in the L2P show output, the test passes, else it fails. This patch updates the test logic to account for the additional auto-ptg. A fix was earlier committed to solve this: I57b925081273300cfc3e5320af6e05a868d0759e but it did not fix the issue completely. Change-Id: Ieeb4ec68bbd6f9f400efad7e2a0b6e477bb5f852
This commit is contained in:
parent
4fab111bd1
commit
0b635a961c
@ -249,7 +249,7 @@ class Gbp_Verify(object):
|
|||||||
cmd = 'gbp %s-show ' % verifyobj_dict[verifyobj] + str(name_uuid)
|
cmd = 'gbp %s-show ' % verifyobj_dict[verifyobj] + str(name_uuid)
|
||||||
# Execute the policy-object-verify-cmd
|
# Execute the policy-object-verify-cmd
|
||||||
cmd_out = commands.getoutput(cmd)
|
cmd_out = commands.getoutput(cmd)
|
||||||
#_log.info(cmd_out)
|
# _log.info(cmd_out)
|
||||||
# Catch for non-exception error strings
|
# Catch for non-exception error strings
|
||||||
for err in self.err_strings:
|
for err in self.err_strings:
|
||||||
if re.search('\\b%s\\b' % (err), cmd_out, re.I):
|
if re.search('\\b%s\\b' % (err), cmd_out, re.I):
|
||||||
@ -277,21 +277,18 @@ class Gbp_Verify(object):
|
|||||||
for arg, val in kwargs.items():
|
for arg, val in kwargs.items():
|
||||||
if re.search("\\b%s\\b\s+\| \\b%s\\b.*" %
|
if re.search("\\b%s\\b\s+\| \\b%s\\b.*" %
|
||||||
(arg, val), cmd_out, re.I) is None:
|
(arg, val), cmd_out, re.I) is None:
|
||||||
if arg == 'policy_target_groups' and (
|
# incase of attribute has more than one value then
|
||||||
re.search("\\b.*\| \\b%s\\b.*" %
|
# then below function will help us validating the values
|
||||||
(val), cmd_out, re.I) is not None):
|
# or the only value among all for the given attr.
|
||||||
# there might be more than one PTG associated
|
# Example: L2P can have multiple PTGs, L3P can have multi
|
||||||
# with the L2P if auto-ptg is enabled, so search
|
# L2Ps
|
||||||
# in the entire command output if the ptg_id
|
if not self.gbp_obj_ver_attr_all_values(
|
||||||
# we are looking for is present, and if its
|
verifyobj, name_uuid, arg, [val]):
|
||||||
# present do not fail
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_log.info(cmd_out)
|
|
||||||
_log.info(
|
_log.info(
|
||||||
"The Attribute== %s and its Value== %s DID NOT "
|
"The Attribute== %s and its Value== %s "
|
||||||
"MATCH for the PolicyObject == %s" %
|
"DID NOT MATCH "
|
||||||
(arg, val, verifyobj))
|
"for the PolicyObject == %s" % (
|
||||||
|
arg, val, verifyobj))
|
||||||
return 0
|
return 0
|
||||||
if verifyobj == "l2p":
|
if verifyobj == "l2p":
|
||||||
match = re.search(
|
match = re.search(
|
||||||
|
Loading…
Reference in New Issue
Block a user