Changing the way VOLTCONFIG is passed to voltctl, required to support dynamic changes of the config for multi-stack setups

Change-Id: I23ab2500255c35207df9c368d2656e502337dff2
diff --git a/tests/functional/Voltha_ErrorScenarios.robot b/tests/functional/Voltha_ErrorScenarios.robot
index d317236..458a89d 100644
--- a/tests/functional/Voltha_ErrorScenarios.robot
+++ b/tests/functional/Voltha_ErrorScenarios.robot
@@ -82,7 +82,7 @@
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    PREPROVISIONED    UNKNOWN    UNKNOWN
         ...    ${olt_device_id}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device create -t openolt -H ${olt_ip}:${OLT_PORT}
         Should Not Be Equal As Integers    ${rc}    0
         Should Contain     ${output}     device is already pre-provisioned    ignore_case=True
         #Enable the created OLT device
@@ -90,7 +90,7 @@
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    ENABLED    ACTIVE    REACHABLE
         ...    ${olt_serial_number}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device create -t openolt -H ${olt_ip}:${OLT_PORT}
         Should Not Be Equal As Integers    ${rc}    0
         Log    ${output}
         Should Contain     ${output}    device is already pre-provisioned    ignore_case=True
@@ -106,7 +106,7 @@
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    DisableInvalidDevice
     Run Keyword and Ignore Error   Collect Logs
-    ${rc}  ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device list -o json
+    ${rc}  ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device list -o json
     Should Be Equal As Integers    ${rc}    0
     ${jsondata}=    To Json    ${output}
     Log    ${jsondata}
@@ -123,12 +123,12 @@
     #Ensure that the new id created is not in the device id list
     List Should Not Contain Value    ${ids}    ${fakeDeviceId}
     #Disable fake device id
-    ${rc}  ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
+    ${rc}  ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device disable ${fakeDeviceId}
     Should Contain    ${output}     Error while disabling '${fakeDeviceId}'
     #Disable device for VOL-2413
     Disable Device    ${device_id}
     #Enable fake device id
-    ${rc}  ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
+    ${rc}  ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device enable ${fakeDeviceId}
     Should Contain    ${output}     Error while enabling '${fakeDeviceId}'
 
 Check deletion of OLT/ONU before disabling
@@ -153,7 +153,7 @@
         #${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    ENABLED    ACTIVE    REACHABLE
         ...   REACHABLE    ${olt_serial_number}
-        ${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
+        ${rc}    ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
         Log    ${output}
         Should Contain     ${output}     expected-admin-state:DISABLED
         Wait Until Keyword Succeeds    ${timeout}    5s
@@ -169,7 +169,7 @@
 	Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
 	...    ENABLED    ACTIVE    REACHABLE
 	...    ${src['onu']}    onu=True    onu_reason=omci-flows-pushed
-	${rc}    ${output}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
+	${rc}    ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device delete ${onu_device_id}
 	Log    ${output}
 	Should Contain     ${output}     expected-admin-state:DISABLED
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
@@ -202,7 +202,7 @@
         ...    UNKNOWN    ${olt_device_id}
         #Try disabling pre-provisioned OLT
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
         Should Not Be Equal As Integers    ${rc}    0
         Log    ${output}
         Should Contain     ${output}     invalid-admin-state:PREPROVISIONED
@@ -251,18 +251,18 @@
         ...    REACHABLE    ${olt_serial_number}
         #Check whether logical devices are also created
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl logicaldevice list
+        ...    voltctl -c ${VOLTCTL_CONFIG} logicaldevice list
         Should Be Equal As Integers    ${rc}    0
         Log    ${output}
         ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
         Should Not Be Empty    ${logical_id}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} logicaldevice disable ${logical_id}
         Should Not Be Equal As Integers    ${rc}    0
         Log    ${output}
         Should Contain     '${output}'     Unknown command
         ${rc}    ${output1}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} logicaldevice delete ${logical_id}
         Should Not Be Equal As Integers    ${rc}    0
         Log    ${output1}
         Should Contain     '${output1}'     Unknown command
@@ -298,7 +298,7 @@
         ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
         Should Not Be Empty    ${logical_id}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl logicaldevice list
+        ...    voltctl -c ${VOLTCTL_CONFIG} logicaldevice list
         Should Be Equal As Integers    ${rc}    0
         Log    ${output}
         Should Contain     ${output}    ${olt_device_id}
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index 72414cd..21e0ca5 100644
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -295,7 +295,7 @@
         ${olt_serial_number}=    Get From Dictionary    ${olt_ids}[${I}]    sn
         ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
         Should Be Equal As Integers    ${rc}    0
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
         ...    ${olt_serial_number}
@@ -424,7 +424,7 @@
         ...    Validate OLT Device    ENABLED    ACTIVE
         ...    REACHABLE    ${src['olt']}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device disable ${onu_device_id}
         Should Be Equal As Integers    ${rc}    0
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate Device    DISABLED    UNKNOWN
@@ -433,12 +433,13 @@
         ...    Validate OLT Device    ENABLED    ACTIVE
         ...    REACHABLE    ${src['olt']}
     END
+
     # Disable all OLTs
     FOR   ${I}    IN RANGE    0    ${olt_count}
         ${olt_serial_number}=    Get From Dictionary    ${olt_ids}[${I}]    sn
         ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
         ${rc}    ${output}=    Run and Return Rc and Output
-        ...    ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
+        ...    voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
         Should Be Equal As Integers    ${rc}    0
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
         ...    ${olt_serial_number}
diff --git a/tests/functional/Voltha_ScaleFunctionalTests.robot b/tests/functional/Voltha_ScaleFunctionalTests.robot
index 9ea1d93..6858aa5 100644
--- a/tests/functional/Voltha_ScaleFunctionalTests.robot
+++ b/tests/functional/Voltha_ScaleFunctionalTests.robot
@@ -213,7 +213,7 @@
 
 Delete Device and Verify
     [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}
+    ${rc}    ${output}=    Run and Return Rc and Output    voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
     Should Be Equal As Integers    ${rc}    0
     Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
     ...    ${olt_serial_number}
diff --git a/tests/functional/Voltha_multipleOLTTests.robot b/tests/functional/Voltha_multipleOLTTests.robot
index 7161d6d..831afc1 100755
--- a/tests/functional/Voltha_multipleOLTTests.robot
+++ b/tests/functional/Voltha_multipleOLTTests.robot
@@ -67,7 +67,7 @@
 Setup Suite
     [Documentation]    Setup the test suite
     Set Global Variable    ${KUBECTL_CONFIG}    export KUBECONFIG=%{KUBECONFIG}
-    Set Global Variable    ${VOLTCTL_CONFIG}    export VOLTCONFIG=%{VOLTCONFIG}
+    Set Global Variable    ${VOLTCTL_CONFIG}    %{VOLTCONFIG}
     ${k8s_node_ip}=    Evaluate    ${nodes}[0].get("ip")
     ${ONOS_REST_IP}=    Get Environment Variable    ONOS_REST_IP    ${k8s_node_ip}
     ${ONOS_SSH_IP}=     Get Environment Variable    ONOS_SSH_IP     ${k8s_node_ip}
diff --git a/tests/scale/Voltha_Scale_Tests.robot b/tests/scale/Voltha_Scale_Tests.robot
index b649378..1d5c849 100644
--- a/tests/scale/Voltha_Scale_Tests.robot
+++ b/tests/scale/Voltha_Scale_Tests.robot
@@ -172,6 +172,7 @@
     FOR    ${olt_device_id}    IN  @{olt_device_ids}
         Disable Device  ${olt_device_id}
         Delete Device  ${olt_device_id}
+        Remove Values From List     ${olt_device_ids}   ${olt_device_id}
     END
 
     Set Suite Variable    ${olt_device_ids}
@@ -180,7 +181,7 @@
 Setup Suite
     [Documentation]    Setup test global variables, open an SSH connection to ONOS and starts a timer
     Set Suite Variable    ${KUBECTL_CONFIG}    export KUBECONFIG=%{KUBECONFIG}
-    Set Suite Variable    ${VOLTCTL_CONFIG}    export VOLTCONFIG=%{VOLTCONFIG}
+    Set Suite Variable    ${VOLTCTL_CONFIG}    %{VOLTCONFIG}
 
     ${total_onus}=   Evaluate    ${olt} * ${pon} * ${onu}
     Set Suite Variable  ${total_onus}