From 603b27eec9586eabb2e2d765243a3be0bf15c14c Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Mon, 4 Sep 2017 18:26:10 +0800 Subject: Initial Submission of Holmes CSIT Configurations Add shell scripts Add test case implemetations Change-Id: I94c11e83ee50725bc11ed2a21e16491bbaf26749 Issue-ID: HOLMES-39 Signed-off-by: Guangrong Fu --- test/csit/plans/holmes/sanity-check/setup.sh | 66 +++++++++++ test/csit/plans/holmes/sanity-check/teardown.sh | 25 ++++ test/csit/plans/holmes/sanity-check/testplan.txt | 5 + .../scripts/holmes/engine-management/startup.sh | 23 ++++ .../csit/scripts/holmes/rule-management/startup.sh | 22 ++++ .../testcase/CommonKeywords/HttpRequest.robot | 37 ++++++ .../testcase/EngineMgt/Engine-Keywords.robot | 34 ++++++ .../holmes/testcase/EngineMgt/Engine-Mgt.robot | 41 +++++++ .../holmes/testcase/EngineMgt/EngineAddr.robot | 3 + .../tests/holmes/testcase/EngineMgt/__init__.txt | 2 + .../holmes/testcase/RuleMgt/Rule-Keywords.robot | 81 +++++++++++++ .../tests/holmes/testcase/RuleMgt/Rule-Mgt.robot | 127 +++++++++++++++++++++ .../tests/holmes/testcase/RuleMgt/RuleAddr.robot | 3 + .../tests/holmes/testcase/RuleMgt/__init__.txt | 0 14 files changed, 469 insertions(+) create mode 100644 test/csit/plans/holmes/sanity-check/setup.sh create mode 100644 test/csit/plans/holmes/sanity-check/teardown.sh create mode 100644 test/csit/plans/holmes/sanity-check/testplan.txt create mode 100644 test/csit/scripts/holmes/engine-management/startup.sh create mode 100644 test/csit/scripts/holmes/rule-management/startup.sh create mode 100644 test/csit/tests/holmes/testcase/CommonKeywords/HttpRequest.robot create mode 100644 test/csit/tests/holmes/testcase/EngineMgt/Engine-Keywords.robot create mode 100644 test/csit/tests/holmes/testcase/EngineMgt/Engine-Mgt.robot create mode 100644 test/csit/tests/holmes/testcase/EngineMgt/EngineAddr.robot create mode 100644 test/csit/tests/holmes/testcase/EngineMgt/__init__.txt create mode 100644 test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot create mode 100644 test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot create mode 100644 test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot create mode 100644 test/csit/tests/holmes/testcase/RuleMgt/__init__.txt (limited to 'test') diff --git a/test/csit/plans/holmes/sanity-check/setup.sh b/test/csit/plans/holmes/sanity-check/setup.sh new file mode 100644 index 000000000..d3214e00e --- /dev/null +++ b/test/csit/plans/holmes/sanity-check/setup.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Place the scripts in run order: + +# Download and start MySQL +docker pull mysql/mysql-server +docker run --name mysql-holmes -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_ROOT_HOST=% -d mysql/mysql-server +MYSQL_IP=`get-instance-ip.sh mysql-holmes` +echo MYSQL_IP=${MYSQL_IP} + +#login to the onap nexus docker repo +docker login -u docker -p docker nexus3.onap.org:10001 + +# Start MSB +docker run -d -p 8500:8500 --name msb_consul nexus3.onap.org:10001/onap/msb/msb_base +CONSUL_IP=`get-instance-ip.sh msb_consul` +echo CONSUL_IP=${CONSUL_IP} +docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo DISCOVERY_IP=${DISCOVERY_IP} +docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IP==`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IP=${MSB_IP} + +# Start rulemgt +source ${SCRIPTS}/holmes/rule-management/startup.sh i-rulemgt ${MYSQL_IP} ${MSB_IP} 80 +RULEMGT_IP=`get-instance-ip.sh i-rulemgt` +echo RULEMGT_IP=${RULEMGT_IP} + +# Wait for initialization +for i in {1..20}; do + curl -sS -m 1 ${RULEMGT_IP}:9101 && curl -sS -m 1 ${MSB_IP}:80 && break + echo sleep $i + sleep $i +done + +# Start engine-d +source ${SCRIPTS}/holmes/engine-management/startup.sh i-engine-d ${MYSQL_IP} ${MSB_IP} 80 +ENGINE_D_IP=`get-instance-ip.sh i-engine-d` +echo ENGINE_D_IP=${ENGINE_D_IP} + + +# Wait for initialization +for i in {1..10}; do + curl -sS -m 1 ${ENGINE_D_IP}:9102 && break + echo sleep $i + sleep $i +done + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IP:${MSB_IP} -v RULEMGT_IP:${RULEMGT_IP} -v ENGINE_D_IP:${ENGINE_D_IP}" + diff --git a/test/csit/plans/holmes/sanity-check/teardown.sh b/test/csit/plans/holmes/sanity-check/teardown.sh new file mode 100644 index 000000000..4c457dc01 --- /dev/null +++ b/test/csit/plans/holmes/sanity-check/teardown.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +kill-instance.sh i-rulemgt +kill-instance.sh i-engine-d +kill-instance.sh msb_internal_apigateway +kill-instance.sh msb_discovery +kill-instance.sh msb_consul +kill-instance.sh mysql-holmes + + diff --git a/test/csit/plans/holmes/sanity-check/testplan.txt b/test/csit/plans/holmes/sanity-check/testplan.txt new file mode 100644 index 000000000..e699512d7 --- /dev/null +++ b/test/csit/plans/holmes/sanity-check/testplan.txt @@ -0,0 +1,5 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. + +holmes/testcase/EngineMgt +holmes/testcase/RuleMgt diff --git a/test/csit/scripts/holmes/engine-management/startup.sh b/test/csit/scripts/holmes/engine-management/startup.sh new file mode 100644 index 000000000..321ac6b3e --- /dev/null +++ b/test/csit/scripts/holmes/engine-management/startup.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $1 nickname for the engined instance +# $2 IP address of JDBC +# $3 IP address of BrokerIP + +docker login -u docker -p docker nexus3.onap.org:10001 + +run-instance.sh nexus3.onap.org:10001/onap/holmes/engine-management:latest $1 "-e URL_JDBC=$2:3306 -e MSB_ADDR=$3 -e MSB_PORT=$4" diff --git a/test/csit/scripts/holmes/rule-management/startup.sh b/test/csit/scripts/holmes/rule-management/startup.sh new file mode 100644 index 000000000..cbfd13ad7 --- /dev/null +++ b/test/csit/scripts/holmes/rule-management/startup.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $1 nickname for the RuleMgt instance +# $2 IP address of JDBC + +docker login -u docker -p docker nexus3.onap.org:10001 + +run-instance.sh nexus3.onap.org:10001/onap/holmes/rule-management:latest $1 "-e URL_JDBC=$2:3306 -e MSB_ADDR=$3 -e MSB_PORT=$4" \ No newline at end of file diff --git a/test/csit/tests/holmes/testcase/CommonKeywords/HttpRequest.robot b/test/csit/tests/holmes/testcase/CommonKeywords/HttpRequest.robot new file mode 100644 index 000000000..5b8417404 --- /dev/null +++ b/test/csit/tests/holmes/testcase/CommonKeywords/HttpRequest.robot @@ -0,0 +1,37 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Resource ../RuleMgt/Rule-Keywords.robot + +*** Keywords *** +httpPut + [Arguments] ${restHost} ${restUrl} ${data} + ${headers} create dictionary Content-Type=application/json;charset=utf-8 Accept=application/json + create session microservices ${restHost} ${headers} + log ${data} + ${putResponse} put request microservices ${restUrl} ${data} \ ${EMPTY} + ... ${headers} + log ${putResponse} + [Return] ${putResponse} + +httpGet + [Arguments] ${restHost} ${restUrl} + create session microservices ${restHost} + ${getResponse} get request microservices ${restUrl} + [Return] ${getResponse} + +httpPost + [Arguments] ${restHost} ${restUrl} ${data} + ${headers} create dictionary Content-Type=application/json Accept=application/json + create session microservices ${restHost} ${headers} + log ${data} + ${postResponse} post request microservices ${restUrl} ${data} + Comment log ${postResponse.content} + [Return] ${postResponse} + +httpDelete + [Arguments] ${restHost} ${restUrl} ${data} + ${headers} create dictionary Content-Type=application/json Accept=application/json + create session microservices ${restHost} ${headers} + ${deleteResponse} delete request microservices ${restUrl} ${data} + [Return] ${deleteResponse} diff --git a/test/csit/tests/holmes/testcase/EngineMgt/Engine-Keywords.robot b/test/csit/tests/holmes/testcase/EngineMgt/Engine-Keywords.robot new file mode 100644 index 000000000..aac867678 --- /dev/null +++ b/test/csit/tests/holmes/testcase/EngineMgt/Engine-Keywords.robot @@ -0,0 +1,34 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Resource ../CommonKeywords/HttpRequest.robot +Resource EngineAddr.robot + +*** Keywords *** +deleteEngineRule + [Arguments] ${packageName} ${codeFlag}=1 + [Documentation] ${packageName} :The data type is string! + ${headers} create dictionary Content-Type=application/json + create session microservices ${engineHost} ${headers} + ${deleteUrl} set variable ${engineUrl}/${packageName} + ${deleteResponse} delete request microservices ${deleteUrl} + log ${deleteResponse.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${deleteResponse.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${deleteResponse.status_code} 499 + [Return] ${deleteResponse} + +verifyEngineRule + [Arguments] ${checkContent} ${codeFlag}=1 + ${response} httpPost ${engineHost} ${engineUrl} ${checkContent} + log ${response.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499 + [Return] ${response} + +deployEngineRule + [Arguments] ${jsonParams} ${codeFlag}=1 + ${response} httpPut ${engineHost} ${engineUrl} ${jsonParams} + log ${response.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499 + [Return] ${response} diff --git a/test/csit/tests/holmes/testcase/EngineMgt/Engine-Mgt.robot b/test/csit/tests/holmes/testcase/EngineMgt/Engine-Mgt.robot new file mode 100644 index 000000000..52c6822fc --- /dev/null +++ b/test/csit/tests/holmes/testcase/EngineMgt/Engine-Mgt.robot @@ -0,0 +1,41 @@ +*** Settings *** +Suite Setup +Suite Teardown Delete All Sessions +Test Teardown +Test Timeout +Library demjson +Resource Engine-Keywords.robot +Resource ../RuleMgt/Rule-Keywords.robot + +*** Test Cases *** +verify_invalid_rule + [Documentation] Verify a rule with invalid contents. + ${dic1} create dictionary content=123123123 + ${Jsonparam} encode ${dic1} + verifyEngineRule ${Jsonparam} -1 + +verify_valid_rule + [Documentation] Verify a rule with valid contents. + ${dic2} create dictionary content=package rule03080001 + ${Jsonparam} encode ${dic2} + verifyEngineRule ${Jsonparam} + +deploy_invalid_rule + [Documentation] Add a rule with invalid contents to the engine. + ${dic3} create dictionary content=789789789 engineid="" + ${Jsonparam} encode ${dic3} + ${response} deployEngineRule ${Jsonparam} -1 + +deploy_valid_rule + [Documentation] Add a rule with valid contents to the engine. + ${dic4} create dictionary content=package rule03080002 engineid="" + ${Jsonparam} encode ${dic4} + ${response} deployEngineRule ${Jsonparam} + +delete_existing_rule + [Documentation] Delete an existing rule using an existing package ID from the engine. + deleteEngineRule rule03080002 + +delete_non_existing_rule + [Documentation] Delete an existing rule using a non-existing package ID from the engine. + deleteEngineRule rule03080002 -1 diff --git a/test/csit/tests/holmes/testcase/EngineMgt/EngineAddr.robot b/test/csit/tests/holmes/testcase/EngineMgt/EngineAddr.robot new file mode 100644 index 000000000..0ff3e6d82 --- /dev/null +++ b/test/csit/tests/holmes/testcase/EngineMgt/EngineAddr.robot @@ -0,0 +1,3 @@ +*** Variables *** +${engineHost} http://${MSB_IP} +${engineUrl} /openoapi/holmes-engine-mgmt/v1/rule diff --git a/test/csit/tests/holmes/testcase/EngineMgt/__init__.txt b/test/csit/tests/holmes/testcase/EngineMgt/__init__.txt new file mode 100644 index 000000000..a69b32dc5 --- /dev/null +++ b/test/csit/tests/holmes/testcase/EngineMgt/__init__.txt @@ -0,0 +1,2 @@ +*** Settings *** +Suite Setup diff --git a/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot b/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot new file mode 100644 index 000000000..b2039174d --- /dev/null +++ b/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot @@ -0,0 +1,81 @@ +*** Settings *** +Library RequestsLibrary +Library Collections +Resource RuleAddr.robot +Resource ../CommonKeywords/HttpRequest.robot + +*** Keywords *** +prepareRules + ${rule1} create dictionary rulename=ying001 content=package rule0001 enabled=1 description=this is first description + ${rule2} create dictionary rulename=ying002 content=package rule0002 enabled=0 description=this is seconddescription + ${rule3} create dictionary rulename=ying003 content=package rule0003 enabled=1 description=this is third description + @{rulesList} create list ${rule1} ${rule2} ${rule3} + : FOR ${row} IN @{rulesList} + \ ${rulejson} encode ${row} + \ log ${rulejson} + \ createRule ${rulejson} + +ruleMgtSuiteVariable + ${RULEDIC} create dictionary rulename=gy2017001 description=create a new rule! content=package rule2017001 enabled=1 + set suite variable ${RULEDIC} + +queryConditionRule + [Arguments] ${queryParam} ${codeFlag}=1 + [Documentation] ${queryParam} : The data type is Json . + create session microservices ${ruleMgtHost} + ${param} set variable queryrequest\=${queryParam} + ${headers} set variable + ${getResponse} get request microservices ${ruleMgtUrl} ${headers} ${param} + log ${getResponse.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${getResponse.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${getResponse.status_code} 499 + [Return] ${getResponse} + +traversalRuleAttribute + [Arguments] ${responseJsonData} ${expectAttrDic} + [Documentation] ${expectAttrDic} : The data type is dictionary; + ... key is the name of the attribute, value is the expected value of the attribute. + @{responseRules} Get From Dictionary ${responseJsonData} rules + : FOR ${rule} IN @{responseRules} + \ log ${rule} + \ verifyRuleAttribute ${rule} ${expectAttrDic} + +verifyRuleAttribute + [Arguments] ${singleRule} ${expectAttrDic} + [Documentation] ${expectAttrDic} : The data type is dictionary; key is the name of the attributes to be traversaled, value is the expected value of the attributes. + log ${singleRule} + log ${expectAttrDic} + @{attrsKeys} get dictionary keys ${expectAttrDic} + : FOR ${attr} IN @{attrsKeys} + \ log ${attr} + \ ${actualResponse} get from dictionary ${singleRule} ${attr} + \ ${expectResponse} get from dictionary ${expectAttrDic} ${attr} + \ Comment log ${actualResponse} + \ Comment log ${expectResponse} + Should be equal as strings ${actualResponse} ${expectResponse} + +createRule + [Arguments] ${jsonParams} ${codeFlag}=1 + [Documentation] ${codeFlag} : The data type is string, defult value is 1, indicating that the case need to assert thatthe statues code is 200. + ... Then other values indicating that the case need to assert that the statues code is 499. + ${response} httpPut ${ruleMgtHost} ${ruleMgtUrl} ${jsonParams} + log ${response.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499 + [Return] ${response} + +modifyRule + [Arguments] ${jsonParams} ${codeFlag}=1 + ${response} httpPost ${ruleMgtHost} ${ruleMgtUrl} ${jsonParams} + log ${response.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499 + [Return] ${response} + +deleteRule + [Arguments] ${jsonParam} ${codeFlag}=1 + ${response} httpDelete ${ruleMgtHost} ${ruleMgtUrl} ${jsonParam} + log ${response.content} + run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200 + run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499 + [Return] ${response} diff --git a/test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot b/test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot new file mode 100644 index 000000000..03ee70849 --- /dev/null +++ b/test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot @@ -0,0 +1,127 @@ +*** Settings *** +Suite Setup +Suite Teardown Delete All Sessions +Test Timeout +Library demjson +Resource Rule-Keywords.robot + +*** Test Cases *** +add_valid_rule + [Documentation] Add a valid rule. + ${dict2} create dictionary rulename=youbowu0314 description=create a new rule! content=package rule03140002 enabled=1 + ${jsonParams} encode ${dict2} + ${response} createRule ${jsonParams} + ${respJson} to json ${response.content} + ${RULEID} get from dictionary ${respJson} ruleid + set global variable ${RULEID} + log ${RULEID} + +add_invalid_content_rule + [Documentation] Add an invalid rule of which the content is incorrect!! + ${dict1} create dictionary rulename=gy0307001 description=create a new rule! content=123123123 enabled=1 + ${jsonParams} encode ${dict1} + ${response} createRule ${jsonParams} -1 + log ${response.content} + +add_deficient_rule + [Documentation] Add an invalid rule of which some mandatory fields are missing.(rulename) + ${dict3} create dictionary description=create a valid rule! content=package rule2017 enabled=1 + ${jsonParams} encode ${dict3} + ${response} createRule ${jsonParams} -1 + +query_rule_with_existing_id + [Documentation] Query a rule with an existing ID. + should not be empty ${RULEID} + ${response} queryConditionRule {"ruleid":"${RULEID}"} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=1 fail Can't find the rule with the specified ruleid. + +query_rule_with_non_existing_id + [Documentation] Query a rule with a non-existing ID. + ${response} queryConditionRule {"ruleid":"invalidid"} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=0 fail + +query_rule_with_partial_existing_name + [Documentation] Query rules with (a part of) an existing name. + ${response} queryConditionRule {"rulename":"youbowu"} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}<1 fail Can't find the rule with (a part of) an existing name + +query_rule_with_partial_non_existing_name + [Documentation] Query rules with (a part of) a non-existing name. + ${response} queryConditionRule {"rulename":"zte2017"} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=0 fail + +query_rule_with_vaild_status + [Documentation] Query rules with a valid status. + ${response} queryConditionRule {"enabled":1} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}<0 fail Can't find the rule with the status valued 1. + +query_rule_with_invalid_status + [Documentation] Query rules with an invalid status. + ${response} queryConditionRule {"enabled":99} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=0 fail + +query_rule_with_empty_status + [Documentation] Query rules with the status left empty. + ${response} queryConditionRule {"enabled":""} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=0 fail + +query_rule_with_combinational_fields + [Documentation] Query rules using the combination of different fields. + ${dic} create dictionary rulename=youbowu0314 enabled=1 + ${paramJson} encode ${dic} + ${response} queryConditionRule ${paramJson} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}<1 fail Can't find the rules with the combination of different fields. + ... ELSE traversalRuleAttribute ${respJson} ${dic} + +modify_rule_with_status + [Documentation] modify the rule with a valid status. + ${dic} create dictionary ruleid=${RULEID} enabled=0 content=package rule03140002 + ${modifyParam} encode ${dic} + ${modifyResp} modifyRule ${modifyParam} + ${response} queryConditionRule {"ruleid":"${RULEID}"} + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=1 fail query rule fails! (can't find the rule modified!) + ... ELSE traversalRuleAttribute ${respJson} ${dic} + +modify_rule_with_invalid_status + [Documentation] modify the rule with an invalid status. + ${dic} create dictionary ruleid=${RULEID} enabled=88 content=package rule03140002 + ${modifyParam} encode ${dic} + ${modifyResponse} modifyRule ${modifyParam} -1 + +modify_rule_with_description + [Documentation] modify the description of the rule with the new string. + ${dic} create dictionary ruleid=${RULEID} description=now, i modifying the description of the rule. content=package rule03140002 + ${modifyParam} encode ${dic} + ${modifyResp} modifyRule ${modifyParam} + ${response} queryConditionRule {"ruleid":"${RULEID}"} 1 + ${respJson} to json ${response.content} + ${count} get from dictionary ${respJson} totalcount + run keyword if ${count}!=1 fail query rule fails! + ... ELSE traversalRuleAttribute ${respJson} ${dic} + +delete_existing_rule + [Documentation] Delete an existing rule. + should not be empty ${RULEID} + deleteRule {"ruleid":"${RULEID}"} + +delete_non_existing_rule + [Documentation] Delete a non-existing rule. + deleteRule {"ruleid":"${RULEID}"} -1 diff --git a/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot b/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot new file mode 100644 index 000000000..a9cf66c60 --- /dev/null +++ b/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot @@ -0,0 +1,3 @@ +*** Variables *** +${ruleMgtHost} http://${MSB_IP} +${ruleMgtUrl} /openoapi/holmes-rule-mgmt/v1/rule diff --git a/test/csit/tests/holmes/testcase/RuleMgt/__init__.txt b/test/csit/tests/holmes/testcase/RuleMgt/__init__.txt new file mode 100644 index 000000000..e69de29bb -- cgit 1.2.3-korg