1 # Copyright (c) 2019 AT&T Intellectual Property.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 Documentation Tests for the A1 Mediator
18 Resource /robot/resources/global_properties.robot
19 Resource /robot/resources/a1mediator/a1mediator_interface.robot
20 Resource /robot/resources/appmgr/appmgr_interface.robot
25 ${POLICY_ID} ${GLOBAL_A1MEDIATOR_POLICY_ID}
26 ${TARGET_XAPP} ${GLOBAL_A1MEDIATOR_TARGET_XAPP}
29 Deploy Target XApp If Necessary
30 [Tags] etetests ci_tests a1tests intrusive
31 ${err} ${xappStatus} = Run Keyword And Ignore Error
32 ... Get XApp By Name ${TARGET_XAPP}
33 Run Keyword If '${err}' == 'FAIL'
34 ... Deploy XApp ${TARGET_XAPP}
37 [Tags] etetests ci_tests a1tests intrusive
38 ${policyProperty} = Create Dictionary
40 ... description=a message
41 ${policyProperties} = Create Dictionary
42 ... message=${policyProperty}
43 ${policyName} = Generate UUID
44 ${policyName} = Convert To String ${policyName}
45 Set Suite Variable ${policyName}
46 ${resp} = Create A1 Policy Type
50 ... ${policyProperties}
51 Should Be True ${resp}
54 [Tags] etetests ci_tests a1tests
55 ${resp} = Retrieve A1 Policy ${POLICY_ID}
56 Should Be True ${resp}
57 Should Be Equal ${resp.json()}[name] ${policyName}
59 Create Policy Instance
60 [Tags] etetests ci_tests a1tests intrusive
61 ${instanceName} = Generate UUID
62 ${instanceName} = Convert To String ${instanceName}
63 Set Suite Variable ${instanceName}
64 ${instanceMessage} = Generate UUID
65 ${instanceMessage} = Convert To String ${instanceMessage}
66 ${instanceProperties} = Create Dictionary
67 ... message=${instanceMessage}
68 Set Suite Variable ${instanceMessage}
69 ${resp} = Instantiate A1 Policy
72 ... ${instanceProperties}
73 Should Be True ${resp}
75 Policy Should Have Instances
76 [Tags] etetests ci_tests a1tests
77 ${resp} = Retrieve A1 Instance ${POLICY_ID}
78 Should Be True ${resp}
79 Should Not Be Empty ${resp.json()}
82 [Tags] etetests ci_tests a1tests
83 ${resp} = Retrieve A1 Instance ${POLICY_ID} ${instanceName}
84 Should Be True ${resp}
85 Should Be Equal ${resp.json()}[message] ${instanceMessage}
87 Instance Should Be IN EFFECT
88 [Tags] etetests ci_tests a1tests
89 Wait Until Keyword Succeeds 3x 5s Status Is IN EFFECT
91 Delete Policy Instance
92 [Tags] etetests ci_tests a1tests intrusive
93 ${resp} = Delete A1 Instance ${POLICY_ID} ${instanceName}
94 Should Be True ${resp}
96 Instance Should Not Exist
97 [Tags] etetests ci_tests a1tests
98 Wait Until Keyword Succeeds 3x 5s Instance Has Been Deleted
101 [Tags] etetests ci_tests a1tests intrusive
102 ${resp} = Delete A1 Policy ${POLICY_ID}
103 Should Be True ${resp}
105 Policy Should Not Exist
106 [Tags] etetests ci_tests a1tests
107 Wait Until Keyword Succeeds 3x 5s Policy Has Been Deleted
110 [Tags] etetests ci_tests a1tests intrusive
111 Undeploy XApp ${TARGET_XAPP}
115 ${resp} = Retrieve A1 Instance Status
118 Should Be True ${resp}
119 Should Be Equal ${resp.json()}[instance_status] IN EFFECT
121 Instance Has Been Deleted
122 ${resp} = Retrieve A1 Instance
125 Should Be Equal As Strings ${resp.status_code} 404
127 Policy Has Been Deleted
128 ${resp} = Retrieve A1 Policy ${POLICY_ID}
129 Should Be Equal As Strings ${resp.status_code} 404