21.05版关键字修改

This commit is contained in:
hebingning
2021-05-17 09:57:31 +08:00
parent c7edf5e738
commit 17aa195375
28 changed files with 293 additions and 67 deletions

View File

@@ -0,0 +1,75 @@
*** Settings ***
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids} ${categoryIds}
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Log.robot
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
Resource ../../../03-Variable/BifangApiVariable.txt
Library json
Library DateTime
*** Variables ***
${policyIds} ${EMPTY}
${objectids} ${EMPTY}
${categoryIds} ${EMPTY}
*** Test Cases ***
ForwardAddCategoriesOneFqdn
Comment 创建categories
${addItemList1} Create Dictionary fqdn=$www.lkong.net
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 200
sleep ${policyModifySleepSeconds}
Comment query Max
QueryCategory pageSize=20&pageNo=1&categoryId=${categoryId}&orderBy=categoryId desc&categoryType=fqdn&categoryName=lkong&isInitialize=0&fqdn=lkong 200
sleep ${policyModifySleepSeconds}
Comment update Category
${addItemList1} Create Dictionary fqdn=*xinxin.lkong.net
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectId=${categoryObjId} categoryId=${categoryId} categoryType=fqdn categoryName=lkongchaoji objectSubType=category fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} update 200
${categoryIds} set Variable ${categoryId}
ForwardAddCategoriesMulFqdn
Comment 创建categories
${addItemList1} Create Dictionary fqdn=$www.hao123.com
${addItemList2} Create Dictionary fqdn=*huai123.com
${addItemList3} Create Dictionary fqdn=*baidu.com
${addItemList4} Create Dictionary fqdn=*kuxiu.com
${addItemLists} Create list ${addItemList1} ${addItemList2} ${addItemList3} ${addItemList4}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 200
${categoryIds} set Variable ${categoryId}
ReverseAddCategoriesMulFqdn1
Comment 创建categories
${addItemList1} Create Dictionary fqdn=cuowuwang.com
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014018
Comment 创建categories
${addItemList1} Create Dictionary fqdn=cuowuwang.com
${addItemList2} Create Dictionary fqdn=*cuowuwang.com
${addItemLists} Create list ${addItemList1} ${addItemList2}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014018
ReverseAddCategoriesMulFqdn2
Comment 创建categories
${addItemList1} Create Dictionary fqdn=*a
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014006
ReverseSearchCategories1
QueryCategory pageSize=20&pageNo=1&categoryId=abc 400
ReverseSearchCategories2
QueryCategory pageSize=20&pageNo=1&categoryType=halala 40090025

View File

@@ -0,0 +1,33 @@
*** Settings ***
Test Teardown DeletePolicyAndGroupObject ${policyIds} ${objectIds}
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Log.robot
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
Resource ../../../03-Variable/ApplicationID.txt
Library ../../../04-CustomLibrary/Library/delUseless.py
Library ../../../04-CustomLibrary/Custometest/JsonDiff.py
Library json
Library DateTime
*** Variables ***
@{policyIds}
@{profiles}
${objectIds} ${EMPTY}
*** Test Cases ***
fqdn_001
${req_fqdn_data} Set Variable {"opAction":"add","refuseCode":true,"returnData":1,"objectList":{"objectType":"fqdn","objectSubType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"hbn_test_fqdn","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*abcds"],"t":"16191477536650","itemId":"","isHexbin":0,"state":2}],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${req_del_key} Create List objectType objectSubType
${req_fqdn_data} deal ${req_fqdn_data} ${req_del_key}
log abcdefg
${res_fqdn_data} Set Variable {"code":200,"msg":"Success","data":{"objectList":[{"addItemList":[{"isValid":1,"opUser":1527,"opTime":"2021-04-23 11:16:31","isInitialize":0,"itemName":null,"itemDesc":null,"isHexbin":0,"keywordArray":["abcds"],"itemId":4347060,"objectId":44552}],"deleteItemIds":[],"iconColor":"#31739C","isDisplay":null,"isExclusion":0,"isInitialize":0,"isValid":1,"memberType":1,"objectDesc":"","objectId":44552,"objectName":"hbn_test_fqdn","objectType":"fqdn","opTime":"2021-04-23 11:16:31","opUser":1527,"subObjectIds":[],"updateItemList":[]}]},"success":true}
${res_del_key} Create List opUser opTime itemName itemDesc itemId objectId
${res_fqdn_data} deal ${res_fqdn_data} ${res_del_key}
log ${res_fqdn_data}
${res_code} json_diff ${req_fqdn_data} ${res_fqdn_data}
${compare_code} Set Variable True
Should Be Equal As Strings ${res_code} ${compare_code}
log abcdesssssss

View File

@@ -16,7 +16,7 @@ InitPotocol
${appDict} Create Dictionary ${appDict} Create Dictionary
${appVDict} Create Dictionary ${appVDict} Create Dictionary
Connect To Database Using Custom Params pymysql ${mysqlHost} Connect To Database Using Custom Params pymysql ${mysqlHost}
${app_id} query SELECT group_id,low_boundary,region_name FROM tsg_obj_app_id WHERE is_valid=1 ${app_id} query SELECT group_id,low_boundary,region_name FROM tsg_obj_app_id WHERE is_valid=1 AND region_name='http' OR region_name='ssl' OR region_name='dns' OR region_name='ftp' OR region_name='mail' OR region_name='doh' OR region_name='rtp' OR region_name='sip'
${app_length} Get Length ${app_id} ${app_length} Get Length ${app_id}
FOR ${n} IN RANGE ${app_length} FOR ${n} IN RANGE ${app_length}
log ${n} log ${n}
@@ -30,6 +30,42 @@ InitPotocol
SET GLOBAL VARIABLE ${objprotol} ${appDict} SET GLOBAL VARIABLE ${objprotol} ${appDict}
#供策略验证使用的appid #供策略验证使用的appid
SET GLOBAL VARIABLE ${appportol} ${appVDict} SET GLOBAL VARIABLE ${appportol} ${appVDict}
GetProtocol
GetProtocol
${HTTP_ID1} Get From Dictionary ${objprotol} http
${RTP_ID1} Get From Dictionary ${objprotol} rtp
${DNS_ID1} Get From Dictionary ${objprotol} dns
${MAIL_ID1} Get From Dictionary ${objprotol} MAIL
${FTP_ID1} Get From Dictionary ${objprotol} ftp
${SIP_ID1} Get From Dictionary ${objprotol} sip
${SSL_ID1} Get From Dictionary ${objprotol} ssl
${DOH_ID1} Get From Dictionary ${objprotol} DoH
SET GLOBAL VARIABLE ${HTTP_ID} ${HTTP_ID1}
SET GLOBAL VARIABLE ${RTP_ID} ${RTP_ID1}
SET GLOBAL VARIABLE ${DNS_ID} ${DNS_ID1}
SET GLOBAL VARIABLE ${MAIL_ID} ${MAIL_ID1}
SET GLOBAL VARIABLE ${FTP_ID} ${FTP_ID1}
SET GLOBAL VARIABLE ${SIP_ID} ${SIP_ID1}
SET GLOBAL VARIABLE ${SSL_ID} ${SSL_ID1}
SET GLOBAL VARIABLE ${DOH_ID} ${DOH_ID1}
${HTTP_VID1} Get From Dictionary ${appportol} http
${RTP_VID1} Get From Dictionary ${appportol} rtp
${DNS_VID1} Get From Dictionary ${appportol} dns
${MAIL_VID1} Get From Dictionary ${appportol} MAIL
${FTP_VID1} Get From Dictionary ${appportol} ftp
${SIP_VID1} Get From Dictionary ${appportol} sip
${SSL_VID1} Get From Dictionary ${appportol} ssl
${DOH_VID1} Get From Dictionary ${appportol} DoH
SET GLOBAL VARIABLE ${HTTP_VID} ${HTTP_VID1}
SET GLOBAL VARIABLE ${RTP_VID} ${RTP_VID1}
SET GLOBAL VARIABLE ${DNS_VID} ${DNS_VID1}
SET GLOBAL VARIABLE ${MAIL_VID} ${MAIL_VID1}
SET GLOBAL VARIABLE ${FTP_VID} ${FTP_VID1}
SET GLOBAL VARIABLE ${SIP_VID} ${SIP_VID1}
SET GLOBAL VARIABLE ${SSL_VID} ${SSL_VID1}
SET GLOBAL VARIABLE ${DOH_VID} ${DOH_VID1}
Login Login
[Tags] tsg_adc tsg_bf_api [Tags] tsg_adc tsg_bf_api
#[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId} #[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId}
@@ -69,7 +105,7 @@ Login
log ${token} log ${token}
SET GLOBAL VARIABLE ${headers} {"Contest-Type":"application/json","Authorization":"${token}"} SET GLOBAL VARIABLE ${headers} {"Contest-Type":"application/json","Authorization":"${token}"}
#初始化接口中策略中引用协议和策略校验协议 #初始化接口中策略中引用协议和策略校验协议
InitPotocol Run Keyword If ${addPolicy}==1 InitPotocol
#Return ${rescode} #Return ${rescode}
Logout Logout
[Tags] tsg_adc tsg_bf_api [Tags] tsg_adc tsg_bf_api

View File

@@ -4,7 +4,7 @@ Resource ../tsg_common/ManagePolicyBody.robot
Resource ../tsg_common/ManageObjectBody.robot Resource ../tsg_common/ManageObjectBody.robot
Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
Resource ../../02-Keyword/tsg_bfapi/policy_object/Object.robot Resource ../../02-Keyword/tsg_bfapi/policy_object/Object.robot
Resource ../../02-Keyword/tsg_adc/FileOperation.robot #Resource ../../02-Keyword/tsg_adc/FileOperation.robot
Library REST http://${host}:${port} Library REST http://${host}:${port}
Library Collections Library Collections
Library RequestsLibrary Library RequestsLibrary
@@ -348,11 +348,14 @@ DeleteProfiles
Run Keyword If "${profile}"!="" and ${profile}!="${EMPTY}" DeleteProfile ${profile}[typeUrl] ${profile}[profileIds] Run Keyword If "${profile}"!="" and ${profile}!="${EMPTY}" DeleteProfile ${profile}[typeUrl] ${profile}[profileIds]
END END
DeletePolicyAndObject DeletePolicyAndObject
[Arguments] ${policyids} ${objectids} [Arguments] ${policyids} ${objectids} ${categoriesId}=null
#删除和对象 #删除和对象
#2020-09-01修改引用DeletePolicyAndGroupObject避免分别维护并兼容之前用例 #2020-09-01修改引用DeletePolicyAndGroupObject避免分别维护并兼容之前用例
# log ${categoriesId}
${objectId1} Create List [${objectids}] ${objectId1} Create List [${objectids}]
DeletePolicyAndGroupObject ${policyIds} ${objectId1} # log ${categoryId1}
${categoryId1} Create List [${categoriesId}]
DeletePolicyAndGroupObject ${policyIds} ${objectId1} ${categoryId1}
#删除策略 #删除策略
#log toDeletePolicy_DeletePolicyAndObject #log toDeletePolicy_DeletePolicyAndObject
@@ -369,7 +372,7 @@ DeletePolicyAndObject
# ... ELSE DeleteObject ${objectids} # ... ELSE DeleteObject ${objectids}
DeletePolicyAndGroupObject DeletePolicyAndGroupObject
[Arguments] ${policyids} ${objectids} [Arguments] ${policyids} ${objectids} ${categoriesId}
#引用此关键字,${objectids}参数必须是双层列表eg['[1]','[2,3]','[4,5,6,7]'] #引用此关键字,${objectids}参数必须是双层列表eg['[1]','[2,3]','[4,5,6,7]']
#删除和对象 #删除和对象
#删除策略 #删除策略
@@ -380,9 +383,15 @@ DeletePolicyAndGroupObject
#删除对象 #删除对象
log todeleteobj_DeletePolicyAndObject log todeleteobj_DeletePolicyAndObject
log ${objectids} log ${objectids}
log ${categoriesId}
Run Keyword If "${objectids}"=="${EMPTY}" log no Objects to del Run Keyword If "${objectids}"=="${EMPTY}" log no Objects to del
... ELSE IF ${objectids}==['[]'] log no Objects to del ... ELSE IF ${objectids}==['[]'] log no Objects to del
# ... ELSE IF "${categoryids}"=="${EMPTY}" or ${categoryids}==['[]'] log no Categories to del
# ... ELSE IF ${categoryids}==['[]'] log no Categories to del
... ELSE DeleteGroupObjects ${objectids} ... ELSE DeleteGroupObjects ${objectids}
log ${categoriesId}
Run Keyword If "${categoriesId}"=="${EMPTY}" or ${categoriesId}==['[null]'] or ${categoriesId}==['[]'] log no Categories to del
... ELSE DeleteGroupCategories ${categoriesId}
DeletePolicys DeletePolicys
[Arguments] ${policyids} [Arguments] ${policyids}
${listlenth}= Get Length ${policyids} ${listlenth}= Get Length ${policyids}
@@ -391,20 +400,53 @@ DeletePolicys
DeletePolicy ${policyids}[${var}] DeletePolicy ${policyids}[${var}]
END END
DeleteGroupObjects DeleteGroupObjects
[Arguments] ${objectids} [Arguments] ${objectids}
FOR ${var} IN @{objectids} FOR ${var} IN @{objectids}
log ${var} log ${var}
DeleteGroupObject ${var} DeleteGroupObject ${var}
END END
DeleteGroupCategories
[Arguments] ${categoryids}
FOR ${var} IN @{categoryids}
log ${var}
DeleteGroupCategory ${var}
END
DeleteGroupObject DeleteGroupObject
[Arguments] ${objectids} [Arguments] ${objectids}
#删除对象 #删除对象
log todeleteobj log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}} ${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}}
${response_code} Get From Dictionary ${response} code ${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200 Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response} ${response} Convert to String ${response}
# ${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}}
# ${response_code} Get From Dictionary ${response} code
# Should Be Equal As Strings ${response_code} 200
# ${response} Convert to String ${response}
log ${response} log ${response}
DeleteGroupCategory
[Arguments] ${categoryids}
#删除对象
log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":${categoryids}}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
log ${response}
DeleteCategory
[Arguments] ${categoryids}
#删除对象
log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":[${categoryids}]}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
log ${response}
DeletePolicyAndObjectAndProfile DeletePolicyAndObjectAndProfile
[Arguments] ${policyids} ${objectids} ${profiles} [Arguments] ${policyids} ${objectids} ${profiles}
DeletePolicyAndObject ${policyids} ${objectids} DeletePolicyAndObject ${policyids} ${objectids}
@@ -413,7 +455,7 @@ DeleteAfterCase
[Arguments] ${policyids} ${objectids} [Arguments] ${policyids} ${objectids}
Run Keyword If '${testPart}'=='all' or '${testPart}'=='3' DeletePolicyAndObject ${policyids} ${objectids} Run Keyword If '${testPart}'=='all' or '${testPart}'=='3' DeletePolicyAndObject ${policyids} ${objectids}
DeletePolicyAndObject1 DeletePolicyAndObject1
[Arguments] ${policyids} ${objectids} ${url} ${profiledId} [Arguments] ${policyids} ${objectids} ${url} ${profiledId} ${categoryIds}=null
#删除策略 #删除策略
log toDeletePolicy_DeletePolicyAndObject log toDeletePolicy_DeletePolicyAndObject
${listlenth}= Get Length ${policyids} ${listlenth}= Get Length ${policyids}
@@ -429,6 +471,12 @@ DeletePolicyAndObject1
log todeleteobj_DeletePolicyAndObject log todeleteobj_DeletePolicyAndObject
Run Keyword If "${profiledId}"=="${EMPTY}" log no file to del Run Keyword If "${profiledId}"=="${EMPTY}" log no file to del
... ELSE DeletePolicyFile1 ${url} ${profiledId} ... ELSE DeletePolicyFile1 ${url} ${profiledId}
#删除Category
log ${categoryIds}
log todeleteCat_DeletePolicyAndObject
Run Keyword If "${categoryIds}"=="${EMPTY}" log no category to del
... ELSE IF "${categoryIds}"=="null" log no category to del
... ELSE DeleteCategory ${categoryIds}
DeletePolicyAndObjectAndVpn DeletePolicyAndObjectAndVpn
[Arguments] ${policyids} ${objectids} ${wan_vpn} [Arguments] ${policyids} ${objectids} ${wan_vpn}
@@ -475,3 +523,12 @@ DeletePolicyAndObjectAndIPpoor
Run Keyword If "${wan_ippoor}"=="${EMPTY}" log no vpn to del Run Keyword If "${wan_ippoor}"=="${EMPTY}" log no vpn to del
... ELSE DeleteWanIpPood ${wan_ippoor} ... ELSE DeleteWanIpPood ${wan_ippoor}
GetIniCategoryId
[Arguments] ${categoryName}
Connect To Database Using Custom Params pymysql ${mysqlHost}
${iniCategoryId} query SELECT group_id FROM tsg_obj_fqdn_cat WHERE low_boundary IN (SELECT category_id FROM tsg_category_dict WHERE category_name='${categoryName}') AND is_initialize=1
Disconnect From Database
${iniCategoryId} Set Variable ${iniCategoryId}[0][0]
[Return] ${iniCategoryId}

View File

@@ -284,15 +284,10 @@ AppIdTreeSearch
Should Be Equal As Strings ${rescode} 200 Should Be Equal As Strings ${rescode} 200
[Return] ${response['data']} [Return] ${response['data']}
AddCategories AddCategories
[Arguments] ${returnData} ${categoryList} [Arguments] ${returnData} ${categoryList} ${opAction} ${testCode}=null
[Documentation] 新增策略对象 [Documentation] 新增Category
... objectList,策略对象,可为list类型与dict类型
... addItemList自动过滤itemId
... updateItemList自动过滤isInitialize(update时该字段引发异常)
... ipItem格式为dict,自动过滤空的字段
... stringItem格式为dict,需要注意keywordArray字段应传入逗号分隔的字符串eg: keyword1,keyword2
... http_signature为代表的拓展关键字keywordArray字段也是以逗号分隔的
... returnData是否返回数据固定为1 ... returnData是否返回数据固定为1
Comment 此处思路给category单独的另一套关键字原因地址与json串名称与Object部分不同了 Comment 此处思路给category单独的另一套关键字原因地址与json串名称与Object部分不同了
${returnData}= Run Keyword If '${returnData}' == '${EMPTY}' Set Variable 1 ${returnData}= Run Keyword If '${returnData}' == '${EMPTY}' Set Variable 1
@@ -300,20 +295,37 @@ AddCategories
#必选参数判定 #必选参数判定
Should Not Be Empty ${categoryList} Should Not Be Empty ${categoryList}
${dictType} = Evaluate type(${categoryList}) ${dictType} = Evaluate type(${categoryList})
${body} Run Keyword If "${dictType}" == "<class 'list'>" CategoryListOperation ${returnData} ${categoryList} add ${body} Run Keyword If "${dictType}" == "<class 'list'>" CategoryListOperation ${returnData} ${categoryList} ${opAction}
... ELSE IF "${dictType}" == "<class 'dict'>" CategoryOperation ${returnData} ${categoryList} add ... ELSE IF "${dictType}" == "<class 'dict'>" CategoryOperation ${returnData} ${categoryList} ${opAction}
... ELSE Set Variable ${EMPTY}
log ${body}
# ${response} BasePostRequestForV2 ${categoryUrl} ${body} ${version}
${response} Run Keyword If "${opAction}"=="add" BasePostRequestForV2 ${categoryUrl} ${body} ${version}
... ELSE IF "${opAction}"=="update" BaseEditRequestForV2 ${categoryUrl} ${body} ${version}
${CategoryObjIds} Run Keyword If "${returnData}" == "1" and ${testCode} == 200 and "${opAction}"=="add" Get-CategoryObjIds ${response}
... ELSE Set Variable ${EMPTY}
${CategoryIds} Run Keyword If "${returnData}" == "1" and ${testCode} == 200 and "${opAction}"=="add" Get-CategoryIds ${response}
... ELSE Set Variable ${EMPTY} ... ELSE Set Variable ${EMPTY}
${response} BasePostRequestForV2 ${categoryUrl} ${body} ${version}
${CategoryIds} Run Keyword If "${returnData}" == "1" Get-CategoryIds ${response}
... ELSE Create List
${rescode} Set Variable ${response['code']} ${rescode} Set Variable ${response['code']}
Should Be Equal As Strings ${rescode} 200 Should Be Equal As Strings ${rescode} ${testCode}
[Return] ${rescode} ${CategoryIds} [Return] ${rescode} ${CategoryObjIds} ${CategoryIds}
QueryUpadateRecord QueryUpadateRecord
[Arguments] ${body} ${code} [Arguments] ${body} ${code}
${response} BaseGetRequestOK /${version}/system/feature/update body=${body} ${response} BaseGetRequestOK /${version}/system/feature/update body=${body}
log ${response} log ${response}
${rescode} Set Variable ${response['code']} ${rescode} Set Variable ${response['code']}
Shoule Be Equal As Strings ${rescode} ${code} Should Be Equal As Strings ${rescode} ${code}
[Return] ${rescode} [Return] ${rescode}
QueryCategory
#hbn
[Arguments] ${body} ${code}
${response} BaseGetRequest /${version}/category/dict body=${body}
log ${response}
${rescode} Set Variable ${response['code']}
Should Be Equal As Strings ${rescode} ${code}
# [Return] ${rescode} ${response}

View File

@@ -130,7 +130,7 @@ CategoryOperation
${json} CategoryOrganize ${category} ${opAction} ${json} CategoryOrganize ${category} ${opAction}
# 转为json结构并返回 # 转为json结构并返回
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} categoryList=replace:objectList ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} list=replace:objectList
${bodyJson} json.Dumps ${dict} ensure_ascii=False ${bodyJson} json.Dumps ${dict} ensure_ascii=False
${json} Replace String ${bodyJson} "replace:objectList" ${json} ${json} Replace String ${bodyJson} "replace:objectList" ${json}
@@ -261,6 +261,7 @@ CategoryOrganize
#新增时addItemList不能为空 #新增时addItemList不能为空
Run Keyword If "${opAction}"=="add" Categorylistorone ${category} Run Keyword If "${opAction}"=="add" Categorylistorone ${category}
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[categoryId] Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[categoryId]
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[objectId]
${return} ${objectId} Run Keyword And Ignore Error Get From Dictionary ${category} objectId ${return} ${objectId} Run Keyword And Ignore Error Get From Dictionary ${category} objectId
Run Keyword If "${return}"=="FAIL" or "${objectId}"=="${EMPTY}" Set To Dictionary ${returnDict} objectId=${EMPTY} Run Keyword If "${return}"=="FAIL" or "${objectId}"=="${EMPTY}" Set To Dictionary ${returnDict} objectId=${EMPTY}
... ELSE Set To Dictionary ${returnDict} objectId=${objectId} ... ELSE Set To Dictionary ${returnDict} objectId=${objectId}
@@ -297,14 +298,10 @@ CategoryOrganize
... ELSE Set To Dictionary ${returnDict} objectSubType=${Default_ObjectSubType} ... ELSE Set To Dictionary ${returnDict} objectSubType=${Default_ObjectSubType}
# 处理AddItemList # 处理AddItemList
${return} ${addItemList} Run Keyword And Ignore Error Get From Dictionary ${category} fqdnList ${return} ${addItemList} Run Keyword And Ignore Error Get From Dictionary ${category} fqdnList
Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType} Run Keyword If "${opAction}"=="add" Should Not Be Empty ${addItemList}
# Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType}
ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType}
# 处理UpdateItemList
${return} ${updateItemList} Run Keyword And Ignore Error Get From Dictionary ${category} updateItemList
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${updateItemList}"!="${EMPTY}" ManageUpdateItemList ${updateItemList} ${returnDict} ${objectTypeV} ${objectSubType}
# 处理deleteItemIds
${return} ${deleteItemIds} Run Keyword And Ignore Error Get From Dictionary ${category} deleteItemIds
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${deleteItemIds}"!="${EMPTY}" ManageDeleteItemIds ${deleteItemIds} ${returnDict}
# 删除无用判断key值objectSubType # 删除无用判断key值objectSubType
Remove From Dictionary ${returnDict} objectSubType Remove From Dictionary ${returnDict} objectSubType
# 转为json结构并返回 # 转为json结构并返回
@@ -354,7 +351,7 @@ ManageUpdateItemList
${itemNew} Run Keyword If '${type}'=='ip' and '${subType}'=="geo_location" ManageGeoItem ${item} ${subType} update ${itemNew} Run Keyword If '${type}'=='ip' and '${subType}'=="geo_location" ManageGeoItem ${item} ${subType} update
... ELSE IF '${type}'=='ip' ManageIpItem ${item} ${subType} update ... ELSE IF '${type}'=='ip' ManageIpItem ${item} ${subType} update
... ELSE IF '${type}'=='url' or '${type}'=='fqdn' or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id' ... ELSE IF '${type}'=='url' or ('${type}'=='fqdn' and '${subType}'!='category') or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id'
... ManageStrItem ${item} ${type} update ... ManageStrItem ${item} ${type} update
... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} update ... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} update
... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} update ... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} update
@@ -365,7 +362,9 @@ ManageUpdateItemList
Remove From Dictionary ${itemNew} isInitialize Remove From Dictionary ${itemNew} isInitialize
Append To List ${itemList} ${itemNew} Append To List ${itemList} ${itemNew}
END END
Set To Dictionary ${returnDict} updateItemList=${itemList} # Set To Dictionary ${returnDict} updateItemList=${itemList}
Run Keyword If '${subType}'=='category' Set To Dictionary ${returnDict} fqdnList=${itemList}
... ELSE Set To Dictionary ${returnDict} updateItemList=${itemList}
ManageIpItem ManageIpItem
[Documentation] [Documentation]
... ip item处理 ... ip item处理
@@ -459,17 +458,8 @@ ManageCategory
${return} ${fqdn} Run Keyword And Ignore Error Set Variable ${item['fqdn']} ${return} ${fqdn} Run Keyword And Ignore Error Set Variable ${item['fqdn']}
${fqdn} Run Keyword If "${return}"!="FAIL" Set Variable ${fqdn} ELSE Set Variable ${EMPTY} ${fqdn} Run Keyword If "${return}"!="FAIL" Set Variable ${fqdn} ELSE Set Variable ${EMPTY}
Run Keyword If "${action}"=="add" Should Not Be Empty ${fqdn} Run Keyword If "${action}"=="add" Should Not Be Empty ${fqdn}
${fqdn} Evaluate re.split('[,]', '${fqdn}') re
# ${return} ${isInitialize} Run Keyword And Ignore Error Set Variable ${item['isInitialize']}
# ${isInitialize} Run Keyword If "${return}"!="FAIL" Set Variable ${isInitialize}
# ... ELSE Set Variable ${EMPTY}
# ${return} ${itemName} Run Keyword And Ignore Error Set Variable ${item['isDelete']}
# ${itemName} Run Keyword If "${return}"!="FAIL" Set Variable ${isDelete}
${itemNew} Create Dictionary ${itemNew} Create Dictionary
Run Keyword If "${fqdn}"!="${EMPTY}" Set To Dictionary ${itemNew} fqdn=${fqdn} Run Keyword If "${fqdn}"!="${EMPTY}" Set To Dictionary ${itemNew} fqdn=${fqdn}
# Run Keyword If "${isInitialize}"!="${EMPTY}" Set To Dictionary ${itemNew} isInitialize=${isInitialize}
# Run Keyword If "${isDelete}"!="${EMPTY}" Set To Dictionary ${itemNew} isDelete=${isDelete}
[Return] ${itemNew} [Return] ${itemNew}
ManageFileItem ManageFileItem
@@ -526,11 +516,29 @@ Get-ObjectIds
${json} Remove String ${json} ] ${json} Remove String ${json} ]
[Return] ${json} [Return] ${json}
Get-CategoryObjIds
[Documentation]
... 获取Category结果中的对象ID
[Arguments] ${value}
Log Call Get-CategoryObjectIds
${CategoryObjIds} Create List
${CategoryTemp} Set Variable ${EMPTY}
${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data
Return From Keyword If "${return}"=="FAIL" ${CategoryTemp}
FOR ${category} IN @{value['data']['list']}
Append To List ${CategoryObjIds} ${category['objectId']}
END
${json} json.Dumps ${CategoryObjIds} ensure_ascii=False
${json} Remove String ${json} [
${json} Remove String ${json} ]
[Return] ${json}
Get-CategoryIds Get-CategoryIds
[Documentation] [Documentation]
... 获取结果中的对象ID ... 获取Category结果中的对象ID
[Arguments] ${value} [Arguments] ${value}
Log Call Get-ObjectIds Log Call Get-CategoryObjectIds
${CategoryIds} Create List ${CategoryIds} Create List
${CategoryTemp} Set Variable ${EMPTY} ${CategoryTemp} Set Variable ${EMPTY}
${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data ${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data

View File

@@ -1 +1 @@
curl -kv https://lunar.pw/| iconv -f utf-8 -t gbk curl -kv https://russia.payu.com/

View File

@@ -1 +1 @@
curl http://www.gf.com.cn/about/intro | iconv -f utf-8 -t gbk curl http://www.gf.com.cn/about/intro -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv --cookie "UM_distinctid=177195d2f67c6b-06a24c7c217958-31346d-384000-177195d2f68bcf; CNZZDATA1279340671=485789824-1611035725-null%7C1611035725; Hm_lvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; Hm_lpvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; _csrfToken=hcK679WZm6N2HCbL4lEBi8VIc5GD6d3nVrFPZTDP; newstatisticUUID=1611038276_1033864685" --referer 'https://www.baidu.com/' https://www.hongxiu.com/ curl -kv --cookie "UM_distinctid=177195d2f67c6b-06a24c7c217958-31346d-384000-177195d2f68bcf; CNZZDATA1279340671=485789824-1611035725-null%7C1611035725; Hm_lvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; Hm_lpvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; _csrfToken=hcK679WZm6N2HCbL4lEBi8VIc5GD6d3nVrFPZTDP; newstatisticUUID=1611038276_1033864685" --referer 'https://www.baidu.com/' https://www.hongxiu.com/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv --cookie "_csrfToken=qjRd8SBOkzGEgOrCAvpDpRLD0hqTSIoNDVZ6DpbU; newstatisticUUID=1611038238_1406562325" --referer 'https://www.baidu.com/' https://www.readnovel.com/ curl -kv --cookie "_csrfToken=qjRd8SBOkzGEgOrCAvpDpRLD0hqTSIoNDVZ6DpbU; newstatisticUUID=1611038238_1406562325" --referer 'https://www.baidu.com/' https://www.readnovel.com/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv https://russia.payu.com/orange-data/ | iconv -f utf-8 -t gbk curl -kv https://russia.payu.com/

View File

@@ -1,2 +1,2 @@
curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gb2312 curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gb2312

View File

@@ -1 +1 @@
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv --cookie "lQfQ_2132_saltkey=t8WY1oPe; lQfQ_2132_lastvisit=1595381790; lQfQ_2132_sid=vqXOg6; lQfQ_2132_lastact=1595385400%09forum.php%09image" --referer 'https://www.baidu.com/' https://www.reval.com/corporates/ curl -kv --cookie "lQfQ_2132_saltkey=t8WY1oPe; lQfQ_2132_lastvisit=1595381790; lQfQ_2132_sid=vqXOg6; lQfQ_2132_lastact=1595385400%09forum.php%09image" --referer 'https://www.baidu.com/' https://www.reval.com/corporates/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv http://www.world-guides.com/north-america/usa/nevada/las-vegas/ curl -kv http://www.world-guides.com/north-america/usa/nevada/las-vegas/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv http://news.cnstock.com/kcb | iconv -f utf-8 -t gbk curl -kv http://news.cnstock.com/kcb | iconv -f utf-8 -t unicode

View File

@@ -0,0 +1 @@
curl -kv https://www.pjpugliese.com/ | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://carblog.co.za/ | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl -kv https://www.ornithomedia.com/ | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://umcfa.webs.com/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl -kv -L --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.engadget.com/gaming/ | iconv -f utf-8 -t gbk curl -kv -L --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' https://www.engadget.com/gaming/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl --connect-timeout 5 -m 10 -w %{http_code} blog.cnstock.com | iconv -f utf-8 -t gbk curl --connect-timeout 5 -m 10 -kv http://blog.cnstock.com/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl --connect-timeout 5 -m 10 -kv --referer 'http://www.baidu.com/' https://www.prlib.ru curl --connect-timeout 5 -m 10 -kv --referer 'http://www.baidu.com/' https://www.prlib.ru | iconv -f utf-8 -t ISO8859-1

View File

@@ -0,0 +1 @@
curl http://www.zongheng.com/ | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl http://nerdreactor.com/latest-posts/ | iconv -f utf-8 -t gbk curl http://www.jrj.com.cn/ | iconv -f gbk -t gbk

View File

@@ -1 +1 @@
curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'http://www.baidu.com/' \ curl http://ww1.dollshouseforum.com/ | iconv -f utf-8 -t gbk curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" http://licaike.hexun.com/self_search?fundType=01 | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl http://www.tccb.com.cn/grjr/index.shtml | iconv -f utf-8 -t gbk curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" http://www.tccb.com | iconv -f utf-8 -t gbk

View File

@@ -1 +1 @@
curl --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://www.iqiyi.com/ | iconv -f utf-8 -t gbk curl --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://nerdreactor.com/ | iconv -f utf-8 -t gbk