#NEWLINE# def test_gbp_ptg_func_1( self , name_uuid = '' , ptg_uuid = '' , rep_cr = 0 , rep_del = 0 ) : #NEWLINE# #INDENT# if ( ( rep_cr == 0 ) and ( rep_del == 0 ) ) : #NEWLINE# #INDENT# self . _log . info ( '\n########################################################\nTESTCASE_GBP_PTG_FUNC_1: TO CREATE/VERIFY/DELETE/VERIFY a POLICY TARGET-GROUP with DEFAULT ATTRIB VALUE\nTEST_STEP::\nCreate Policy Target-Group Object\nVerify the attributes & value, show & list cmds\nVerify the implicitly GBP(L2P,L3P) & Neutron(net,subnet,dhcp-port) Objects\nDelete Policy Target-Group using Name\nVerify the PTG has got deleted, show & list cmds\nVerify the implicit GBP & Neutron Objects are deleted\n##########################################################\n' ) #NEWLINE# #UNINDENT# if ( name_uuid == '' ) : #NEWLINE# #INDENT# name_uuid = self . ptg_name #NEWLINE# #UNINDENT# if ( ( rep_cr == 0 ) or ( rep_cr == 1 ) ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 1: Create Target-Group with default attrib vals##\n' ) #NEWLINE# uuids = self . gbpcfg . gbp_policy_cfg_all ( 1 , 'group' , name_uuid ) #NEWLINE# if ( uuids != 0 ) : #NEWLINE# #INDENT# ptg_uuid = uuids [ 0 ] #NEWLINE# l2pid = uuids [ 1 ] #NEWLINE# subnetid = uuids [ 2 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 1: Create Target-Group == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# self . _log . info ( '\n## Step 2A: Verify Target-Group using -list cmd' ) #NEWLINE# if ( self . gbpverify . gbp_policy_verify_all ( 0 , 'group' , name_uuid , ptg_uuid ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 2A: Verify Target-Group using -list option == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# self . _log . info ( '\n## Step 2B: Verify Target-Group using -show cmd' ) #NEWLINE# if ( self . gbpverify . gbp_policy_verify_all ( 1 , 'group' , name_uuid , id = ptg_uuid , shared = 'False' ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 2B: Verify Target-Group using -show option == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# ret_uuid = self . gbpverify . gbp_l2l3ntk_pol_ver_all ( 1 , 'l2p' , self . ptg_name , ret = 'default' , id = l2pid , policy_target_groups = ptg_uuid ) #NEWLINE# if ( ( ret_uuid != 0 ) and ( len ( ret_uuid ) == 2 ) ) : #NEWLINE# #INDENT# l3pid = ret_uuid [ 0 ] #NEWLINE# ntkid = ret_uuid [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 2C: Verify By-Default L2Policy == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# rtr_uuid = self . gbpverify . gbp_l2l3ntk_pol_ver_all ( 1 , 'l3p' , l3pid , ret = 'default' , id = l3pid , name = 'default' , ip_pool = self . def_ip_pool , l2_policies = l2pid , subnet_prefix_length = '24' , ip_version = '4' ) #NEWLINE# if ( ( rtr_uuid != 0 ) and ( isinstance ( rtr_uuid , str ) == 0 ) ) : #NEWLINE# #INDENT# self . _log . info ( '# Step 2D: Verify By-Default L3Policy == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# net_name = ( 'l2p_%s' % name_uuid ) #NEWLINE# if ( self . gbpverify . neut_ver_all ( 'net' , ntkid , name = net_name , admin_state_up = 'True' , subnets = subnetid ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '# Step 2E: Implicit-creation of Neutron Network-Obj -show option == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( self . gbpverify . neut_ver_all ( 'subnet' , subnetid , cidr = self . cidr , enable_dhcp = 'True' , network_id = ntkid ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 2F: Implicit-creation of Neutron SubNet-Obj == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( self . env_flag != 'aci' ) : #NEWLINE# #INDENT# if ( self . gbpverify . neut_ver_all ( 'router' , rtr_uuid , admin_state_up = 'True' , status = 'ACTIVE' ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 2G: Implicit-creation of Neutron Router-Obj == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( rep_del == 0 ) or ( rep_del > 0 ) ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 3: Delete Target-Group using name  ##\n' ) #NEWLINE# if ( self . gbpcfg . gbp_policy_cfg_all ( 0 , 'group' , ptg_uuid ) == 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 3: Delete Target-Group == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( self . gbpverify . gbp_policy_verify_all ( 0 , 'group' , ptg_uuid ) != 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 3A: Verify Target-Group is Deleted using -list option == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( self . gbpverify . gbp_policy_verify_all ( 1 , 'group' , ptg_uuid ) != 0 ) : #NEWLINE# #INDENT# self . _log . info ( '\n## Step 3B: Verify Target-Group is Deleted using -show option == Failed' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( ( rep_cr == 0 ) and ( rep_del == 0 ) ) : #NEWLINE# #INDENT# self . _log . info ( '\n## TESTCASE_GBP_PTG_FUNC_1: PASSED' ) #NEWLINE# #UNINDENT# #UNINDENT# return 1