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 Measurement Campaign XApp
19 Resource /robot/resources/global_properties.robot
20 Resource /robot/resources/mcxapp_properties.robot
22 Resource /robot/resources/ric/ric_utils.robot
25 Library KubernetesEntity ${GLOBAL_XAPP_NAMESPACE}
28 ${listenerContainerName} mc-xapp-listener
29 ${listenerStatRegex} ^[0-9]+\\s*\\[STAT\\]\\s*\\(mcl\\)
30 ${recentListenerDrops} .*last 60s.*drops\\s*=\\s*([1-9][0-9]*)
31 ${recentListenerErrors} .*last 60s.*errs\\s*=\\s*([1-9][0-9]*)
32 ${writerVesSuccesses} .*successful\\s+ves\\s+posts\\s*-\\s*([1-9][0-9]*)
33 ${writerVesErrors} .*failed\\s+ves\\s+posts\\s*-\\s*([1-9][0-9]*)
36 XApp Should Be Available
37 [Tags] etetests xapptests mcxapptests
38 ${deploymentName} = Get From Dictionary ${GLOBAL_RICPLT_XAPPS} mcxapp
39 Set Suite Variable ${deploymentName}
40 ${deploy} = Deployment ${deploymentName}
41 ${status} = Most Recent Availability Condition @{deploy.status.conditions}
42 Should Be Equal As Strings ${status} True ignore_case=True
44 Listener Should Not Be Dropping Messages
45 [Tags] etetests xapptests mcxapptests
46 ${log} = Most Recent Container Logs ${deploymentName}
47 ... ${GLOBAL_MCXAPP_LISTENER_NAME}
48 ... ${listenerStatRegex}
49 Should Not Contain Match ${log} regexp=${recentListenerDrops}
51 Listener Should Not Be Producing Errors
52 [Tags] etetests xapptests mcxapptests
53 ${log} = Most Recent Container Logs ${deploymentName}
54 ... ${GLOBAL_MCXAPP_LISTENER_NAME}
55 ... ${listenerStatRegex}
56 Should Not Contain Match ${log} regexp=${recentListenerErrors}
58 Writer Should Be Successfully Sending Statistics
59 [Tags] etetests xapptests mcxapptests
60 Set Test Variable ${finalStatus} PASS
61 :FOR ${stat} IN @{GLOBAL_MCXAPP_WRITER_STATISTICS}
62 \ ${statRE} = Regexp Escape ${stat}
63 \ ${log} = Most Recent Container Logs ${deploymentName}
64 ... ${GLOBAL_MCXAPP_WRITER_NAME}
65 ... ^${statRE}:\\s+successful\\s+ves\\s+posts\\.*
66 \ ${status} ${u} = Run Keyword And Ignore Error
67 ... Should Contain Match ${log} regexp=${writerVesSuccesses}
68 \ ${finalStatus} = Set Variable If "${status}" == "FAIL"
71 \ Run Keyword If "${status}" == "FAIL"
72 ... Log No messages have been sent to VES for ${stat}
73 \ ${status} ${u} = Run Keyword And Ignore Error
74 ... Should Not Contain Match ${log} regexp=${writerVesErrors}
75 \ ${finalStatus} = Set Variable If "${status}" == "FAIL"
78 \ Run Keyword If "${status}" == "FAIL"
79 ... Log ${stat} is producing errors logging to VES
80 Run Keyword If "${finalStatus}" == "FAIL"
81 ... Fail One or more statistics is not being succesfully logged