feat(Cli):1、策略状态更改测试用例补充策略类型,2、策略对象查询测试用例多次迭代,3、增加对各cli命令help参数返回值测试
This commit is contained in:
@@ -3,20 +3,14 @@ Force Tags tsg-cli Policy EnDisable
|
||||
Resource ../../03-Variable/bifangapivariable.txt
|
||||
Resource ../../02-Keyword/tsg_cli/interface.robot
|
||||
|
||||
*** Variables ***
|
||||
${PolicyType} tsg_security
|
||||
|
||||
*** Test Cases ***
|
||||
init
|
||||
${data} Get_Policy_Object3 ${PolicyType}
|
||||
Set Suite Variable ${obj} ${data}
|
||||
|
||||
Policy_Update01
|
||||
Tsg_Policy_EnDisable ${obj}[policyId] ${PolicyType} ${obj}[commandType1]
|
||||
|
||||
Policy_Update02
|
||||
Tsg_Policy_EnDisable ${obj}[policyId] ${PolicyType} ${obj}[commandType2]
|
||||
|
||||
|
||||
|
||||
|
||||
Policy_EnDisable_TestCase
|
||||
# 操作不同类型策略
|
||||
FOR ${policyType} IN @{PolicyTypes}
|
||||
${obj} Get_Policy_Object3 ${policyType}
|
||||
# 更改策略状态
|
||||
Tsg_Policy_EnDisable ${obj}[policyId] ${policyType} ${obj}[commandType1]
|
||||
# 复原策略状态
|
||||
Tsg_Policy_EnDisable ${obj}[policyId] ${policyType} ${obj}[commandType2]
|
||||
END
|
||||
|
||||
@@ -6,7 +6,11 @@ Resource ../../02-Keyword/tsg_cli/interface.robot
|
||||
Tsg_Help_TestCase
|
||||
[Tags] tsg-cli TsgHelp
|
||||
Tsg_Help_Keyword
|
||||
|
||||
Tsg_Command_Help tsg_policy
|
||||
Tsg_Command_Help tsg_policy_object
|
||||
Tsg_Command_Help tsg_record
|
||||
Tsg_Command_Help tsg_show
|
||||
|
||||
Tsg_Diagnose_TestCase
|
||||
[Tags] tsg-cli TsgDiagnose
|
||||
Tsg_Diagnose_Keyword
|
||||
|
||||
@@ -3,31 +3,17 @@ Force Tags tsg-cli ManipulationPolicy Query
|
||||
Resource ../../03-Variable/bifangapivariable.txt
|
||||
Resource ../../02-Keyword/tsg_cli/interface.robot
|
||||
|
||||
*** Variables ***
|
||||
${PolicyType} pxy_manipulation
|
||||
|
||||
*** Test Cases ***
|
||||
init
|
||||
${data} Get_Policy_Object2 ${PolicyType}
|
||||
Set Suite Variable ${obj} ${data}
|
||||
PxyManipulation_Policy_Query_TestCase
|
||||
# 取最多10条策略数据,分别做条件查询
|
||||
${list} Get_Policy_Object2 pxy_manipulation
|
||||
FOR ${obj} IN @{list}
|
||||
Tsg_Policy_Query pxy_manipulation ${obj}[policyId] ${None} ${None} ${True}
|
||||
Tsg_Policy_Query pxy_manipulation ${None} ${obj}[policyName] ${None} ${True}
|
||||
Tsg_Policy_Query pxy_manipulation ${None} ${None} ${obj}[policyDesc] ${True}
|
||||
Tsg_Policy_Query pxy_manipulation ${obj}[policyId] ${obj}[policyName] ${None} ${True}
|
||||
Tsg_Policy_Query pxy_manipulation ${obj}[policyId] ${None} ${obj}[policyDesc] ${True}
|
||||
Tsg_Policy_Query pxy_manipulation ${None} ${obj}[policyName] ${obj}[policyDesc] ${True}
|
||||
END
|
||||
|
||||
|
||||
Policy_Query01
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${None} ${None} ${True}
|
||||
|
||||
Policy_Query02
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${obj}[policyName] ${None} ${True}
|
||||
|
||||
Policy_Query03
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${None} ${obj}[policyDesc] ${True}
|
||||
|
||||
Policy_Query04
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${obj}[policyName] ${None} ${True}
|
||||
|
||||
Policy_Query05
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${None} ${obj}[policyDesc] ${True}
|
||||
|
||||
Policy_Query06
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${obj}[policyName] ${obj}[policyDesc] ${True}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,109 +3,12 @@ Force Tags tsg-cli Object Query
|
||||
Resource ../../03-Variable/bifangapivariable.txt
|
||||
Resource ../../02-Keyword/tsg_cli/interface.robot
|
||||
|
||||
*** Variables ***
|
||||
${ObjectType1} ip
|
||||
${ObjectType2} url
|
||||
${ObjectType3} fqdn
|
||||
${ObjectType4} keywords
|
||||
${ObjectType5} subscriberid
|
||||
${ObjectType6} fqdn_category
|
||||
${ObjectType7} account
|
||||
${ObjectType8} http_signature
|
||||
|
||||
*** Test Cases ***
|
||||
init
|
||||
${data1} Get_Policy_Object4 ${ObjectType1}
|
||||
Set Suite Variable ${obj1} ${data1}
|
||||
${data2} Get_Policy_Object4 ${ObjectType2}
|
||||
Set Suite Variable ${obj2} ${data2}
|
||||
${data3} Get_Policy_Object4 ${ObjectType3}
|
||||
Set Suite Variable ${obj3} ${data3}
|
||||
${data4} Get_Policy_Object4 ${ObjectType4}
|
||||
Set Suite Variable ${obj4} ${data4}
|
||||
${data5} Get_Policy_Object4 ${ObjectType5}
|
||||
Set Suite Variable ${obj5} ${data5}
|
||||
${data6} Get_Policy_Object4 ${ObjectType6}
|
||||
Set Suite Variable ${obj6} ${data6}
|
||||
${data7} Get_Policy_Object4 ${ObjectType7}
|
||||
Set Suite Variable ${obj7} ${data7}
|
||||
${data8} Get_Policy_Object4 ${ObjectType8}
|
||||
Set Suite Variable ${obj8} ${data8}
|
||||
|
||||
|
||||
Object_Query01
|
||||
Objects_Query_TestCase
|
||||
# 无条件查询
|
||||
Tsg_Policy_Object_Query ${None} ${None} ${True}
|
||||
|
||||
Object_Query_IP_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj1}[objectName] ${True}
|
||||
|
||||
Object_Query_IP_02
|
||||
Tsg_Policy_Object_Query ${obj1}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_IP_03
|
||||
Tsg_Policy_Object_Query ${obj1}[objectType] ${obj1}[objectName] ${True}
|
||||
|
||||
Object_Query_URL_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj2}[objectName] ${True}
|
||||
|
||||
Object_Query_URL_02
|
||||
Tsg_Policy_Object_Query ${obj2}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_URL_03
|
||||
Tsg_Policy_Object_Query ${obj2}[objectType] ${obj2}[objectName] ${True}
|
||||
FOR ${objectType} IN @{ObjectTypes}
|
||||
QueryObjectInnerForEach ${objectType}
|
||||
END
|
||||
|
||||
Object_Query_FQDN_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj3}[objectName] ${True}
|
||||
|
||||
Object_Query_FQDN_02
|
||||
Tsg_Policy_Object_Query ${obj3}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_FQDN_03
|
||||
Tsg_Policy_Object_Query ${obj3}[objectType] ${obj3}[objectName] ${True}
|
||||
|
||||
Object_Query_KEYWORDS_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj4}[objectName] ${True}
|
||||
|
||||
Object_Query_KEYWORDS_02
|
||||
Tsg_Policy_Object_Query ${obj4}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_KEYWORDS_03
|
||||
Tsg_Policy_Object_Query ${obj4}[objectType] ${obj4}[objectName] ${True}
|
||||
|
||||
Object_Query_SUBSCRIBERID_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj5}[objectName] ${True}
|
||||
|
||||
Object_Query_SUBSCRIBERID_02
|
||||
Tsg_Policy_Object_Query ${obj5}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_SUBSCRIBERID_03
|
||||
Tsg_Policy_Object_Query ${obj5}[objectType] ${obj5}[objectName] ${True}
|
||||
|
||||
Object_Query_FQDN_CATEGORY_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj6}[objectName] ${True}
|
||||
|
||||
Object_Query_FQDN_CATEGORY_02
|
||||
Tsg_Policy_Object_Query ${obj6}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_FQDN_CATEGORY_03
|
||||
Tsg_Policy_Object_Query ${obj6}[objectType] ${obj6}[objectName] ${True}
|
||||
|
||||
Object_Query_ACCOUNT_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj7}[objectName] ${True}
|
||||
|
||||
Object_Query_ACCOUNT_02
|
||||
Tsg_Policy_Object_Query ${obj7}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_ACCOUNT_03
|
||||
Tsg_Policy_Object_Query ${obj7}[objectType] ${obj7}[objectName] ${True}
|
||||
|
||||
Object_Query_HTTP_SIGNATURE_01
|
||||
Tsg_Policy_Object_Query ${None} ${obj8}[objectName] ${True}
|
||||
|
||||
Object_Query_HTTP_SIGNATURE_02
|
||||
Tsg_Policy_Object_Query ${obj8}[objectType] ${None} ${True}
|
||||
|
||||
Object_Query_HTTP_SIGNATURE_03
|
||||
Tsg_Policy_Object_Query ${obj8}[objectType] ${obj8}[objectName] ${True}
|
||||
|
||||
|
||||
|
||||
@@ -3,31 +3,15 @@ Force Tags tsg-cli SecurityPolicy Query
|
||||
Resource ../../03-Variable/bifangapivariable.txt
|
||||
Resource ../../02-Keyword/tsg_cli/interface.robot
|
||||
|
||||
*** Variables ***
|
||||
${PolicyType} tsg_security
|
||||
|
||||
*** Test Cases ***
|
||||
init
|
||||
${data} Get_Policy_Object1 ${PolicyType}
|
||||
Set Suite Variable ${obj} ${data}
|
||||
|
||||
Policy_Query01
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${None} ${None} ${True}
|
||||
|
||||
Policy_Query02
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${obj}[policyName] ${None} ${True}
|
||||
|
||||
Policy_Query03
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${None} ${obj}[policyDesc] ${True}
|
||||
|
||||
Policy_Query04
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${obj}[policyName] ${None} ${True}
|
||||
|
||||
Policy_Query05
|
||||
Tsg_Policy_Query ${PolicyType} ${obj}[policyId] ${None} ${obj}[policyDesc] ${True}
|
||||
|
||||
Policy_Query06
|
||||
Tsg_Policy_Query ${PolicyType} ${None} ${obj}[policyName] ${obj}[policyDesc] ${True}
|
||||
|
||||
|
||||
|
||||
Security_Policy_Query_TestCase
|
||||
# 取最多10条策略数据,分别做条件查询
|
||||
${list} Get_Policy_Object2 tsg_security
|
||||
FOR ${obj} IN @{list}
|
||||
Tsg_Policy_Query tsg_security ${obj}[policyId] ${None} ${None} ${True}
|
||||
Tsg_Policy_Query tsg_security ${None} ${obj}[policyName] ${None} ${True}
|
||||
Tsg_Policy_Query tsg_security ${None} ${None} ${obj}[policyDesc] ${True}
|
||||
Tsg_Policy_Query tsg_security ${obj}[policyId] ${obj}[policyName] ${None} ${True}
|
||||
Tsg_Policy_Query tsg_security ${obj}[policyId] ${None} ${obj}[policyDesc] ${True}
|
||||
Tsg_Policy_Query tsg_security ${None} ${obj}[policyName] ${obj}[policyDesc] ${True}
|
||||
END
|
||||
|
||||
@@ -32,7 +32,8 @@ Get_Policy_Object1
|
||||
[Arguments] ${type}
|
||||
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
|
||||
Should Be True ${dict}[data][total] > 1
|
||||
[Return] ${dict}[data][list][1]
|
||||
${list} Evaluate list(${dict}[data][list])[1:11]
|
||||
[Return] ${list}
|
||||
|
||||
Get_Policy_Object2
|
||||
[Documentation]
|
||||
@@ -41,7 +42,8 @@ Get_Policy_Object2
|
||||
... 返回:任意单条策略
|
||||
[Arguments] ${type}
|
||||
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
|
||||
[Return] ${dict}[data][list][0]
|
||||
${list} Evaluate list(${dict}[data][list])[:10]
|
||||
[Return] ${list}
|
||||
|
||||
Get_Policy_Object3
|
||||
[Documentation]
|
||||
@@ -49,7 +51,11 @@ Get_Policy_Object3
|
||||
... 参数:type(策略类型)
|
||||
... 返回:policyId(策略ID)、commandType1(enable/disable,修改)、commandType2(enable/disable,还原)
|
||||
[Arguments] ${type}
|
||||
${obj} Get_Policy_Object1 ${type}
|
||||
#${obj} Get_Policy_Object1 ${type}
|
||||
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
|
||||
Should Be True ${dict}[data][total] > 1
|
||||
${obj} Set Variable ${dict}[data][list][1]
|
||||
|
||||
${commandType1} Run Keyword If ${obj}[isValid]==0 Set Variable enable
|
||||
... ELSE Set Variable disable
|
||||
${commandType2} Run Keyword If ${obj}[isValid]==1 Set Variable enable
|
||||
@@ -64,7 +70,8 @@ Get_Policy_Object4
|
||||
... 返回:任意单条对象
|
||||
[Arguments] ${type}
|
||||
${dict} Tsg_Policy_Object_Query ${type} ${None} ${True}
|
||||
[Return] ${dict}[data][list][0]
|
||||
${list} Evaluate list(${dict}[data][list])[:10]
|
||||
[Return] ${list}
|
||||
|
||||
Get_File_Name
|
||||
[Documentation]
|
||||
@@ -209,6 +216,17 @@ Tsg_Diagnose_Keyword
|
||||
# 执行'text'指令,在'timeout'时间内每隔'retry_interval'时间重试,直至返回值出现'expected'时或超时结束
|
||||
Write Until Expected Output tsg_diagnose\n Success ${timeout} ${retryInterval}
|
||||
|
||||
Tsg_Command_Help
|
||||
[Documentation]
|
||||
... 描述:执行'* --help'指令,并验证返回值
|
||||
... 参数:无
|
||||
... 返回:无
|
||||
[Arguments] ${cmd}
|
||||
${str} Set Variable ${cmd} --help
|
||||
${r} Run9 ${str}
|
||||
${data} Evaluate open(r"${path}/cli_files/${cmd}_help.txt",'rb').read()
|
||||
Should Be Equal ${r} ${data}
|
||||
|
||||
Tsg_Show_Chassis-ip
|
||||
[Documentation]
|
||||
... 描述:执行'tsg_show --chassis-ip'指令,并验证返回值
|
||||
@@ -464,3 +482,15 @@ Run9
|
||||
${r} Read delay=10s
|
||||
Should Not Be Empty ${r}
|
||||
[Return] ${r}
|
||||
|
||||
QueryObjectInnerForEach
|
||||
# 循环嵌套
|
||||
[Arguments] ${objectType}
|
||||
${list} Get_Policy_Object4 ${objectType}
|
||||
# 取最多10条策略对象数据,分别做条件查询
|
||||
FOR ${obj} IN @{list}
|
||||
Tsg_Policy_Object_Query ${None} ${obj}[objectName] ${True}
|
||||
Tsg_Policy_Object_Query ${obj}[objectType] ${None} ${True}
|
||||
Tsg_Policy_Object_Query ${obj}[objectType] ${obj}[objectName] ${True}
|
||||
END
|
||||
|
||||
|
||||
5
05-Other/cli_files/tsg_policy_help.txt
Normal file
5
05-Other/cli_files/tsg_policy_help.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Policy query
|
||||
tsg_policy [--query --policyType(tsg_security|pxy_manipulation|pxy_cache) --policyId --policyName --policyDesc --all] Query strategy: policyType is required, policyId, policyName, policyDesc is not.
|
||||
tsg_policy [--enable --policyId --policyType] Enable the strategy
|
||||
tsg_policy [--disable --policyId --policyType] Stop using strategy
|
||||
tsgcli >
|
||||
5
05-Other/cli_files/tsg_policy_object_help.txt
Normal file
5
05-Other/cli_files/tsg_policy_object_help.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Strategy object query
|
||||
tsg_policy_object [--query --objectType(ip|url|fqdn|keywords|subscriberid|fqdn_category|account|http_signature) --all --objectName] Query strategy object
|
||||
tsg_policy_object [--import --objectType --file --objectName] Import the policy object by file: enter objectType/file are required, objectName is optional
|
||||
tsg_policy_object [--export --objectType --file --exportFormat(txt|csv)] Export the policy object to a local file:export objectType/file are required, exportFormat is optional
|
||||
tsgcli >
|
||||
4
05-Other/cli_files/tsg_record_help.txt
Normal file
4
05-Other/cli_files/tsg_record_help.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Display the most recently run command history: you can view the command history of all users
|
||||
tsg_record [--username] Specifies the user's history is to be viewed
|
||||
tsg_record [--userlist] View all current CLI user names
|
||||
tsgcli >
|
||||
9
05-Other/cli_files/tsg_show_help.txt
Normal file
9
05-Other/cli_files/tsg_show_help.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Used to view the running status of devices and applications, network traffic, and related statistics
|
||||
tsg_show [--interface -- "where PhyRXBits > 60"] Display all available ports of the current device (network card name),where support, format : -- "where PhyRXBits > 60"
|
||||
tsg_show [--app -- "where RxBits > 3000"] Displays traffic information processed by the application,where support, format : -- "where RxBits > 3000"
|
||||
tsg_show [--protocol -- "where Ipv4_Bit > 3000"] Show Eth,Ipv4, and IPv6 statistics for each layer of network traffic,where support, format : -- "where Ipv4_Bit > 3000"
|
||||
tsg_show [--stream -- "where Tcp_Concurrent > 0"] TCP stream related information, including the number of concurrent streams, C2S, S2C, etc,where support, format : -- "where Tcp_Concurrent > 0"
|
||||
tsg_show [--chassis-ip] Output all board card IP information of TSG device
|
||||
tsg_show [--chassis-port] Output all board card port information of TSG device
|
||||
tsg_show [--intercept -- "where intcp_rdy_bits > 0"] Show intercept information,where support, format : -- "where intcp_rdy_bits > 0"
|
||||
tsgcli >
|
||||
Reference in New Issue
Block a user