[VOL-4724] TIM Workflow Robot Test Setup

Added some configuration to the test enviroment for set up  multiple sanity test for tim workflow

Change-Id: I9cdc88eb278bb48945dd71befec81a7ddea9d312

Added some method to verify the correctness of flow rules genereted by ONOS.

Change-Id: Iba9a11a87070ce1bf4bbd7d06c767e1e2e1cac28

Added some Test Case to do a Sanity-Test for the TIM Workflow Test are x Multi OLT, Multi PON and Multi ONO About the correctness of generation about the ONOS flow rules

Change-Id: Ica62a7720554bb2cbf82597ee861a7149b89e30a

Test file structure to do a single OLT, Single PON and Single ONU Sanity Test for TIM Workflow

Change-Id: I5a1cdf323398055ec41d2dddbf5c842e3b50b393

Test file structure to do a single OLT, Single PON and Multi ONU Sanity Test for TIM Workflow

Change-Id: Ifc74e84da3bafda23c3501e40104624ff98a6007

Test file structure to do a single OLT, Multi PON and Multi ONU Sanity Test for TIM Workflow

Change-Id: I22a812ceac39caeb574feffc64892559f6c0096d

Test file structure to do a Multi OLT, Multi PON and Multi ONU Sanity Test for TIM Workflow

Change-Id: I68745b986cdb94347dff96ffd99608bffdfa8470

Robot Test Code to do TIM Workflow  Sanity Test
Scalability Test in ONOS and in OLTs and ONUs device

Change-Id: I1c21f45751b5502c16fbcadc6f70e50388389d3f
diff --git a/Makefile b/Makefile
index 171b236..e2f7277 100755
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,11 @@
 ROBOT_SANITY_TT_MULTI_UNI_SINGLE_PON_FILE    ?= $(ROOT_DIR)/tests/data/bbsim-kind-multi-uni-tt.yaml
 ROBOT_SANITY_TT_MULTI_UNI_MULTIPLE_OLT_FILE     ?= $(ROOT_DIR)/tests/data/bbsim-kind-multi-uni-2OLTx2ONUx2PON-tt.yaml
 ROBOT_SANITY_DT_FTTB_SINGLE_PON_FILE    ?= $(ROOT_DIR)/tests/data/bbsim-kind-dt-fttb-1OLTx1PONx2ONUx2UNI.yaml
+ROBOT_SANITY_TIM_SINGLE_PON_FILE    ?= $(ROOT_DIR)/tests/data/bbsim-kind-tim.yaml
+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
+
 
 # for backwards compatibility
 sanity-kind: sanity-single-kind
@@ -137,6 +142,28 @@
 functional-single-kind-multiuni-tt: ROBOT_FILE := Voltha_TT_PODTests.robot
 functional-single-kind-multiuni-tt: voltha-tt-test
 
+# target to invoke TIM Workflow Sanity
+sanity-kind-tim: ROBOT_MISC_ARGS += -i sanityTIM $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-tim: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TIM_SINGLE_PON_FILE)
+sanity-kind-tim: ROBOT_FILE := Voltha_TIM_PODTests.robot
+sanity-kind-tim: voltha-tim-test
+
+sanity-kind-tim-multi-onu: ROBOT_MISC_ARGS += -i sanityTIM $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-tim-multi-onu: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TIM_SINGLE_PON_MULTI_ONU_FILE)
+sanity-kind-tim-multi-onu: ROBOT_FILE := Voltha_TIM_PODTests.robot
+sanity-kind-tim-multi-onu: voltha-tim-test
+
+sanity-kind-tim-multi-pon-multi-onu: ROBOT_MISC_ARGS += -i sanityTIM $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-tim-multi-pon-multi-onu: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TIM_MULTI_PON_MULTI_ONU_FILE)
+sanity-kind-tim-multi-pon-multi-onu: ROBOT_FILE := Voltha_TIM_PODTests.robot
+sanity-kind-tim-multi-pon-multi-onu: voltha-tim-test
+
+sanity-kind-tim-multi-olt-multi-pon-multi-onu: ROBOT_MISC_ARGS += -i sanityTIM $(ROBOT_DEBUG_LOG_OPT)
+sanity-kind-tim-multi-olt-multi-pon-multi-onu: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TIM_MULTI_OLT_MULTI_PON_MULTI_ONU_FILE)
+sanity-kind-tim-multi-olt-multi-pon-multi-onu: ROBOT_FILE := Voltha_TIM_PODTests.robot
+sanity-kind-tim-multi-olt-multi-pon-multi-onu: voltha-tim-test
+
+
 # target to invoke multiple OLTs Functional scenarios
 functional-multi-olt: ROBOT_MISC_ARGS += -i sanityORfunctional -e PowerSwitch $(ROBOT_DEBUG_LOG_OPT)
 functional-multi-olt: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_MULTIPLE_OLT_FILE)
@@ -655,6 +682,13 @@
 	cd tests/tt-workflow ;\
 	robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
 
+voltha-tim-test: ROBOT_MISC_ARGS += -e notready  --noncritical non-critical
+
+voltha-tim-test: vst_venv
+	source ./$</bin/activate ; set -u ;\
+	cd tests/tim-workflow ;\
+	robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+
 voltha-scale-test: vst_venv
 	source ./$</bin/activate ; set -u ;\
 	cd tests/scale ;\
diff --git a/libraries/flows.robot b/libraries/flows.robot
index ff8b673..f6e6a4a 100644
--- a/libraries/flows.robot
+++ b/libraries/flows.robot
@@ -35,7 +35,9 @@
     ...     ${uni_count}    ${olt_count}    ${provisioned}  ${withLldp}
     ...     ELSE IF     $workflow=="tt"     Calculate Tt Flows
     ...     ${uni_count}    ${olt_count}    ${provisioned}  ${withDhcp}     ${withIgmp}     ${withLldp}
-    ...     ELSE    Fail    Workflow ${workflow} should be one of 'att', 'dt', 'tt'
+    ...     ELSE IF     $workflow=="tim"     Calculate Tim Flows
+    ...     ${uni_count}    ${olt_count}    ${provisioned}  ${withPppoe}     ${withIgmp}     ${withLldp}
+    ...     ELSE    Fail    Workflow ${workflow} should be one of 'att', 'dt', 'tt' , 'tim'
     Return From Keyword     ${expectedFlows}
 
 Calculate Att flows
@@ -130,4 +132,31 @@
     ...     Evaluate     ${totalDhcpFlows} + ${totalLldpFlows} + ${totalIgmpFlows}
     ...     ELSE
     ...     Evaluate    (${uni_count} * 15) + ${totalDhcpFlows} + ${totalLldpFlows} + ${totalIgmpFlows}
+    Return From Keyword     ${flow_count}
+
+Calculate Tim flows
+    [Documentation]  Calculate the flow for the Tim workflow
+    [Arguments]  ${uni_count}    ${olt_count}   ${provisioned}  ${withPppoe}     ${withIgmp}    ${withLldp}
+    # (1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs before provisioning
+    # 1 Any VLAN + (4 * UNIs) * (1 LLDP + 1 PPPoE + 1 IGMP) for each OLTs after provisioning
+    ${anyVlanFlowsCount}=   Evaluate    1
+    ${pppoeFlowsCount}=   Run Keyword If   $withPppoe=='true'
+    ...     Evaluate     1
+    ...     ELSE
+    ...     Evaluate     0
+    ${lldpFlowsCount}=   Run Keyword If   $withLldp=='true'
+    ...     Evaluate     1
+    ...     ELSE
+    ...     Evaluate     0
+    ${igmpFlowsCount}=   Run Keyword If   $withIgmp=='true'
+    ...     Evaluate     1
+    ...     ELSE
+    ...     Evaluate     0
+    ${pppoeFlowsCount}=   Evaluate   ${olt_count} * ${pppoeFlowsCount}
+    ${totalLldpFlows}=   Evaluate   ${olt_count} * ${lldpFlowsCount}
+    ${totalIgmpFlows}=   Evaluate   ${olt_count} * ${igmpFlowsCount}
+    ${flow_count}=  Run Keyword If  $provisioned=='false'
+    ...     Evaluate     ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows}
+    ...     ELSE
+    ...     Evaluate    ${anyVlanFlowsCount} + (${uni_count} * 4) + ${pppoeFlowsCount} + ${totalLldpFlows} + ${totalIgmpFlows}
     Return From Keyword     ${flow_count}
\ No newline at end of file
diff --git a/libraries/onos.robot b/libraries/onos.robot
index b6a9cb9..c2c949d 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -461,6 +461,14 @@
     ${access_flows_added_count}=      Get Line Count      ${access_flows_added}
     Should Be Equal As Integers    ${access_flows_added_count}    ${expected_flows}
 
+Verify Subscriber Access Flows Added Count TIM
+    [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${expected_flows}
+    [Documentation]    Matches for total number of subscriber access flows added for all onus
+    ${access_flows_added}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    flows -s ADDED ${olt_of_id} | grep -v deviceId
+    ${access_flows_added_count}=      Get Line Count      ${access_flows_added}
+    Should Be Equal As Integers    ${access_flows_added_count}    ${expected_flows}
+
 Verify Added Flow Count for OLT TT
     [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${expected_flows}
     [Documentation]    Total number of added flows given OLT with subscriber flows
@@ -494,6 +502,75 @@
     ...    ${downstream_flow_igmp_cmd}
     Should Not Be Empty    ${downstream_flow_igmp_added}
 
+Verify Downstream Flows for Single OLT NNI Port TIM
+    [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${nni_port}
+    [Documentation]    Verifies if the downstream flows from the NNI port to the CONTROLLER port are added in ONOS for the OLT
+
+    # Verify PPPoE downstream flow form NNI to CONTROLLER port
+    ${downstream_pppoed_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:pppoed | grep OUTPUT:CONTROLLER
+    ${downstream_pppoed}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${downstream_pppoed_cmd}
+    Should Not Be Empty    ${downstream_pppoed}
+
+    # Verify IGMP downstream flow form NNI to CONTROLLER port
+    ${downstream_igmp_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 | grep IP_PROTO:2 | grep OUTPUT:CONTROLLER
+    ${downstream_igmp}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${downstream_igmp_cmd}
+    Should Not Be Empty    ${downstream_igmp}
+
+    # Verify LLDP downstream flow form NNI to CONTROLLER port
+    ${downstream_lldp_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:lldp | grep OUTPUT:CONTROLLER
+    ${downstream_lldp}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${downstream_lldp_cmd}
+    Should Not Be Empty    ${downstream_lldp}
+
+Verify Subscriber Access Flows Added for Single ONU Port TIM
+    [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${onu_port}    ${nni_port}    ${c_tag}   ${uni_tag}
+    [Documentation]    Verifies if the Subscriber Access Flows are added in ONOS for the ONU
+
+    # Verify upstream pppoed flow from UNI port to CONTROLLER
+    ${upstream_flow_pppoed_added_cmd}=   Catenate    SEPARATOR=
+    ...     flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:pppoed |
+    ...     grep VLAN_VID:${uni_tag} | grep OUTPUT:CONTROLLER
+    ${upstream_flow_pppoed_added}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${upstream_flow_pppoed_added_cmd}
+    Should Not Be Empty    ${upstream_flow_pppoed_added}
+
+    # Verify upstream table=0 flow, from UNI to TABLE 1
+    ${upstream_flow_0_added_cmd}=     Catenate    SEPARATOR=
+    ...     flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${uni_tag} |
+    ...     grep VLAN_ID:${c_tag}  | grep transition=TABLE:1
+    ${upstream_flow_0_added}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${upstream_flow_0_added_cmd}
+    Should Not Be Empty    ${upstream_flow_0_added}
+
+    # Verify upstream table=1 flow, from UNI to NNI
+    ${flow_vlan_UNI_to_NNI_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep table=1 | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} |
+    ...    grep OUTPUT:${nni_port}
+    ${flow_vlan_UNI_to_NNI}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${flow_vlan_UNI_to_NNI_cmd}
+    Should Not Be Empty    ${flow_vlan_UNI_to_NNI}
+
+    # Verify downstream table=0 flow, from NNI to TABLE 1
+    ${downstream_flow_0_added_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:Any |
+    ...    grep transition=TABLE:1
+    ${downstream_flow_0_added}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${downstream_flow_0_added_cmd}
+    Should Not Be Empty    ${downstream_flow_0_added}
+
+    # Verify downstream table=1 flow, from NNI to UNI
+    ${downstream_form_NNI_to_UNI_in_table_1_cmd}=     Catenate    SEPARATOR=
+    ...    flows -s ADDED ${olt_of_id} | grep table=1 | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} |
+    ...    grep VLAN_ID:${uni_tag} | grep OUTPUT:${onu_port}
+    ${downstream_form_NNI_to_UNI_in_table_1}=    Execute ONOS CLI Command use single connection    ${ip}    ${port}
+    ...    ${downstream_form_NNI_to_UNI_in_table_1_cmd}
+    Should Not Be Empty    ${downstream_form_NNI_to_UNI_in_table_1}
+
 Get Programmed Subscribers
     [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${onu_port}    ${filter}=${EMPTY}
     [Documentation]    Retrieves the subscriber details at a given location
diff --git a/libraries/utils.robot b/libraries/utils.robot
index c42d35f..2bfe322 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -1714,3 +1714,112 @@
     END
     # Waiting extra time for the ONUs to come up
     Sleep    60s
+
+Perform Sanity Test TIM
+    [Documentation]    This keyword iterate all OLTs and performs Sanity Test Procedure for TIM workflow
+    ...    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    ${maclearning_enabled}=False
+    FOR    ${J}    IN RANGE    0    ${num_olts}
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${J}][sn]
+        ${num_onus}=    Set Variable    ${list_olts}[${J}][onucount]
+        ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS
+        ...    ${olt_serial_number}
+        Set Global Variable    ${of_id}
+
+        #Permorm test on flow rules that are writen inside ONOS, OLT and ONUs
+        ${nni_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get NNI Port in ONOS    ${of_id}
+        Perform Sanity Test TIM Per OLT    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}
+        ...    ${supress_add_subscriber}
+
+        #Scalability Test
+        #Extract the total iphotetical number of UNIs that an OLT controll having multiple ONUs connected
+        ${num_of_provisioned_onus_ports}=      Count Number of UNI ports for OLT
+        ...     ${olt_serial_number}    hsia
+
+        # Verify ONOS Flows
+        # Number of Access Flows for OLT on ONOS are equals to:
+        # a standard downstream flow for the Any VLAN, that flow exist when there are at least 1 onu,
+        # 4 rules for each single ONU/UNI
+        # and there are 3 default flows lldp, igmp and pppoe flow rules for the OLT
+        ${onos_flows_count}=    Run Keyword    Calculate Tim flows
+        ...     ${num_of_provisioned_onus_ports}    1   true  true     true    true
+
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
+        ...    Verify Subscriber Access Flows Added Count TIM    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
+        ...    ${onos_flows_count}
+
+        # Verify VOLTHA Flows
+        # Number of per OLT Flows are 3 times the Number of Active ONUs
+        # (for downstream and upstream) + 3 on the NNI port the LLDP, IGMP and PPPoE default flows
+        ${olt_flows}=    Evaluate   3 * ${num_of_provisioned_onus_ports} + 3
+        Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows
+        ...    ${olt_flows}    ${olt_device_id}
+        ${List_ONU_Serial}    Create List
+        Set Suite Variable    ${List_ONU_Serial}
+        Build ONU SN List    ${List_ONU_Serial}    ${olt_serial_number}
+        Log    ${List_ONU_Serial}
+        # Number of per ONU Flows equals 3
+        ${onu_flows}=    Set Variable    3
+        Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONU Flows
+        ...    ${List_ONU_Serial}    ${onu_flows}
+    END
+
+Count Number of UNI ports for OLT
+    [Documentation]  Count Provisioned UNI ports, for ONUs connected with specified OLT
+    [Arguments]    ${olt_serial_number}     ${type_of_service}
+    ${num_of_provisioned_onus_ports}=      Evaluate     0
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        Continue For Loop If    "${olt_serial_number}"!="${src['olt']}"
+        Continue For Loop If    "${type_of_service}"!="${src['service_type']}"
+        ${num_of_provisioned_onus_ports}=      Evaluate     ${num_of_provisioned_onus_ports} + 1
+    END
+    [Return]    ${num_of_provisioned_onus_ports}
+
+
+Perform Sanity Test TIM Per OLT
+    [Arguments]    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}    ${supress_add_subscriber}=False
+    [Documentation]    This keyword performs Sanity Test Procedure for TIM Workflow
+    ...    Sanity test performs pppoe and flows for all the ONUs (and for each UNIs of a consider ONU)
+    ...    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).
+    Wait Until Keyword Succeeds    ${timeout}    5s
+        ...    Verify Downstream Flows for Single OLT NNI Port TIM    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
+        ...    ${nni_port}
+
+    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    ${src['onu']}
+        ${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   120s   2s
+        ...    Verify UNI Port Is Enabled   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}    ${src['uni_id']}
+
+        # Subscribe a RG on a defualt UNI_id=1
+        ${add_subscriber_access} =  Set Variable     volt-add-subscriber-access ${of_id} ${onu_port}
+        Run Keyword If    '${supress_add_subscriber}' == 'False'
+        ...     Execute ONOS CLI Command use single connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}   ${add_subscriber_access}
+
+        # Verify ONU state in voltha
+        ${onu_reasons}=  Create List     omci-flows-pushed
+        Run Keyword    Append To List    ${onu_reasons}    onu-reenabled
+        Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
+        ...    ENABLED    ACTIVE    REACHABLE
+        ...    ${src['onu']}    onu=True    onu_reason=${onu_reasons}
+
+        # Verify subscriber access flows are added for a single ONU puniort
+        Wait Until Keyword Succeeds    ${timeout}    5s
+        ...    Verify Subscriber Access Flows Added For Single ONU Port TIM    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
+        ...    ${onu_port}    ${nni_port}    ${src['c_tag']}    ${src['uni_tag']}
+
+        # TO DO: 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}
+    END
diff --git a/tests/data/bbsim-kind-tim-2OLTx2PONx2ONU.yaml b/tests/data/bbsim-kind-tim-2OLTx2PONx2ONU.yaml
new file mode 100644
index 0000000..ec02b87
--- /dev/null
+++ b/tests/data/bbsim-kind-tim-2OLTx2PONx2ONU.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.voltha.svc
+    serial: BBSIM_OLT_10
+  - ip: bbsim1.voltha.svc
+    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: 'BBSM000a0101'
+      olt: 'BBSIM_OLT_10'
+      uni_tag: '835'
+      c_tag: '100'
+      s_tag: '4096'
+      service_type: 'hsia'
+      uni_id: 1
+      tp_id: '64'
+    - onu: 'BBSM000a0102'
+      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'
+    - onu: 'BBSM000b0101'
+      olt: 'BBSIM_OLT_11'
+      uni_tag: '835'
+      c_tag: '100'
+      s_tag: '4096'
+      service_type: 'hsia'
+      uni_id: 1
+      tp_id: '64'
+    - onu: 'BBSM000b0102'
+      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
+    - ip: null
+    - ip: null
+    - ip: null
+    - ip: null
diff --git a/tests/data/bbsim-kind-tim-OLTx2PONx2ONU.yaml b/tests/data/bbsim-kind-tim-OLTx2PONx2ONU.yaml
new file mode 100644
index 0000000..483ad27
--- /dev/null
+++ b/tests/data/bbsim-kind-tim-OLTx2PONx2ONU.yaml
@@ -0,0 +1,77 @@
+---
+
+# 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.voltha.svc
+    serial: BBSIM_OLT_10
+
+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: 'BBSM000a0101'
+      olt: 'BBSIM_OLT_10'
+      uni_tag: '835'
+      c_tag: '100'
+      s_tag: '4096'
+      service_type: 'hsia'
+      uni_id: 1
+      tp_id: '64'
+    - onu: 'BBSM000a0102'
+      olt: 'BBSIM_OLT_10'
+      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
diff --git a/tests/data/bbsim-kind-tim-OLTxPONx2ONU.yaml b/tests/data/bbsim-kind-tim-OLTxPONx2ONU.yaml
new file mode 100644
index 0000000..8a71814
--- /dev/null
+++ b/tests/data/bbsim-kind-tim-OLTxPONx2ONU.yaml
@@ -0,0 +1,59 @@
+---
+
+# 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.voltha.svc
+    serial: BBSIM_OLT_10
+
+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'
+
+  dst:
+    - ip: null
+    - ip: null
diff --git a/tests/data/bbsim-kind-tim.yaml b/tests/data/bbsim-kind-tim.yaml
new file mode 100644
index 0000000..79e9769
--- /dev/null
+++ b/tests/data/bbsim-kind-tim.yaml
@@ -0,0 +1,50 @@
+---
+
+# 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.voltha.svc
+    serial: BBSIM_OLT_10
+
+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'
+
+  dst:
+    - ip: null
diff --git a/tests/tim-workflow/Voltha_TIM_PODTests.robot b/tests/tim-workflow/Voltha_TIM_PODTests.robot
new file mode 100755
index 0000000..ebd2ed5
--- /dev/null
+++ b/tests/tim-workflow/Voltha_TIM_PODTests.robot
@@ -0,0 +1,119 @@
+#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 ***
+Documentation     Test various end-to-end scenarios
+Suite Setup       Setup Suite
+Test Setup        Setup
+Test Teardown     Teardown
+Suite Teardown    Teardown Suite
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+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_CONFIGS_DIR}    ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
+${KUBERNETES_YAML}    ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
+${HELM_CHARTS_DIR}    ~/helm-charts
+${VOLTHA_POD_NUM}    8
+${NAMESPACE}      voltha
+${INFRA_NAMESPACE}      default
+# For below variable value, using deployment name as using grep for
+# parsing radius pod name, we can also use full radius pod name
+${RESTART_POD_NAME}    radius
+${timeout}        60s
+${of_id}          0
+${logical_id}     0
+${has_dataplane}    True
+${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
+
+#Test the actual on board configuration (Not yet used but it is a placeholder)
+#${testonboardconfiguration}     False
+
+#Suppress the subscribe phase
+${suppressaddsubscriber}     False
+
+#Enable or Disable the MacLearning verifier for MacLearning ONOS APP
+${maclearningenabled}   False   #Not yet used but it is a placeholder
+
+*** Test Cases ***
+Sanity E2E Test for TIM (HSIA)
+    [Documentation]     Validate the correct construction of the flow rules in ONOS and in the devices:
+    ...    Flow rules in accordance with TIM Workflow.
+    ...    Set up the clean TIM test environment.
+    ...    Make subscriptions of all possible subscribers described in the test case.
+    ...    Verify the correctness of the flow rules generated by ONOS and written in
+    ...    the respective devices (OLT and ONU), about PPPoE, IGMP and LLDP Flows.
+    ...    We use a Transparent VLAN approach
+    ...    Perform a scalability test both for flow rules in ONOS and in devices.
+    [Tags]    sanityTIM
+    [Setup]    Start Logging    SanityTestTIM
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    SanityTestTIM
+    Run Keyword     Setup    ${SOAK_TEST}
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    Perform Sanity Test TIM     supress_add_subscriber=${suppressaddsubscriber}
+    ...     maclearning_enabled=${maclearningenabled}
+
+Sanity E2E Test for TIM (MCAST)
+    [Documentation]    Validate the correct construction of the flow rules in ONOS and in the devices:
+    ...    Flow rules in accordance with TIM Workflow.
+    ...    Verify the correctness of the flow/group rules generated by ONOS and written in
+    ...    the respective devices (OLT and ONU), about IGMP.
+    ...    We use a Transparent VLAN approach.
+    ...    Perform a scalability test both for flow rules in ONOS and in devices.
+    [Tags]    sanityTIM-MCast    notready
+    [Setup]    Start Logging    sanityTIM-MCast
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    sanityTIM-MCast
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    TODO: Yet to Implement below keyword
+    Perform Sanity Test TIM MCAST     supress_add_subscriber=${suppressaddsubscriber}
+    ...     maclearning_enabled=${maclearningenabled}
+
+*** 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}
+