2021-03-03 18:11:18 +08:00
|
|
|
*** Settings ***
|
2021-03-05 11:37:54 +08:00
|
|
|
Force Tags tsg_adc_wp adc_api security_policy
|
2021-03-03 18:11:18 +08:00
|
|
|
Library OperatingSystem
|
|
|
|
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
|
|
|
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
|
|
|
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
|
|
|
|
Resource ../../../02-Keyword/tsg_adc/FileOperation.robot
|
|
|
|
|
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
|
|
|
|
|
Resource ../../../03-Variable/ApplicationID.txt
|
|
|
|
|
|
|
|
|
|
*** Test Cases ***
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00001
|
|
|
|
|
[Tags] calling ip source
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00001 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00002
|
|
|
|
|
[Tags] calling ip port source
|
|
|
|
|
Comment 创建第二个源IP
|
|
|
|
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.60-192.168.50.60 port=0-22222 direction=0 protocol=0 isInitialize=0
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00002 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} source=${objectId}|TSG_SECURITY_SOURCE_ADDR isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId1 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00003
|
|
|
|
|
[Tags] calling subid source
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00003 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} defaultClient=clientsubid isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId2 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00004
|
|
|
|
|
[Tags] calling ip geo source
|
|
|
|
|
Comment 创建ip geo
|
|
|
|
|
${addItemList1} Create Dictionary keywordArray=XXG地区.*
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00004 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} source=${objectId}|TSG_SECURITY_SOURCE_LOCATION isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId1 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId3 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00005
|
|
|
|
|
[Tags] called domain ip source
|
|
|
|
|
Comment 创建第二个源IP
|
|
|
|
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.2-192.168.50.2 port=0-0 direction=0 protocol=0 isInitialize=0
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00005 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} source=${objectId}|TSG_SECURITY_SOURCE_ADDR isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId2 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId4 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00006
|
|
|
|
|
[Tags] called domain ip port source
|
|
|
|
|
Comment 创建第二个源IP
|
|
|
|
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.2-192.168.50.2 port=0-22222 direction=0 protocol=0 isInitialize=0
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00006 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} source=${objectId}|TSG_SECURITY_SOURCE_ADDR isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId3 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId5 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00007
|
|
|
|
|
[Tags] called domain ip geo source
|
|
|
|
|
Comment 创建ip geo
|
|
|
|
|
${addItemList1} Create Dictionary keywordArray=XXG地区.*
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00007 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} source=${objectId}|TSG_SECURITY_SOURCE_LOCATION isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId4 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId6 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00008
|
|
|
|
|
[Tags] called domain ip des
|
|
|
|
|
Comment 创建第二个源IP
|
|
|
|
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.2-192.168.50.2 port=0-0 direction=0 protocol=0 isInitialize=0
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00005 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId5 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId7 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-00009
|
|
|
|
|
[Tags] called domain ip port des
|
|
|
|
|
Comment 创建第二个源IP
|
|
|
|
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.2-192.168.50.2 port=0-22222 direction=0 protocol=0 isInitialize=0
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00006 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId6 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId8 ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Rtp-000010
|
|
|
|
|
[Tags] called domain ip geo des
|
|
|
|
|
Comment 创建ip geo
|
|
|
|
|
${addItemList1} Create Dictionary keywordArray=XXG地区.*
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Rtp-00007 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"RTP"} destination=${objectId}|TSG_SECURITY_DESTINATION_LOCATION isValid=${0} appIdObjects=${RTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_objectId7 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_rtp_policyId9 ${policyId}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|