VOL-1821: Voltha 2.0 Functional Test Case: OLT Provisioning and Enabling (BBSIM)
VOL-1822: Voltha 2.0 Functional Test Case: ONU Discovery (BBSIM)

First two Functional Test Cases to run in its own Kind Voltha framework
in a new Jenkins Job to be run at given periods during the day (nightly?)
This uses BBSIM with 16 ONUs and is intented to perform more indept testing
than what the sanity tests does
Added config and sadis files to handle 8 pon, 2 onus or single pon, 16 onus

Change-Id: I4a02bbffacb24b76f2166366b47437120b91ce67
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index 70c08c8..37d2690 100644
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -60,9 +60,8 @@
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${dst}=    Set Variable    ${hosts.dst[${I}]}
 
-        ${onu_reasons}=    Create List     tech-profile-config-download-success    omci-flows-pushed
-        Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device    ${src['onu']}    ENABLED    ACTIVE
-        ...    REACHABLE    onu=True    onu_reasons=${onu_reasons}
+        Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device        ENABLED    ACTIVE    REACHABLE
+        ...    ${src['onu']}    onu=True    onu_reason=omci-flows-pushed
 
         ${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']}
@@ -109,7 +108,6 @@
     ${onos_auth}=    Create List    karaf    karaf
     ${HEADERS}    Create Dictionary    Content-Type=application/json
     Create Session    ONOS    http://${k8s_node_ip}:${ONOS_REST_PORT}    auth=${ONOS_AUTH}
-    Set Global Variable    ${export_kubeconfig}    export KUBECONFIG=${KUBERNETES_CONF}
     ${olt_ip}=    Evaluate    ${olts}[0].get("ip")
     ${olt_user}=    Evaluate    ${olts}[0].get("user")
     ${olt_pass}=    Evaluate    ${olts}[0].get("pass")
@@ -130,15 +128,20 @@
     ${datetime}=    Get Current Date
     Set Suite Variable    ${datetime}
 
-
 Setup
     [Documentation]    Pre-test Setup
+    #test for empty device list
+    ${length}=    Test Empty Device List
+    Should Be Equal As Integers  ${length}     0
     #create/preprovision device
     ${olt_device_id}=    Create Device    ${olt_ip}    ${OLT_PORT}
     Set Suite Variable    ${olt_device_id}
+    #validate olt states
+    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    PREPROVISIONED    UNKNOWN    UNKNOWN
+    ...    ${EMPTY}    ${olt_device_id}
     Enable Device    ${olt_device_id}
-    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device    ${olt_serial_number}    ENABLED    ACTIVE
-    ...    REACHABLE
+    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    ENABLED    ACTIVE    REACHABLE
+    ...    ${olt_serial_number}
     ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
     Set Suite Variable    ${logical_id}
 
@@ -153,9 +156,12 @@
 Teardown Suite
     [Documentation]    Clean up device if desired
     Run Keyword If    ${teardown_device}    Delete Device and Verify
+    ${length}=    Run Keyword If    ${teardown_device}    Run Keyword And Return    Test Empty Device List
+    Run Keyword If    ${teardown_device}    Should Be Equal As Integers    ${length}    0
     Run Keyword If    ${teardown_device}    Execute ONOS CLI Command    ${k8s_node_ip}    ${ONOS_SSH_PORT}
     ...    device-remove ${of_id}
 
+
 Clean Up Linux
     [Documentation]    Kill processes and clean up interfaces on src+dst servers
     FOR    ${I}    IN RANGE    0    ${num_onus}
@@ -179,8 +185,8 @@
     [Documentation]    Disable -> Delete devices via voltctl and verify its removed
     ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
     Should Be Equal As Integers    ${rc}    0
-    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device    ${olt_serial_number}    DISABLED    UNKNOWN
-    ...    REACHABLE
+    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
+    ...    ${olt_serial_number}
     ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
     Should Be Equal As Integers    ${rc}    0
     Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device Removed    ${olt_device_id}