blob: 4139d3ad5a5a6515a69ee56ab03338b72efdf485 [file] [log] [blame]
You Wangaabb2832017-11-16 17:24:09 -08001# Copyright 2017-present Radisys Corporation
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
You Wang09911962018-02-09 15:34:06 -080015# NOTE: `make collect-diag` command needs to be executed on the head-node
16# before running this test
You Wangaabb2832017-11-16 17:24:09 -080017
18*** Settings ***
19Documentation Test suite for checking results collected by `make collect-diag` command
20Library OperatingSystem
21Library ../cord-api/Framework/utils/onosUtils.py
22Library ../cord-api/Framework/utils/utils.py
23Resource ../cord-api/Framework/utils/utils.robot
24
25*** Variables ***
26${DOCKER_CONTAINERS_FILE} ${CURDIR}/dockerContainers.json
27${ONOS_APPS_FILE} ${CURDIR}/onosApps.json
28${CORD_PROFILE} rcord
29${CORD_SCENARIO} cord
30
31*** Test Cases ***
32Verify Docker Containers
33 [Documentation] Verify expected containers are up and running
34 ${dockerContainersExpected} utils.jsonToList ${DOCKER_CONTAINERS_FILE} docker-containers-${CORD_PROFILE}
35 : FOR ${container} IN @{dockerContainersExpected}
You Wang046fa862017-11-21 13:13:26 -080036 \ Run Keyword And Continue On Failure Verify Docker Container ${container}
You Wangaabb2832017-11-16 17:24:09 -080037
38Verify Synchronizer Logs
39 [Documentation] Verify synchronizer logs are correct
You Wangdc604932018-02-09 17:21:29 -080040 ${latestDiag}= Run ls -1t /home/cord | head -1
41 ${synchronizerLogs} utils.readFiles /home/cord/${latestDiag}/docker/*synchronizer*.logs
You Wangaabb2832017-11-16 17:24:09 -080042 : FOR ${key} IN @{synchronizerLogs.keys()}
You Wang0894ffa2017-11-30 23:00:59 -080043 \ @{name}= Split String ${key} -synchronizer
44 \ @{name}= Split String From Right @{name}[0] _ 1
You Wang046fa862017-11-21 13:13:26 -080045 \ ${synchronizerLog}= Get From Dictionary ${synchronizerLogs} ${key}
You Wangf89c8e72017-12-05 13:06:46 -080046 \ Run Keyword And Continue On Failure Verify Synchronizer Log ${name} ${synchronizerLog}
You Wangaabb2832017-11-16 17:24:09 -080047
48Verify ONOS
49 [Documentation] Verify ONOS status, applications and logs
You Wangd65eb852017-11-20 15:04:32 -080050 Run Keyword If '${CORD_PROFILE}' != 'ecord-global' Verify ONOS-Fabric ${CORD_PROFILE}
51 Verify ONOS-CORD ${CORD_PROFILE}
You Wangaabb2832017-11-16 17:24:09 -080052
53*** Keywords ***
You Wang046fa862017-11-21 13:13:26 -080054Verify Docker Container
55 [Arguments] ${container}
Kailash Khalasi71ee3232018-01-16 15:20:45 -080056 OperatingSystem.File Should Exist /home/cord/diag-*/docker/${container}.logs
You Wang046fa862017-11-21 13:13:26 -080057
58Verify Synchronizer Log
You Wangf89c8e72017-12-05 13:06:46 -080059 [Arguments] ${name} ${log}
You Wangf35df4a2018-01-24 11:00:58 -080060 ${config} utils.readFile /opt/cord/orchestration/*/*/xos/synchronizer/@{name}[1]_config.yaml
You Wang4c09fae2017-12-06 13:30:34 -080061 ${match1}= Get Lines Matching Regexp ${config} ^steps_dir: ".*"$
62 ${match2}= Get Lines Matching Regexp ${config} ^model_policies_dir: ".*"$
63 Run Keyword If '${match1}' != '${EMPTY}' Should Contain ${log} Waiting for event or timeout msg= "Waiting for event or timeout" not found in @{name}[1] synchronizer log
64 ... ELSE IF '${match2}' != '${EMPTY}' Should Contain ${log} Loaded model policies msg= "Loaded model policies" not found in @{name}[1] synchronizer log
You Wang046fa862017-11-21 13:13:26 -080065
You Wangd65eb852017-11-20 15:04:32 -080066Verify ONOS-Fabric
67 [Arguments] ${cord_profile}
You Wang046fa862017-11-21 13:13:26 -080068 Run Keyword And Continue On Failure Verify ONOS Status onos-fabric
69 Run Keyword And Continue On Failure Verify ONOS Applications onos-fabric ${cord_profile}
70 Run Keyword And Continue On Failure Verify ONOS Log onos-fabric
You Wangd65eb852017-11-20 15:04:32 -080071
72Verify ONOS-CORD
73 [Arguments] ${cord_profile}
You Wang046fa862017-11-21 13:13:26 -080074 Run Keyword And Continue On Failure Verify ONOS Status onos-cord
75 Run Keyword And Continue On Failure Verify ONOS Applications onos-cord ${cord_profile}
76 Run Keyword And Continue On Failure Verify ONOS Log onos-cord
You Wangd65eb852017-11-20 15:04:32 -080077
You Wangaabb2832017-11-16 17:24:09 -080078Verify ONOS Status
79 [Arguments] ${onosName}
80 ${onosStatus} utils.readFile /home/cord/diag-*/${onosName}/nodes
81 Should Contain ${onosStatus} READY
82
83Verify ONOS Applications
84 [Arguments] ${onosName} ${cordProfile}
85 ${onosAppsExpected} utils.jsonToList ${ONOS_APPS_FILE} ${onosName}-${cordProfile}
86 ${onosApps} utils.readFile /home/cord/diag-*/${onosName}/apps_-s_-a
87 : FOR ${app} IN @{onosAppsExpected}
88 \ Should Contain ${onosApps} ${app}
89
You Wang046fa862017-11-21 13:13:26 -080090Verify ONOS Log
You Wangaabb2832017-11-16 17:24:09 -080091 [Arguments] ${onosName}
92 ${onosLog} utils.readFile /home/cord/diag-*/${onosName}/log_display
93 Should Not Contain ${onosLog} ERROR