[VOL-4767] Add basic test and library for BBF-Adapter
Change-Id: Ia35f7f0745e8f104aad7cd762ac6c6c6864a0706
diff --git a/Makefile b/Makefile
index 5195311..c0b918c 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,8 @@
ROBOT_SANITY_TIM_SINGLE_PON_MULTI_ONU_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-tim-OLTxPONx2ONU.yaml
ROBOT_SANITY_TIM_MULTI_PON_MULTI_ONU_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-tim-OLTx2PONx2ONU.yaml
ROBOT_SANITY_TIM_MULTI_OLT_MULTI_PON_MULTI_ONU_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-tim-2OLTx2PONx2ONU.yaml
+ROBOT_SANITY_BBF_ADPATER_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-bbf-adapter.yaml
+ROBOT_SANITY_BBF_ADPATER_ADD_DELETE_FILE ?= $(ROOT_DIR)/tests/data/bbsim-bbf-adapter_addDelete_tests.yaml
# for backwards compatibility
@@ -200,6 +202,22 @@
openonu-go-adapter-test: ROBOT_FILE := Voltha_ONUStateTests.robot
openonu-go-adapter-test: openonu-go-adapter-tests
+# target to invoke bbf adapter
+bbf-adapter: ROBOT_MISC_ARGS += -i sanityBbfAdapter $(ROBOT_DEBUG_LOG_OPT)
+bbf-adapter: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_BBF_ADPATER_SINGLE_PON_FILE)
+bbf-adapter: ROBOT_FILE := Voltha_BBF_Adapter_Tests.robot
+bbf-adapter: voltha-bbf-adapter-test
+
+bbf-adapter-functionality: ROBOT_MISC_ARGS += -i bbfAdapterFunctionality $(ROBOT_DEBUG_LOG_OPT)
+bbf-adapter-functionality: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_BBF_ADPATER_ADD_DELETE_FILE)
+bbf-adapter-functionality: ROBOT_FILE := Voltha_BBF_Adapter_Tests.robot
+bbf-adapter-functionality: voltha-bbf-adapter-test
+
+bbf-adapter-functionality-single: ROBOT_MISC_ARGS += -i bbfAdapterFunctionalitySingleTest $(ROBOT_DEBUG_LOG_OPT)
+bbf-adapter-functionality-single: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_BBF_ADPATER_ADD_DELETE_FILE)
+bbf-adapter-functionality-single: ROBOT_FILE := Voltha_BBF_Adapter_Tests.robot
+bbf-adapter-functionality-single: voltha-bbf-adapter-test
+
# target to invoke test with openonu go adapter applying MIB-Upload-Templating
mib-upload-templating-openonu-go-adapter-test: ROBOT_MISC_ARGS += -i functionalOnuGo
mib-upload-templating-openonu-go-adapter-test: ROBOT_MISC_ARGS += -e notreadyOnuGo $(ROBOT_DEBUG_LOG_OPT)
@@ -729,6 +747,12 @@
cd tests/openonu-go-adapter ;\
robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+voltha-bbf-adapter-test: ROBOT_MISC_ARGS += -e notready --noncritical non-critical
+voltha-bbf-adapter-test: vst_venv
+ source ./$</bin/activate ; set -u ;\
+ cd tests/bbf-adapter ;\
+ robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+
voltha-memory-leak-test: vst_venv
source ./$</bin/activate ; set -u ;\
cd tests/memory-leak ;\
diff --git a/VERSION b/VERSION
index 03b7bd6..34728b5 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.11.6
+2.11.7
diff --git a/libraries/bbf_adapter_utilities.robot b/libraries/bbf_adapter_utilities.robot
new file mode 100644
index 0000000..94b71bf
--- /dev/null
+++ b/libraries/bbf_adapter_utilities.robot
@@ -0,0 +1,547 @@
+# Copyright 2022-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.
+# common functions
+
+*** Settings ***
+Documentation Library for various utilities
+Library SSHLibrary
+Library String
+Library DateTime
+Library Process
+Library Collections
+Library RequestsLibrary
+Library OperatingSystem
+Library XML
+Resource ./k8s.robot
+
+*** Variables ***
+
+*** Keywords ***
+
+Get BBF Device Aggregation
+ [Documentation] Extract, running an except script, the XML that
+ ... represent all the Network viewed by the BBF-Adapter and
+ ... copy it to the ${XMLDestPath}.
+ [Arguments] ${namespace} ${XMLDestPath} ${pathToScript}
+
+ #Remove the previus XML (extract by previus tests)
+ ${rc} ${exec_pod_name}= Run and Return Rc and Output
+ ... rm ${XMLDestPath}
+ #Retrive the Name of the BBF-Adapter Pod
+ ${rc} ${exec_pod_name}= Run and Return Rc and Output
+ ... kubectl get pods -n ${namespace} -l app=bbf-adapter --no-headers | awk 'NR==1{print $1}'
+ #Execute the script that access with SSH to the BBF-Adapter Pod
+ #Run the netopeer2-cli, set up it, and ask to the device-aggregation XML
+ ${rc} ${output}= Run and Return Rc and Output
+ ... expect ${pathToScript}/bbf_device_aggregation.exp ${exec_pod_name}
+ Log ${output}
+ #Verify if there are some error of connectivity with the Adapter Pod
+ ${expect}= Get Length ${output}
+ Run Keyword If ${expect} <= 100
+ ... Fail Impossible to Reach the BBF-Adapter Pod (port-forward/key-exchange?)
+ #Copy From the Pod to the ${XMLDestPath} the XML file
+ Copy File From Pod ${namespace} app=bbf-adapter home/voltha/output.xml ${XMLDestPath}
+
+OLT XML update From BBF
+ [Documentation] Extract, running an except script, the XML that
+ ... represent all the Network viewed by the BBF-Adapter and
+ ... copy it to the ${XMLDestPath}.
+ [Arguments] ${dirXML} ${pathToScript}
+ Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript}
+ ${oltes_bbf}= Get Olts From XML ${dirXML}
+ Set Global Variable ${oltes_bbf}
+
+ONU XML update From BBF
+ [Documentation] Extract, running an except script, the XML that
+ ... represent all the Network viewed by the BBF-Adapter and
+ ... copy it to the ${XMLDestPath}.
+ [Arguments] ${dirXML} ${pathToScript}
+ Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript}
+ ${onus_bbf}= Get Onus From XML ${dirXML}
+ Set Global Variable ${onus_bbf}
+
+ALL DEVICES XML update From BBF
+ [Documentation] Extract, running an except script, the XML that
+ ... represent all the Network viewed by the BBF-Adapter and
+ ... copy it to the ${XMLDestPath}.
+ [Arguments] ${dirXML} ${pathToScript}
+ Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript}
+ ${all_devices_bbf}= Get All Devices ${dirXML}
+ Set Global Variable ${all_devices_bbf}
+
+Get Devices By Type
+ [Documentation] Extract ALL the Devices viewed by the BBF-Adapter
+ ... that there are the type defined: OLT(bbf-dvct:olt), ONU(bbf-dvct:onu)
+ ... ${XML} is the path to XML file OR the XML itself.
+ ... Return a List of Defined Devices information
+ [Arguments] ${XML} ${typeAsk}
+ #Take the XML file o the XML itself
+ Log ${XML}
+ ${root}= Parse XML ${XML}
+ #Define a list of all the OLTs
+ @{bbf_olts_xml}= Create List
+ #Navigate in the XML to enter in the Devices and get all Devices in XML
+ @{device} = Get Elements ${root} devices/device
+ ${number_of_devices}= Get Length ${device}
+ #Run on all the devices
+ FOR ${I} IN RANGE 0 ${number_of_devices}
+ #Verify the correct Type of device that is declared
+ ${type}= Get Element Text ${device}[${I}] type
+ Continue For Loop If "${type}" != "${typeAsk}"
+ #Append the device with che correct type in the list
+ Append To List ${bbf_olts_xml} ${device}[${I}]
+ END
+ Log ${bbf_olts_xml}
+ [Return] ${bbf_olts_xml}
+
+Get Olts From XML
+ [Documentation] Extract ALL the OLTs viewed by the BBF-Adapter
+ ... ${XML} is the path to XML file OR the XML itself.
+ ... Return a List of OLTs information.
+ [Arguments] ${XML}
+ #Get from the XML all OLT
+ ${bbf_olts}= Get Devices By Type ${XML} bbf-dvct:olt
+ #Create a List of OLTs
+ @{bbf_olts_Info}= Create List
+ ${number_of_olts}= Get Length ${bbf_olts}
+ FOR ${I} IN RANGE 0 ${number_of_olts}
+ #Enter in the component where there are the information of the OLT
+ ${component}= Get Element ${bbf_olts}[${I}] data/hardware/component
+ #Get from the XML the data
+ ${name}= Get Element Text ${component} name
+ ${hardware_rev}= Get Element Text ${component} hardware-rev
+ ${firmware_rev}= Get Element Text ${component} firmware-rev
+ ${serial_number}= Get Element Text ${component} serial-num
+ ${mfg_name}= Get Element Text ${component} mfg-name
+ ${model_name}= Get Element Text ${component} model-name
+ ${admin_state}= Get Element Text ${component} state/admin-state
+ ${oper_state}= Get Element Text ${component} state/oper-state
+
+ #Define a Dictionary that containe all the information about the OLT
+ #Need to modify when there are add in the XML the connect-state
+ ${bbf_olt} Create Dictionary
+ ... name ${name}
+ ... hardware_rev ${hardware_rev}
+ ... firmware_rev ${firmware_rev}
+ ... serial-num ${serial_number}
+ ... mfg-name ${mfg_name}
+ ... model-name ${model_name}
+ ... admin-state ${admin_state}
+ ... oper-state ${oper_state}
+ ... connect-state unknown
+
+ Append To List ${bbf_olts_Info} ${bbf_olt}
+ END
+ Log ${bbf_olts_Info}
+ [Return] ${bbf_olts_Info}
+
+Get Onus From XML
+ [Documentation] Extract ALL the ONUs viewed by the BBF-Adapter
+ ... Return a List of ONUs information.
+ [Arguments] ${XML}
+ #Get all the devices of the specific type
+ ${bbf_onus}= Get Devices By Type ${XML} bbf-dvct:onu
+ #Create a list that will contain all the information of the ONUs
+ @{bbf_onus_Info}= Create List
+ #Run on the XML compose be ONUs information
+ ${number_of_onus}= Get Length ${bbf_onus}
+ FOR ${I} IN RANGE 0 ${number_of_onus}
+ #Enter in the component where there are the information of the ONU
+ ${component}= Get Element ${bbf_onus}[${I}] data/hardware/component
+ #Get from the XML the data
+ ${name}= Get Element Text ${component} name
+ ${parent}= Get Element Text ${component} parent
+ ${parent_rel_pos}= Get Element Text ${component} parent-rel-pos
+ ${hardware_rev}= Get Element Text ${component} hardware-rev
+ ${firmware_rev}= Get Element Text ${component} firmware-rev
+ ${serial_number}= Get Element Text ${component} serial-num
+ ${mfg_name}= Get Element Text ${component} mfg-name
+ ${model_name}= Get Element Text ${component} model-name
+ ${admin_state}= Get Element Text ${component} state/admin-state
+ ${oper_state}= Get Element Text ${component} state/oper-state
+ #Enter in the interfaces part
+ ${interfaces}= Get Element ${bbf_onus}[${I}] data/interfaces
+ #Retrive all the information about all the interface of the consider ONU
+ @{onu_interfaces}= Get Interfaces From Onu XML Interfaces ${interfaces}
+
+ #Define a Dictionary that containe all the information about the OLT
+ #Need to modify when there are add in the XML the connect-state
+ #Need to modify when there are add in the XML the Onu-Reason
+ ${bbf_onu} Create Dictionary
+ ... name ${name}
+ ... parent-id ${parent}
+ ... parent-rel-pos ${parent_rel_pos}
+ ... hardware_rev ${hardware_rev}
+ ... firmware_rev ${firmware_rev}
+ ... serial-num ${serial_number}
+ ... mfg-name ${mfg_name}
+ ... model-name ${model_name}
+ ... admin-state ${admin_state}
+ ... oper-state ${oper_state}
+ ... connect-state unknown
+ ... onu-reason omci-flows-pushed
+ ... interfaces ${onu_interfaces}
+
+ Append To List ${bbf_onus_Info} ${bbf_onu}
+ END
+ Log ${bbf_onus_Info}
+ [Return] ${bbf_onus_Info}
+
+Get Interfaces From Onu XML Interfaces
+ [Documentation] Extract ALL the Interfaces of a ONU viewed by the BBF-Adapter
+ ... Return a List of ONU Interfaces information
+ [Arguments] ${interfaces_bbf}
+ #Intereate on the Interfaces
+ @{interface}= Get Elements ${interfaces_bbf} interface
+ #Create a list of interface for each ONU
+ @{interfaces_Info}= Create List
+ ${number_of_interfaces}= Get Length ${interface}
+ FOR ${I} IN RANGE 0 ${number_of_interfaces}
+ #Get from the XML information about the interface
+ ${name}= Get Element Text ${interface}[${I}] name
+ ${type}= Get Element Text ${interface}[${I}] type
+ ${oper_status}= Get Element Text ${interface}[${I}] oper-status
+ #Define a Dictionary that contain all the information of single interface
+ ${onu_interface} Create Dictionary
+ ... name ${name}
+ ... type ${type}
+ ... oper_status ${oper_status}
+ #Appen interface
+ Append To List ${interfaces_Info} ${onu_interface}
+ END
+ Log ${interfaces_Info}
+ [Return] ${interfaces_Info}
+
+Get All Devices
+ [Documentation] Extract all the Device (OLTs and ONUS) in a unique List of Devices
+ [Arguments] ${XML}
+ ${onus_bbf}= Get Onus From XML ${XML}
+ ${olts_bbf}= Get Olts From XML ${XML}
+ ${all_devices_bbf}= Combine Lists ${onus_bbf} ${olts_bbf}
+ [Return] ${all_devices_bbf}
+
+Admin State Translation From IETF to VOLTHA
+ [Documentation] Allow to translate the IETF of a Admin-State to VOLTHA
+ [Arguments] ${ietf_admin_state}
+ #Remeber that exist in VOLTHA also Admini State with: Downloading_Image
+ #PREPROVISIONED is consider inside the DISABLED state
+ ${voltha_admin_state}= Run Keyword IF "${ietf_admin_state}"=="locked"
+ ... Set Variable DISABLED
+ ... ELSE
+ ... Run Keyword IF "${ietf_admin_state}"=="unlocked"
+ ... Set Variable ENABLED
+ ... ELSE
+ ... Set Variable UNKNOWN
+ Log ${voltha_admin_state}
+ [Return] ${voltha_admin_state}
+
+Create Device in BBF
+ [Arguments] ${device_id}
+ [Documentation] PlaceHolder Method to future Create Device from the BBF Adapter
+ Should Be True True
+
+Delete Device in BBF
+ [Arguments] ${device_id}
+ [Documentation] PlaceHolder Method to future Delete Device from the BBF Adapter
+ Should Be True True
+
+Enable Device in BBF
+ [Arguments] ${device_id}
+ [Documentation] PlaceHolder Method to future Enable Device from the BBF Adapter
+ Should Be True True
+
+Disable Device in BBF
+ [Arguments] ${device_id}
+ [Documentation] PlaceHolder Method to future Disable Device from the BBF Adapter
+ Should Be True True
+
+Admin State Translation From VOLTHA to IETF
+ [Documentation] Allow to translate the VOLTHA of a Admin-State to IETF Standard
+ [Arguments] ${voltha_admin_state}
+ #Remeber that exist in VOLTHA also Admini State with: Downloading_Image
+ ${ietf_admin_state}= Run Keyword IF "${voltha_admin_state}"=="DISABLED"
+ ... Set Variable locked
+ ... ELSE
+ ... Run Keyword IF "${voltha_admin_state}"=="PREPROVISIONED"
+ ... Set Variable locked
+ ... ELSE
+ ... Run Keyword IF "${voltha_admin_state}"=="ENABLED"
+ ... Set Variable unlocked
+ ... ELSE
+ ... Set Variable unknown
+ [Return] ${ietf_admin_state}
+
+Oper State Translation From IETF to VOLTHA
+ [Documentation] Allow to translate the IETF of a Oper-State to VOLTHA
+ [Arguments] ${ietf_oper_state}
+ #Remeber that exist in VOLTHA also Admini State with: Discovered and Activating and Failed
+ ${voltha_oper_state}= Run Keyword IF "${ietf_oper_state}"=="disable"
+ ... Set Variable RECONCILING_FAILED
+ ... ELSE
+ ... Run Keyword IF "${ietf_oper_state}"=="enabled"
+ ... Set Variable ACTIVE
+ ... ELSE
+ ... Run Keyword IF "${ietf_oper_state}"=="testing"
+ ... Set Variable TESTING
+ ... ELSE
+ ... Set Variable UNKNOWN
+ Log ${voltha_oper_state}
+ [Return] ${voltha_oper_state}
+
+Oper State Translation From VOLTHA to IETF
+ [Documentation] Allow to translate the VOLTHA of a Oper-State to IETF Standard
+ [Arguments] ${voltha_oper_state}
+ #Remeber that exist in VOLTHA also Admini State with: Discovered and Activating and Failed
+ ${ietf_oper_state}= Run Keyword IF "${voltha_oper_state}"=="RECONCILING_FAILED"
+ ... Set Variable disable
+ ... ELSE
+ ... Run Keyword IF "${voltha_oper_state}"=="ACTIVE"
+ ... Set Variable enabled
+ ... ELSE
+ ... Run Keyword IF "${voltha_oper_state}"=="TESTING"
+ ... Set Variable testing
+ ... ELSE
+ ... Set Variable unknown
+ Log ${ietf_oper_state}
+ [Return] ${ietf_oper_state}
+
+Connect State Translation From IETF to VOLTHA
+ [Documentation] Allow to translate the IETF of a Connect-State to VOLTHA
+ [Arguments] ${bbf_connect_state}
+ #Only REACHABLE because we don't know the IETF status
+ ${voltha_connect_state}= Set Variable REACHABLE
+ [Return] ${voltha_connect_state}
+
+Connect State Translation From VOLTHA to IETF
+ [Documentation] Allow to translate the VOLTHA of a Connect-State to IETF Standard
+ [Arguments] ${voltha_connect_state}
+ ${bbf_connect_state}= Set Variable unknown
+ [Return] ${bbf_connect_state}
+
+Validate Onu in BBF
+ [Documentation] Validate an ONU in BBF and its states
+ [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha}
+ ... ${onu_serial_number} ${onu_reasons}
+ #Translate some states from VOLTHA to IETF to verify it in the BBF
+ ${admin_state}= Admin State Translation From VOLTHA to IETF ${admin_state_voltha}
+ ${oper_status}= Oper State Translation From VOLTHA to IETF ${oper_status_voltha}
+ #${connect_status_voltha}= Connect State Translation From VOLTHA to IETF ${connect_status_voltha}
+ #Define passed to understand if there are or not the consider ONU
+ ${passed}= Set Variable False
+ ${number_of_onus}= Get Length ${onus_bbf}
+ FOR ${I} IN RANGE 0 ${number_of_onus}
+ Continue For Loop If "${onu_serial_number}"!="${onus_bbf}[${I}][serial-num]"
+ #The ONU is in the BBF
+ ${passed}= Set Variable True
+ #Get all the information of the ONU
+ ${sn}= Set Variable ${onus_bbf}[${I}][serial-num]
+ ${astate}= Set Variable ${onus_bbf}[${I}][admin-state]
+ ${ostate}= Set Variable ${onus_bbf}[${I}][oper-state]
+ #To modify when will add
+ #${cstate}= ${onus_bbf}[${I}][connect-state]
+ ${oreason}= Set Variable ${onus_bbf}[${I}][onu-reason]
+ #Check if status is correct to consider the ONU in a correct setup state
+ Should Be True ${passed} No match found for ${sn} to validate device
+ Log ${passed}
+ Should Be Equal '${admin_state}' '${astate}' Device ${sn} admin_state != ${admin_state}
+ ... passed=False
+ Should Be Equal '${oper_status}' '${ostate}' Device ${sn} oper_status != ${oper_status}
+ ... passed=False
+ #To modify when will add
+ #Should Be Equal '${connect_status}' '${cstate}' Device ${sn} conn_status != ${connect_status}
+ #... passed=False
+ #Should Be Equal '${onu_reasons}' '${oreason}' Device ${sn} reason != ${onu_reasons}
+ #... passed=False
+ #Run Keyword If '${onu}' == 'True' Should Contain '${onu_reason}' '${mib_state}'
+ #... Device ${sn} mib_state incorrect (${mib_state}) passed=False
+ Log ${sn}
+ Log ${astate}
+ Log ${ostate}
+ #Log ${cstate}
+ #Log ${oreason}
+ END
+ #If false can not are the ONU or there are problem with the states status
+ Should Be True ${passed} BBF Problem with this ONU SN: ${onu_serial_number}
+
+Validate Olt in BBF
+ [Documentation] Verify if the Olts are present inside the XML of the BBF adapter
+ ... and if the states are correct.
+ [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha}
+ ... ${olt_serial_number} ${olt_device_id}
+ #Translate some states from VOLTHA to IETF to verify it in the BBF
+ ${admin_state}= Admin State Translation From VOLTHA to IETF ${admin_state_voltha}
+ ${oper_status}= Oper State Translation From VOLTHA to IETF ${oper_status_voltha}
+ #${connect_status_voltha}= Connect State Translation From VOLTHA to IETF ${connect_status_voltha}
+ #Define passed to understand if there are or not the consider OLT
+ ${passed}= Set Variable False
+ ${number_of_oltes}= Get Length ${oltes_bbf}
+ FOR ${I} IN RANGE 0 ${number_of_oltes}
+ Continue For Loop If "${olt_serial_number}"!="${oltes_bbf}[${I}][serial-num]"
+ #The OLT is in the BBF
+ ${passed}= Set Variable True
+ #Get information of the OLT
+ ${sn}= Set Variable ${oltes_bbf}[${I}][serial-num]
+ ${astate}= Set Variable ${oltes_bbf}[${I}][admin-state]
+ ${ostate}= Set Variable ${oltes_bbf}[${I}][oper-state]
+ #To modify when will add
+ #${cstate}= ${oltes_bbf}[${I}][connect-state]
+ #Check all the state status
+ Should Be True ${passed} No match found for ${sn} to validate device
+ Log ${passed}
+ Should Be Equal '${admin_state}' '${astate}' Device ${sn} admin_state != ${admin_state}
+ ... passed=False
+ Should Be Equal '${oper_status}' '${ostate}' Device ${sn} oper_status != ${oper_status}
+ ... passed=False
+ #To modify when will add
+ #Should Be Equal '${connect_status}' '${cstate}' Device ${sn} conn_status != ${connect_status}
+ #... passed=False
+ END
+ #If false can not are the OLT or there are problem with the states status
+ Should Be True ${passed} BBF Problem with this ONU SN: ${olt_serial_number}
+
+Validate Device in BBF
+ [Documentation] Verify if the Device (Olt or Onu) are present inside the XML of the BBF adapter
+ ... and if the states are correct.
+ [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha}
+ ... ${serial_number} ${device_id} ${isONU}
+ Run Keyword If ${isONU}
+ ... Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha}
+ ... ${serial_number} ${device_id}
+ ... ELSE
+ ... Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha}
+ ... ${serial_number} ${device_id}
+
+Validate ONUs After OLT Disable in BBF
+ [Documentation] Validates the ONUs state in BBF, ONUs port state in ONOS
+ ... and that pings do not succeed After corresponding OLT is Disabled
+ [Arguments] ${olt_serial_number}
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
+ ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds ${timeout} 2s
+ ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
+ ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ ${onu_reasons}= Create List omci-flows-deleted
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} stopping-openomci
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ENABLED DISCOVERED
+ ... UNREACHABLE ${src['onu']} ${onu_reasons}
+ END
+
+Validate Olt Disabled in BBF
+ [Documentation] Validates the ONUs state in BBF, ONUs port state in ONOS
+ ... and that pings do not succeed After corresponding OLT is Disabled
+ [Arguments] ${olt_serial_number} ${olt_device_id}
+ Validate Olt in BBF admin_state_voltha=DISABLED oper_status_voltha=UNKNOWN
+ ... connect_status_voltha=REACHABLE olt_serial_number=${olt_serial_number}
+ ... olt_device_id=${olt_device_id}
+
+Validate Device Removed in BBF
+ [Documentation] Verify if the device with that ${serial_number}, has been removed
+ [Arguments] ${device_serial_number}
+ ${eliminated}= Set Variable True
+ ${number_of_devices}= Get Length ${all_devices_bbf}
+ FOR ${I} IN RANGE 0 ${number_of_devices}
+ Continue For Loop If "${device_serial_number}"!="${all_devices_bbf}[${I}][serial-num]"
+ ${eliminated}= Set Variable False
+ END
+ Should Be True ${eliminated} Device with ${device_serial_number} not eliminated
+
+Validate all ONUS for OLT Removed in BBF
+ [Arguments] ${olt_serial_number}
+ [Documentation] Verifys that all the ONUS for OLT ${serial_number}, has been removed
+ @{removed_onu_list}= Create List
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${removed_onu_seria_number}= Set Variable ${src['onu']}
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device Removed in BBF ${removed_onu_seria_number}
+ Append To List ${removed_onu_list} ${removed_onu_seria_number}
+ END
+ Log ${removed_onu_list}
+
+Get Device ID From SN in BBF
+ [Documentation] Retrive from the XML the Device Id of a Device
+ ... using the Serial Number
+ [Arguments] ${device_serial_number}
+ ${Device_ID}= Set Variable 0
+ ${number_of_devices}= Get Length ${all_devices_bbf}
+ FOR ${I} IN RANGE 0 ${number_of_devices}
+ Continue For Loop If "${device_serial_number}"!="${all_devices_bbf}[${I}][serial-num]"
+ ${Device_ID}= Set Variable ${all_devices_bbf}[${I}][name]
+ Log ${Device_ID}
+ END
+ [Return] ${Device_ID}
+
+Correct representation check VOLTHA-IETF
+ [Documentation] Check if all the information the VOLTHA have about a device
+ ... is a correct representation of the device in BBF-Adapter
+ ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do
+ ... the reverse test.
+ [Arguments] ${device_serial_number} ${isONU}
+ ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list | grep ${device_serial_number}
+ ${rc} ${rest}= Run and Return Rc and Output ${cmd}
+ Should Not Be Empty ${rest}
+ Run Keyword If ${isONU}
+ ... Correct Representation check ONU Voltha-IETF ${rest}
+ ... ELSE
+ ... Correct Representation check OLT Voltha-IETF ${rest}
+
+Correct Representation check ONU Voltha-IETF
+ [Documentation] Check if all the information the VOLTHA have about a device
+ ... is a correct representation of the device in BBF-Adapter
+ ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do
+ ... the reverse test.
+ [Arguments] ${rest}
+ ${rest} ${onu_reason} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${connect_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${oper_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${admin_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${serial_number} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${parent_id} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${root} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${id} ${type} = Split String From Right ${rest} ${SPACE} max_split=1
+
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ${admin_state} ${oper_state} ${connect_state}
+ ... ${serial_number} ${onu_reason}
+
+Correct Representation check OLT Voltha-IETF
+ [Documentation] Check if all the information the VOLTHA have about a device
+ ... is a correct representation of the device in BBF-Adapter
+ ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do
+ ... the reverse test.
+ [Arguments] ${rest}
+ ${rest} ${connect_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${oper_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${admin_state} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${serial_number} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${parent_id} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${rest} ${root} = Split String From Right ${rest} ${SPACE} max_split=1
+ ${id} ${type} = Split String From Right ${rest} ${SPACE} max_split=1
+
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ${admin_state} ${oper_state} ${connect_state}
+ ... ${serial_number} ${id}
\ No newline at end of file
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 876a5f6..15822c2 100755
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -121,6 +121,18 @@
Log ${output}
[return] ${output}
+Copy File From Pod
+ [Arguments] ${namespace} ${label} ${src} ${dest}
+ [Documentation] Uses kubectl to copy a file from a pod
+ ${rc} ${exec_pod_name}= Run and Return Rc and Output
+ ... kubectl get pods -n ${namespace} -l ${label} --no-headers | awk 'NR==1{print $1}'
+ Log ${exec_pod_name}
+ Should Not Be Empty ${exec_pod_name} Unable to parse pod name
+ ${rc} ${output}= Run and Return Rc and Output
+ ... kubectl cp -n ${namespace} ${exec_pod_name}:${src} ${dest}
+ Log ${output}
+ [return] ${output}
+
Apply Kubernetes Resources
[Arguments] ${resource_yaml} ${namespace}
[Documentation] Use kubectl to create resources given a yaml file
diff --git a/libraries/utils.robot b/libraries/utils.robot
index dad5fc9..a045a46 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -217,9 +217,9 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
# Check ONU port is Enabled in ONOS
Wait Until Keyword Succeeds 120s 2s
... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
@@ -324,9 +324,9 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
# Check ONU port is Enabled in ONOS
Wait Until Keyword Succeeds 120s 2s
... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
@@ -381,9 +381,9 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
# Check ONU port is Enabled in ONOS
Wait Until Keyword Succeeds 120s 2s
... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
@@ -543,9 +543,9 @@
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Set Global Variable ${of_id}
${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
# Check ONU port is Enabled in ONOS
Wait Until Keyword Succeeds ${timeout} 2s
... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
@@ -646,9 +646,9 @@
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Set Global Variable ${of_id}
${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
# Check ONU port is Enabled in ONOS
Wait Until Keyword Succeeds ${timeout} 2s
... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
@@ -783,9 +783,9 @@
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
... ${of_id}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
${valid_onu_states}= Create List stopping-openomci omci-flows-deleted
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
... Validate Device ENABLED DISCOVERED
@@ -926,10 +926,10 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_sn}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
... ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
Run Keyword If ${matched}
... Run Keywords
@@ -964,11 +964,11 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_sn}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
... ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
... /tmp/wpa ${src['dp_iface_name']} log
@@ -1062,10 +1062,10 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_sn}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
... ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
${valid_onu_states}= Create List stopping-openomci omci-flows-deleted
Run Keyword If ${matched}
@@ -1103,11 +1103,11 @@
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Continue For Loop If "${olt_sn}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
... ${of_id} ${src['uni_id']}
- ${onu_device_id}= Get Device ID From SN ${src['onu']}
${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
Run Keyword If ${matched}
... Run Keywords
@@ -1823,3 +1823,89 @@
#Wait Until Keyword Succeeds ${timeout} 5s
#... Verify Meters in ONOS Ietf ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
END
+
+Perform Sanity Test of BBFadapter Aggregation
+ [Documentation] This test verfy if each OLT and ONU viewed by the BBF-Adapter
+ ... represent the device in Voltha
+ ... (with the correct translation to and from ietf standard)
+ [Arguments] ${XML} ${supress_add_subscriber}=False
+ Log ${supress_add_subscriber}
+ #Extract from the XML of the Device Aggregation different tipe of data structure
+ #One for only OLTs, one for only ONUs and one for Both
+ Set Global Variable ${XML}
+
+ ALL DEVICES XML update From BBF ${XML} ${scripts}
+
+ OLT XML update From BBF ${XML} ${scripts}
+
+ #Do the verification for each OLT and its ONUs
+ FOR ${J} IN RANGE 0 ${num_olts}
+ ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
+ ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
+ ... ${olt_serial_number}
+ Set Global Variable ${of_id} ${olt_device_id}
+ #Validate in VOLTHA if the OLT exist have the correct states
+ Wait Until Keyword Succeeds ${timeout} 5s Validate Device
+ ... ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number}
+ #Validate in BBF if the OLT exist and have the correct states
+ #State are defined in VOLTHA but internal translate in IETF standard
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ #Verify if the OLT in BBF have all the features present in VOLTHA
+ #Is like a Viceversa Check
+ Correct representation check VOLTHA-IETF ${olt_serial_number} False
+
+ #NNI_port is a place_holder for future tests on services
+ #Do a Test for the OLT configuration and its ONUS
+ ${nni_port}= Set Variable 0
+ Perform Sanity BBF Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
+ ... ${supress_add_subscriber}
+
+ END
+
+Perform Sanity BBF Per OLT
+ [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}
+ [Documentation] This keyword performs Sanity Test Procedure for BBF on Multiple Workflow
+ ... This keyword can be used to call in any other tests where sanity check is required
+ ... and avoids duplication of code.
+ ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ # Test all the ONUs of the consider OLT
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
+ ${onu_device_id}= Get Device ID From SN in BBF ${src['onu']}
+ ${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
+ ... ${of_id} ${src['uni_id']}
+ # Subscribe the ONU if not on repete sanity check
+ Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
+ ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
+ ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
+ # Verify ONU state in BBF
+ ${onu_reasons}= Create List omci-flows-pushed
+ #Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
+ Log ${onu_reasons}
+ Log ${supress_add_subscriber}
+
+ ONU XML update From BBF ${XML} ${scripts}
+
+ #Validate in VOLTHA if the ONU exist and have the correct states
+ Wait Until Keyword Succeeds ${timeout} 5s Validate Device
+ ... ENABLED ACTIVE REACHABLE
+ ... ${src['onu']} onu=True onu_reason=${onu_reasons}
+ #Validate in BBF if the ONU exist have the correct states
+ #State are defined in VOLTHA but internal translate in IETF standard
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ENABLED ACTIVE REACHABLE
+ ... ${src['onu']} ${onu_reasons}
+ #Verify if the ONU in BBF have all the features present in VOLTHA
+ #Is like a Viceversa Check
+ Correct representation check VOLTHA-IETF ${src['onu']} True
+ END
+
diff --git a/scripts/bbf_device_aggregation.exp b/scripts/bbf_device_aggregation.exp
new file mode 100644
index 0000000..a5c926b
--- /dev/null
+++ b/scripts/bbf_device_aggregation.exp
@@ -0,0 +1,126 @@
+# Copyright 2021-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.
+#!/usr/bin/expect -f
+#
+# This Expect script was generated by autoexpect on Wed Aug 17 22:24:22 2022
+# Expect and autoexpect were both written by Don Libes, NIST.
+#
+# Note that autoexpect does not guarantee a working script. It
+# necessarily has to guess about certain things. Two reasons a script
+# might fail are:
+#
+# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
+# etc.) and devices discard or ignore keystrokes that arrive "too
+# quickly" after prompts. If you find your new script hanging up at
+# one spot, try adding a short sleep just before the previous send.
+# Setting "force_conservative" to 1 (see below) makes Expect do this
+# automatically - pausing briefly before sending each character. This
+# pacifies every program I know of. The -c flag makes the script do
+# this in the first place. The -C flag allows you to define a
+# character to toggle this mode off and on.
+
+set force_conservative 0 ;# set to 1 to force conservative mode even if
+ ;# script wasn't run conservatively originally
+if {$force_conservative} {
+ set send_slow {1 .1}
+ proc send {ignore arg} {
+ sleep .1
+ exp_send -s -- $arg
+ }
+}
+
+#
+# 2) differing output - Some programs produce different output each time
+# they run. The "date" command is an obvious example. Another is
+# ftp, if it produces throughput statistics at the end of a file
+# transfer. If this causes a problem, delete these patterns or replace
+# them with wildcards. An alternative is to use the -p flag (for
+# "prompt") which makes Expect only look for the last line of output
+# (i.e., the prompt). The -P flag allows you to define a character to
+# toggle this mode off and on.
+#
+# Read the man page for more info.
+#
+# -Don
+
+set bbfPodName [lindex $argv 0]
+
+set timeout 5
+spawn ssh -p 50022 voltha@localhost
+match_max 100000
+
+expect {
+ {Are you sure you want to continue connecting (yes/no/\[fingerprint\])? }
+ { send -- "yes\r"
+ expect "voltha@localhost's password: "
+ send -- "onf\r"
+ expect -exact "$bbfPodName:~\$"
+ send -- "netopeer2-cli\r"
+ expect -exact "> "
+ send -- "searchpath /etc/sysrepo/yang\r"
+ expect -exact "> "
+ send -- "ext-data /schema-mount.xml\r"
+ expect -exact "> "
+ send -- "connect --login voltha\r"
+ expect -exact "Are you sure you want to continue connecting (yes/no)? "
+ send -- "yes\r"
+ expect -exact "Password: "
+ send -- "onf\r"
+ expect -exact "> "
+ send -- "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ expect -exact "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ send -- "\r"
+ expect -exact "> "
+ send -- ""
+ expect -exact "$bbfPodName:~\$ \[6n"
+ expect eof ; exp_continue}
+
+ "voltha@localhost's password: " {
+ send -- "onf\r"
+ expect -exact "$bbfPodName:~\$"
+ send -- "netopeer2-cli\r"
+ expect -exact "> "
+ send -- "searchpath /etc/sysrepo/yang\r"
+ expect -exact "> "
+ send -- "ext-data /schema-mount.xml\r"
+ expect -exact "> "
+ send -- "connect --login voltha\r"
+ expect {
+ "Are you sure you want to continue connecting (yes/no)? " {
+ send -- "yes\r"
+ expect -exact "Password: "
+ send -- "onf\r"
+ expect -exact "> "
+ send -- "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ expect -exact "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ send -- "\r"
+ expect -exact "> "
+ send -- ""
+ expect -exact "$bbfPodName:~\$ \[6n"
+ expect eof ; exp_continue}
+
+ "Password: " {
+ send -- "onf\r"
+ expect -exact "> "
+ send -- "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ expect -exact "get-data --datastore operational --filter-xpath /bbf-device-aggregation:* --out output.xml"
+ send -- "\r"
+ expect -exact "> "
+ send -- ""
+ expect -exact "$bbfPodName:~\$ \[6n"
+ expect eof ; exp_continue}
+ }
+ }
+}
+exit 0
\ No newline at end of file
diff --git a/tests/bbf-adapter/Voltha_BBF_Adapter_Tests.robot b/tests/bbf-adapter/Voltha_BBF_Adapter_Tests.robot
new file mode 100644
index 0000000..260d0ab
--- /dev/null
+++ b/tests/bbf-adapter/Voltha_BBF_Adapter_Tests.robot
@@ -0,0 +1,595 @@
+# Copyright 2022 - 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 ***
+Suite Setup Setup Suite
+Test Setup Setup
+Test Teardown Teardown
+Suite Teardown Teardown Suite
+Library XML
+Library String
+Library DateTime
+Library Process
+Library Collections
+Library RequestsLibrary
+Library OperatingSystem
+Resource ../../libraries/bbf_adapter_utilities.robot
+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
+Resource ../../libraries/power_switch.robot
+
+*** Variables ***
+${POD_NAME} flex-ocp-cord
+${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
+${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
+${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
+${HELM_CHARTS_DIR} ~/helm-charts
+${VOLTHA_POD_NUM} 8
+${NAMESPACE} voltha
+${INFRA_NAMESPACE} default
+${timeout} 60s
+${of_id} 0
+${logical_id} 0
+${has_dataplane} False
+${teardown_device} True
+${scripts} ../../scripts
+
+# Per-test logging on failure is turned off by default; set this variable to enable
+${container_log_dir} ${None}
+
+# logging flag to enable Collect Logs, can be passed via the command line too
+# example: -v logging:False
+${logging} True
+
+# Flag specific to Soak Jobs
+${SOAK_TEST} False
+${bbsim_port} 50060
+
+#Suppress the subscribe phase
+${supress_add_subscriber} False
+
+#Enable or Disable the MacLearning verifier for MacLearning ONOS APP
+${maclearningenabled} False #Not yet used but it is a placeholder
+
+*** Test Cases ***
+BBF Adapter Aggregation Test
+ [Documentation] Do a runtime test enabling all the device
+ ... and verify if VOLTHA and BBF have the same view,
+ ... with the correct translation, of the network
+ [Tags] sanityBbfAdapter
+ [Setup] Start Logging sanityBbfAdapter
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging sanityBbfAdapter
+ Run Keyword Setup ${SOAK_TEST}
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ Get BBF Device Aggregation ${NAMESPACE} ${CURDIR}/data.xml ${scripts}
+ Log ${supress_add_subscriber}
+ Perform Sanity Test of BBFadapter Aggregation ./data.xml ${supress_add_subscriber}
+ Teardown Suite
+
+Test Disable and Enable ONU for BBF
+ [Documentation] Disable ONUs from the BBF Adapter (PlaceHolder with VOLTHA)
+ ... Verify all the states in voltha and in the BBF Adapter (like a compare).
+ ... Enable the ONUs from the BBF adapter, verify the enable states in voltha
+ ... and in BBF Adapter (like a compare).
+ ... It is also possible to verify a connectivity, with a no block test.
+ [Tags] bbfAdapterFunctionality disableEnableONUBBF
+ [Setup] Start Logging disableEnableONUBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging disableEnableONUBBF
+ # Create a single Setup for Multiple Test Case
+ Run Keyword Setup ${SOAK_TEST}
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ # Disable, verify state, Enable and verify stato for each ONU
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
+ ... ${of_id} ${src['uni_id']}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ # Subscribe the ONU if requested for the tests
+ Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
+ ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
+ ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
+ # Disbale the device (actually with voltha in future with BBF Adapter)
+ Disable Device ${onu_device_id}
+ Disable Device in BBF ${onu_device_id}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Define some states that the ONU reason can be
+ ${onu_reasons}= Create List omci-flows-deleted
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} omci-admin-lock
+ Log ${onu_reasons}
+ # Verify in Voltha the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device DISABLED UNKNOWN
+ ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF DISABLED UNKNOWN
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Verify if the disabling of the ONU desable also the UNI port
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
+ # Verify if there are not connectivity to the ONU
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds ${timeout} 2s
+ ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
+ ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ # Enable the device (actually with voltha in future with BBF Adapter)
+ Enable Device ${onu_device_id}
+ Enable Device in BBF ${onu_device_id}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Define some states that the ONU reason can be
+ ${onu_reasons}= Create List omci-flows-pushed
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
+ Log ${onu_reasons}
+ # Verify in the Voltha the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Verify if the disabling of the ONU desable also the UNI port
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
+ # Verify if there are not connectivity to the ONU
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds ${timeout} 2s
+ ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
+ ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ END
+
+Test Disable and Enable OLT for BBF
+ [Documentation] Disable OLTs from the BBF Adapter (Placeholder with Voltha).
+ ... Verify the disable states of OLTs in Voltha and in the BBF Adapter (like a compare).
+ ... Enable the OLTs from the BBF adapter, verify the states in voltha
+ ... and in BBF Adapter (like a compare).
+ ... It is also possible to verify a connectivity, with a no block test.
+ [Tags] bbfAdapterFunctionality disableEnableOLTBBF
+ [Setup] Start Logging disableEnableOLTBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging disableEnableOLTBBF
+ # Disable each OLT and Validate it state
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ ${of_id}= Get ofID From OLT List ${olt_serial_number}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ # Disbale the device (actually with voltha in future with BBF Adapter)
+ Disable Device ${olt_device_id}
+ Disable Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device DISABLED UNKNOWN REACHABLE
+ ... ${olt_serial_number}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ END
+ # Enable the OLT back and check OLT operstatus are back to "ACTIVE"
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ ${of_id}= Get ofID From OLT List ${olt_serial_number}
+ # Enable the device (actually with voltha in future with BBF Adapter)
+ Enable Device ${olt_device_id}
+ Enable Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ END
+
+Test Disable and Delete OLT for BBF
+ [Documentation] Disable OLTs from the BBF Adapter (PlaceHolder with Voltha)
+ ... Verify the disable state of the OLT in voltha and in the BBF Adapter,
+ ... Delete the OLTs from the BBF adapter, verify if it was done correctly in voltha
+ ... and in BBF Adapter.
+ [Tags] bbfAdapterFunctionality disableEnableOLTBBF
+ [Setup] Start Logging disableEnableOLTBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging disableEnableOLTBBF
+ # Disable and Validate OLT Device
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ Disable Device ${olt_device_id}
+ Disable Device in BBF ${olt_device_id}
+ ${of_id}= Get ofID From OLT List ${olt_serial_number}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device DISABLED UNKNOWN REACHABLE
+ ... ${olt_serial_number}
+ Validate Olt Disabled in BBF ${olt_serial_number} ${olt_device_id}
+
+ ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
+ # Validate ONUs
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate ONUs After OLT Disable
+ ... ${num_onus} ${olt_serial_number}
+ Validate ONUs After OLT Disable in BBF ${olt_serial_number}
+ # Delete the device (actually with voltha in future with BBF Adapter)
+ Delete Device ${olt_device_id}
+ Delete Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Check that the OLT are actually removed from the system
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
+ ... ${olt_serial_number}
+ # Check if the OLT has been removed from the system
+ Validate Device Removed in BBF ${olt_serial_number}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
+ Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
+ ... ${olt_serial_number} ${timeout}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
+ Validate All Onus for OLT Removed in BBF ${olt_serial_number}
+ #Wait Until Keyword Succeeds ${timeout} 5s
+ #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
+ END
+ Teardown Suite
+
+Test Delete and ReAdd OLT for BBF
+ [Documentation] Delete OLTs from the BBF Adapter (PlaceHolder with Voltha)
+ ... Verify if the OLT and ONUs connected was really delete in voltha and in the BBF Adapter.
+ ... Readd all the OLTs from the BBF adapter, verify the enable state in voltha
+ ... and in BBF Adapter and check the correct status after the readd.
+ [Tags] bbfAdapterFunctionality DeleteReAddOLTBBF
+ [Setup] Start Logging DeleteReAddOLTBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging DeleteReAddOLTBBF
+ Run Keyword Setup ${SOAK_TEST}
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ # Delete the device (actually with voltha in future with BBF Adapter)
+ Delete Device ${olt_device_id}
+ Delete Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Check if the OLT has been removed from the system
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device Removed ${olt_serial_number}
+ # Check if the OLT has been removed from the BBF Adapter
+ Validate Device Removed in BBF ${olt_serial_number}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
+ Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
+ ... ${olt_serial_number} ${timeout}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
+ Validate all ONUS for OLT Removed in BBF ${olt_serial_number}
+ #Wait Until Keyword Succeeds ${timeout} 5s
+ #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
+ END
+ # Recreate the OLTs
+ Run Keyword Setup ${SOAK_TEST}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ END
+ Teardown Suite
+
+Test Disable ONUs and OLT for BBF
+ [Documentation] Disable ONUs and OLTs, verify if the OLT and ONUs connected
+ ... was really disable in voltha and in the BBF Adapter.
+ ... Delete ONUs and OLTs, verify if the ONUs and OLT was really deleted
+ ... in voltha and BBF Adapter.
+ [Tags] bbfAdapterFunctionality DisableONUOLTBBF
+ [Setup] Start Logging DisableONUOLTBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging DisableONUOLTBBF
+ Run Keyword Setup ${SOAK_TEST}
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ # Define some states that the ONU reason can be
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
+ ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${src['olt']}
+ # Subscribe the ONU if requested for the tests
+ Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
+ ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
+ ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
+ # Onu reasons selection
+ @{onu_reasons}= Create List omci-flows-pushed
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in the Voltha the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device ENABLED ACTIVE
+ ... REACHABLE ${src['olt']}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${src['olt']} ${olt_device_id}
+ # Disbale the device (actually with voltha in future with BBF Adapter)
+ Disable Device ${onu_device_id}
+ Disable Device in BBF ${onu_device_id}
+ # Onu reasons selection
+ ${onu_reasons}= Create List omci-flows-deleted
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} omci-admin-lock
+ Log ${onu_reasons}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in the Voltha the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device DISABLED UNKNOWN
+ ... REACHABLE ${src['onu']} ${onu_reasons} onu=True
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF DISABLED UNKNOWN
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Check if the OLT where the ONU is connected have the correct state
+ # after the disbaling one ONU connected
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device ENABLED ACTIVE
+ ... REACHABLE ${src['olt']}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
+ ... ${src['olt']} ${olt_device_id}
+ END
+ # Disable all OLTs and check if the state after disable are correct
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ Disable Device ${olt_device_id}
+ Disable Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
+ ... ${olt_serial_number}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
+ ... ${olt_serial_number} ${olt_device_id}
+ END
+
+Delete Disabled ONUs and OLT for BBF
+ [Documentation] Continue of the before test.
+ ... Validate the Disble state of ONUs and Oltes,
+ ... Delete Disabled Onus and Disabled Olts and verify the correct
+ ... elimination of all devices from Voltha and BBF Adapter.
+ [Tags] bbfAdapterFunctionality DeleteONUOLTBBF
+ [Setup] Start Logging DeleteONUOLTBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging DeleteONUOLTBBF
+ # Validate ONUs states after OLT disable
+ ${onu_reasons}= Create List stopping-openomci
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} stopping-openomci
+ Log ${onu_reasons}
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${src['olt']}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in the Voltha the State of the ONU
+ Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Device DISABLED DISCOVERED
+ ... UNREACHABLE ${src['onu']} ${onu_reasons} onu=True
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Onu in BBF DISABLED DISCOVERED
+ ... UNREACHABLE ${src['onu']} ${onu_reasons}
+ # Delete the device (actually with voltha in future with BBF Adapter)
+ Delete Device ${onu_device_id}
+ Delete Device in BBF ${onu_device_id}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ Validate Device Removed in BBF ${src['onu']}
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify in Voltha the State of the OLT
+ Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate OLT Device DISABLED UNKNOWN
+ ... REACHABLE ${src['olt']}
+ # Verify in BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
+ ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
+ ... ${src['olt']} ${olt_device_id}
+ END
+ # Delete all OLTs
+ # Delete All Devices and Verify
+ FOR ${I} IN RANGE 0 ${olt_count}
+ ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
+ ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
+ # Delete the device (actually with voltha in future with BBF Adapter)
+ Delete Device ${olt_device_id}
+ Delete Device in BBF ${olt_device_id}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Check that the OLT and the ONUs are actually removed from the system
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
+ ... ${olt_serial_number}
+ # Check if the OLT has been removed from the system
+ Validate Device Removed in BBF ${olt_serial_number}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
+ Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
+ ... ${olt_serial_number} ${timeout}
+ # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
+ Validate all ONUS for OLT Removed in BBF ${olt_serial_number}
+ #Wait Until Keyword Succeeds ${timeout} 5s
+ #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
+ END
+ Teardown Suite
+
+Test ONU Delete and Auto-Discovery for BBF
+ [Documentation] Validate the Autodiscory of an ONUs in case of Delete.
+ ... Delete the device and verify if them was really deleted.
+ ... Verify if all the Onus are re discovered in the correct way.
+ ... Verify the state after and before a subscription if needed.
+ ... Verify the connectivity if needed.
+ [Tags] bbfAdapterFunctionality ONUAutoDiscoveryBBF
+ [Setup] Start Logging ONUAutoDiscoveryBBF
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging ONUAutoDiscoveryBBF
+ Clear All Devices Then Create New Device
+ # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${of_id}= Get ofID From OLT List ${src['olt']}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
+ ... Get ONU Port in ONOS ${src['onu']} ${of_id}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
+ # Subscribe the ONU if requested for the tests
+ Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
+ ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
+ ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
+ # Verify ONU state in voltha
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ @{onu_reasons}= Create List omci-flows-pushed
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
+ # Verify in the Voltha the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
+ ... Validate Device ENABLED ACTIVE REACHABLE
+ ... ${src['onu']} onu=True onu_reason=${onu_reasons}
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
+ ... Validate Onu in BBF ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Delete ONU and Verify Ping Fails
+ # Delete the device (actually with voltha in future with BBF Adapter)
+ Delete Device ${onu_device_id}
+ Delete Device in BBF ${onu_device_id}
+ # Retrive from BBF Adapter an Update XML that contain all the devices
+ ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
+ # Verify if the ONU has been removed from the system
+ Validate Device Removed in BBF ${src['onu']}
+ Run Keyword If ${has_dataplane} Verify ping is successful except for given device
+ ... ${num_all_onus} ${src['onu']}
+ # Verify that no pending flows exist for the ONU port
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
+ # ONU Auto-Discovery
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
+ ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
+ # Check ONU port is Enabled in ONOS
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
+ ${onu_device_id}= Get Device ID From SN ${src['onu']}
+ Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
+ # Re-Add Subscriber
+ Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
+ ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
+ ... volt-add-subscriber-access ${of_id} ${onu_port}
+ # Verify that no pending flows exist for the ONU port
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
+ # Verify ONU state in voltha
+ # Retrive from BBF Adapter an Update XML that contain the ONUs
+ ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
+ @{onu_reasons}= Create List omci-flows-pushed
+ Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
+ ... Validate Device ENABLED ACTIVE REACHABLE
+ ... ${src['onu']} onu=True onu_reason=${onu_reasons}
+ # Verify in the BBF Adapter the State of the ONU
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
+ ... Validate Onu in BBF ENABLED ACTIVE
+ ... REACHABLE ${src['onu']} ${onu_reasons}
+ # Verify Meters in ONOS
+ #Wait Until Keyword Succeeds ${timeout} 5s
+ #... Verify Meters in ONOS Ietf ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
+ Run Keyword If ${has_dataplane} 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']}
+ END
+ # Verify flows for all OLTs
+ #Wait Until Keyword Succeeds ${timeout} 5s Validate All OLT Flows
+
+
+*** Keywords ***
+Setup Suite
+ [Documentation] Set up the test suite
+ Common Test Suite Setup
+ #power_switch.robot needs it to support different vendor's power switch
+ ${switch_type}= Get Variable Value ${web_power_switch.type}
+ Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
+
+Clear All Devices Then Create New Device
+ [Documentation] Remove any devices from VOLTHA and ONOS
+ # Remove all devices from voltha and nos
+ Run Keyword Delete All Devices and Verify
+ # Execute normal test Setup Keyword
+ Run Keyword Setup ${SOAK_TEST}
\ No newline at end of file
diff --git a/tests/data/bbsim-bbf-adapter.yaml b/tests/data/bbsim-bbf-adapter.yaml
new file mode 100644
index 0000000..c6b7541
--- /dev/null
+++ b/tests/data/bbsim-bbf-adapter.yaml
@@ -0,0 +1,115 @@
+---
+
+# 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 systems running BBSim
+
+# Change default values in tests
+workflow: TIM
+has_dataplane: false
+teardown_device: true
+ONOS_REST_PORT: 8181
+ONOS_SSH_PORT: 8101
+OLT_PORT: 50060
+
+# Actual Unused sadis.file but ready to future implementation
+# sadis.file: ../data/tim-sadis-config.json
+
+nodes:
+ -
+ ip: '127.0.0.1'
+
+olts:
+ - ip: bbsim0
+ serial: BBSIM_OLT_10
+ - ip: bbsim1
+ serial: BBSIM_OLT_11
+
+hosts:
+ src:
+ - onu: 'BBSM000a0001'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000a0001'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '836'
+ c_tag: '101'
+ s_tag: '4096'
+ service_type: 'vod'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000a0002'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000a0002'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '836'
+ c_tag: '101'
+ s_tag: '4096'
+ service_type: 'vod'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0001'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0001'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '836'
+ c_tag: '101'
+ s_tag: '4096'
+ service_type: 'vod'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0002'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0002'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '836'
+ c_tag: '101'
+ s_tag: '4096'
+ service_type: 'vod'
+ uni_id: 1
+ tp_id: '64'
+
+ dst:
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null
diff --git a/tests/data/bbsim-bbf-adapter_addDelete_tests.yaml b/tests/data/bbsim-bbf-adapter_addDelete_tests.yaml
new file mode 100644
index 0000000..83e5cf9
--- /dev/null
+++ b/tests/data/bbsim-bbf-adapter_addDelete_tests.yaml
@@ -0,0 +1,79 @@
+---
+
+# 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 systems running BBSim
+
+# Change default values in tests
+workflow: TIM
+has_dataplane: false
+teardown_device: true
+ONOS_REST_PORT: 8181
+ONOS_SSH_PORT: 8101
+OLT_PORT: 50060
+
+# Actual Unused sadis.file but ready to future implementation
+# sadis.file: ../data/tim-sadis-config.json
+
+nodes:
+ -
+ ip: '127.0.0.1'
+
+olts:
+ - ip: bbsim0
+ serial: BBSIM_OLT_10
+ - ip: bbsim1
+ serial: BBSIM_OLT_11
+
+hosts:
+ src:
+ - onu: 'BBSM000a0001'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000a0002'
+ olt: 'BBSIM_OLT_10'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0001'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+ - onu: 'BBSM000b0002'
+ olt: 'BBSIM_OLT_11'
+ uni_tag: '835'
+ c_tag: '100'
+ s_tag: '4096'
+ service_type: 'hsia'
+ uni_id: 1
+ tp_id: '64'
+
+ dst:
+ - ip: null
+ - ip: null
+ - ip: null
+ - ip: null