[VOL-4767] Add basic test and library for BBF-Adapter
Change-Id: Ia35f7f0745e8f104aad7cd762ac6c6c6864a0706
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
+