[VOL-4483] Updated TT suite to use uniTag subscriber provisioning

Change-Id: I04a08e20752e6809ee8b997b3fb9318c73cf9702
diff --git a/tests/tt-workflow/Voltha_TT_FailureScenarios.robot b/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
index a23d3cf..9651d01 100755
--- a/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
+++ b/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
@@ -63,6 +63,12 @@
 
 ${suppressaddsubscriber}    True
 
+# 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"
+# if set to False, comand used is "volt-add-subscriber-access"
+${unitag_sub}    False
+
 *** Test Cases ***
 Verify ONU after Rebooting Physically for TT
     [Documentation]    Test the ONU functionality by physically turning on/off ONU.
@@ -98,17 +104,27 @@
         ...    Check Ping    False    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
         ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
         # Remove Subscriber Access (To replicate TT workflow)
+        ${del_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-remove-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-remove-subscriber-access ${of_id} ${onu_port}
         Wait Until Keyword Succeeds    ${timeout}    2s    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}
-        ...    ${ONOS_SSH_PORT}    volt-remove-subscriber-access ${of_id} ${onu_port}
+        ...    ${ONOS_SSH_PORT}    ${del_sub_cmd}
         Sleep    5s
         # Enable Power Switch
         Enable Switch Outlet    ${src['power_switch_port']}
         # Check ONU port is Enabled in ONOS
         Wait Until Keyword Succeeds    120s    5s
         ...    Verify UNI Port Is Enabled   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}
+        # Add Subscriber Access
+        ${add_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-add-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-add-subscriber-access ${of_id} ${onu_port}
         Wait Until Keyword Succeeds    ${timeout}    2
-        ...    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-        ...    volt-add-subscriber-access ${of_id} ${onu_port}
+        ...    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${add_sub_cmd}
         # Verify ONU state in voltha
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
         ...    ENABLED    ACTIVE    REACHABLE
@@ -203,14 +219,24 @@
         ...    Check Ping    False    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
         ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
         # Remove Subscriber Access (To replicate TT workflow)
+        ${del_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-remove-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-remove-subscriber-access ${of_id} ${onu_port}
         Wait Until Keyword Succeeds    ${timeout}    2s    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}
-        ...    ${ONOS_SSH_PORT}    volt-remove-subscriber-access ${of_id} ${onu_port}
+        ...    ${ONOS_SSH_PORT}    ${del_sub_cmd}
         # Check ONU port is Enabled in ONOS
         Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify UNI Port Is Enabled   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}
+        # Add Subscriber Access
+        ${add_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-add-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-add-subscriber-access ${of_id} ${onu_port}
         Wait Until Keyword Succeeds    ${timeout}    2
-        ...    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-        ...    volt-add-subscriber-access ${of_id} ${onu_port}
+        ...    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${add_sub_cmd}
         # Verify ONU state in voltha
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
         ...    ENABLED    ACTIVE    REACHABLE
@@ -429,7 +455,7 @@
     ...    Run the ping continuously in background during container restart,
     ...    and verify that there should be no affect on the dataplane.
     ...    Also, verify that the voltha control plane functionality is not affected.
-    [Tags]    functionalTT    Restart-OpenOnu-Ping-TT
+    [Tags]    functionalTT    Restart-OpenOnu-Ping-TT    dataplaneTT
     [Setup]    Start Logging    Restart-OpenOnu-Ping-TT
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    Restart-OpenOnu-Ping-TT
@@ -491,7 +517,7 @@
     ...    Run the ping continuously in background during container restart,
     ...    and verify that there should be no affect on the dataplane.
     ...    Also, verify that the voltha control plane functionality is not affected.
-    [Tags]    functionalTT    Restart-OpenOlt-Ping-TT
+    [Tags]    functionalTT    Restart-OpenOlt-Ping-TT    dataplaneTT
     [Setup]    Start Logging    Restart-OpenOlt-Ping-TT
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    Restart-OpenOlt-Ping-TT
@@ -553,7 +579,7 @@
     ...    Run the ping continuously in background during container restart,
     ...    and verify that there should be no affect on the dataplane.
     ...    Also, verify that the voltha control plane functionality is not affected.
-    [Tags]    functionalTT    Restart-RwCore-Ping-TT
+    [Tags]    functionalTT    Restart-RwCore-Ping-TT    dataplaneTT
     [Setup]    Start Logging    Restart-RwCore-Ping-TT
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    Restart-RwCore-Ping-TT
@@ -645,15 +671,25 @@
         ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
         ...    ${of_id}    ${src['uni_id']}
         # Remove Subscriber Access
+        ${del_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-remove-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-remove-subscriber-access ${of_id} ${onu_port}
         Wait Until Keyword Succeeds    ${timeout}    2s    Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}
-        ...    ${ONOS_SSH_PORT}    volt-remove-subscriber-access ${of_id} ${onu_port}
+        ...    ${ONOS_SSH_PORT}    ${del_sub_cmd}
         Run Keyword If    ${has_dataplane} and '${service_type}' != 'mcast'
         ...    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Check Ping    False    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
         ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
         # Add Subscriber Access
+        ${add_sub_cmd}=    Run Keyword If    ${unitag_sub}
+        ...    Catenate    volt-add-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
+        ...    --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
+        ...    ELSE
+        ...    Set Variable    volt-add-subscriber-access ${of_id} ${onu_port}`
         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}
+        ...    ${ONOS_SSH_PORT}    ${add_sub_cmd}
         Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate Device    ENABLED    ACTIVE
         ...    REACHABLE    ${src['onu']}    onu=True    onu_reason=omci-flows-pushed