feat(MIB):增加TSG MIB测试用例
This commit is contained in:
62
01-TestCase/tsg_mib/MibTestCase.robot
Normal file
62
01-TestCase/tsg_mib/MibTestCase.robot
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Setup OpenMibConnection
|
||||||
|
Test Teardown CloseMibConnection
|
||||||
|
Library json
|
||||||
|
Library String
|
||||||
|
Library Collections
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Resource ../../02-Keyword/tsg_mib/MibKeywords.robot
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
ScalarObjects_TestCase
|
||||||
|
# hwRRCTEMP
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.2 int
|
||||||
|
# hwCMMTEMP
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.3 int
|
||||||
|
# hwP1V
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.4 float
|
||||||
|
# hwPVDDS
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.5 float
|
||||||
|
# hwPVDDF
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.6 float
|
||||||
|
# hwP3V3
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.7 float
|
||||||
|
# hwP5V
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.8 float
|
||||||
|
# hwP12V
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.9 float
|
||||||
|
# hwP1VRT
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.10 float
|
||||||
|
# hwFan1
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.11 int
|
||||||
|
# hwFan2
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.12 int
|
||||||
|
# hwFan3
|
||||||
|
CheckMibByOid1 1.3.6.1.4.1.54450.1.13 int
|
||||||
|
|
||||||
|
TabularObjects_TestCase
|
||||||
|
# hwMCNTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.1.100 21
|
||||||
|
# cpuTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.2.100 7
|
||||||
|
# memTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.3.100 6
|
||||||
|
# dskTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.4.100 6
|
||||||
|
# netTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.5.100 6
|
||||||
|
# interfaceTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.6.100 13
|
||||||
|
# appTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.7.100 9
|
||||||
|
# protocolTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.8.100 13
|
||||||
|
# streamTable
|
||||||
|
CheckMibByOid2 1.3.6.1.4.1.54450.9.100 9
|
||||||
|
|
||||||
|
Notification_TestCase
|
||||||
|
# genTrap
|
||||||
|
CheckMibByOid3 1.3.6.1.4.1.54450.15.1
|
||||||
|
# thresholdTrap
|
||||||
|
CheckMibByOid3 1.3.6.1.4.1.54450.15.2
|
||||||
|
|
||||||
@@ -84,5 +84,5 @@ CliLogin
|
|||||||
CliLogout
|
CliLogout
|
||||||
[Tags] tsg_cli cli_logout
|
[Tags] tsg_cli cli_logout
|
||||||
Close Connection
|
Close Connection
|
||||||
Log Close connection
|
Log Close CLI Connection
|
||||||
#exit
|
|
||||||
@@ -13,13 +13,13 @@ LoginAndAddLocalIP
|
|||||||
# 获取主机IP
|
# 获取主机IP
|
||||||
#${ip} Get Host IP
|
#${ip} Get Host IP
|
||||||
#Run Keyword If '${ip}' != '${EMPTY}' Set Global Variable ${testClentIP} ${ip}
|
#Run Keyword If '${ip}' != '${EMPTY}' Set Global Variable ${testClentIP} ${ip}
|
||||||
|
|
||||||
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP
|
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP
|
||||||
... ELSE IF '${loginType}' == 'cli' CliLogin
|
... ELSE IF '${loginType}' == 'cli' CliLogin
|
||||||
... ELSE UiLoginAndAaddLocalIP
|
... ELSE IF '${loginType}' != '${None}' UiLoginAndAaddLocalIP
|
||||||
|
|
||||||
LogoutAndDelLocalIP
|
LogoutAndDelLocalIP
|
||||||
[Tags] tsg_adc tsg_bf_api tsg_cli
|
[Tags] tsg_adc tsg_bf_api tsg_cli
|
||||||
Run Keyword If '${loginType}' == 'api' ApiLogoutAndDelLocalIP
|
Run Keyword If '${loginType}' == 'api' ApiLogoutAndDelLocalIP
|
||||||
... ELSE IF '${loginType}' == 'cli' CliLogout
|
... ELSE IF '${loginType}' == 'cli' CliLogout
|
||||||
... ELSE UiLogoutAndDelLocalIP
|
... ELSE IF '${loginType}' != '${None}' UiLoginAndAaddLocalIP
|
||||||
|
|||||||
70
02-Keyword/tsg_mib/MibKeywords.robot
Normal file
70
02-Keyword/tsg_mib/MibKeywords.robot
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library json
|
||||||
|
Library String
|
||||||
|
Library SnmpLibrary
|
||||||
|
Library SSHLibrary
|
||||||
|
Library Collections
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
OpenMibConnection
|
||||||
|
Open Snmp V2c Connection host=${snmpHost} community_string=${snmpCommunity} port=${snmpPort} timeout=${snmpConnTimeout}
|
||||||
|
|
||||||
|
# Open Snmp V3 Connection host=192.168.40.165 user=unsec port=50161
|
||||||
|
|
||||||
|
# Open Snmp V3 Connection host=192.168.40.165 user=SHA port=50161 timeout=3
|
||||||
|
# ... password=SHAAuthPP
|
||||||
|
# ... authentication_protocol=SHA
|
||||||
|
|
||||||
|
# Open Snmp V3 Connection host=192.168.40.165 user=SHADES port=50161 timeout=3
|
||||||
|
# ... password=SHADESAuthPP
|
||||||
|
# ... encryption_password=SHADESPrivPP
|
||||||
|
# ... authentication_protocol=SHA
|
||||||
|
# ... encryption_protocol=DES
|
||||||
|
|
||||||
|
CloseMibConnection
|
||||||
|
Close Snmp Connection
|
||||||
|
Log Close MIB Connection
|
||||||
|
|
||||||
|
CheckMibByOid1
|
||||||
|
[Documentation]
|
||||||
|
... 校验命令是否正常返回,且字段类型是否正确
|
||||||
|
[Arguments] ${oid} ${type}
|
||||||
|
${value} Walk .${oid}
|
||||||
|
# 断言返回值不能为空
|
||||||
|
Should Not Be Empty ${value}
|
||||||
|
${length} Get Length ${value}
|
||||||
|
Should Be True ${length} > 0
|
||||||
|
# 判断返回是否包含OID
|
||||||
|
${obj1} Set Variable ${value}[0]
|
||||||
|
Should Contain ${obj1}[0] ${oid}
|
||||||
|
# 判断返回值类型是否正确,int/float/str
|
||||||
|
${flag} Evaluate type(${obj1}[1]) is ${type}
|
||||||
|
Should Be True ${flag}
|
||||||
|
|
||||||
|
CheckMibByOid2
|
||||||
|
[Documentation]
|
||||||
|
... 校验命令是否正常返回,且字段总数是否正确
|
||||||
|
[Arguments] ${oid} ${total}
|
||||||
|
${value} Walk .${oid}
|
||||||
|
# 断言返回值不能为空
|
||||||
|
Should Not Be Empty ${value}
|
||||||
|
${list} Convert To List ${value}
|
||||||
|
${length} Get Length ${list}
|
||||||
|
Should Be True ${length} > 0
|
||||||
|
# 判断是否返回所有的项
|
||||||
|
${index} Set Variable
|
||||||
|
FOR ${var} IN @{list}
|
||||||
|
Should Contain ${var}[0] ${oid}
|
||||||
|
Should Not Be Empty ${var}[1]
|
||||||
|
${nums} Evaluate re.split('[.]', '${var}[0]') re
|
||||||
|
${index} Evaluate ${nums[len(${nums})-2]}
|
||||||
|
END
|
||||||
|
Should Be True ${index} == ${total}
|
||||||
|
|
||||||
|
CheckMibByOid3
|
||||||
|
[Documentation]
|
||||||
|
... 校验命令是否正常返回
|
||||||
|
[Arguments] ${oid}
|
||||||
|
${value} Walk .${oid}
|
||||||
|
Log ${value}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
*** Variables ***
|
*** Variables ***
|
||||||
#ui登陆还是api登陆
|
#登录类型:api | cli | ${None}(tsg mib) | 未指定,默认为ui
|
||||||
${loginType} api
|
${loginType} api
|
||||||
#执行环境是否Widonws
|
#执行环境是否Widonws
|
||||||
${systemType} Windows
|
${systemType} Windows
|
||||||
@@ -46,6 +46,13 @@ ${cliHost} 192.168.40.165
|
|||||||
${cliUsername} tsgadmin
|
${cliUsername} tsgadmin
|
||||||
${cliPassword} Cli2019
|
${cliPassword} Cli2019
|
||||||
${timeout} 600s
|
${timeout} 600s
|
||||||
${retryInterval} 300s
|
${retryInterval} 300s
|
||||||
|
@{PolicyTypes} tsg_security pxy_manipulation
|
||||||
@{ObjectTypes} ip url fqdn keywords subscriberid fqdn_category account http_signature
|
@{ObjectTypes} ip url fqdn keywords subscriberid fqdn_category account http_signature
|
||||||
# Cli自动化测试变量[end]
|
# Cli自动化测试变量[end]
|
||||||
|
# SNMP服务测试变量[start]
|
||||||
|
${snmpHost} 192.168.40.165
|
||||||
|
${snmpPort} 50161
|
||||||
|
${snmpConnTimeout} 5 # 默认超时时间为6s,设置timeout值后超时时间为n*6s
|
||||||
|
${snmpCommunity} public
|
||||||
|
# SNMP服务测试变量[end]
|
||||||
|
|||||||
Reference in New Issue
Block a user