def cleanup(self, fail=0): for obj in ['node', 'spec']: self.gbpcfg.gbp_del_all_anyobj(obj) if fail != 0: self._log.info("\n## TESTCASE_GBP_RI_FUNC_4: FAILED") utils_libs.report_results('test_gbp_ri_func_4', 'test_results.txt') sys.exit(1)
def main(): print('For now skipping this entire suite ..') sys.exit(1) # Run the Testcases: test = test_gbp_prs_func() if test.test_gbp_prs_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_1') if test.test_gbp_prs_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_2') if test.test_gbp_prs_func_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_3') if test.test_gbp_prs_func_4() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_4') if sys.argv[1] == 'aci': test._log.info( "\nTESTCASE_GBP_PRS_FUNC_5: TO CREATE/VERIFY/DELETE/VERIFY a " "PARENT and CHILD POLICY RULESET\n") test._log.info("\nTESTCASE_GBP_PRS_FUNC_5: NOT SUPPORTED in ACI") test._log.info( "\nTESTCASE_GBP_PRS_FUNC_6: TO CHANGE/UPDATE/DELETE/VERIFY PARENT " "and CHILD POLICY RULESET\n") test._log.info("\nTESTCASE_GBP_PRS_FUNC_6: NOT SUPPORTED in ACI") else: if test.test_gbp_prs_func_5() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_5') if test.test_gbp_prs_func_6() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_6') test.cleanup() utils_libs.report_results('test_gbp_prs_func', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcases: test = test_gbp_prs_func() if test.test_gbp_prs_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_1') if test.test_gbp_prs_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_2') if test.test_gbp_prs_func_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_3') if test.test_gbp_prs_func_4() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_4') if sys.argv[1] == 'aci': test._log.info( "\nTESTCASE_GBP_PRS_FUNC_5: TO CREATE/VERIFY/DELETE/VERIFY " "a PARENT and CHILD POLICY RULESET\n") test._log.info("\nTESTCASE_GBP_PRS_FUNC_5: NOT SUPPORTED in ACI") test._log.info( "\nTESTCASE_GBP_PRS_FUNC_6: TO CHANGE/UPDATE/DELETE/VERIFY " "PARENT and CHILD POLICY RULESET\n") test._log.info("\nTESTCASE_GBP_PRS_FUNC_6: NOT SUPPORTED in ACI") else: if test.test_gbp_prs_func_5() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_5') if test.test_gbp_prs_func_6() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_FUNC_6') test.cleanup() utils_libs.report_results('test_gbp_prs_func', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcase: test = test_gbp_pa_func() test.test_cr_ver_del_ver_default() test.test_upd_ver_del() utils_libs.report_results('test_gbp_pa_func', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcases: test = test_gbp_prs_pr_shared_func() if test.test_gbp_prs_pr_shared_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_PR_SHARED_INTEG_1') if test.test_gbp_prs_pr_shared_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_PR_SHARED_INTEG_2') test.cleanup() utils_libs.report_results('test_gbp_prs_pr_shared_func', 'test_results_admin.txt') sys.exit(1)
def main(): # Run the Testcases: test = test_gbp_l2p_func() if test.test_gbp_l2p_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_L2P_FUNC_1') if test.test_gbp_l2p_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_L2P_FUNC_2') test.cleanup() utils_libs.report_results('test_gbp_l2p_func', 'test_results.txt') sys.exit(1)
def main(): print('For now skipping this entire suite ..') sys.exit(1) # Run the Testcases: test = test_gbp_prs_pr_shared_func() if test.test_gbp_prs_pr_shared_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_PR_SHARED_INTEG_1') if test.test_gbp_prs_pr_shared_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_PR_SHARED_INTEG_2') test.cleanup() utils_libs.report_results('test_gbp_prs_pr_shared_func', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcases: test = test_gbp_prs_neg() if test.test_gbp_prs_neg_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_NEG_1') if test.test_gbp_prs_neg_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_NEG_2') if test.test_gbp_prs_neg_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PRS_NEG_3') test.cleanup() utils_libs.report_results('test_gbp_prs_neg', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcases: env_flag = sys.argv[1] test = test_gbp_ptg_func(env_flag) test.global_cfg() if test.test_gbp_ptg_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PTG_FUNC_1') test.global_cfg() # Making global_cfg available for the subsequent TC if test.test_gbp_ptg_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PTG_FUNC_2') test.global_cfg() if test.test_gbp_ptg_func_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PTG_FUNC_3') test.cleanup() utils_libs.report_results('test_gbp_ptg_func', 'test_results.txt') sys.exit(1)
def cleanup(self, cfgobj, uuid_name, fail=0): if isinstance(cfgobj, str): cfgobj = [cfgobj] if isinstance(uuid_name, str): uuid_name = [uuid_name] for obj, _id in zip(cfgobj, uuid_name): if self.gbpcfg.gbp_policy_cfg_all(0, obj, _id): self._log.info( 'Success in Clean-up/Delete of Policy Object %s\n' % (obj)) else: self._log.info( 'Failed to Clean-up/Delete of Policy Object %s\n' % (obj)) if fail != 0: self._log.info("\n## TESTCASE_GBP_RI_FUNC_1: FAILED") utils_libs.report_results('test_gbp_ri_func_1', 'test_results.txt') sys.exit(1)
def main(): print ('For now skipping this entire suite ' 'TESTCASE_GBP_PR_PC_PA_SHARED_INTEG* ...') sys.exit(1) # Run the Testcases: test = test_gbp_pr_pc_pa_shared_func() if test.test_gbp_pr_pc_pa_shared_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_PC_PA_SHARED_INTEG_1') if test.test_gbp_pr_pc_pa_shared_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_PC_PA_SHARED_INTEG_2') if test.test_gbp_pr_pc_pa_shared_func_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_PC_PA_SHARED_INTEG_3') if test.test_gbp_pr_pc_pa_shared_func_4() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_PC_PA_SHARED_INTEG_4') test.cleanup() utils_libs.report_results('test_gbp_pr_pc_pa_shared_func', 'test_results.txt') sys.exit(1)
def run(self): self._log.info("\n## TESTCASE_GBP_RI_FUNC_4: RESOURCE INTEGRITY AMONG " "SERVICE-CHAIN OBJECTS") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info("\n## Step 1: Create Service Chain Nodes LB & FW ##\n") lb_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'node', self.lb_name) if lb_uuid == 0: self._log.info( "# Step 1: Create Service Chain Loadbalance Node == Failed") self.cleanup(fail=1) fw_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'node', self.lb_name) if fw_uuid == 0: self._log.info( "# Step 1A: Create Service Chain Firewall Node == Failed") self.cleanup(fail=1) ###### self._log.info("\n## Step 2: Create ServiceChain Spec ##\n") # Ensur that node names or node uuids passed as val to param # 'nodes',MUST be in order of FW and then LB.. this order is required # from gbp pov spec_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'spec', self.spec_name, nodes='%s %s' % (fw_uuid, lb_uuid)) if spec_uuid == 0: self._log.info("# Step 2: Create ServiceChain Spec == Failed") self.cleanup(fail=1) ###### self._log.info("\n## Step 3: Delete the Service Chain Nodes ##\n") cnt = 0 for nodeid in [lb_uuid, fw_uuid]: if self.gbpcfg.gbp_sc_cfg_all(0, 'node', nodeid) != 0: self._log.info( "# Step 4: Deletion of ServiceChain did NOT fail") cnt += 1 if cnt > 0: self.cleanup(fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_4: PASSED") self.cleanup() utils_libs.report_results('test_gbp_ri_func_4', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcases: test = test_gbp_pr_func() if test.test_gbp_pr_func_1() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_1') if test.test_gbp_pr_func_2() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_2') if test.test_gbp_pr_func_3() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_3') if test.test_gbp_pr_func_4() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_4') if test.test_gbp_pr_func_5() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_5') if test.test_gbp_pr_func_6() == 0: test.cleanup(tc_name='TESTCASE_GBP_PR_FUNC_6') test.cleanup() utils_libs.report_results('test_gbp_pr_func', 'test_results.txt') sys.exit(1)
def run(self): self._log.info( "\n## TESTCASE_GBP_RI_FUNC_4: RESOURCE INTEGRITY AMONG " "SERVICE-CHAIN OBJECTS") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info("\n## Step 1: Create Service Chain Nodes LB & FW ##\n") lb_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'node', self.lb_name) if lb_uuid == 0: self._log.info( "# Step 1: Create Service Chain Loadbalance Node == Failed") self.cleanup(fail=1) fw_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'node', self.lb_name) if fw_uuid == 0: self._log.info( "# Step 1A: Create Service Chain Firewall Node == Failed") self.cleanup(fail=1) ###### self._log.info("\n## Step 2: Create ServiceChain Spec ##\n") # Ensur that node names or node uuids passed as val to param # 'nodes',MUST be in order of FW and then LB.. this order is required # from gbp pov spec_uuid = self.gbpcfg.gbp_sc_cfg_all( 1, 'spec', self.spec_name, nodes='%s %s' % (fw_uuid, lb_uuid)) if spec_uuid == 0: self._log.info("# Step 2: Create ServiceChain Spec == Failed") self.cleanup(fail=1) ###### self._log.info("\n## Step 3: Delete the Service Chain Nodes ##\n") cnt = 0 for nodeid in [lb_uuid, fw_uuid]: if self.gbpcfg.gbp_sc_cfg_all(0, 'node', nodeid) != 0: self._log.info( "# Step 4: Deletion of ServiceChain did NOT fail") cnt += 1 if cnt > 0: self.cleanup(fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_4: PASSED") self.cleanup() utils_libs.report_results('test_gbp_ri_func_4', 'test_results.txt') sys.exit(1)
def main(): # Run the Testcase: test = test_gbp_pa_neg() if test.test_pa_invalid_act_type() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_1') if test.test_pa_valid_type_inval_val() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_2') if test.test_pa_invalid_act_value() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_3') if test.test_pa_update_act_type() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_4') if test.test_pa_update_invalid_act_val() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_5') if test.test_pa_delete_invalid_pa() == 0: test.cleanup(tc_name='TESTCASE_GBP_PA_NEG_6') test.cleanup() utils_libs.report_results('test_gbp_pa_neg', 'test_results.txt') sys.exit(1)
def run(self): self._log.info( "\n## TESTCASE_GBP_RI_FUNC_3: RESOURCE INTEGRITY " "AMONG POLICY ACTION and SC OBJs") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info( "\n## Step 1: Create Policy Action with type Redirect ##\n") act_uuid = self.gbpcfg.gbp_action_config(1, self.act_name) if act_uuid == 0: self._log.info("# Step 1: Create Action == Failed") self.cleanup('action', act_uuid, fail=1) ###### self._log.info("\n## Step 2: Create ServiceChain Spec ##\n") spec_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'spec', self.spec_name) # this is needed for cleanup,can append and sort for the sake of order. # but it kept it simple objs, names = ['action', 'spec'], [act_uuid, spec_uuid] if spec_uuid == 0: self._log.info("# Step 2: Create Classifier == Failed") self.cleanup(objs, names, fail=1) ###### self._log.info( "\n## Step 3: Update the Policy Action with SCSpec ##\n") if self.gbpcfg.gbp_action_config( 2, act_uuid, action_value=spec_uuid) == 0: self._log.info( "\n##Step 2: Updating Policy Action's Attributes name & " "action_value == Failed") self.cleanup(objs, names, fail=1) ###### self._log.info("\n## Step 4: Delete ServiceChain Spec ##\n") if self.gbpcfg.gbp_sc_cfg_all(0, 'spec', spec_uuid) != 0: self._log.info("# Step 4: Deletion of ServiceChain did NOT fail") self.cleanup(objs, names, fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_3: PASSED") self.cleanup(objs, names) utils_libs.report_results('test_gbp_ri_func_3', 'test_results.txt') sys.exit(1)
def run(self): self._log.info("\n## TESTCASE_GBP_RI_FUNC_3: RESOURCE INTEGRITY " "AMONG POLICY ACTION and SC OBJs") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info( "\n## Step 1: Create Policy Action with type Redirect ##\n") act_uuid = self.gbpcfg.gbp_action_config(1, self.act_name) if act_uuid == 0: self._log.info("# Step 1: Create Action == Failed") self.cleanup('action', act_uuid, fail=1) ###### self._log.info("\n## Step 2: Create ServiceChain Spec ##\n") spec_uuid = self.gbpcfg.gbp_sc_cfg_all(1, 'spec', self.spec_name) # this is needed for cleanup,can append and sort for the sake of order. # but it kept it simple objs, names = ['action', 'spec'], [act_uuid, spec_uuid] if spec_uuid == 0: self._log.info("# Step 2: Create Classifier == Failed") self.cleanup(objs, names, fail=1) ###### self._log.info( "\n## Step 3: Update the Policy Action with SCSpec ##\n") if self.gbpcfg.gbp_action_config(2, act_uuid, action_value=spec_uuid) == 0: self._log.info( "\n##Step 2: Updating Policy Action's Attributes name & " "action_value == Failed") self.cleanup(objs, names, fail=1) ###### self._log.info("\n## Step 4: Delete ServiceChain Spec ##\n") if self.gbpcfg.gbp_sc_cfg_all(0, 'spec', spec_uuid) != 0: self._log.info("# Step 4: Deletion of ServiceChain did NOT fail") self.cleanup(objs, names, fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_3: PASSED") self.cleanup(objs, names) utils_libs.report_results('test_gbp_ri_func_3', 'test_results.txt') sys.exit(1)
def run(self): self._log.info( "\n## TESTCASE_GBP_RI_FUNC_1: RESOURCE INTEGRITY AMONG " "GBP's PA,PC,PR,PRS,PTG,PT OBJs") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info("\n## Step 1: Create Action ##\n") act_uuid = self.gbpcfg.gbp_action_config(1, self.act_name) if act_uuid == 0: self._log.info("# Step 1: Create Action == Failed") self.cleanup('action', act_uuid, fail=1) self._log.info("\n## Step 2: Create Classifier ##\n") cls_uuid = self.gbpcfg.gbp_policy_cfg_all( 1, 'classifier', self.class_name, protocol='icmp', direction='bi') # this is needed for cleanup,can append and sort for the sake of # order... but it kept it simple objs, names = ['classifier', 'action'], [cls_uuid, act_uuid] if cls_uuid == 0: self._log.info("# Step 2: Create Classifier == Failed") self.cleanup(objs, names, fail=1) ###### self._log.info("\n## Step 3: Create Policy Rule ##\n") rule_uuid = self.gbpcfg.gbp_policy_cfg_all( 1, 'rule', self.rule_name, classifier=self.class_name, action=self.act_name) objs, names = [ 'rule', 'classifier', 'action'], [ rule_uuid, cls_uuid, act_uuid] if rule_uuid == 0: self._log.info("# Step 3: Create Policy Rule == Failed") self.cleanup(objs, names, fail=1) self._log.info( "\n## Step 4: Delete in-use Policy Action & Classifier ##\n") if self.gbpcfg.gbp_policy_cfg_all( 0, 'classifier', self.class_name) != 0: self._log.info( "\n# Step 4A: Delete in-use Policy Classifier did not fail #") self.cleanup(objs, names, fail=1) if self.gbpcfg.gbp_action_config(0, self.act_name) != 0: self._log.info( "\n# Step 4B: Delete in-use Policy Action did not fail #") self.cleanup(objs, names, fail=1) ###### self._log.info("\n## Step 5: Create Policy Rule-Set ##\n") ruleset_uuid = self.gbpcfg.gbp_policy_cfg_all( 1, 'ruleset', self.ruleset_name, policy_rules=self.rule_name) objs, names = ['ruleset', 'rule', 'classifier', 'action'],\ [ruleset_uuid, rule_uuid, cls_uuid, act_uuid] if ruleset_uuid == 0: self._log.info("# Step 5: Create Policy Rule-Set == Failed") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 5A: Delete of in-use Policy Rule ##\n") if self.gbpcfg.gbp_policy_cfg_all(0, 'rule', self.rule_name) != 0: self._log.info( "\n# Step 5A: Delete in-use Policy Rule did not fail") self.cleanup(objs, names, fail=1) ##### self._log.info("\n## Step 7: Create Policy Target-Grp ##\n") uuids = self.gbpcfg.gbp_policy_cfg_all( 1, 'group', self.ptg_name, consumed_policy_rule_sets='%s=scope' % (self.ruleset_name)) if uuids != 0: ptg_uuid = uuids[0].rstrip() objs, names = ( ['group', 'ruleset', 'rule', 'classifier', 'action'], [ptg_uuid, ruleset_uuid, rule_uuid, cls_uuid, act_uuid]) else: self._log.info("# Step 7: Create Policy Target-Grp == Failed") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 7A: Delete in-use Policy RuleSet ##\n") if self.gbpcfg.gbp_policy_cfg_all( 0, 'ruleset', self.ruleset_name) != 0: self._log.info( "\n# Step 7A: Delete in-use Policy RuleSet did not fail") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 8: Create Policy Targets ##\n") ret_uuids = self.gbpcfg.gbp_policy_cfg_all( 1, 'target', self.tg_name, policy_target_group=self.ptg_name) if ret_uuids != 0 and len(ret_uuids) == 2: pt_uuid = ret_uuids[0] objs, names = ( ['target', 'group', 'ruleset', 'rule', 'classifier', 'action'], [pt_uuid, ptg_uuid, ruleset_uuid, rule_uuid, cls_uuid, act_uuid]) self._log.info( "# Step 8: Creation of Policy Target Passed, UUID == %s\n" % (pt_uuid)) else: self._log.info("# Step 8: Creation of Policy Target == Failed") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 8: Delete in-use Policy Target Group ##\n") if self.gbpcfg.gbp_policy_cfg_all( 0, 'ruleset', self.ruleset_name) != 0: self._log.info( "\n# Step 8A: Delete in-use Policy RuleSet did not fail") self.cleanup(objs, names, fail=1) self._log.info("\n## TESTCASE_GBP_RI_FUNC_1: PASSED") self.cleanup(objs, names) # Cleanup the system utils_libs.report_results('test_gbp_ri_func_1', 'test_results.txt') sys.exit(1)
def run(self): self._log.info( "\n## TESTCASE_GBP_RI_FUNC_2A: RESOURCE INTEGRITY AMONG " "L2POLICY and L3POLICY OBJs") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info("\n## Step 1: Create L3Policy ##\n") l3p_uuid = self.gbpcfg.gbp_policy_cfg_all(1, 'l3p', self.l3pol_name) if l3p_uuid == 0: self._log.info("# Step 1: Create L3Policy == Failed") self.cleanup('l3p', l3p_uuid, tc_name='TESTCASE_GBP_RI_FUNC_2A', fail=1) ###### self._log.info("\n## Step 2: Create L2Policy using L3Policy ##\n") l2p_uuid = self.gbpcfg.gbp_policy_cfg_all(1, 'l2p', self.l2pol_name, l3_policy=l3p_uuid) # this is needed for cleanup,can append and sort for the sake # of order.. but it kept it simple. l2p_uuid[1] is same as l3p_uuid, # just that cfg_all func returns both uuid when l2p is obj objs, names = ['l2p', 'l3p'], [l2p_uuid[0], l2p_uuid[1]] if l2p_uuid == 0: self._log.info("# Step 2: Create L2Policy == Failed") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 3: Delete in-use L3Policy ##\n") if self.gbpcfg.gbp_policy_cfg_all(0, 'l3p', l3p_uuid) != 0: self._log.info( "\n# Step 4A: Delete in-use L3Policy did not fail #") self.cleanup(objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2A', fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_2A: PASSED") ###### self._log.info( "\n## TESTCASE_GBP_RI_FUNC_2B: RESOURCE INTEGRITY AMONG L2POLICY " "and PTG OBJs") self._log.info("\n## Step 5: Create Policy Target-Grp ##\n") uuids = self.gbpcfg.gbp_policy_cfg_all(1, 'group', self.ptg_name, l2_policy=l2p_uuid[0]) if uuids != 0: objs, names = ['group', 'l2p', 'l3p'],\ [self.ptg_name, l2p_uuid[0], l3p_uuid] else: self._log.info("# Step 5: Create Policy Target-Grp == Failed") self.cleanup(objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2B', fail=1) self._log.info("\n## Step 5A: Delete in-use L2 Policy ##") if self.gbpcfg.gbp_policy_cfg_all(0, 'l2p', l2p_uuid[0]) != 0: self._log.info("\n# Step 5A: Delete in-use L2Policy did not fail") self.cleanup(objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2B', fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_2B: PASSED") self.cleanup(objs, names) # Cleanup the system now utils_libs.report_results('test_gbp_ri_func_2', 'test_results.txt') sys.exit(1)
def run(self): self._log.info( "\n## TESTCASE_GBP_RI_FUNC_2A: RESOURCE INTEGRITY AMONG " "L2POLICY and L3POLICY OBJs") # Testcase work-flow starts # ============ ALL POLICY OBJECTS ARE TO BE CREATED AND VERIFIED = self._log.info("\n## Step 1: Create L3Policy ##\n") l3p_uuid = self.gbpcfg.gbp_policy_cfg_all(1, 'l3p', self.l3pol_name) if l3p_uuid == 0: self._log.info("# Step 1: Create L3Policy == Failed") self.cleanup( 'l3p', l3p_uuid, tc_name='TESTCASE_GBP_RI_FUNC_2A', fail=1) ###### self._log.info("\n## Step 2: Create L2Policy using L3Policy ##\n") l2p_uuid = self.gbpcfg.gbp_policy_cfg_all( 1, 'l2p', self.l2pol_name, l3_policy=l3p_uuid) # this is needed for cleanup,can append and sort for the sake # of order.. but it kept it simple. l2p_uuid[1] is same as l3p_uuid, # just that cfg_all func returns both uuid when l2p is obj objs, names = ['l2p', 'l3p'], [l2p_uuid[0], l2p_uuid[1]] if l2p_uuid == 0: self._log.info("# Step 2: Create L2Policy == Failed") self.cleanup(objs, names, fail=1) self._log.info("\n## Step 3: Delete in-use L3Policy ##\n") if self.gbpcfg.gbp_policy_cfg_all(0, 'l3p', l3p_uuid) != 0: self._log.info( "\n# Step 4A: Delete in-use L3Policy did not fail #") self.cleanup( objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2A', fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_2A: PASSED") ###### self._log.info( "\n## TESTCASE_GBP_RI_FUNC_2B: RESOURCE INTEGRITY AMONG L2POLICY " "and PTG OBJs") self._log.info("\n## Step 5: Create Policy Target-Grp ##\n") uuids = self.gbpcfg.gbp_policy_cfg_all( 1, 'group', self.ptg_name, l2_policy=l2p_uuid[0]) if uuids != 0: objs, names = ['group', 'l2p', 'l3p'],\ [self.ptg_name, l2p_uuid[0], l3p_uuid] else: self._log.info("# Step 5: Create Policy Target-Grp == Failed") self.cleanup( objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2B', fail=1) self._log.info("\n## Step 5A: Delete in-use L2 Policy ##") if self.gbpcfg.gbp_policy_cfg_all(0, 'l2p', l2p_uuid[0]) != 0: self._log.info("\n# Step 5A: Delete in-use L2Policy did not fail") self.cleanup( objs, names, tc_name='TESTCASE_GBP_RI_FUNC_2B', fail=1) else: self._log.info("\n## TESTCASE_GBP_RI_FUNC_2B: PASSED") self.cleanup(objs, names) # Cleanup the system now utils_libs.report_results('test_gbp_ri_func_2', 'test_results.txt') sys.exit(1)