Framework for logging

Change-Id: If578d2801fd48dbde09927239d82aa4bef10e5ae
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index adca1fe..d7dc48a 100644
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -40,6 +40,30 @@
     ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device enable ${device_id}
     Should Be Equal As Integers    ${rc}    0
 
+Get Device Flows from Voltha
+    [Arguments]    ${device_id}
+    ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device flows ${device_id}
+    Should Be Equal As Integers    ${rc}    0
+    [Return]    ${output}
+
+Get Logical Device Output from Voltha
+    [Arguments]    ${device_id}
+    ${rc1}    ${flows}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl logicaldevice flows ${device_id}
+    ${rc2}    ${ports}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl logicaldevice ports ${device_id}
+    Log    ${flows}
+    Log    ${ports}
+    Should Be Equal As Integers    ${rc1}    0
+    Should Be Equal As Integers    ${rc2}    0
+
+Get Device Output from Voltha
+    [Arguments]    ${device_id}
+    ${rc1}    ${flows}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device flows ${device_id}
+    ${rc2}    ${ports}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device ports ${device_id}
+    Log    ${flows}
+    Log    ${ports}
+    Should Be Equal As Integers    ${rc1}    0
+    Should Be Equal As Integers    ${rc2}    0
+
 Validate Device
     [Arguments]    ${serial_number}    ${admin_state}    ${oper_status}    ${connect_status}    ${onu_reason}=${EMPTY}    ${onu}=False
     [Documentation]    Parses the output of "voltctl device list" and inspects device ${serial_number}
@@ -76,6 +100,20 @@
     \    Run Keyword If    '${sn}' == '${serial_number}'    Exit For Loop
     [Return]    ${id}
 
+Get Logical Device ID From SN
+    [Arguments]    ${serial_number}
+    [Documentation]    Gets the device id by matching for ${serial_number}
+    ${output}=    Run    ${VOLTCTL_CONFIG}; voltctl device list -o json
+    ${jsondata}=    To Json    ${output}
+    Log    ${jsondata}
+    ${length}=    Get Length    ${jsondata}
+    : FOR    ${INDEX}    IN RANGE    0    ${length}
+    \    ${value}=    Get From List    ${jsondata}    ${INDEX}
+    \    ${id}=    Get From Dictionary    ${value}    parentid
+    \    ${sn}=    Get From Dictionary    ${value}    serialnumber
+    \    Run Keyword If    '${sn}' == '${serial_number}'    Exit For Loop
+    [Return]    ${id}
+
 Validate Device Removed
     [Arguments]    ${id}
     [Documentation]    Verifys that device, ${serial_number}, has been removed
@@ -88,4 +126,4 @@
     \    ${value}=    Get From List    ${jsondata}    ${INDEX}
     \    ${device_id}=    Get From Dictionary    ${value}    id
     \    Append To List    ${ids}    ${device_id}
-    List Should Not Contain Value    ${ids}    ${id}
\ No newline at end of file
+    List Should Not Contain Value    ${ids}    ${id}
diff --git a/tests/Voltha_PODTests.robot b/tests/Voltha_PODTests.robot
index 6801228..d73437d 100644
--- a/tests/Voltha_PODTests.robot
+++ b/tests/Voltha_PODTests.robot
@@ -22,11 +22,11 @@
 Library           OperatingSystem
 Library           XML
 Library           RequestsLibrary
-Library           %{HOME}/voltha/tests/atests/common/testCaseUtils.py
-Resource          %{HOME}/cord-tester/src/test/cord-api/Framework/Subscriber.robot
-Resource          %{HOME}/cord-tester/src/test/cord-api/Framework/OLT.robot
-Resource          %{HOME}/cord-tester/src/test/cord-api/Framework/DHCP.robot
-Resource          %{HOME}/cord-tester/src/test/cord-api/Framework/Kubernetes.robot
+Library           ../../voltha/tests/atests/common/testCaseUtils.py
+Resource          ../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
+Resource          ../../cord-tester/src/test/cord-api/Framework/Voltha_OLT.robot
+Resource          ../../cord-tester/src/test/cord-api/Framework/DHCP.robot
+Resource          ../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
 Resource          ../libraries/onos.robot
 Resource          ../libraries/voltctl.robot
 Resource          ../libraries/utils.robot
@@ -43,6 +43,7 @@
 ${timeout}          90s
 ${num_onus}         1
 ${of_id}            0
+${logical_id}            0
 
 *** Test Cases ***
 Sanity E2E Test for OLT/ONU on POD
@@ -104,22 +105,25 @@
 
 Setup
     #create/preprovision device
-    ${olt_device_id}=    Create Device    ${olt_ip}    ${OLT_PORT}
-    Set Suite Variable    ${olt_device_id}
+    #${olt_device_id}=    Create Device    ${olt_ip}    ${OLT_PORT}
+    #Set Suite Variable    ${olt_device_id}
     #enable device
-    Enable Device    ${olt_device_id}
+    #Enable Device    ${olt_device_id}
     #validate olt states
     Wait Until Keyword Succeeds    60s    5s    Validate Device    ${olt_serial_number}    ENABLED    ACTIVE    REACHABLE
     #validate onu states
-    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${onu_serial_number}    ENABLED    ACTIVE    REACHABLE    onu=True    onu_reason=tech-profile-config-download-success
+    #Wait Until Keyword Succeeds    60s    5s    Validate Device    ${onu_serial_number}    ENABLED    ACTIVE    REACHABLE    onu=True    onu_reason=tech-profile-config-download-success
     #get onu device id
     ${onu_device_id}=    Get Device ID From SN    ${onu_serial_number}
     Set Suite Variable    ${onu_device_id}
+    ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
+    Set Suite Variable    ${logical_id}
 
 Teardown
     [Documentation]    kills processes and cleans up interfaces on src+dst servers
-    Get VOLTHA Status
-    Get ONOS Status
+    Get Device Output from Voltha    ${of_id}
+    Get Logical Device Output from Voltha    ${logical_id}
+    Get ONOS Command output    ${k8s_node_ip}
     Clean Up Linux
     Log Kubernetes Containers Logs Since Time    ${datetime}    ${container_list}