diff --git a/02-Keyword/tsg_bfapi/PolicyObject.robot b/02-Keyword/tsg_bfapi/PolicyObject.robot index 52e4d1e..5fd0a3b 100644 --- a/02-Keyword/tsg_bfapi/PolicyObject.robot +++ b/02-Keyword/tsg_bfapi/PolicyObject.robot @@ -4,6 +4,7 @@ Resource ../tsg_common/ManagePolicyBody.robot Resource ../tsg_common/ManageObjectBody.robot Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot Resource ../../02-Keyword/tsg_bfapi/policy_object/Object.robot +Resource ../../02-Keyword/tsg_adc/FileOperation.robot Library REST http://${host}:${port} Library Collections Library RequestsLibrary @@ -38,13 +39,14 @@ AddLocalIPObject Comment 创建IP #object为IP→endpoint时的addItemList单个对象 - ${addItemList1} Create Dictionary isSession=endpoint ip=${testClentIP}-${testClentIP} port=0-0 direction=0 protocol=0 isInitialize=0 + ${addItemList1} Create Dictionary isSession=endpoint ip=${testClentIP} port=0-65535 direction=0 protocol=0 isInitialize=0 #可以添加多个 ${addItemLists} Create list ${addItemList1} #objectList对象 ${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists} ${rescode} ${objectId1} AddObjects ${1} ${objectDict} SET GLOBAL VARIABLE ${testClentID} ${objectId1} + Comment 创建SubId log to_AddLocalSubidObject ${objectDict} Create Dictionary ... objectType=subscriberid @@ -60,15 +62,44 @@ AddLocalIPObject #log ${subiid} log LocalSubIP:${subiid} SET GLOBAL VARIABLE ${testClentSubID} ${subiid} + # Comment 创建mobile_identity-imsi + # ${addItemList1} Create Dictionary keywordArray=imsi + # ${addItemLists} Create list ${addItemList1} + # ${objectDict} Create Dictionary objectType=mobile_identity objectSubType=imsi isValid=${1} addItemList=${addItemLists} + # ${rescode} ${imsi_id} AddObjects ${1} ${objectDict} + # insert_policyId_to_file1 global_imsi_id ${imsi_id} + # SET GLOBAL VARIABLE ${object_imsi_id} ${imsi_id} + # Comment 创建mobile_identity-phone_number + # ${addItemList1} Create Dictionary keywordArray=${phone_number1} + # ${addItemList2} Create Dictionary keywordArray=${phone_number2} + # ${addItemList3} Create Dictionary keywordArray=${phone_number3} + # ${addItemList4} Create Dictionary keywordArray=${phone_number4} + # ${addItemLists} Create list ${addItemList1} ${addItemList2} ${addItemList3} ${addItemList4} + # ${objectDict} Create Dictionary objectType=mobile_identity objectSubType=phone_number isValid=${1} addItemList=${addItemLists} + # ${rescode} ${phoneNum_id} AddObjects ${1} ${objectDict} + # insert_policyId_to_file1 global_phoneNum_id ${imsi_id} + # SET GLOBAL VARIABLE ${obj_phoneNum_Id} ${phoneNum_id} + # Comment 创建apn + # ${addItemList1} Create Dictionary keywordArray=${apn1} + # ${addItemList2} Create Dictionary keywordArray=${apn2} + # ${addItemLists} Create list ${addItemList1} ${addItemList2} + # ${objectDict} Create Dictionary objectType=apn objectSubType=apn isValid=${1} addItemList=${addItemLists} + # ${rescode} ${apn_id} AddObjects ${1} ${objectDict} + # insert_policyId_to_file1 global_apn_id ${imsi_id} + # SET GLOBAL VARIABLE ${obj_apn_Id} ${apn_id} DelLocalIPObject log to_DelLocalIPObject ${emptyList} Create List ${objectId1} Create List [${testClentID},${testClentSubID}] + # ${objectId1} Create List [${testClentID},${testClentSubID},${object_imsi_id},${obj_phoneNum_Id},${obj_apn_Id}] DeletePolicyAndGroupObject ${emptyList} ${objectId1} SET GLOBAL VARIABLE ${testClentID} ${EMPTY} SET GLOBAL VARIABLE ${testClentSubID} ${EMPTY} + # SET GLOBAL VARIABLE ${object_imsi_id} ${EMPTY} + # SET GLOBAL VARIABLE ${obj_phoneNum_Id} ${EMPTY} + # SET GLOBAL VARIABLE ${obj_apn_Id} ${EMPTY} #${response} BaseDeleteRequest /${version}/policy/object {"objectIds":[${testClentID}]} #${response_code} Get From Dictionary ${response} code diff --git a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot index f612d96..daba534 100644 --- a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot +++ b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot @@ -249,19 +249,34 @@ ManageObjectV2 Log To Console Call ManageObjectV2 #默认客户端条件类型:clientip or clientsubid ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defaultClient + + # ${return1} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defaultClient1 + # ${return2} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defaultClient2 + # ${return3} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defaultClient3 + # ${return4} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defaultClient4 + ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} - ... ELSE Set Variable ${defaultClient} + # ... ELSE IF "${return1}"=="FAIL" or "${defaultClient1}"=="${EMPTY}" Set Variable ${Default_Client_subidType} + # ... ELSE IF "${return2}"=="FAIL" or "${defaultClient2}"=="${EMPTY}" Set Variable ${Default_Client_imsiType} + # ... ELSE IF "${return3}"=="FAIL" or "${defaultClient3}"=="${EMPTY}" Set Variable ${Default_Client_phonenumberType} + # ... ELSE IF "${return4}"=="FAIL" or "${defaultClient4}"=="${EMPTY}" Set Variable ${Default_Client_apnType} + ... ELSE Set Variable ${defaultClient} ${sourceList} Create List ${destinationList} Create List ${filterList} Create List - Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientip' ManageClientIPObjectV2 ${sourceList} - Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientsubid' ManageClientSubIDObjectV2 ${sourceList} + Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'!='${EMPTY}' and '${defaultClient}'=='clientip' ManageClientIPObjectV2 ${sourceList} + + # Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient1}'!='${EMPTY}' and '${defaultClient1}'=='clientsubid' ManageClientSubIDObjectV2 ${sourceList} + # Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient2}'!='${EMPTY}' and '${defaultClient2}'=='clientImsi' ManageClientImsiObjectV2 ${sourceList} + # Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient3}'!='${EMPTY}' and '${defaultClient3}'=='clientPhoneNumber' ManageClientPhoneNumberObjectV2 ${sourceList} + # Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient4}'!='${EMPTY}' and '${defaultClient4}'=='clientApn' ManageClientApnObjectV2 ${sourceList} + AnalysisObjectV2 ${policy} source ${sourceList} AnalysisObjectV2 ${policy} destination ${destinationList} AnalysisObjectV2 ${policy} filterList ${filterList} Set To Dictionary ${returnDict} source=${sourceList} destination=${destinationList} filterList=${filterList} Log ${policy} - + ManageClientIPObjectV2 [Arguments] ${emptyList} # 增加引用测试终端IP策略对象 @@ -280,6 +295,30 @@ ManageClientSubIDObjectV2 ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=${protocolField} Append To List ${emptyList} ${obj1} +ManageClientImsiObjectV2 + [Arguments] ${emptyList} + # 增加引用测试终端Imsi策略对象 + ${protocolField} Set Variable + insert_policyId_to_file1 addpolicySubId ${testClentSubID} + ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=TSG_FILED_GTP_IMSI + Append To List ${emptyList} ${obj1} + +ManageClientPhoneNumberObjectV2 + [Arguments] ${emptyList} + # 增加引用测试终端phonenumber策略对象 + ${protocolField} Set Variable + log ${testClentSubID} + ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=TSG_FILED_GTP_PHONE_NUMBER + Append To List ${emptyList} ${obj1} + +ManageClientApnObjectV2 + [Arguments] ${emptyList} + # 增加引用测试终端apn策略对象 + ${protocolField} Set Variable + insert_policyId_to_file1 addpolicySubId ${testClentSubID} + ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=TSG_FILED_GTP_APN + Append To List ${emptyList} ${obj1} + AnalysisObjectV2 [Arguments] ${policy} ${objectType} ${objList} Log To Console Call AnalysisObjectV2 diff --git a/03-Variable/PolicyObjectDefault.txt b/03-Variable/PolicyObjectDefault.txt index ea2ae0e..17226d5 100644 --- a/03-Variable/PolicyObjectDefault.txt +++ b/03-Variable/PolicyObjectDefault.txt @@ -39,7 +39,11 @@ ${Default_AddItem_IsHexbin} ${0} ${Default_AddItem_IsInitialize} ${0} ${Default_AddItem_ItemName} ${EMPTY} ${Default_AddItem_ItemDesc} ${EMPTY} -#默认客户端条件类型:clientip or clientsubid -${Default_Client_Type} clientip +#默认客户端条件类型:clientip or clientsubid or clientImsi or clientPhoneNumber or clientApn +${Default_Client_Type} clientip +${Default_Client_subidType} clientsubid +${Default_Client_imsiType} clientImsi +${Default_Client_phonenumberType} clientPhoneNumber +${Default_Client_apnType} clientApn ${Default_PolicyEnabled} open ${Default_PolicyLogSession} 1 \ No newline at end of file