Build virtualenv using the Makefile

Add tidy target (don't use yet as there's a bug)

Make lint target cover all the files

Start at documentation generation using libdoc/testdoc within robot

Change-Id: I8117baf4bd006588ae9383e0731c49e17102348c
diff --git a/tests/Voltha_PODTests.robot b/tests/Voltha_PODTests.robot
index f55afc0..6d1949d 100644
--- a/tests/Voltha_PODTests.robot
+++ b/tests/Voltha_PODTests.robot
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 *** Settings ***
-Documentation     Test various end-to-end scenarios 
+Documentation     Test various end-to-end scenarios
 Suite Setup       Setup Suite
 Test Setup        Setup
 Test Teardown     Teardown
@@ -33,38 +33,41 @@
 Resource          ../variables/variables.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
-${timeout}          90s
-${num_onus}         1
-${of_id}            0
-${logical_id}            0
+${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
+${timeout}        90s
+${num_onus}       1
+${of_id}          0
+${logical_id}     0
 
 *** Test Cases ***
 Sanity E2E Test for OLT/ONU on POD
     [Documentation]    Validates E2E Ping Connectivity and object states for the given scenario:
     ...    Validate successful authentication/DHCP/E2E ping for the tech profile that is used
-    #[Setup]    Clean Up Linux
     [Tags]    test1
-    ${of_id}=    Wait Until Keyword Succeeds    60s    15s    Validate OLT Device in ONOS   ${olt_serial_number}
-    #Wait Until Keyword Succeeds    60s    2s    Verify Eapol Flows Added   ${k8s_node_ip}    ${ONOS_SSH_PORT}    5
-    Validate Authentication    True    ${src0['dp_iface_name']}    wpa_supplicant.conf    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}
+    #[Setup]    Clean Up Linux
+    ${of_id}=    Wait Until Keyword Succeeds    60s    15s    Validate OLT Device in ONOS    ${olt_serial_number}
+    #Wait Until Keyword Succeeds    60s    2s    Verify Eapol Flows Added    ${k8s_node_ip}    ${ONOS_SSH_PORT}    5
+    Validate Authentication    True    ${src0['dp_iface_name']}    wpa_supplicant.conf    ${src0['ip']}    ${src0['user']}    ${src0['pass']}
+    ...    ${src0['container_type']}    ${src0['container_name']}
     #Validate ONU authenticated in ONOS
     Wait Until Keyword Succeeds    90s    2s    Verify Number of AAA-Users    ${k8s_node_ip}    ${ONOS_SSH_PORT}    ${num_onus}
     Wait Until Keyword Succeeds    60s    2s    Execute ONOS Command    ${k8s_node_ip}    ${ONOS_SSH_PORT}    volt-add-subscriber-access ${of_id} 16
     # Perform dhclient and ping operations
-    Validate DHCP and Ping    True    True    ${src0['dp_iface_name']}    ${src0['s_tag']}    ${src0['c_tag']}    ${dst0['dp_iface_ip_qinq']}    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}    ${dst0['dp_iface_name']}    ${dst0['ip']}    ${dst0['user']}    ${dst0['pass']}    ${dst0['container_type']}    ${dst0['container_name']}
+    Validate DHCP and Ping    True    True    ${src0['dp_iface_name']}    ${src0['s_tag']}    ${src0['c_tag']}    ${dst0['dp_iface_ip_qinq']}
+    ...    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}    ${dst0['dp_iface_name']}
+    ...    ${dst0['ip']}    ${dst0['user']}    ${dst0['pass']}    ${dst0['container_type']}    ${dst0['container_name']}
     #Validate DHCP allocation in ONOS
-    Wait Until Keyword Succeeds    60s    2s    Validate DHCP Allocations    ${k8s_node_ip}    ${ONOS_SSH_PORT}     ${num_onus}
-
+    Wait Until Keyword Succeeds    60s    2s    Validate DHCP Allocations    ${k8s_node_ip}    ${ONOS_SSH_PORT}    ${num_onus}
 
 *** Keywords ***
 Setup Suite
+    [Documentation]    Setup the whole test suite
     Set Global Variable    ${KUBECTL_CONFIG}    export KUBECONFIG=%{KUBECONFIG}
     Set Global Variable    ${export_kubeconfig}    export KUBECONFIG=${KUBERNETES_CONF}
     Set Global Variable    ${of_id}
@@ -104,15 +107,18 @@
     Set Suite Variable    ${datetime}
 
 Setup
+    [Documentation]    Pre-test Setup
     #create/preprovision device
     ${olt_device_id}=    Create Device    ${olt_ip}    ${OLT_PORT}
     Set Suite Variable    ${olt_device_id}
     #enable device
     Enable Device    ${olt_device_id}
     #validate olt states
-    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${olt_serial_number}    ENABLED    ACTIVE    REACHABLE
+    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}
@@ -129,9 +135,12 @@
 
 Clean Up Linux
     [Documentation]    Kill processes and clean up interfaces on src+dst servers
-    Run Keyword And Ignore Error    Kill Linux Process    [w]pa_supplicant    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}
-    Run Keyword And Ignore Error    Kill Linux Process    [d]hclient    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}
-    Run Keyword If    '${dst0['ip']}' != '${None}'    Run Keyword And Ignore Error    Kill Linux Process    [d]hcpd    ${dst0['ip']}    ${dst0['user']}    ${dst0['pass']}    ${dst0['container_type']}    ${dst0['container_name']}
+    Run Keyword And Ignore Error    Kill Linux Process    [w]pa_supplicant    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}
+    ...    ${src0['container_name']}
+    Run Keyword And Ignore Error    Kill Linux Process    [d]hclient    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}
+    ...    ${src0['container_name']}
+    Run Keyword If    '${dst0['ip']}' != '${None}'    Run Keyword And Ignore Error    Kill Linux Process    [d]hcpd    ${dst0['ip']}    ${dst0['user']}
+    ...    ${dst0['pass']}    ${dst0['container_type']}    ${dst0['container_name']}
     Delete IP Addresses from Interface on Remote Host    ${src0['dp_iface_name']}    ${src0['ip']}    ${src0['user']}    ${src0['pass']}    ${src0['container_type']}    ${src0['container_name']}
-    Run Keyword If    '${dst0['ip']}' != '${None}'    Delete Interface on Remote Host    ${dst0['dp_iface_name']}.${src0['s_tag']}    ${dst0['ip']}    ${dst0['user']}    ${dst0['pass']}    ${dst0['container_type']}    ${dst0['container_name']}
-
+    Run Keyword If    '${dst0['ip']}' != '${None}'    Delete Interface on Remote Host    ${dst0['dp_iface_name']}.${src0['s_tag']}    ${dst0['ip']}    ${dst0['user']}    ${dst0['pass']}
+    ...    ${dst0['container_type']}    ${dst0['container_name']}
diff --git a/tests/sanity/sanity.robot b/tests/sanity/sanity.robot
index 00324df..2fb7794 100644
--- a/tests/sanity/sanity.robot
+++ b/tests/sanity/sanity.robot
@@ -17,19 +17,19 @@
 Documentation     Creates bbsim olt/onu and validates activataion
 ...               Assumes voltha-go, go-based onu/olt adapters, and bbsim are installed
 ...               voltctl and kubectl should be configured prior to running these tests
+Suite Setup       Setup
+Suite Teardown    Teardown
+Test Teardown     Execute ONOS CLI Command    ${server_ip}    ${ONOS_SSH_PORT}    flows -s
 Library           OperatingSystem
 Resource          ${CURDIR}/../../libraries/onos.robot
 Resource          ${CURDIR}/../../libraries/voltctl.robot
 Resource          ${CURDIR}/../../libraries/utils.robot
 Resource          ${CURDIR}/../../variables/variables.robot
-Suite Setup       Setup
-Suite Teardown    Teardown
-Test Teardown     Execute ONOS CLI Command    ${server_ip}    ${ONOS_SSH_PORT}    flows -s
 
 *** Variables ***
-${server_ip}        localhost
-${timeout}          90s
-${num_onus}         1
+${server_ip}      localhost
+${timeout}        90s
+${num_onus}       1
 
 *** Test Cases ***
 Activate Device BBSIM OLT/ONU
@@ -43,9 +43,11 @@
     #enable device
     Enable Device    ${olt_device_id}
     #validate olt states
-    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_OLT_SN}    ENABLED    ACTIVE    REACHABLE
+    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_OLT_SN}    ENABLED    ACTIVE
+    ...    REACHABLE
     #validate onu states
-    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_ONU_SN}    ENABLED    ACTIVE    REACHABLE    onu=True    onu_reason=tech-profile-config-download-success
+    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_ONU_SN}    ENABLED    ACTIVE
+    ...    REACHABLE    onu=True    onu_reason=tech-profile-config-download-success
     #get onu device id
     ${onu_device_id}=    Get Device ID From SN    ${BBSIM_ONU_SN}
     Set Suite Variable    ${onu_device_id}
@@ -71,16 +73,16 @@
 Add Subscriber-Access in ONOS
     [Documentation]    Through the olt-app in ONOS, execute 'volt-add-subscriber-access' and validate IP Flows
     [Tags]    sanity
-    ##     TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes
-    ...    prior to to dhclient starting. possible start a process after first test case to just attempt
-    ...    "volt-add-subscriber-access" to all onus periodically?
+    ##    TODO: this works fine with 1 onu, but with multiple onus, we need to ensure this is executes
+    ##    prior to to dhclient starting. possible start a process after first test case to just attempt
+    ##    "volt-add-subscriber-access" to all onus periodically?
     ${output}=    Execute ONOS CLI Command    ${server_ip}    ${ONOS_SSH_PORT}    volt-add-subscriber-access ${of_id} 16
     Log    ${output}
 
 Validate DHCP Assignment in ONOS
     [Documentation]    After IP Flows are pushed to the device, BBSIM will start a dhclient for the ONU.
     [Tags]    sanity
-    Wait Until Keyword Succeeds    120s    15s    Validate DHCP Allocations    ${server_ip}    ${ONOS_SSH_PORT}     ${num_onus}
+    Wait Until Keyword Succeeds    120s    15s    Validate DHCP Allocations    ${server_ip}    ${ONOS_SSH_PORT}    ${num_onus}
 
 Delete Device and Verify
     [Documentation]    Disable -> Delete devices via voltctl and verify its removed
@@ -88,14 +90,16 @@
     #disable/delete onu
     ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
     Should Be Equal As Integers    ${rc}    0
-    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_ONU_SN}    DISABLED    UNKNOWN    REACHABLE
+    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_ONU_SN}    DISABLED    UNKNOWN
+    ...    REACHABLE
     ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
     Should Be Equal As Integers    ${rc}    0
     Wait Until Keyword Succeeds    60s    5s    Validate Device Removed    ${onu_device_id}
     #disable/delete olt
     ${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    60s    5s    Validate Device    ${BBSIM_OLT_SN}    DISABLED    UNKNOWN    REACHABLE
+    Wait Until Keyword Succeeds    60s    5s    Validate Device    ${BBSIM_OLT_SN}    DISABLED    UNKNOWN
+    ...    REACHABLE
     ${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    60s    5s    Validate Device Removed    ${olt_device_id}