[VOL-4590] Added Mac Learner test support in TT Sanity
Change-Id: Ib41226d7a97d81114325977e2cf433111b47e2ac
diff --git a/Makefile b/Makefile
index 4f1a177..bbc4052 100755
--- a/Makefile
+++ b/Makefile
@@ -109,6 +109,11 @@
sanity-kind-tt: ROBOT_FILE := Voltha_TT_PODTests.robot
sanity-kind-tt: voltha-tt-test
+sanity-kind-tt-maclearning: ROBOT_MISC_ARGS += -i sanityTT -v with_maclearning:True $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-tt-maclearning: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TT_SINGLE_PON_FILE)
+sanity-kind-tt-maclearning: ROBOT_FILE := Voltha_TT_PODTests.robot
+sanity-kind-tt-maclearning: voltha-tt-test
+
sanity-kind-multiuni-tt: ROBOT_MISC_ARGS += -i sanityTT $(ROBOT_DEBUG_LOG_OPT)
sanity-kind-multiuni-tt: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TT_MULTI_UNI_SINGLE_PON_FILE)
sanity-kind-multiuni-tt: ROBOT_FILE := Voltha_TT_PODTests.robot
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 4dc7967..aff9866 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -769,6 +769,14 @@
... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} | grep ${vlan}
Should Not Be Empty ${allocations} ONU port ${onu_port} not found in dhcpl2relay-allocations
+Validate Mac Learner Mapping in ONOS
+ [Arguments] ${ip} ${port} ${dev_id} ${onu_port} ${vlan}
+ [Documentation] Verifies the MAC mapping for the client
+ ${mac}= Execute ONOS CLI Command use single connection ${ip} ${port}
+ ... mac-learner-get-mapping ${dev_id} ${onu_port} ${vlan} | grep -v INFO
+ Should Not Be Empty ${mac}
+ ... No client mac-mapping found with vlan-id: ${vlan} that uses port: ${onu_port} of device: ${dev_id}
+
Device Is Available In ONOS
[Arguments] ${url} ${dpid} ${available}=true
[Documentation] Validates the device exists and it has the expected availability in ONOS
@@ -1005,7 +1013,7 @@
[Return] ${limiting_BW}
Validate Deleted Device Cleanup In ONOS
- [Arguments] ${ip} ${port} ${olt_serial_number}
+ [Arguments] ${ip} ${port} ${olt_serial_number} ${maclearning_enabled}=False
[Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in ONOS
# Fetch OF Id for OLT
${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${olt_serial_number}
@@ -1039,6 +1047,12 @@
... dhcpl2relay-allocations ${olt_of_id}
${dhcp_count}= Get Line Count ${dhcp}
Should Be Equal As Integers ${dhcp_count} 0 DHCP Allocations have not been removed from ONOS after cleanup
+ # Verify MAC Learner Mappings are Removed
+ ${mac}= Run Keyword If ${maclearning_enabled} Execute ONOS CLI Command use single connection ${ip} ${port}
+ ... mac-learner-get-mapping | grep -v INFO
+ ${mac_count}= Run Keyword If ${maclearning_enabled} Get Line Count ${mac}
+ ... ELSE Set Variable 0
+ Should Be Equal As Integers ${mac_count} 0 Client MAC Learner Mappings have not been removed from ONOS after cleanup
Delete ONOS App
[Arguments] ${url} ${app_name}
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 04282b6..ec94c5f 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -409,12 +409,13 @@
... 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).
- [Arguments] ${supress_add_subscriber}=False
+ [Arguments] ${supress_add_subscriber}=False ${maclearning_enabled}=False
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
${service_type}= Get Variable Value ${src['service_type']} "null"
- Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst} ${supress_add_subscriber}
+ Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
+ ... ${supress_add_subscriber} ${maclearning_enabled}
END
# Verify Subscriber Access Flow Count
@{particular_onu_device_port}= Create List
@@ -495,7 +496,7 @@
... Assertions apply to HSIA, VoD, VoIP services
... 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).
- [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
+ [Arguments] ${src} ${dst} ${supress_add_subscriber}=False ${maclearning_enabled}=False
Provision Subscription for ONU TT ${src} ${dst} ${supress_add_subscriber}
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Set Global Variable ${of_id}
@@ -507,10 +508,14 @@
... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
... ${dst['container_name']}
- Run Keyword IF '${src['service_type']}'!='hsia'
+ Run Keyword If '${src['service_type']}'!='hsia'
+ ... Run Keywords
... Wait Until Keyword Succeeds ${timeout} 2s
... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
... ${src['c_tag']}
+ ... AND Run Keyword If ${maclearning_enabled}
+ ... Wait Until Keyword Succeeds ${timeout} 5s Validate Mac Learner Mapping in ONOS
+ ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} ${src['c_tag']}
Perform Sanity Test TT MCAST
[Documentation] This keyword performs Sanity Test Procedure for TT Workflow
@@ -715,6 +720,7 @@
Delete All Devices and Verify
[Documentation] Remove any devices from VOLTHA and ONOS
+ [Arguments] ${maclearning_enabled}=False
# Clear devices from VOLTHA
Disable Devices In Voltha Root=true
Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
@@ -724,6 +730,7 @@
${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
Wait Until Keyword Succeeds ${timeout} 5s
... Validate Deleted Device Cleanup In ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_serial_number}
+ ... ${maclearning_enabled}
END
Wait Until Keyword Succeeds ${timeout} 5s Validate Cleanup In ETCD ${INFRA_NAMESPACE}
diff --git a/tests/tt-workflow/Voltha_TT_PODTests.robot b/tests/tt-workflow/Voltha_TT_PODTests.robot
index f5caa13..483ca6e 100755
--- a/tests/tt-workflow/Voltha_TT_PODTests.robot
+++ b/tests/tt-workflow/Voltha_TT_PODTests.robot
@@ -64,6 +64,10 @@
${suppressaddsubscriber} True
+# flag to choose if mac-learning is enabled, or disabled (i.e. mac-address is configured)
+# example: -v with_maclearning:True
+${with_maclearning} False
+
# flag to choose the subscriber provisioning command type in ONOS
# TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other.
# if set to True, command used is "volt-add-subscriber-unitag"
@@ -102,7 +106,7 @@
[Teardown] Run Keywords Collect Logs
... AND Stop Logging SanityTestTT
Run Keyword If ${has_dataplane} Clean Up Linux
- Perform Sanity Test TT
+ Perform Sanity Test TT maclearning_enabled=${with_maclearning}
Sanity E2E Test for TT (MCAST)
[Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
@@ -294,7 +298,7 @@
[Documentation] Tear down steps for the suite
Start Logging Setup or Teardown Teardown-${SUITE NAME}
Run Keyword If ${has_dataplane} Clean Up Linux
- Run Keyword If ${teardown_device} Delete All Devices And Verify
+ Run Keyword If ${teardown_device} Delete All Devices And Verify maclearning_enabled=${with_maclearning}
Close All ONOS SSH Connections
# remove pre-loaded tech profiles
Set Suite Variable ${TechProfile} ${EMPTY}