aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/holmes/testcase/RuleMgt
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-09-27 10:29:30 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-09-27 12:50:28 -0700
commit2d3d8dcf6ef1bd2a161c69d561c629c5ec3f59c4 (patch)
tree652fd47a183c291e96c6721f550a5f63464f6e66 /test/csit/tests/holmes/testcase/RuleMgt
parente161173e279a73134dda4c2f429605d6c9ee1fe7 (diff)
Move CSIT to integration/csit repo
To facilite branching of CSIT tests, all CSIT test code and scripts are relocated to the integration/csit repo. Change-Id: I6777cd414e43dbf2bfa6215f7e50849e1a6a2e59 Issue-ID: INT-671 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'test/csit/tests/holmes/testcase/RuleMgt')
-rw-r--r--test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot80
-rw-r--r--test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot127
-rw-r--r--test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot3
-rw-r--r--test/csit/tests/holmes/testcase/RuleMgt/__init__.txt0
4 files changed, 0 insertions, 210 deletions
diff --git a/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot b/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot
deleted file mode 100644
index 3ce4be485..000000000
--- a/test/csit/tests/holmes/testcase/RuleMgt/Rule-Keywords.robot
+++ /dev/null
@@ -1,80 +0,0 @@
-*** 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}
- Comment ${param} set variable queryrequest\=${queryParam}
- ${getResponse} get request microservices ${ruleMgtUrl}?queryrequest\=${queryParam}
- 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} correlationRules
- : 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] ${ruleId} ${codeFlag}=1
- ${response} httpDelete ${ruleMgtHost} ${ruleMgtUrl}/${ruleId}
- 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
deleted file mode 100644
index 55e57ecd4..000000000
--- a/test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot
+++ /dev/null
@@ -1,127 +0,0 @@
-*** 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 ruleqwertasd;\n\nimport java.util.Locale; enabled=1 loopControlName=closedControlLoop
- ${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":null}
- ${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 loopControlName=closedControlLoop
- ${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 loopControlName=closedControlLoop
- ${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}
-
-delete_non_existing_rule
- [Documentation] Delete a non-existing rule.
- deleteRule ${RULEID} -1
diff --git a/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot b/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot
deleted file mode 100644
index be7384206..000000000
--- a/test/csit/tests/holmes/testcase/RuleMgt/RuleAddr.robot
+++ /dev/null
@@ -1,3 +0,0 @@
-*** Variables ***
-${ruleMgtHost} http://${MSB_IP}
-${ruleMgtUrl} /api/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
deleted file mode 100644
index e69de29bb..000000000
--- a/test/csit/tests/holmes/testcase/RuleMgt/__init__.txt
+++ /dev/null