updating documentation on bbsim test
Change-Id: Ibe5365228472c35ac0acdb0ca1d7cef04970b9e7
diff --git a/src/test/cord-api/Tests/BBSim/BBSIM.robot b/src/test/cord-api/Tests/BBSim/BBSIM.robot
new file mode 100644
index 0000000..17dcf5b
--- /dev/null
+++ b/src/test/cord-api/Tests/BBSim/BBSIM.robot
@@ -0,0 +1,121 @@
+# 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.
+
+*** Settings ***
+Documentation Test various E2E conditions for seba-in-a-box
+Suite Setup Setup
+Suite Teardown Teardown
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library bbsim_utils.py
+Library ../../Framework/utils/utils.py
+Resource ../../Framework/utils/utils.robot
+Library ../../Framework/restApi.py
+Resource ../../Framework/Subscriber.robot
+Resource ../../Framework/ATTWorkFlowDriver.robot
+Resource ../../Framework/Kubernetes.robot
+Resource ../../Framework/ONU.robot
+Resource ../../Framework/DHCP.robot
+Variables ../../Properties/RestApiProperties.py
+
+*** Variables ***
+${number_of_onus} 16
+
+*** Test Cases ***
+Debug
+ [Tags] debug
+ Log debug
+
+Create Subscriber and Whitelist for ONUs
+ [Documentation] Creates whitelists in ATT-WF for each onu device
+ [Tags] play
+ ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
+ ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
+ ${rcord_service_id}= Get Service Owner Id /xosapi/v1/rcord/rcordservices
+ CORD Post ${VOLT_DEVICE} {'device_type': 'openolt', 'host': 'bbsim.voltha.svc', 'port': 50060, 'switch_datapath_id': 'of:0000000000000002', 'switch_port': '3', 'outer_tpid': '0x8100', 'uplink': '65536', 'nas_id': 'NAS_ID', 'serial_number': 'bbsim.voltha.svc:50060', 'volt_service_id': ${volt_service_id}}
+ @{subscribers}= Generate Subscribers ${number_of_onus} ${rcord_service_id}
+ : FOR ${subscriber} IN @{subscribers}
+ \ Log To Console ${subscriber}
+ \ CORD Post ${VOLT_SUBSCRIBER} ${subscriber}
+ @{whitelists}= Generate Whitelists ${number_of_onus} ${att_workflow_service_id}
+ : FOR ${whitelist} IN @{whitelists}
+ \ Log To Console ${whitelist}
+ \ CORD Post ${ATT_WHITELIST} ${whitelist}
+
+ONUs Discovered
+ [Documentation] Validates All ONU Devices are discovered and retrieve SNs
+ [Tags] onudiscovery
+ Wait Until Keyword Succeeds 120s 5s Validate Number of ONU Devices ${number_of_onus}
+
+Validate ONU States
+ [Documentation] Validates All ONU Device states are "enabled" and "active"
+ [Tags] onustates
+ : FOR ${onu} IN @{serial_numbers}
+ \ Wait Until Keyword Succeeds 120s 5s Validate ONU States ACTIVE ENABLED ${onu}
+
+Validate ATT WF Driver SIs
+ [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered"
+ [Tags] serviceinstances
+ : FOR ${onu} IN @{serial_numbers}
+ \ Wait Until Keyword Succeeds 180s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
+ \ Wait Until Keyword Succeeds 240s 2s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu}
+
+*** Keywords ***
+Setup
+ ${server_ip}= Get Environment Variable SERVER_IP localhost
+ ${port}= Get Environment Variable SERVER_PORT 30001
+ ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
+ ${HEADERS} Create Dictionary Content-Type=application/json
+ Create Session ${server_ip} http://${server_ip}:${port} auth=${AUTH} headers=${HEADERS}
+ @{container_list}= Create List
+ Append To List ${container_list} att-workflow-att-workflow-driver
+ Append To List ${container_list} seba-services-volt
+ Append To List ${container_list} seba-services-rcord
+ Append To List ${container_list} seba-services-fabric-crossconnect
+ Append To List ${container_list} seba-services-onos-service
+ Append To List ${container_list} xos-core
+ Append To List ${container_list} vcore
+ Set Suite Variable ${container_list}
+
+Teardown
+ #Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
+ #Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
+ Delete All Sessions
+ #Get Pod Logs
+
+Get Pod Logs
+ : FOR ${pod} IN @{container_list}
+ \ ${full_pod_name}= Run kubectl get pods --all-namespaces | grep '${pod}' | head -1 | awk '{print $2}'
+ \ ${namespace}= Run kubectl get pods --all-namespaces | grep ' ${pod}' | head -1 | awk '{print $1}'
+ \ ${output}= Run kubectl logs --timestamps -n ${namespace} ${full_pod_name}
+ \ Log ${output}
+
+Validate Number of ONU Devices
+ [Arguments] ${expected_onus}
+ ${resp}= CORD Get ${ONU_DEVICE}
+ ${jsondata}= To Json ${resp.content}
+ Log ${jsondata}
+ ${length}= Get Length ${jsondata['items']}
+ @{serial_numbers}= Create List
+ : FOR ${INDEX} IN RANGE 0 ${length}
+ \ ${value}= Get From List ${jsondata['items']} ${INDEX}
+ \ ${sn}= Get From Dictionary ${value} serial_number
+ \ ${contains}= Evaluate "BBSM" in """${sn}"""
+ \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn}
+ Set Suite Variable ${serial_numbers}
+ ${length_of_bbsim_onus}= Get Length ${serial_numbers}
+ Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus}
\ No newline at end of file
diff --git a/src/test/cord-api/Tests/BBSim/BBSIMScale.robot b/src/test/cord-api/Tests/BBSim/BBSIMScale.robot
index 4f07a08..721cded 100644
--- a/src/test/cord-api/Tests/BBSim/BBSIMScale.robot
+++ b/src/test/cord-api/Tests/BBSim/BBSIMScale.robot
@@ -74,14 +74,13 @@
: FOR ${onu} IN @{serial_numbers}
\ Wait Until Keyword Succeeds ${timeout} 5s Validate ONU States ACTIVE ENABLED ${onu}
-Validate Hosts and DHCP Allocations in ONOS
- [Documentation] Verify number of hosts in ONOS match number of onus and verify number of DHCP allocations
+Validate DHCP Allocations in ONOS
+ [Documentation] Verify number of DHCP allocations in ONOS to match number of ONUs
[Tags] onosdhcp
- #Wait Until Keyword Succeeds ${timeout} 5s Validate Hosts in ONOS ${number_of_onus}
Wait Until Keyword Succeeds ${timeout} 5s Validate DHCP Allocations ${number_of_onus}
Validate ATT WF Driver SIs
- [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered"
+ [Documentation] Validates all service instances per onu devices become "approved" and "dhcpack"
[Tags] serviceinstances
: FOR ${onu} IN @{serial_numbers}
\ Wait Until Keyword Succeeds ${timeout} 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
diff --git a/src/test/cord-api/Tests/WorkflowValidations/OLT_Reboot.robot b/src/test/cord-api/Tests/WorkflowValidations/OLT_Reboot.robot
new file mode 100644
index 0000000..1cd63b2
--- /dev/null
+++ b/src/test/cord-api/Tests/WorkflowValidations/OLT_Reboot.robot
@@ -0,0 +1,190 @@
+# 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.
+
+*** Settings ***
+Documentation Test various end-to-end scenarios with ATT workflow
+Suite Setup Setup Suite
+Suite Teardown Teardown Suite
+Test Setup Setup Test
+Test Teardown Teardown Test
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../../Framework/utils/utils.py
+Resource ../../Framework/utils/utils.robot
+Library ../../Framework/restApi.py
+Resource ../../Framework/Subscriber.robot
+Resource ../../Framework/ATTWorkFlowDriver.robot
+Resource ../../Framework/Kubernetes.robot
+Resource ../../Framework/ONU.robot
+Resource ../../Framework/OLT.robot
+Resource ../../Framework/DHCP.robot
+Variables ../../Properties/RestApiProperties.py
+
+*** Variables ***
+${NUM_REBOOTS} 5
+${POD_NAME} flex-pod1-olt
+${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
+${HELM_CHARTS_DIR} ~/helm-charts
+${WHITELIST_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTWhiteList.json
+${SUBSCRIBER_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTSubscriber.json
+${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/${POD_NAME}/RealOLTDevice.json
+${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
+${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
+${VOLTHA_POD_NUM} 8
+
+*** Test Cases ***
+Reboot OLT
+ [Documentation] Validate olt creation -> olt deletion
+ ${reboot_count}= Convert To Integer ${NUM_REBOOTS}
+ : FOR ${INDEX} IN RANGE 0 ${reboot_count}
+ \ Log To Console \n Reboot Attempt - ${INDEX}
+ \ Setup Test
+ \ Wait Until Keyword Succeeds 300s 5s Device in VOLTHA and ONOS
+ \ Wait Until Keyword Succeeds Validate OLT States in XOS
+ \ Teardown Test
+
+*** Keywords ***
+Device in VOLTHA and ONOS
+ ${voltha_num}= Run curl -s -U voltha:admin http://10.90.0.101:30125/api/v1/devices| grep '10.90.0.114' | grep '"admin_state":"ENABLED"' | grep '"connect_status":"REACHABLE"' | grep '"oper_status":"ACTIVE"' | wc -l
+ ${onos_num}= Run sshpass -p'rocks' ssh onos@10.90.0.101 -p 30115 devices | grep voltha | grep OLT | grep available=true | grep local-status=connected | wc -l
+ Should Contain ${voltha_num} 1
+ Should Contain ${onos_num} 1
+
+Validate OLT States in XOS
+ ${xos_output}= Run curl -s -u admin@opencord.org:letmein http://10.90.0.101:30001/xosapi/v1/volt/oltdevices
+ Log ${xos_output}
+ ${xos_num}= Run curl -s -u admin@opencord.org:letmein http://10.90.0.101:30001/xosapi/v1/volt/oltdevices | grep '10.90.0.114' | grep '"admin_state": "ENABLED"' | grep '"oper_status": "ACTIVE"' | wc -l
+ Should Contain ${xos_num}
+
+Setup Suite
+ ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
+ ${HEADERS} Create Dictionary Content-Type=application/json
+ Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
+ ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
+ ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
+ ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
+ Set Suite Variable ${AttWhiteListList}
+ ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
+ ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
+ ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
+ Set Global Variable ${onu_device}
+ ${onu_location}= Get From Dictionary ${AttWhiteListDict} pon_port_id
+ Set Global Variable ${onu_location}
+ ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
+ Set Global Variable ${SubscriberList}
+ ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
+ ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
+ ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
+ ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
+ ${VoltDeviceDict}= utils.setFieldValueInDict ${VoltDeviceList[0]} volt_service_id ${volt_service_id}
+ Set Global Variable ${VoltDeviceList}
+ Set Global Variable ${VoltDeviceDict}
+ Set Suite Variable ${s_tag}
+ Set Suite Variable ${c_tag}
+ Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
+ # Read variables from yaml file
+ ${src_ip}= Evaluate ${hosts}.get("src").get("ip")
+ ${src_user}= Evaluate ${hosts}.get("src").get("user")
+ ${src_pass}= Evaluate ${hosts}.get("src").get("pass")
+ ${src_container_type}= Evaluate ${hosts}.get("src").get("container_type")
+ ${src_container_name}= Evaluate ${hosts}.get("src").get("container_name")
+ ${src_iface}= Evaluate ${hosts}.get("src").get("dp_iface_name")
+ ${dst_ip}= Evaluate ${hosts}.get("dst").get("ip")
+ ${dst_user} = Evaluate ${hosts}.get("dst").get("user")
+ ${dst_pass}= Evaluate ${hosts}.get("dst").get("pass")
+ ${dst_container_type}= Evaluate ${hosts}.get("dst").get("container_type")
+ ${dst_container_name}= Evaluate ${hosts}.get("dst").get("container_name")
+ ${dst_dp_iface}= Evaluate ${hosts}.get("dst").get("dp_iface_name")
+ ${dst_dp_ip}= Evaluate ${hosts}.get("dst").get("dp_iface_ip_qinq")
+ ${olt_ip}= Evaluate ${olts}[0].get("ip")
+ ${olt_user}= Evaluate ${olts}[0].get("user")
+ ${olt_pass}= Evaluate ${olts}[0].get("pass")
+ ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
+ ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
+ ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
+ Set Suite Variable ${src_ip}
+ Set Suite Variable ${src_user}
+ Set Suite Variable ${src_pass}
+ Set Suite Variable ${src_container_type}
+ Set Suite Variable ${src_container_name}
+ Set Suite Variable ${src_iface}
+ Set Suite Variable ${dst_ip}
+ Set Suite Variable ${dst_user}
+ Set Suite Variable ${dst_pass}
+ Set Suite Variable ${dst_container_type}
+ Set Suite Variable ${dst_container_name}
+ Set Suite Variable ${dst_dp_iface}
+ Set Suite Variable ${dst_dp_ip}
+ Set Suite Variable ${olt_ip}
+ Set Suite Variable ${olt_user}
+ Set Suite Variable ${olt_pass}
+ Set Suite Variable ${k8s_node_ip}
+ Set Suite Variable ${k8s_node_user}
+ Set Suite Variable ${k8s_node_pass}
+ @{container_list}= Create List
+ Append To List ${container_list} att-workflow-att-workflow-driver
+ Append To List ${container_list} seba-services-volt
+ Append To List ${container_list} seba-services-rcord
+ Append To List ${container_list} seba-services-fabric-crossconnect
+ Append To List ${container_list} xos-core
+ Append To List ${container_list} vcore
+ Set Suite Variable ${container_list}
+ ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
+ Set Suite Variable ${datetime}
+
+Teardown Suite
+ [Documentation] Performs any additional cleanup required
+ Log Suite Teardown cleanup
+ Delete All Sessions
+
+Setup Test
+ [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
+ Log Re-creating objects
+ ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
+ Create Whitelist
+ Create Subscriber
+ Create VOLT
+
+Teardown Test
+ [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
+ Clean Up XOS
+ Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
+
+Clean Up XOS
+ [Documentation] Clean up all XOS objects and reinstall voltha after OLT reboots
+ Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
+ Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
+ Sleep 20s
+ Wait Until Keyword Succeeds 30s 2s Validate Subscriber Count 0
+ Sleep 10s
+ Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
+ Sleep 20s
+ Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_SERVICEINSTANCES}
+ Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
+ Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
+ Wait Until Keyword Succeeds 300s 1s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
+
+Create Whitelist
+ ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
+ CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
+
+Create Subscriber
+ ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
+ Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
+
+Create VOLT
+ CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
diff --git a/src/test/cord-api/Tests/WorkflowValidations/data/SIABBandwidthprofile.json b/src/test/cord-api/Tests/WorkflowValidations/data/SIABBandwidthprofile.json
new file mode 100644
index 0000000..948d92e
--- /dev/null
+++ b/src/test/cord-api/Tests/WorkflowValidations/data/SIABBandwidthprofile.json
@@ -0,0 +1,20 @@
+{
+ "BandwidthprofileInfo" : [
+ {
+ "name": "SIAB_Upstream_TP",
+ "cir": 111,
+ "cbs": 222,
+ "eir": 333,
+ "ebs": 444,
+ "air": 555
+ },
+ {
+ "name": "SIAB_Downstream_TP",
+ "cir": 555,
+ "cbs": 444,
+ "eir": 333,
+ "ebs": 222,
+ "air": 111
+ }
+ ]
+}
diff --git a/src/test/cord-api/Tests/XosScaleValidations/xos-service-migration.robot b/src/test/cord-api/Tests/XosScaleValidations/xos-service-migration.robot
new file mode 100644
index 0000000..8471c8d
--- /dev/null
+++ b/src/test/cord-api/Tests/XosScaleValidations/xos-service-migration.robot
@@ -0,0 +1,66 @@
+*** Settings ***
+Documentation Test migration of a Service in the core
+Library RequestsLibrary
+Library HttpLibrary.HTTP
+Library Collections
+Library String
+Library OperatingSystem
+Library DateTime
+Library ../../Framework/utils/utils.py
+Resource ../../Framework/utils/utils.robot
+Library ../../Framework/restApi.py
+Variables ../../Properties/RestApiProperties.py
+Suite Setup Setup
+Suite Teardown Teardown
+
+*** Variables ***
+${timeout} 300s
+
+*** Test Cases ***
+Validate Service Version A
+ [Documentation] Validate fields from model in version A
+ [Tags] test1
+ ${resp} = CORD Get /xosapi/v1/core/users
+ ${jsondata} = To Json ${resp.content}
+ ${length} = Get Length ${jsondata['items']}
+ : FOR ${INDEX} IN RANGE 0 ${length}
+ \ ${dict}= Get From List ${jsondata['items']} ${INDEX}
+ \ ${keys}= Get Dictionary Keys ${dict}
+ : FOR ${field} IN @{model_A_fields}
+ \ List Should Contain Value ${keys} ${field}
+
+Upgrade Service
+ [Documentation] Upgrade the version of the service and wait for completion
+ [Tags] test2
+ Run helm upgrade --set imageTag=2.0.0 demosimpleexampleservice
+ Wait Until Keyword Succeeds ${timeout} 5s Validate Pod Running
+
+Validate Service Version B
+ [Documentation] Validate fields from model in upgraded version B (2.0.0)
+ [Tags] test3
+ ${resp} = CORD Get /xosapi/v1/core/users
+ ${jsondata} = To Json ${resp.content}
+ ${length} = Get Length ${jsondata['items']}
+ : FOR ${INDEX} IN RANGE 0 ${length}
+ \ ${dict}= Get From List ${jsondata['items']} ${INDEX}
+ \ ${keys}= Get Dictionary Keys ${dict}
+ : FOR ${field} IN @{model_B_fields}
+ \ List Should Contain Value ${keys} ${field}
+
+*** Keywords ***
+Setup
+ ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
+ ${HEADERS} Create Dictionary Content-Type=application/json allow_modify_feedback=True
+ Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
+ @{model_A_fields}= Create List firstname lastname timezone
+ @{model_B_fields}= Create List firstname lastname timezone newBfield
+ Set Suite Variable @{model_A_fields}
+ Set Suite Variable @{model_B_fields}
+
+Teardown
+ [Documentation] Delete all https sessions
+ Delete All Sessions
+
+Validate Pod Running
+ ${output}= Run kubectl get pods | grep demo-simpleexampleservice | grep -i running | grep 1/1 | wc -l
+ Should Be Equal As Integers ${output} 1