diff --git a/01-TestCase/tsg_bfapi/setting/PacketCapture.robot b/01-TestCase/tsg_bfapi/setting/PacketCapture.robot index adbe618..417c130 100644 --- a/01-TestCase/tsg_bfapi/setting/PacketCapture.robot +++ b/01-TestCase/tsg_bfapi/setting/PacketCapture.robot @@ -13,39 +13,165 @@ Library Custometest *** Variables *** ${policyIds} ${EMPTY} ${objectids} ${EMPTY} +${url} /v1/policy/profile/responsepages +${profiledId} ${EMPTY} -*** Test Cases *** -test - ${isp} Create List transtel tnsplus ktel-mask ktel-bng ktel-mxpe - ${value} Set Variable transtel - ${aaaaa} Index ${isp} ${value} - # index ${isp} ${value} - log ${aaaaa} +*** Test Cases *** create_PacketCapture_Select_Location - #添加一个vpn - ${PacketCapture} Create Dictionary policyId= policyName=zmmtest addrType=4 protocol=6 clientIp=192.168.40.5 clientPort=120 serverIp=0.0.0.0 serverPort=0 maxPacket=1000 captureDuration=1 + # 创建捕包策略 + log 创建捕包策略 + ${PacketCapture} Create Dictionary policyId= policyName=zmmtest addrType=4 protocol=6 clientIp=192.168.50.60 clientPort=8080 serverIp=0.0.0.0 serverPort=0 maxPacket=1000 captureDuration=1 ${location} Create List Almaty Nursurtan # ${location} Create List # ${isp} Create List transtel tnsplus ktel-mask ktel-bng ktel-mxpe ${isp} Create List log ${PacketCapture} ${PacketCaptureresponse} Add&Edit_PacketCapture ${PacketCapture} ${location} ${isp} + LOG WEQEWEQWEWEWERWERWQERWEQRWERWEQRWQEQWERWEQR + #创建策略 + Comment 创建应答头 + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=html|Content-Type + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + ${objectids} set Variable ${objectId} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-HTTP-00001 policyType=tsg_security policyDesc=autotest userTags= action=intercept effectiveRange= userRegion={"protocol": "HTTP"} referenceObject= isValid=${1} appObjectIdArray=2 + ${rescode} ${policyId} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]} + ${policyIds} Create List ${policyId1} + ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages + ${profiledId} Get From Dictionary ${response} profileId + Comment 创建管控策略 + ${policyDict} Create Dictionary policyName=proxyPolicy-Deny-HTTP-00014 policyType=pxy_manipulation policyDesc=autotest userTags= action=deny effectiveRange= userRegion={"method":"block","html_profile":${profiledId},"code":403,"protocol":"HTTP"} isValid=${1} appObjectIdArray=2 referenceObject=${objectId}|TSG_FIELD_HTTP_RES_HDR + ${rescode} ${policyId3} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${policyId3}]} + ${policyIds} Create List ${policyId1} ${policyId2} + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/SecurityPolicy-Intercept-HTTP-0001.bat + ... ELSE set variable curl http://open.node.com/test/xiaozhu/xiaozhu.html + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ... ELSE Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + #日志验证 + ${s} Convert to String ${policyId3} + GetLogList proxy_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com + + + LOG 捕包进度查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress policyId=${policyId3} v1 + LOG 捕包任务详情查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/detail taskId=${PacketCaptureresponse} v1 + LOG 捕包设备执行情况查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress/detail taskId=${PacketCaptureresponse} v1 create_PacketCapture_Select_ISP - #添加一个vpn - ${wan_vpn_dict} Create Dictionary username=zmmtest2 password=abcdef iconColor=#dddddd - ${wan_vpn_dict_2} Create Dictionary username=zmmtest3 password=abcdef iconColor=#dddddd - ${wan_vpn_list} Create List ${wan_vpn_dict} ${wan_vpn_dict_2} - ${a} AddWanVpn ${wan_vpn_list} - log ${a} -delete_wan_vpn_1 - # 删除一个vpn - ${deletelist} Create List 31 - ${a} DeleteWanVpn ${deletelist} -delete_wan_vpn_2 - # 删除一个vpn - ${deletelist} Create List 35 33 - ${a} DeleteWanVpn ${deletelist} - ${result} Replace String ${test01} ( ; \ No newline at end of file + # 创建捕包策略 + log 创建捕包策略 + ${PacketCapture} Create Dictionary policyId= policyName=zmmtest addrType=4 protocol=6 clientIp=192.168.50.60 clientPort=8080 serverIp=0.0.0.0 serverPort=0 maxPacket=1000 captureDuration=1 + # ${location} Create List Almaty Nursurtan + ${location} Create List + ${isp} Create List transtel tnsplus ktel-mask ktel-bng ktel-mxpe + # ${isp} Create List + log ${PacketCapture} + ${PacketCaptureresponse} Add&Edit_PacketCapture ${PacketCapture} ${location} ${isp} + + #创建策略 + Comment 创建应答头 + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=html|Content-Type + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + ${objectids} set Variable ${objectId} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-HTTP-00001 policyType=tsg_security policyDesc=autotest userTags= action=intercept effectiveRange= userRegion={"protocol": "HTTP"} referenceObject= isValid=${1} appObjectIdArray=2 + ${rescode} ${policyId} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]} + ${policyIds} Create List ${policyId1} + ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages + ${profiledId} Get From Dictionary ${response} profileId + Comment 创建管控策略 + ${policyDict} Create Dictionary policyName=proxyPolicy-Deny-HTTP-00014 policyType=pxy_manipulation policyDesc=autotest userTags= action=deny effectiveRange= userRegion={"method":"block","html_profile":${profiledId},"code":403,"protocol":"HTTP"} isValid=${1} appObjectIdArray=2 referenceObject=${objectId}|TSG_FIELD_HTTP_RES_HDR + ${rescode} ${policyId3} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${policyId3}]} + ${policyIds} Create List ${policyId1} ${policyId2} + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/SecurityPolicy-Intercept-HTTP-0001.bat + ... ELSE set variable curl http://open.node.com/test/xiaozhu/xiaozhu.html + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ... ELSE Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + #日志验证 + ${s} Convert to String ${policyId3} + GetLogList proxy_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com + + + LOG 捕包进度查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress policyId=${policyId3} v1 + LOG 捕包任务详情查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/detail taskId=${PacketCaptureresponse} v1 + LOG 捕包设备执行情况查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress/detail taskId=${PacketCaptureresponse} v1 + +create_PacketCapture_Select_ISP + # 创建捕包策略 + log 创建捕包策略 + ${PacketCapture} Create Dictionary policyId= policyName=zmmtest addrType=4 protocol=6 clientIp=192.168.50.60 clientPort=8080 serverIp=0.0.0.0 serverPort=0 maxPacket=1000 captureDuration=1 + ${location} Create List Almaty Nursurtan + # ${location} Create List + ${isp} Create List transtel tnsplus ktel-mask ktel-bng ktel-mxpe + # ${isp} Create List + log ${PacketCapture} + ${PacketCaptureresponse} Add&Edit_PacketCapture ${PacketCapture} ${location} ${isp} + + #创建策略 + Comment 创建应答头 + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=html|Content-Type + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + ${objectids} set Variable ${objectId} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-HTTP-00001 policyType=tsg_security policyDesc=autotest userTags= action=intercept effectiveRange= userRegion={"protocol": "HTTP"} referenceObject= isValid=${1} appObjectIdArray=2 + ${rescode} ${policyId} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]} + ${policyIds} Create List ${policyId1} + ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages + ${profiledId} Get From Dictionary ${response} profileId + Comment 创建管控策略 + ${policyDict} Create Dictionary policyName=proxyPolicy-Deny-HTTP-00014 policyType=pxy_manipulation policyDesc=autotest userTags= action=deny effectiveRange= userRegion={"method":"block","html_profile":${profiledId},"code":403,"protocol":"HTTP"} isValid=${1} appObjectIdArray=2 referenceObject=${objectId}|TSG_FIELD_HTTP_RES_HDR + ${rescode} ${policyId3} AddPolicy2 ${1} ${policyDict} + #删除策略 + ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${policyId3}]} + ${policyIds} Create List ${policyId1} ${policyId2} + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/SecurityPolicy-Intercept-HTTP-0001.bat + ... ELSE set variable curl http://open.node.com/test/xiaozhu/xiaozhu.html + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ... ELSE Create List 对不起,您请求的页面不存在、或已被删除、或暂时不可用 + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + #日志验证 + ${s} Convert to String ${policyId3} + GetLogList proxy_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com + + + LOG 捕包进度查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress policyId=${policyId3} v1 + LOG 捕包任务详情查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/detail taskId=${PacketCaptureresponse} v1 + LOG 捕包设备执行情况查询 + ${progress_response} BaseGetRequestForV2 troubleshooting/packetcapture/log/progress/detail taskId=${PacketCaptureresponse} v1 +