blob: e41120f5a27f8a37d17ae97639633d994369cccd [file] [log] [blame]
Andrea Campanella4c404632020-08-26 14:41:36 +02001# Copyright 2020 - present Open Networking Foundation
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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
17Documentation ONOS high avaliablity tests
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
34Resource ../../libraries/power_switch.robot
35
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
41${HELM_CHARTS_DIR} ~/helm-charts
42${VOLTHA_POD_NUM} 8
Hardik Windlass4288c6a2021-09-28 07:22:06 +000043${NAMESPACE} voltha
44${INFRA_NAMESPACE} default
Andrea Campanella4c404632020-08-26 14:41:36 +020045# For below variable value, using deployment name as using grep for
46# parsing radius pod name, we can also use full radius pod name
47${RESTART_POD_NAME} radius
48${timeout} 60s
49${of_id} 0
50${logical_id} 0
51${has_dataplane} True
52${teardown_device} True
Andrea Campanella962fe832020-09-21 10:41:47 +020053${numOfOnos} 1
Andrea Campanella4c404632020-08-26 14:41:36 +020054${scripts} ../../scripts
55${workflow} ATT
56
Matteo Scandolo7e519fb2021-08-13 11:35:16 -070057${suppressaddsubscriber} True
58
Andrea Campanella4c404632020-08-26 14:41:36 +020059# Per-test logging on failure is turned off by default; set this variable to enable
60${container_log_dir} ${None}
61
Matteo Scandoloda1c64b2021-07-20 10:14:49 -070062# logging flag to enable Collect Logs, can be passed via the command line too
63# example: -v logging:False
64${logging} True
65
Andrea Campanella4c404632020-08-26 14:41:36 +020066*** Test Cases ***
67Verify restart ONOS instace master of device after subscriber is provisioned
68 [Documentation] Restat ONOS instance master of a given device and check that during restart and after the
69 ... subscriuber still has dataplane traffic.
70 ... Prerequisite : ONUs are authenticated and pingable, thus setup and sanity is performed.
71 [Tags] onosHa VOL-3436 onosMasterRestart
Suchitra Vemuri8130be82020-09-15 16:47:58 -070072 [Setup] Start Logging onosMasterRestart
Andrea Campanella4c404632020-08-26 14:41:36 +020073 [Teardown] Run Keywords Collect Logs
74 ... AND Stop Logging onosMasterRestart
Matteo Scandolo10acf562021-05-03 15:35:16 -070075 ${numOfOnos}= Wait Until Keyword Succeeds 20s 5s Get Number of Running Pods Number By Label ${INFRA_NAMESPACE}
Hardik Windlass71702fa2021-04-28 15:46:51 +000076 ... app onos-classic
77 Should Not Be Equal As Integers ${numOfOnos} 0 Error fetching number of ONOS instances
Andrea Campanella962fe832020-09-21 10:41:47 +020078 Pass Execution If ${numOfOnos} == 1 Skipping test: just one instance of ONOS
Suchitra Vemuri94f045c2020-09-14 15:56:25 -070079 Delete All Devices and Verify
80 Setup
Andrea Campanella4c404632020-08-26 14:41:36 +020081 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass58b23a32022-05-10 11:06:48 +053082 Run Keyword If '${workflow}' == 'ATT' Perform Sanity Test
83 Run Keyword If '${workflow}' == 'DT' Perform Sanity Test DT
84 Run Keyword If '${workflow}' == 'TT' Perform Sanity Tests TT
Suchitra Vemurif8462be2020-11-05 13:38:42 -080085 FOR ${I} IN RANGE 0 ${olt_count}
86 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
87 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
88 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
89 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
90 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
91 ${of_id}= Wait Until Keyword Succeeds 360s 15s Validate OLT Device in ONOS ${olt_serial_number}
92 ${node_id}= Wait Until Keyword Succeeds 20s 5s Get Master Instace in ONOS ${of_id}
Hardik Windlass347472c2021-02-23 18:54:31 +053093 @{onos_id}= Split String ${node_id} -
Hardik Windlass71702fa2021-04-28 15:46:51 +000094 ${podName}= Catenate SEPARATOR=- voltha-infra-onos-classic ${onos_id[1]}
Matteo Scandolo10acf562021-05-03 15:35:16 -070095 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Name ${INFRA_NAMESPACE} ${podName}
Suchitra Vemurif8462be2020-11-05 13:38:42 -080096 Sleep 60s
Matteo Scandolo10acf562021-05-03 15:35:16 -070097 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Name ${INFRA_NAMESPACE}
Suchitra Vemurif8462be2020-11-05 13:38:42 -080098 ... ${podName} Running
Andrea Campanellad6226c62020-11-27 11:44:33 +010099 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
100 Run Keyword If ${has_dataplane} Clean Up Linux
101 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
102 ... ${olt_serial_number}
103 Set Global Variable ${of_id}
TorstenThiemedda37652021-11-11 16:22:05 +0000104 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
Andrea Campanellad6226c62020-11-27 11:44:33 +0100105 ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
106 Run Keyword If '${workflow}' == 'ATT' Wait Until Keyword Succeeds ${timeout} 2s
107 ... Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700108 ... ${suppressaddsubscriber}
Andrea Campanellad6226c62020-11-27 11:44:33 +0100109 Run Keyword If '${workflow}' == 'DT' Wait Until Keyword Succeeds ${timeout} 2s
110 ... Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800111 END
Hardik Windlass58b23a32022-05-10 11:06:48 +0530112 Run Keyword If '${workflow}' == 'TT' Perform Sanity Tests TT
Andrea Campanella4c404632020-08-26 14:41:36 +0200113 Log to console Pod ${podName} deleted and sanity checks passed successfully
114
115*** Keywords ***
116Setup Suite
117 [Documentation] Set up the test suite
Suchitra Vemuri94f045c2020-09-14 15:56:25 -0700118 Common Test Suite Setup