[VOL-2054] Validate technology profile with pbit verification

Change-Id: I148c87681d11d1dcbb4739007acdd9ac1326db41
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index 8fb1fe2..741e764 100644
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -579,6 +579,55 @@
         ...    The downstream bandwidth guarantee was not met (${pct_limit_dn}% of resv)
     END
 
+Validate parsing of data traffic through voltha using tech profile
+    [Documentation]    Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
+    ...    Prerequisite tools : Tcpdump and Mausezahn traffic generator on both RG and DHCP/BNG VMs
+    ...    Install jq tool to read json file, where test suite is being running
+    ...    Make sure 9999 port is enabled or forwarded for both upsteam and downstream direction
+    ...    This test sends UDP packets on port 9999 with pbits between 0 and 7 and validates that
+    ...    the pbits are preserved by the PON.
+    [Tags]    dataplane    TechProfile    VOL-2054
+    [Setup]    Start Logging    TechProfile
+    [Teardown]    Run Keywords    Collect Logs
+    ...           AND    Stop Logging    TechProfile
+    Pass Execution If   '${has_dataplane}'=='False'
+    ...    Skipping test: Technology profile validation can be done only in physical pod
+    FOR    ${I}    IN RANGE    0    ${num_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${dst}=    Set Variable    ${hosts.dst[${I}]}
+
+        ${bng_ip}=    Get Variable Value    ${dst['noroot_ip']}
+        ${bng_user}=    Get Variable Value    ${dst['noroot_user']}
+        ${bng_pass}=    Get Variable Value    ${dst['noroot_pass']}
+        Pass Execution If    not ("${bng_ip}" and "${bng_user}" and "${bng_pass}")
+        ...    Skipping test: credentials for BNG login required in deployment config
+
+        ${stdout}    ${stderr}    ${rc}=    Execute Remote Command    which mausezahn tcpdump
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
+        Pass Execution If    ${rc} != 0    Skipping test: mausezahn / tcpdump not found on the RG
+        ${stdout}    ${stderr}    ${rc}=    Execute Remote Command    which mausezahn tcpdump
+        ...    ${bng_ip}    ${bng_user}    ${bng_pass}    ${dst['container_type']}    ${dst['container_name']}
+        Pass Execution If    ${rc} != 0    Skipping test: mausezahn / tcpdump not found on the BNG
+        Log    Upstream test
+        Run Keyword If    ${has_dataplane}    Wait Until Keyword Succeeds    ${timeout}    2s
+        ...    Create traffic with each pbit and capture at other end
+        ...    ${dst['dp_iface_ip_qinq']}    ${dst['dp_iface_name']}    ${src['dp_iface_name']}
+        ...    0    udp    9999    0    vlan
+        ...    ${bng_ip}    ${bng_user}    ${bng_pass}    ${dst['container_type']}    ${dst['container_name']}
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
+        Log    Downstream test
+        ${rg_ip}    ${stderr}    ${rc}=    Execute Remote Command
+        ...    ifconfig ${src['dp_iface_name']} | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 }'
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
+        Should Be Equal As Integers    ${rc}    0    Could not get RG's IP address
+        Run Keyword If    ${has_dataplane}    Wait Until Keyword Succeeds    ${timeout}    2s
+        ...    Create traffic with each pbit and capture at other end
+        ...    ${rg_ip}    ${src['dp_iface_name']}    ${dst['dp_iface_name']}.${src['s_tag']}
+        ...    0    udp    9999    ${src['c_tag']}    udp
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
+        ...    ${bng_ip}    ${bng_user}    ${bng_pass}    ${dst['container_type']}    ${dst['container_name']}
+    END
+
 *** Keywords ***
 Setup Suite
     [Documentation]    Set up the test suite
@@ -595,4 +644,3 @@
     Delete All Devices and Verify
     # Execute normal test Setup Keyword
     Setup
-