35a5b09fcfa03e5037f4d4035bba8211c26bc337
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / o1mediator.robot
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #
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
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 *** Settings ***
16 Documentation  Tests for the UE Event Collector XApp
17
18 Resource       /robot/resources/global_properties.robot
19
20 Resource       /robot/resources/o1mediator/o1mediator_interface.robot
21 Resource       /robot/resources/ric/ric_utils.robot
22
23 Library        String
24 Library        Collections
25 Library        XML
26
27 Library        KubernetesEntity  ${GLOBAL_RICPLT_NAMESPACE}
28
29 *** Variables ***
30 ${sessionPfx} =   nanobot-O1
31
32 *** Test Cases ***
33 O1 Mediator Should Be Available
34   [Tags]   etetests  o1mediatortests
35   ${o1} =        Get From Dictionary  ${GLOBAL_RICPLT_COMPONENTS}  o1mediator
36   ${deploy} =    Deployment           ${o1}
37   ${status} =    Most Recent Availability Condition  @{deploy.status.conditions}
38   Should Be Equal As Strings          ${status}  True  ignore_case=True
39
40 Connect To O1 Mediator
41    [tags]  etetests  o1mediatortests
42    ${sessionGensym} =    Generate Random String
43    ${O1Session} =        Set Variable  ${sessionPfx}-${sessionGensym}
44    Set Suite Variable    ${O1Session}
45    Set Suite Variable    ${O1Session}
46    ${status} =           Establish O1 Session
47    ...                   ${GLOBAL_O1MEDIATOR_USER}
48    ...                   ${GLOBAL_O1MEDIATOR_PASSWORD}
49    ...                   ${O1Session}
50    ...                   ${GLOBAL_O1MEDIATOR_HOST}
51    ...                   ${GLOBAL_O1MEDIATOR_PORT}
52    Should Be True        ${status}
53
54 Get O1 State
55    [tags]  etetests  o1mediatortests
56    ${conf} =         Retrieve O1 State  ${O1Session}
57    # just going to let this bail at a lower layer if
58    # the Get fails.  Might be better to look for ric stuff
59    # in the active modules, though.
60    ${confXML} =      Element To String  ${conf}
61    
62 Deploy XApp Via O1
63    [tags]  etetests  o1mediatortests  intrusive
64    Deploy An XApp Using O1  ${O1Session}
65    ...                      ${GLOBAL_O1MEDIATOR_TARGET_XAPP}
66    ...                      ${GLOBAL_O1MEDIATOR_XAPP_VERSION}
67
68 XApp Should Be Running
69    [tags]  etetests  o1mediatortests
70    Wait For Deployment      ${GLOBAL_XAPP_NAMESPACE}-${GLOBAL_O1MEDIATOR_TARGET_XAPP}
71    ...                      timeout=${GLOBAL_O1MEDIATOR_DEPLOYMENT_WAIT}
72    ...                      namespace=${GLOBAL_XAPP_NAMESPACE}
73
74 Undeploy XApp Via O1
75    [tags]  etetests  o1mediatortests  intrusive
76    Remove An XApp Using O1  ${O1Session}
77    ...                      ${GLOBAL_O1MEDIATOR_TARGET_XAPP}
78    ...                      ${GLOBAL_O1MEDIATOR_XAPP_VERSION}
79
80 XApp Should Not Be Running
81    [tags]  etetests  o1mediatortests
82    ${status}  ${deploy} =      Run Keyword And Ignore Error
83    ...                         Deployment  ${GLOBAL_XAPP_NAMESPACE}-${GLOBAL_O1MEDIATOR_TARGET_XAPP}
84    ${status} =                 Run Keyword If  '${status}' == 'PASS'
85    ...                         Most Recent Availablity Condition  @{deploy.status.conditions}
86    ...  ELSE
87    ...                         Set Variable   False
88    Should Be Equal As Strings  '${status}'  'False'
89    
90 Disconnect From O1
91    [tags]  etetests  o1mediatortests
92    Close O1 Session  ${O1Session}