*** Settings *** Library json Library Collections Resource ../../../03-Variable/BifangApiVariable.txt Resource ../../../03-Variable/PolicyObjectDefault.txt Resource ../../tsg_common/ManagePolicyBody.robot *** Keywords *** # ... 特殊参数说明: # ... effectiveRange=Nursurtan|Transtelecom&Astel,Almaty&Nursurtan,|Astel&Transtelecom # ... 为字符串类型,每条生效区域信息以','分隔 # ... ①以'|'字符开头表示仅为isp信息,如:effectiveRange=|Astel&Transtelecom # ... ②非'|'字符开头表示仅为location信息或location和isp信息,如: # ... effectiveRange=Nursurtan(仅为location信息) # ... effectiveRange=Nursurtan|Transtelecom&Astel(location和isp信息) # ... userRegion=protocol:HTTP,keyring:${1} # ... 为字符串类型,每条动作参数以','分隔 # ... [key]:[value],... # ... 在v1版本中referenceObject=${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN # ... 为字符串类型,每条引用的策略对象信息以','分隔 # ... [objectId]|[protocolFileds],... ,多个protocolFileds用'&'连接 # ... scheduleId=${3},${1} # ... 为字符串类型,以','分隔 # ... 在v1版本接口中appObjectIdArray==${2},${3} # ... 在v2版本接口中appIdObjects==${2},${3} # ... 为字符串类型,以','分隔 # ... # ... 注:数字类型变量为${0}、${1}、${...} # ... 在v2版本中 无referenceObject,取而代之的是source,destination,filterList # ... source= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN # ... destination= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN # ... filterList= ${265}|${257}:TSG_FIELD_HTTP_HOST,${266}|${299}:TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN # ... filterList由多个数字用‘|’分隔,加上:对上对应的protocolFiled, # ... 一个filter中的protocolFiled是确定的,一个protocolFiled对应多个objectId PolicyListDataOperation [Documentation] ... 描述:入口,opAction参数可为'add','update','disable','enable' ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 ... policyList: 必传,字典类型。字典内可选参数信息: ... policyObjectVersion: 必传,v1,v2,涉及策略版本 ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt ... 多个策略处理 [Arguments] ${returnData} ${policyList} ${opAction} ${policyObjectVersion} Log To Console Call PolicyListDataOperation ${policyListJson} Set Variable [ FOR ${policy} IN @{policyList} ${json} WxPolicyOrganize ${policy} ${opAction} ${policyObjectVersion} ${policyListJson} Set Variable ${policyListJson}${json}, END ${policyListJson}= Replace String Using Regexp ${policyListJson} ,$ ] # 转为json结构并返回 ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList ${bodyJson} json.Dumps ${dict} ensure_ascii=False ${json} Replace String ${bodyJson} "replace:policyList" ${policyListJson} Log Policy_Request_Body-${json} [Return] ${json} PolicyDataOperation [Documentation] ... 描述:入口,opAction参数可为'add','update','disable','enable' ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 ... policy: 必传,字典类型。字典内可选参数信息: ... policyObjectVersion: 必传,v1,v2,涉及策略版本 ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt ... 单个策略处理 [Arguments] ${returnData} ${policy} ${opAction} ${policyObjectVersion} Log To Console Call PolicyDataOperation ${json} WxPolicyOrganize ${policy} ${opAction} ${policyObjectVersion} # 转为json结构并返回 ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList ${bodyJson} json.Dumps ${dict} ensure_ascii=False ${json} Replace String ${bodyJson} "replace:policyList" ${json} Log Policy_Request_Body-${json} [Return] ${json} WxPolicyOrganize [Documentation] ... 描述:入口,opAction参数可为'add','update','disable','enable' ... policy: 必传,字典类型。字典内可选参数信息: ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt ... policyObjectVersion: 必传,v1,v2,涉及策略版本 ... 单个策略转换为json [Arguments] ${policy} ${opAction} ${policyObjectVersion} Log To Console Call WxPolicyOrganize ${returnDict} Create Dictionary ${emptyList} Create List #v1版本接口与v2版本接口不同的字段 Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} source Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} destination Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} filterList Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} appIdObjects Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} referenceObject Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} appObjectIdArray #更新时 policyId不允许为空 ${return} ${policyId} Run Keyword And Ignore Error Get From Dictionary ${policy} policyId Run Keyword If "${opAction}"=="update" and "${return}"=="FAIL" Fail policyId is required when opAction is update Run Keyword If "${opAction}"=="update" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is update Run Keyword If "${opAction}"=="disable" and "${return}"=="FAIL" Fail policyId is required when opAction is disable Run Keyword If "${opAction}"=="disable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is disable Run Keyword If "${opAction}"=="enable" and "${return}"=="FAIL" Fail policyId is required when opAction is enable Run Keyword If "${opAction}"=="enable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is enable ${policyId} Run Keyword If "${opAction}"=="add" Set Variable ${EMPTY} ... ELSE Get From Dictionary ${policy} policyId Set To Dictionary ${returnDict} policyId=${policyId} ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${policy} policyType Run Keyword If "${return}"=="FAIL" or "${policyType}"=="${EMPTY}" Set To Dictionary ${returnDict} policyType=${Default_PolicyType} ... ELSE Set To Dictionary ${returnDict} policyType=${policyType} #enable disable直接返回json Run Keyword And Return If "${opAction}"=="enable" or "${opAction}"=="disable" ManagePolicyEnableAndDisable ${returnDict} ${opAction} # 取可选参数,为传入设置默认值 ${return} ${policyName} Run Keyword And Ignore Error Get From Dictionary ${policy} policyName Run Keyword If "${return}"=="FAIL" or "${policyName}"=="${EMPTY}" Set To Dictionary ${returnDict} policyName=${Default_PolicyName} ... ELSE Set To Dictionary ${returnDict} policyName=${policyName} #policyDesc 不是必填的选项 ${return} ${policyDesc} Run Keyword And Ignore Error Get From Dictionary ${policy} policyDesc Run Keyword If "${return}"=="FAIL" or "${policyDesc}"=="${EMPTY}" Set To Dictionary ${returnDict} policyDesc=${Default_PolicyDesc} ... ELSE Set To Dictionary ${returnDict} policyDesc=${policyDesc} ${return} ${action} Run Keyword And Ignore Error Get From Dictionary ${policy} action Run Keyword If "${return}"=="FAIL" or "${action}"=="${EMPTY}" Set To Dictionary ${returnDict} action=${Default_Action} ... ELSE Set To Dictionary ${returnDict} action=${action} #userTags 不是必填的选项 ${return} ${userTags} Run Keyword And Ignore Error Get From Dictionary ${policy} userTags Run Keyword If "${return}"=="FAIL" or "${userTags}"=="${EMPTY}" Set To Dictionary ${returnDict} userTags=${Default_UserTags} ... ELSE Set To Dictionary ${returnDict} userTags=${userTags} ${return} ${doLog} Run Keyword And Ignore Error Get From Dictionary ${policy} doLog Run Keyword If "${return}"=="FAIL" or "${doLog}"=="${EMPTY}" Set To Dictionary ${returnDict} doLog=${Default_DoLog} ... ELSE Set To Dictionary ${returnDict} doLog=${doLog} ${return} ${isValid} Run Keyword And Ignore Error Get From Dictionary ${policy} isValid Run Keyword If "${return}"=="FAIL" or "${isValid}"=="${EMPTY}" Set To Dictionary ${returnDict} isValid=${Default_IsValid} ... ELSE Set To Dictionary ${returnDict} isValid=${isValid} ${return} ${scheduleId} Run Keyword And Ignore Error Get From Dictionary ${policy} scheduleId ${scheduleIdV} Run Keyword If "${return}"!="FAIL" and "${scheduleId}"!="${EMPTY}" and "${scheduleId}"!="${None}" Evaluate list(map(int, re.split('[,]', '${scheduleId}'))) re ... ELSE Set Variable ${emptyList} Set To Dictionary ${returnDict} scheduleId=${scheduleIdV} ${return} ${appObjectIdArray} Run Keyword If "${policyObjectVersion}"=="v1" Run Keyword And Ignore Error Get From Dictionary ${policy} appObjectIdArray ... ELSE Run Keyword And Ignore Error Get From Dictionary ${policy} appIdObjects ${appObjectIdArrayV} Run Keyword If "${return}"=="FAIL" or "${appObjectIdArray}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_AppObjectIdArray}'))) re ... ELSE Evaluate list(map(int, re.split('[,]', '${appObjectIdArray}'))) re Run Keyword If "${policyObjectVersion}"=="v1" Set To Dictionary ${returnDict} appObjectIdArray=${appObjectIdArrayV} ... ELSE IF "${policyObjectVersion}"=="v2" Set To Dictionary ${returnDict} appIdObjects=${appObjectIdArrayV} # 固定值 Set To Dictionary ${returnDict} doBlacklist=${0} # 分别处理EffectiveRange、UserRegion和ReferenceObject参数 WxManageEffectiveRange ${policy} ${returnDict} #WxManageUserRegion ${policy} Run Keyword If "${policyObjectVersion}"=="v1" WxManageReferenceObject ${policy} ${returnDict} ELSE IF "${policyObjectVersion}"=="v2" WxManageObjectV2 ${policy} ${returnDict} #先取出useragion 再放回json ${return} ${userRegion} Run Keyword And Ignore Error Get From Dictionary ${policy} userRegion Set To Dictionary ${returnDict} userRegion=${Default_UserRegion} ${userRegion} Run Keyword If "${return}"=="FAIL" or '${userRegion}'=="${EMPTY}" Set Variable "" ... ELSE Set Variable ${userRegion} #针对主动防御特殊处理,主动防御不应用对象 ${active_defence_emptyList} Create List ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${policy} policyType Run Keyword If "${policyObjectVersion}"=="v1" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} referenceObject=${active_defence_emptyList} Run Keyword If "${policyObjectVersion}"=="v1" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appObjectIdArray=${active_defence_emptyList} #v版本主动防御 Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} source=${active_defence_emptyList} Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} destination=${active_defence_emptyList} Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} filterList=${active_defence_emptyList} Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appIdObjects=${active_defence_emptyList} # 转为json结构并返回 ${json} json.Dumps ${returnDict} ensure_ascii=False ${json} Replace String ${json} "method:rst" ${userRegion} #${json} Replace String ${json} "effectiveRange:Empty" {} Log Policy-${json} [Return] ${json} ManagePolicyEnableAndDisable [Documentation] ... 启用与禁用时调用 [Arguments] ${returnDict} ${opAction} Run Keyword If "${opAction}"=="enable" Set To Dictionary ${returnDict} isValid=1 Run Keyword If "${opAction}"=="disable" Set To Dictionary ${returnDict} isValid=0 ${json} json.Dumps ${returnDict} ensure_ascii=False Log Policy-${json} [Return] ${json} WxManageEffectiveRange [Documentation] ... 处理EffectiveRange ... 加入effectiveRange={}的处理支持 [Arguments] ${policyList} ${returnDict} Log To Console Call WxManageEffectiveRange ${emptyList} Create List ${emptyListDouble} Create List ${emptyList} ${return} ${effectiveRange} Run Keyword And Ignore Error Get From Dictionary ${policyList} effectiveRange ${effectiveRange} Run Keyword If "${return}"=="FAIL" or "${effectiveRange}"=="${EMPTY}" Set Variable ${Default_EffectiveRange} ... ELSE Set Variable ${effectiveRange} ${value} Run Keyword If "${effectiveRange}"=="${EMPTY}" Create Dictionary tag_sets=${emptyListDouble} ... ELSE IF "${effectiveRange}"=="{}" Create Dictionary ELSE AnalysisEffectiveRange ${effectiveRange} Set To Dictionary ${returnDict} effectiveRange=${value} WxManageReferenceObject [Documentation] ... 处理引用对象字符串 ... v1版本接口使用 [Arguments] ${policy} ${returnDict} Log To Console Call WxManageReferenceObject ${emptyList} Create List #默认客户端条件类型:clientip or clientsubid ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} ... ELSE Set Variable ${defaultClient} Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientip' ManageClientIPObject ${emptyList} Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientsubid' ManageClientSubIDObject ${emptyList} #Run Keyword If '${addTestClentIPFlag}'=='1' ManageClientObject ${emptyList} # Run Keyword If "${clientHostObj}"!="${None}" Append To List ${emptyList} ${clientHostObj} ${defaultObj} Create Dictionary ${return} ${referenceObject} Run Keyword And Ignore Error Get From Dictionary ${policy} referenceObject ${referenceObject} Run Keyword If "${return}"=="FAIL" or "${referenceObject}"=="${EMPTY}" Set Variable ${Default_ReferenceObject} ... ELSE Set Variable ${referenceObject} ${value} Run Keyword If "${referenceObject}"=="${EMPTY}" Create List ${defaultObj} ... ELSE AnalysisReferenceObject ${referenceObject} # 若参数为空,设置默认结构 # FOR ${var} IN @{value} # Run Keyword If ${var}!={} Append To List ${referenceObject} ${var} # END ObjectLoop ${value} ${emptyList} Set To Dictionary ${returnDict} referenceObject=${emptyList} ObjectLoop [Arguments] ${value} ${valueList} # 若参数为空,设置默认结构 FOR ${var} IN @{value} Run Keyword If ${var}!={} Append To List ${valueList} ${var} END [Return] ${valueList} WxManageObjectV2 [Documentation] ... 处理引用对象字符串 ... v2版本接口使用 ... source,destination,filterList # 处理引用对象字符串 [Arguments] ${policy} ${returnDict} Log To Console Call WxManageObjectV2 #默认客户端条件类型:clientip or clientsubid ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} ... ELSE Set Variable ${defaultClient} ${sourceList} Create List ${destinationList} Create List ${filterList} Create List Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientip' ManageClientIPObjectV2 ${sourceList} Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientsubid' ManageClientSubIDObjectV2 ${sourceList} AnalysisObjectV2 ${policy} source ${sourceList} AnalysisObjectV2 ${policy} destination ${destinationList} AnalysisObjectV2 ${policy} filterList ${filterList} Set To Dictionary ${returnDict} source=${sourceList} destination=${destinationList} filterList=${filterList} Log ${policy} ManageClientIPObjectV2 [Arguments] ${emptyList} # 增加引用测试终端IP策略对象 ${obj1} Create Dictionary objectId=${testClentID} protocolField=TSG_SECURITY_SOURCE_ADDR Append To List ${emptyList} ${obj1} ManageClientSubIDObjectV2 [Arguments] ${emptyList} # 增加引用测试终端IP策略对象 ${protocolField} Set Variable ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=${protocolField} Append To List ${emptyList} ${obj1} AnalysisObjectV2 [Arguments] ${policy} ${objectType} ${objList} Log To Console Call AnalysisObjectV2 ${policyObjectDefault} Run Keyword If "${objectType}"=="source" Set Variable ${Default_v2_SourceObject} ... ELSE IF "${objectType}"=="destination" Set Variable ${Default_v2_DestinationObject} ... ELSE IF "${objectType}"=="filterList" Set Variable ${Default_v2_FilterObject} ${return} ${objectList} Run Keyword And Ignore Error Get From Dictionary ${policy} ${objectType} # source,destination,filterList ${objectList} Run Keyword If "${return}"=="FAIL" or "${objectList}"=="${EMPTY}" Set Variable ${policyObjectDefault} ... ELSE Set Variable ${objectList} ${list} Evaluate re.split('[,]', '${objectList}') re FOR ${var} IN @{list} ${tempObj} Run Keyword If "${objectType}"=="filterList" and "${var}" != "" ManageFilter ${var} ... ELSE IF "${var}" != "" ManageObject ${var} ELSE Set Variable ${EMPTY} Run Keyword If "${tempObj}" != "${EMPTY}" Append To List ${objList} ${tempObj} END Log ${objList} ManageObject [Documentation] ... source,destination处理 [Arguments] ${object} Log To Console Call ManageObject ${objectList} Create List #截取objectId ${objectId} Evaluate '${object}'[0:'${object}'.find('|')] #截取protocolField ${protocolField} Evaluate '${object}'['${object}'.find('|')+1:] ${tempObj} Create Dictionary ${objectId} Run Keyword If '${objectId}'.isdigit() Evaluate int('${objectId}') ... ELSE Set Variable ${objectId} Set To Dictionary ${tempObj} objectId=${objectId} Set To Dictionary ${tempObj} protocolField=${protocolField} [Return] ${tempObj} ManageFilter [Documentation] ... filterList处理 [Arguments] ${filter} Log To Console Call ManageFilter ${filterObjectList} Create List #截取objectId ${objectIds} Evaluate '${filter}'[0:'${filter}'.find(':')] #截取protocolField ${protocolField} Evaluate '${filter}'['${filter}'.find(':')+1:] #遍历 objectId ${list} Evaluate re.split('[|]', '${objectIds}') re FOR ${var} IN @{list} ${tempObj} Create Dictionary ${var} Run Keyword If '${var}'.isdigit() Evaluate int('${var}') ... ELSE Set Variable ${var} Set To Dictionary ${tempObj} objectId=${var} Set To Dictionary ${tempObj} protocolField=${protocolField} Append To List ${filterObjectList} ${tempObj} END ${filterObject} Create Dictionary filter=${filterObjectList} [Return] ${filterObject} Get-PolicyIds [Documentation] ... 获取结果中的策略ID [Arguments] ${value} ${policyIds} Create List FOR ${policy} IN @{value['data']['policyList']} ${policyIdList} Create List ${policy['policyId']} ${policyObj} Create Dictionary policyType=${policy['policyType']} policyIds=${policyIdList} Append To List ${policyIds} ${policyObj} #Log To Console ${policy['referenceObject']} #${objectType} Evaluate type(${policy['referenceObject']}) #Log To Console ${objectType} END [Return] ${policyIds} DeletePolicyWithParamDict [Documentation] ... 删除策略 ... params,传入的删除字典 ... 结构为policyIds=${policyIds} (List) policyType=${policyType} (variable) [Arguments] ${params} ${response} BaseDeleteRequest /${version}${policyUrl} ${params} ${rescode} Set Variable ${response['code']} Should Be Equal As Strings ${rescode} 200 [Return] ${rescode} VerifyPolicyList [Documentation] ... 策略验证 ... 多个策略验证 [Arguments] ${verifyList} Log To Console Call VerifyPolicyList ${verifyListJson} Set Variable [ FOR ${verifyObj} IN @{verifyList} ${json} VerifyPolicyObj ${verifyObj} ${verifyListJson} Set Variable ${verifyListJson}${json}, END ${verifyListJson}= Replace String Using Regexp ${verifyListJson} ,$ ] Log Policy_Request_Body-${verifyListJson} [Return] ${verifyListJson} VerifyPolicyObj [Documentation] ... 策略验证 ... 单个策略验证 [Arguments] ${verifyObj} Log To Console Call VerifyPolicyObj ${emptyList} Create List ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${verifyObj} policyType #Should Not Be Empty ${policyType} ${verifySession} Get From Dictionary ${verifyObj} verifySession Should Not Be Empty ${verifySession} ${attributes} Get From Dictionary ${verifySession} attributes Should Not Be Empty ${attributes} FOR ${attribute} IN @{attributes} ${attributeType} Get From Dictionary ${attribute} attributeType ${return} ${tableName} Run Keyword And Ignore Error Get From Dictionary ${attribute} tableName ${return} ${protocol} Run Keyword And Ignore Error Get From Dictionary ${attribute} protocol ${attributeName} Get From Dictionary ${attribute} attributeName ${attributeValue} Get From Dictionary ${attribute} attributeValue #将json转换为dict ${attributeValue} Convert To String ${attributeValue} ${start} Get Regexp Matches ${attributeValue} ^{\" ${start1} Get Regexp Matches ${attributeValue} ^{\' ${len} Get Length ${start} ${len1} Get Length ${start1} ${attributeValue} Run Keyword If ${len}>0 Evaluate eval('${attributeValue}') ... ELSE IF ${len1}>0 Evaluate eval("${attributeValue}") ... ELSE Set Variable ${attributeValue} ${type} Run Keyword If ${len}>0 or ${len1}>0 Set Variable dict ... ELSE Set Variable str ${attributeValue} Run Keyword If "${attributeType}"=="ip" ManageIpAttributeValue ${attributeValue} ${attributeName} ${type} ... ELSE IF "${attributeType}"=="signature" ManageSignatureAttributeValue ${attributeValue} ${type} ... ELSE ManageStringAttributeValue ${attributeValue} ${type} Set To Dictionary ${attribute} attributeValue=${attributeValue} END Set To Dictionary ${verifyObj} verifySession=${verifySession} # 转为json结构并返回 ${json} json.Dumps ${verifyObj} ensure_ascii=False Log VerifyPolicy-${json} [Return] ${json} ManageIpAttributeValue [Arguments] ${attributeValue} ${attributeName} ${type} Run Keyword And Return If "${type}"=="str" ExtractIpAttributeValue ${attributeValue} ${dict} Create Dictionary ${return} ${clientIp} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} clientIp Run Keyword If "${clientIp}"=="${EMPTY}" and "${attributeName}"=="src_ip" Should Not Be Empty ${clientIp} Set To Dictionary ${dict} clientIp=${clientIp} ${return} ${clientPort} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} clientPort Run Keyword If "${clientPort}"=="${EMPTY}" and "${attributeName}"=="src_ip" Should Not Be Empty ${clientPort} Set To Dictionary ${dict} clientPort=${clientPort} ${return} ${serverIp} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} serverIp Run Keyword If "${serverIp}"=="${EMPTY}" and "${attributeName}"=="dest_ip" Should Not Be Empty ${serverIp} Set To Dictionary ${dict} serverIp=${serverIp} ${return} ${serverPort} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} serverPort Run Keyword If "${serverPort}"=="${EMPTY}" and "${attributeName}"=="dest_ip" Should Not Be Empty ${serverPort} Set To Dictionary ${dict} serverPort=${serverPort} ${return} ${addrType} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} addrType Should Be Equal As Strings ${return} PASS Set To Dictionary ${dict} addrType=${addrType} ${return} ${protocol} Run Keyword And Ignore Error Get From Dictionary ${attributeValue} protocol Should Be Equal As Strings ${return} PASS Set To Dictionary ${dict} protocol=${protocol} [Return] ${dict} ExtractIpAttributeValue [Arguments] ${attributeValue} ${list} Split String ${attributeValue} | ${len} Get Length ${list} Should Be Equal As Integers ${len} 6 ${addrType} Evaluate int(${list}[4]) ${protocol} Evaluate int(${list}[5]) ${dict} Create Dictionary clientIp=${list}[0] clientPort=${list}[1] serverIp=${list}[2] ... serverPort=${list}[3] addrType=${addrType} protocol=${protocol} [Return] ${dict} ManageSignatureAttributeValue [Arguments] ${attributeValue} ${type} Run Keyword And Return If "${type}"=="str" ExtractSignatureAttributeValue ${attributeValue} ${dict} Create Dictionary ${district} Get From Dictionary ${attributeValue} district Should Not Be Empty ${district} Set To Dictionary ${dict} district=${district} ${string} Get From Dictionary ${attributeValue} string Should Not Be Empty ${string} Set To Dictionary ${dict} string=${string} [Return] ${dict} ExtractSignatureAttributeValue [Arguments] ${attributeValue} ${list} Split String ${attributeValue} | ${len} Get Length ${list} Should Be Equal As Integers ${len} 2 ${dict} Create Dictionary district=${list}[0] string=${list}[1] [Return] ${dict} ManageStringAttributeValue [Arguments] ${attributeValue} ${type} ${dict} Create Dictionary Run Keyword And Return If "${type}"=="str" Create Dictionary string=${attributeValue} ${string} Get From Dictionary ${attributeValue} string Should Not Be Empty ${string} Set To Dictionary ${dict} string=${string} [Return] ${dict}