[VOL-2483] DT workflow sanity test
Change-Id: I482dc6a463bb8bc733e37f8c7e093b52eea89de2
diff --git a/Makefile b/Makefile
index 1d75059..f2b7085 100644
--- a/Makefile
+++ b/Makefile
@@ -35,6 +35,7 @@
# Robot config
ROBOT_SANITY_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind.yaml
+ROBOT_SANITY_DT_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-dt.yaml
ROBOT_FAIL_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind.yaml
ROBOT_SANITY_MULT_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-2x2.yaml
ROBOT_SCALE_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-16.yaml
@@ -45,6 +46,12 @@
# for backwards compatibility
sanity-kind: sanity-single-kind
+# target to invoke DT Workflow Sanity
+sanity-kind-dt: ROBOT_MISC_ARGS += -i sanityDt $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-dt: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_DT_SINGLE_PON_FILE)
+sanity-kind-dt: ROBOT_FILE := Voltha_DT_PODTests.robot
+sanity-kind-dt: voltha-dt-test
+
functional-single-kind: ROBOT_MISC_ARGS += -i sanity -i functional $(ROBOT_DEBUG_LOG_OPT)
functional-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE)
functional-single-kind: bbsim-kind
@@ -106,6 +113,11 @@
cd tests/functional ;\
robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+voltha-dt-test: vst_venv
+ source ./$</bin/activate ; set -u ;\
+ cd tests/dt-workflow ;\
+ robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+
# self-test, lint, and setup targets
# virtualenv for the robot tools
diff --git a/README.md b/README.md
index 4c46faf..37e2aa6 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,9 @@
See all available versions in [Docker
voltha](https://hub.docker.com/u/voltha/).
+### DT Workflow
+If you want to install voltha for the DT Workflow, add `WITH_RADIUS=n WITH_EAPOL=n WITH_DHCP=n WITH_IGMP=n CONFIG_SADIS=n` flags in the command.
+
### Debug the kind-voltha installation
If you meet any issues when you set up the VOLTHA testing environment by
@@ -112,6 +115,13 @@
make -C voltha-system-tests sanity-kind
```
+### DT Workflow
+To run the sanity tests for the DT Workflow, use `sanity-kind-dt` as the make target.
+```bash
+git clone https://github.com/opencord/voltha-system-tests
+make -C voltha-system-tests sanity-kind-dt
+```
+
This test execution will generate three report files in
`voltha-system-tests/tests/sanity` (`output.xml`, `report.html`, `log.html`).
View the `report.html` page in a browser to analyze the results.
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 9143fc1..5d1d2a2 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -186,6 +186,51 @@
Run Keyword and Ignore Error Collect Logs
END
+Perform Sanity Test DT
+ [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
+ ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
+ ... This keyword can be used to call in any other tests where sanity check is required
+ ... and avoids duplication of code.
+ ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
+ Set Global Variable ${of_id}
+ FOR ${I} IN RANGE 0 ${num_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
+ ... Get ONU Port in ONOS ${src['onu']} ${of_id}
+ # Check ONU port is Enabled in ONOS
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
+ ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
+ ... Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
+ ... volt-add-subscriber-access ${of_id} ${onu_port}
+ # Verify ONU state in voltha
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
+ ... ENABLED ACTIVE REACHABLE
+ ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
+ # TODO: Yet to Verify on the Physical POD
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
+ ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
+ ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
+ ... ${dst['container_name']}
+ Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
+ Run Keyword and Ignore Error Collect Logs
+ END
+ # Verify VOLTHA Flows (TODO: Add verification for ONOS Flows)
+ # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
+ ${olt_flows}= Evaluate 2 * ${num_onus} + 1
+ # Number of per ONU Flows equals 2 (one each for downstream and upstream)
+ ${onu_flows}= Set Variable 2
+ Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
+ ${List_ONU_Serial} Create List
+ Set Suite Variable ${List_ONU_Serial}
+ Build ONU SN List ${List_ONU_Serial}
+ Log ${List_ONU_Serial}
+ Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
+ ... ${List_ONU_Serial} ${onu_flows}
+
Setup
[Documentation] Pre-test Setup
#test for empty device list
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 00c85c4..e0883d7 100644
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -209,7 +209,7 @@
END
Validate Device Flows
- [Arguments] ${device_id} ${test}=${EMPTY}
+ [Arguments] ${device_id} ${flow_count}=${EMPTY}
[Documentation] Parses the output of voltctl device flows <device_id> and expects flow count > 0
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device flows ${device_id} -o json
Should Be Equal As Integers ${rc} 0
@@ -217,22 +217,24 @@
Log ${jsondata}
${length}= Get Length ${jsondata}
Log 'Number of flows = ' ${length}
- Run Keyword If '${test}' == '${EMPTY}' Should Be True ${length} > 0
+ Run Keyword If '${flow_count}' == '${EMPTY}' Should Be True ${length} > 0
... Number of flows for ${device_id} was 0
- ... ELSE Should Be True ${length} == ${test}
- ... Number of flows for ${device_id} was not ${test}
+ ... ELSE Should Be True ${length} == ${flow_count}
+ ... Number of flows for ${device_id} was not ${flow_count}
Validate OLT Flows
- [Documentation] Parses the output of voltctl device flows ${olt_device_id} and expects flow count > 0
- Validate Device Flows ${olt_device_id}
+ [Arguments] ${flow_count}=${EMPTY}
+ [Documentation] Parses the output of voltctl device flows ${olt_device_id}
+ ... and expects flow count == ${flow_count}
+ Validate Device Flows ${olt_device_id} ${flow_count}
Validate ONU Flows
- [Arguments] ${List_ONU_Serial} ${test}
+ [Arguments] ${List_ONU_Serial} ${flow_count}=${EMPTY}
[Documentation] Parses the output of voltctl device flows for each ONU SN listed in ${List_ONU_Serial}
- ... and expects flow count == 0
+ ... and expects flow count == ${flow_count}
FOR ${serial_number} IN @{List_ONU_Serial}
${onu_dev_id}= Get Device ID From SN ${serial_number}
- Validate Device Flows ${onu_dev_id} ${test}
+ Validate Device Flows ${onu_dev_id} ${flow_count}
END
Validate Logical Device
diff --git a/tests/data/bbsim-kind-dt.yaml b/tests/data/bbsim-kind-dt.yaml
new file mode 100644
index 0000000..a5abc4d
--- /dev/null
+++ b/tests/data/bbsim-kind-dt.yaml
@@ -0,0 +1,44 @@
+---
+
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Automated deployment configuration for kind-voltha running BBSim
+
+# Change default values in tests
+has_dataplane: false
+external_libs: false
+teardown_device: true
+ONOS_REST_PORT: 8181
+ONOS_SSH_PORT: 8101
+OLT_PORT: 50060
+
+nodes:
+ -
+ ip: '127.0.0.1'
+
+olts:
+ -
+ ip: bbsim.voltha.svc
+ serial: BBSIM_OLT_0
+
+hosts:
+ src:
+ - onu: 'BBSM00000001'
+
+ dst:
+ - ip: null
+
+sadis:
+ file: ${CURDIR}/../../data/onos-sadis-bbsim-dt.json
diff --git a/tests/data/onos-sadis-bbsim-dt.json b/tests/data/onos-sadis-bbsim-dt.json
new file mode 100644
index 0000000..03a7eac
--- /dev/null
+++ b/tests/data/onos-sadis-bbsim-dt.json
@@ -0,0 +1,72 @@
+{
+ "org.opencord.sadis": {
+ "sadis": {
+ "integration": {
+ "cache": {
+ "enabled": false,
+ "maxsize": 50,
+ "ttl": "PT0m"
+ }
+ },
+ "entries": [
+ {
+ "id": "BBSIM_OLT_0",
+ "hardwareIdentifier": "0f:f1:ce:c0:ff:ee",
+ "nasId": "BBSIMOLT000",
+ "uplinkPort": 1048576
+ },
+ {
+ "id": "BBSM00000001-1",
+ "nasPortId": "BBSM00000001-1",
+ "circuitId": "BBSM00000001-1",
+ "remoteId": "BBSM00000001-1",
+ "uniTagList": [
+ {
+ "ponCTag": 4095,
+ "ponSTag": 900,
+ "technologyProfileId": 64,
+ "downstreamBandwidthProfile": "Default",
+ "upstreamBandwidthProfile": "Default",
+ "isDhcpRequired": true
+ }
+ ]
+ },
+ {
+ "id": "BBSM00000002-1",
+ "nasPortId": "BBSM00000002-1",
+ "circuitId": "BBSM00000002-1",
+ "remoteId": "BBSM00000002-1",
+ "uniTagList": [
+ {
+ "ponCTag": 4095,
+ "ponSTag": 901,
+ "technologyProfileId": 64,
+ "downstreamBandwidthProfile": "Default",
+ "upstreamBandwidthProfile": "Default",
+ "isDhcpRequired": true
+ }
+ ]
+ }
+ ]
+ },
+ "bandwidthprofile": {
+ "integration": {
+ "cache": {
+ "enabled": true,
+ "maxsize": 40,
+ "ttl": "PT1m"
+ }
+ },
+ "entries": [
+ {
+ "id": "Default",
+ "cir": 1000000,
+ "cbs": 1001,
+ "eir": 1002,
+ "ebs": 1003,
+ "air": 1004
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
new file mode 100644
index 0000000..51acfbc
--- /dev/null
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -0,0 +1,86 @@
+# Copyright 2017 - present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# FIXME Can we use the same test against BBSim and Hardware?
+
+*** Settings ***
+Documentation Test various end-to-end scenarios
+Suite Setup Setup Suite
+Test Setup Setup
+Test Teardown Teardown
+Suite Teardown Teardown Suite
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../../libraries/DependencyLibrary.py
+Resource ../../libraries/onos.robot
+Resource ../../libraries/voltctl.robot
+Resource ../../libraries/voltha.robot
+Resource ../../libraries/utils.robot
+Resource ../../libraries/k8s.robot
+Resource ../../variables/variables.robot
+
+*** Variables ***
+${POD_NAME} flex-ocp-cord
+${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
+${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
+#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
+${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
+${HELM_CHARTS_DIR} ~/helm-charts
+${VOLTHA_POD_NUM} 8
+${NAMESPACE} voltha
+# For below variable value, using deployment name as using grep for
+# parsing radius pod name, we can also use full radius pod name
+${RESTART_POD_NAME} radius
+${timeout} 60s
+${of_id} 0
+${logical_id} 0
+${has_dataplane} True
+${external_libs} True
+${teardown_device} False
+${scripts} ../../scripts
+
+# Per-test logging on failure is turned off by default; set this variable to enable
+${container_log_dir} ${None}
+
+*** Test Cases ***
+Sanity E2E Test for OLT/ONU on POD for DT
+ [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
+ ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
+ ... Traffic sent with same vlan from different RGs,
+ ... should reach the NNI port on the OLT with the expected double tagged vlan ids
+ ... Inner vlans from the RG should not change
+ [Tags] sanityDt bbsim test1
+ [Setup] Run Keywords Announce Message START TEST SanityTestDt
+ ... AND Start Logging SanityTestDt
+ ... AND Setup
+ [Teardown] Run Keywords Collect Logs
+ ... AND Stop Logging SanityTestDt
+ ... AND Announce Message END TEST SanityTestDt
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
+
+*** Keywords ***
+Setup Suite
+ [Documentation] Set up the test suite
+ Common Test Suite Setup
+
+Clear All Devices Then Create New Device
+ [Documentation] Remove any devices from VOLTHA and ONOS
+ # Remove all devices from voltha and nos
+ Delete All Devices and Verify
+ # Execute normal test Setup Keyword
+ Setup
+