VGC_Validation_Fixes

Change-Id: I62ac1509a6a9188b27dae1f62181ab81db61c46f
Signed-off-by: Guru Prasanna <guruprasanna.st@radisys.com>
diff --git a/tests/data/bbsim-kind-dt-fttb-1OLTx1PONx2ONUx2UNI.yaml b/tests/data/bbsim-kind-dt-fttb-1OLTx1PONx2ONUx2UNI.yaml
index bbc521e..4d57a25 100644
--- a/tests/data/bbsim-kind-dt-fttb-1OLTx1PONx2ONUx2UNI.yaml
+++ b/tests/data/bbsim-kind-dt-fttb-1OLTx1PONx2ONUx2UNI.yaml
@@ -26,6 +26,9 @@
 VGC_SSH_PORT: 8101
 OLT_PORT: 50060
 
+# Actual Unused sadis.file but ready to future implementation
+sadis.file: ../data/dt-sadis-config-fttb-vgc.json
+
 nodes:
   -
     ip: '127.0.0.1'
@@ -44,53 +47,13 @@
       service:
         -
           name: DPU_MGMT_TRAFFIC
-          c_tag: '6'
-          s_tag: '60'
+          c_tag: '4090'
+          s_tag: '4'
         -
           name: FTTB_SUBSCRIBER_TRAFFIC
           c_tag: '101'
           s_tag: '3101'
         -
-          name: DPU_ANCP_TRAFFIC
-          c_tag: '4'
-          s_tag: '40'
       uni_id: '1'
-    -
-      onu: 'BBSM000a0001'
-      olt: 'BBSIM_OLT_10'
-      service:
-        -
-          name: DPU_MGMT_TRAFFIC
-          c_tag: '6'
-          s_tag: '60'
-        -
-          name: FTTB_SUBSCRIBER_TRAFFIC
-          c_tag: '102'
-          s_tag: '3102'
-        -
-          name: DPU_ANCP_TRAFFIC
-          c_tag: '4'
-          s_tag: '40'
-      uni_id: '2'
-    -
-      onu: 'BBSM000a0002'
-      olt: 'BBSIM_OLT_10'
-      service:
-        -
-          name: DPU_MGMT_TRAFFIC
-          c_tag: '6'
-          s_tag: '60'
-        -
-          name: FTTB_SUBSCRIBER_TRAFFIC
-          c_tag: '105'
-          s_tag: '3105'
-        -
-          name: DPU_ANCP_TRAFFIC
-          c_tag: '4'
-          s_tag: '40'
-      uni_id: '1'
-
   dst:
     - ip: null
-    - ip: null
-    - ip: null
diff --git a/tests/data/dt-sadis-config-fttb-vgc.json b/tests/data/dt-sadis-config-fttb-vgc.json
new file mode 100644
index 0000000..33920a5
--- /dev/null
+++ b/tests/data/dt-sadis-config-fttb-vgc.json
@@ -0,0 +1,67 @@
+{
+  "apps": {
+    "org.opencord.sadis": {
+      "bandwidthprofile": {
+        "entries": [
+          {
+            "id": "upstream_bw_profile_dpu_mgmt_gpon",
+            "gir": 10000,
+            "cbs": 382928,
+            "cir": 11904,
+            "pbs": 18692048,
+            "pir": 584064
+          },
+          {
+            "id": "High-Speed-Internet",
+            "gir": 50000,
+            "cbs": 10000,
+            "cir": 50000,
+            "pbs": 1000,
+            "pir": 300000
+          }
+        ]
+      },
+      "sadis": {
+        "entries": [
+          {
+            "id": "BBSIM_OLT_10",
+            "nasId": "BBSIM_OLT_10",
+            "hardwareIdentifier": "28:b9:d9:e2:93:d6",
+            "uplinkPort": "16777216",
+            "nniDhcpTrapVid": 4
+          },
+          {
+            "id": "BBSM000a0001-1",
+            "nasPortId": "BBSM000a0001-1",
+            "circuitId": "BBSM000a0001-1",
+            "remoteId": "BBSM000a0001",
+            "uniTagList": [
+              {
+                "uniTagMatch": 4096,
+                "ponCTag": 4090,
+                "ponSTag": 4,
+                "usPonCTagPriority": 0,
+                "usPonSTagPriority": 0,
+                "dsPonCTagPriority": 0,
+                "dsPonSTagPriority": 0,
+                "technologyProfileId": 65,
+                "downstreamBandwidthProfile": "upstream_bw_profile_dpu_mgmt_gpon",
+                "upstreamBandwidthProfile": "upstream_bw_profile_dpu_mgmt_gpon",
+                "serviceName": "DPU_MGMT_TRAFFIC"
+              },
+              {
+                "uniTagMatch": 4096,
+                "ponCTag": 101,
+                "ponSTag": 3101,
+                "technologyProfileId": 74,
+                "upstreamBandwidthProfile": "High-Speed-Internet",
+                "downstreamBandwidthProfile": "High-Speed-Internet",
+                "serviceName": "FTTB_SUBSCRIBER_TRAFFIC"
+              }
+            ]
+          }
+        ]
+      }
+    }
+  }
+}
diff --git a/tests/dt-workflow/Voltha_DT_FailureScenarios_VGC.robot b/tests/dt-workflow/Voltha_DT_FailureScenarios_VGC.robot
index 1cdb4d3..f9bf40c 100644
--- a/tests/dt-workflow/Voltha_DT_FailureScenarios_VGC.robot
+++ b/tests/dt-workflow/Voltha_DT_FailureScenarios_VGC.robot
@@ -46,6 +46,8 @@
 ${of_id}          0
 ${logical_id}     0
 ${has_dataplane}    True
+${kafka}    voltha-voltha-api
+${KAFKA_PORT}    55555
 ${teardown_device}    False
 ${scripts}        ../../scripts
 
@@ -103,7 +105,7 @@
     [Setup]    Start Logging    Restart-OpenOlt-Dt
     [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    Restart-OpenOlt-Dt
-    # Add OLT device
+    # Add OLT_device
     Run Keyword If    '${SOAK_TEST}'=='False'    setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
     Run Keyword If    ${has_dataplane}    Clean Up Linux
@@ -136,6 +138,8 @@
     [Teardown]   Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...          AND             Stop Logging    OltAdapterRestart-Dt
     # Add OLT device
+    Sleep    120s
+    Deactivate Subscribers In VGC
     Clear All Devices Then Create New Device
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Set Global Variable    ${of_id}
@@ -149,7 +153,7 @@
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate Device        ENABLED    ACTIVE    REACHABLE
-        ...    ${onu_device_id}    onu=True    onu_reason=omci-flows-pushed    by_dev_id=True
+        ...    ${onu_device_id}    onu=True    onu_reason=initial-mib-downloaded    by_dev_id=True
     END
     # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
     Scale K8s Deployment by Pod Label    ${NAMESPACE}    app    ${OLT_ADAPTER_APP_LABEL}    0
@@ -201,6 +205,7 @@
     # sleep of 60s is introduced to give enough time for OLT adapter to reconcile the OLTs."
     Sleep   60s
     END
+    Deactivate Subscribers In VGC
 
 Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for DT
     [Documentation]    Deploys an device instance and waits for it to authenticate. After
@@ -231,7 +236,7 @@
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         # Bring up the device and verify it authenticates
         Wait Until Keyword Succeeds    360s    5s    Validate Device    ENABLED    ACTIVE    REACHABLE
-        ...    ${onu_device_id}    onu=True    onu_reason=omci-flows-pushed    by_dev_id=True
+        ...    ${onu_device_id}    onu=True    onu_reason=initial-mib-downloaded    by_dev_id=True
     END
 
     # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
@@ -248,7 +253,7 @@
     ...    Check Expected Available Deployment Replicas    voltha    voltha-voltha-go-controller    1
     # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
     # so restart the port forwarding for the API service
-    Restart VOLTHA Port Forward    voltha-api
+    Restart VOLTHA Port Forward    voltha-api 55555:55555
     # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
     # represents system connectivity being restored
     FOR   ${I}    IN RANGE    0    ${olt_count}
@@ -279,6 +284,8 @@
         ...    ${dst['dp_iface_name']}    ${dst['ip']}    ${dst['user']}    ${dst['pass']}    ${dst['container_type']}
         ...    ${dst['container_name']}
     END
+    Restart VOLTHA Port Forward    voltha-api
+    ${port_fwd}    Start Process    kubectl -n voltha port-forward svc/${kafka} ${KAFKA_PORT}:${KAFKA_PORT} --address 0.0.0.0 &    shell=true
 
 Verify OLT Soft Reboot for DT
     [Documentation]    Test soft reboot of the OLT using voltctl command
@@ -293,7 +300,7 @@
         ...    Validate OLT Device    ENABLED    ACTIVE
         ...    REACHABLE    ${olt_serial_number}
         # Reboot the OLT using "voltctl device reboot" command
-        Reboot Device    ${olt_device_id}
+        Wait Until Keyword Succeeds    360s    5s    Reboot Device    ${olt_device_id}
         # Wait for the OLT to actually go down
         Wait Until Keyword Succeeds    360s    5s    Validate OLT Device    ENABLED    UNKNOWN    UNREACHABLE
         ...    ${olt_serial_number}
@@ -509,6 +516,7 @@
     # of now. And there is no other to check if the reconcile has happened for all the OLTs. Due to this limitations a
     # sleep of 60s is introduced to give enough time for rw core to reconcile the OLTs."
     Sleep   60s
+    ${port_fwd}    Start Process    kubectl -n voltha port-forward svc/${kafka} ${KAFKA_PORT}:${KAFKA_PORT} --address 0.0.0.0 &    shell=true
     Verify Control Plane After Pod Restart DT
 
 *** Keywords ***