VOL-1532: BBSim OLT preprovisioning test case
VOL-1533: BBSim OLT/ONU Discovery
Fix issus with pod list no longer printing to console
Change-Id: I9309aee43306e8ca36d0b59e6942db51a929eca7
diff --git a/tests/atests/common/auto_test.py b/tests/atests/common/auto_test.py
index d93e7b5..6e21842 100755
--- a/tests/atests/common/auto_test.py
+++ b/tests/atests/common/auto_test.py
@@ -31,12 +31,20 @@
import logging
DEFAULT_LOG_DIR = '/tmp/voltha_test_results'
+DEFAULT_ADAPTER = 'ponsim'
logging.basicConfig(level=logging.INFO)
def dir_init(log_dir=DEFAULT_LOG_DIR, voltha_dir=os.environ['VOLTHA_BASE']):
- logging.info(__file__)
"""
+
+ :param log_dir: default log dir
+ :param voltha_dir: voltha base dir
+ :return: root_dir, voltha_dir, log_dir
+ """
+ logging.info(__file__)
+
+ """
Init automated testing environment and return three directories: root dir,
voltha sources dir and log dir
"""
@@ -58,6 +66,31 @@
return root_dir, voltha_dir, log_dir
+def adapter_init(adapter=DEFAULT_ADAPTER):
+ """
+
+ :param adapter: ponsim or bbsim
+ :return: olt_type, onu_type, olt_host_ip, onu_count
+ """
+ if adapter == 'ponsim':
+ olt_type = 'ponsim_olt'
+ onu_type = 'ponsim_onu'
+ olt_host_ip = 'olt.voltha.svc'
+ onu_count = 1
+ elif adapter == 'bbsim':
+ olt_type = 'openolt'
+ onu_type = 'brcm_openomci_onu'
+ olt_host_ip = 'bbsim.voltha.svc'
+ onu_count = 16
+ else:
+ olt_type = None
+ onu_type = None
+ olt_host_ip = None
+ onu_count = 0
+
+ return olt_type, onu_type, olt_host_ip, onu_count
+
+
#
# MAIN
#
@@ -69,20 +102,21 @@
parser = argparse.ArgumentParser(description='VOLTHA Automated Testing')
parser.add_argument('-l', dest='logDir', default=DEFAULT_LOG_DIR,
help='log directory (default: %s).' % DEFAULT_LOG_DIR)
+ parser.add_argument('-a', dest='adapter', choices=['ponsim', 'bbsim'], default=DEFAULT_ADAPTER,
+ help='adapter (default: %s).' % DEFAULT_ADAPTER)
args = parser.parse_args()
ROOT_DIR, VOLTHA_DIR, LOG_DIR = dir_init(args.logDir)
+ OLT_TYPE, ONU_TYPE, OLT_HOST_IP, ONU_COUNT = adapter_init(args.adapter)
- volthaMngr.voltha_initialize(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
+ volthaMngr.voltha_initialize(ROOT_DIR, VOLTHA_DIR, LOG_DIR, args.adapter)
- preprovisioning.run_test('olt.voltha.svc', 50060, 'ponsim_olt', 'ponsim_onu', LOG_DIR)
-
- discovery.run_test('olt.voltha.svc', 'ponsim_olt', 'ponsim_onu', LOG_DIR)
+ preprovisioning.run_test(OLT_HOST_IP, 50060, OLT_TYPE, ONU_TYPE, ONU_COUNT, LOG_DIR)
+ time.sleep(60)
+ discovery.run_test(OLT_HOST_IP, OLT_TYPE, ONU_TYPE, ONU_COUNT, LOG_DIR)
+ if args.adapter == 'ponsim':
+ authentication.run_test(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
- authentication.run_test(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
+ dhcp.run_test(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
- dhcp.run_test(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
-
- unicast.run_test(ROOT_DIR, VOLTHA_DIR, LOG_DIR)
-
- time.sleep(5)
+ unicast.run_test(ONU_TYPE, ONU_COUNT, ROOT_DIR, VOLTHA_DIR, LOG_DIR)
diff --git a/tests/atests/common/build.sh b/tests/atests/common/build.sh
index 23e9adb..6c0b7ed 100755
--- a/tests/atests/common/build.sh
+++ b/tests/atests/common/build.sh
@@ -16,29 +16,28 @@
SRC_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
BUILD_DIR="$SRC_DIR/../build"
-cd $BUILD_DIR
-
-if [ $# -ne 1 ]
+cd ${BUILD_DIR}
+if [[ $# -ne 2 ]]
then
- echo "No arguments supplied"
+ echo "Wrong number of arguments supplied"
exit 1
fi
-if [ -z "$1" ]
+if [[ -z "${1}" || -z "${2}" ]]
then
echo "Empty argument supplied"
exit 1
fi
-if [ $1 == "clear" ]
+if [[ "${1}" == "clear" ]]
then
sudo make reset-kubeadm
-elif [ $1 == "start" ]
+elif [[ "${1}" == "start" ]]
then
sudo service docker restart
- sudo make -f Makefile
-elif [ $1 == "stop" ]
+ sudo make -f Makefile ${2}
+elif [[ "${1}" == "stop" ]]
then
pods=$( /usr/bin/kubectl get pods --all-namespaces 2>&1 | grep -c -e refused -e resource )
- if [ $pods -eq 0 ]
+ if [[ ${pods} -eq 0 ]]
then
sudo make teardown-charts
fi
diff --git a/tests/atests/common/dhcp.py b/tests/atests/common/dhcp.py
index d52234a..a9acd8e 100644
--- a/tests/atests/common/dhcp.py
+++ b/tests/atests/common/dhcp.py
@@ -70,13 +70,14 @@
def should_now_have_two_dhcp_flows(self):
testCaseUtils.send_command_to_onos_cli(testCaseUtils.get_dir(self, 'log'),
- 'voltha_onos_flows.log', 'flows')
+ 'voltha_onos_flows.log', 'flows -s')
statusLines = testCaseUtils.get_fields_from_grep_command(self, 'IP_PROTO:17', 'voltha_onos_flows.log')
assert statusLines, 'No DHCP Detection flows'
lines = statusLines.splitlines()
+ assert len(lines) == 2, 'Expected 2 DHCP Detection Flows but result was %s' % len(lines)
for line in lines:
self.__fields = testCaseUtils.parse_fields(line, ',')
- inPortStr = self.__fields[10].strip()
+ inPortStr = self.__fields[5].strip()
selector, delimiter, inPort = inPortStr.partition('=[')
assert (inPort == 'IN_PORT:2' or inPort == 'IN_PORT:128'), 'DHCP detection flows not associated with expected ports'
diff --git a/tests/atests/common/discovery.py b/tests/atests/common/discovery.py
index 1c5234a..3f0804f 100755
--- a/tests/atests/common/discovery.py
+++ b/tests/atests/common/discovery.py
@@ -38,6 +38,7 @@
self.__logicalDeviceType = None
self.__oltType = None
self.__onuType = None
+ self.__onuCount = None
self.__fields = []
self.__logicalDeviceId = None
self.__oltDeviceId = None
@@ -47,17 +48,21 @@
def d_set_log_dirs(self, log_dir):
testCaseUtils.config_dirs(self, log_dir)
- def d_configure(self, logical_device_type, olt_type, onu_type):
+ def d_configure(self, logical_device_type, olt_type, onu_type, onu_count):
self.__logicalDeviceType = logical_device_type
self.__oltType = olt_type
self.__onuType = onu_type
+ self.__onuCount = onu_count
def logical_device(self):
logging.info('Logical Device Info')
- statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__logicalDeviceType, 'voltha_devices_after_enable.log')
- assert statusLines, 'No Logical Devices listed under devices'
+ testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
+ 'voltha_logical_devices.log', 'logical_devices')
+ testCaseUtils.print_log_file(self, 'voltha_logical_devices.log')
+ statusLines = testCaseUtils.get_fields_from_grep_command(self, '-i olt', 'voltha_logical_devices.log')
+ assert statusLines, 'No Logical Device listed under logical devices'
self.__fields = testCaseUtils.parse_fields(statusLines, '|')
- self.__logicalDeviceId = self.__fields[4].strip()
+ self.__logicalDeviceId = self.__fields[1].strip()
testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
'voltha_logical_device.log', 'logical_device ' + self.__logicalDeviceId,
'voltha_logical_device_ports.log', 'ports', 'voltha_logical_device_flows.log', 'flows')
@@ -69,18 +74,16 @@
def logical_device_ports_should_exist(self):
statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__oltDeviceId, 'voltha_logical_device_ports.log')
- assert statusLines, 'No Olt device listed under logical device ports'
+ assert statusLines, 'No Olt ports listed under logical device ports'
self.__fields = testCaseUtils.parse_fields(statusLines, '|')
portType = self.__fields[1].strip()
- assert portType == 'nni', 'Port type for %s does not match expected nni' % self.__oltDeviceId
+ assert portType.count('nni') == 1, 'Port type for %s does not match expected nni' % self.__oltDeviceId
for onuDeviceId in self.__onuDeviceIds:
statusLines = testCaseUtils.get_fields_from_grep_command(self, onuDeviceId, 'voltha_logical_device_ports.log')
assert statusLines, 'No Onu device %s listed under logical device ports' % onuDeviceId
- lines = statusLines.splitlines()
- for line in lines:
- self.__fields = testCaseUtils.parse_fields(line, '|')
- portType = self.__fields[1].strip()
- assert portType == 'uni-128', 'Port type for %s does not match expected uni-128' % onuDeviceId
+ self.__fields = testCaseUtils.parse_fields(statusLines, '|')
+ portType = self.__fields[1].strip()
+ assert portType.count('uni') == 1, 'Port type for %s does not match expected uni' % onuDeviceId
def logical_device_should_have_at_least_one_flow(self):
statusLines = testCaseUtils.get_fields_from_grep_command(self, 'Flows', 'voltha_logical_device_flows.log')
@@ -107,6 +110,7 @@
statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__onuType, 'voltha_devices_after_enable.log')
assert statusLines, 'No Onu listed under devices'
lines = statusLines.splitlines()
+ assert len(lines) == self.__onuCount, 'Onu count mismatch found: %s, should be: %s' % (len(lines), self.__onuCount)
for line in lines:
self.__fields = testCaseUtils.parse_fields(line, '|')
onuDeviceId = self.__fields[1].strip()
@@ -127,7 +131,7 @@
self.__fields = testCaseUtils.parse_fields(line, '|')
assert (self.check_states(self.__oltDeviceId) is True), 'States of %s does match expected ' % self.__oltDeviceId
portType = self.__fields[3].strip()
- assert (portType == 'ETHERNET_NNI' or portType == 'PON_OLT'),\
+ assert (portType == 'ETHERNET_NNI' or portType == 'PON_OLT' or portType == 'ETHERNET_UNI'),\
'Port type for %s does not match expected ETHERNET_NNI or PON_OLT' % self.__oltDeviceId
if portType == 'PON_OLT':
self.__peers = self.__fields[7].strip()
@@ -160,10 +164,12 @@
def check_states(self, device_id):
result = True
- adminState = self.__fields[4].strip()
- assert adminState == 'ENABLED', 'Admin State of %s not ENABLED' % device_id
- operatorStatus = self.__fields[5].strip()
- assert operatorStatus == 'ACTIVE', 'Operator Status of %s not ACTIVE' % device_id
+ stateMatchCount = 0
+ for field in self.__fields:
+ field_no_space = field.strip()
+ if field_no_space == 'ENABLED' or field_no_space == 'ACTIVE':
+ stateMatchCount += 1
+ assert stateMatchCount == 2, 'State of %s is not ENABLED or ACTIVE' % device_id
return result
def olt_should_have_at_least_one_flow(self):
@@ -185,10 +191,10 @@
assert int(plainNumber) > 0, 'Zero number of flows for Onu %s' % onuDeviceId
-def run_test(logical_device_type, olt_type, onu_type, log_dir):
+def run_test(logical_device_type, olt_type, onu_type, onu_count, log_dir):
discovery = Discovery()
discovery.d_set_log_dirs(log_dir)
- discovery.d_configure(logical_device_type, olt_type, onu_type)
+ discovery.d_configure(logical_device_type, olt_type, onu_type, onu_count)
discovery.olt_discovery()
discovery.onu_discovery()
discovery.logical_device()
diff --git a/tests/atests/common/preprovisioning.py b/tests/atests/common/preprovisioning.py
index a7f8a7f..fb68634 100755
--- a/tests/atests/common/preprovisioning.py
+++ b/tests/atests/common/preprovisioning.py
@@ -39,23 +39,25 @@
self.__oltPort = None
self.__oltType = None
self.__onuType = None
+ self.__onuCount = None
self.__fields = []
self.__oltDeviceId = None
def p_set_log_dirs(self, log_dir):
testCaseUtils.config_dirs(self, log_dir)
- def p_configure(self, olt_ip_address, olt_port, olt_type, onu_type):
+ def p_configure(self, olt_ip_address, olt_port, olt_type, onu_type, onu_count):
self.__oltIpAddress = olt_ip_address
self.__oltPort = olt_port
self.__oltType = olt_type
self.__onuType = onu_type
+ self.__onuCount = onu_count
def preprovision_olt(self):
logging.info('Do PROVISIONING')
testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
- 'voltha_preprovision_olt.log', 'preprovision_olt -t ponsim_olt -H %s:%s' %
- (self.__oltIpAddress, self.__oltPort))
+ 'voltha_preprovision_olt.log', 'preprovision_olt -t %s -H %s:%s' %
+ (self.__oltType, self.__oltIpAddress, self.__oltPort))
time.sleep(5)
def status_should_be_success_after_preprovision_command(self):
@@ -84,12 +86,12 @@
def check_states(self, dev_type):
result = True
- adminState = self.__fields[7].strip()
- assert adminState == 'ENABLED', 'Admin State of %s not ENABLED' % dev_type
- operatorStatus = self.__fields[8].strip()
- assert operatorStatus == 'ACTIVE', 'Operator Status of %s not ACTIVE' % dev_type
- connectStatus = self.__fields[9].strip()
- assert connectStatus == 'REACHABLE', 'Connect Status of %s not REACHABLE' % dev_type
+ stateMatchCount = 0
+ for field in self.__fields:
+ field_no_space = field.strip()
+ if field_no_space == 'ENABLED' or field_no_space == 'ACTIVE' or field_no_space == 'DISCOVERED' or field_no_space == 'REACHABLE':
+ stateMatchCount += 1
+ assert stateMatchCount == 3, 'State of %s is not ENABLED, ACTIVE or DISCOVERED and REACHABLE' % dev_type
return result
def check_olt_fields_after_enabling(self):
@@ -97,18 +99,17 @@
assert statusLines, 'No Olt listed under devices'
self.__fields = testCaseUtils.parse_fields(statusLines, '|')
assert self.check_states(self.__oltType), 'States of %s does match expected' % self.__oltType
- hostPort = self.__fields[11].strip()
- assert hostPort, 'hostPort field is empty'
- hostPortFields = hostPort.split(":")
- assert hostPortFields[0] == self.__oltIpAddress or hostPortFields[1] == str(self.__oltPort), \
- 'Olt IP or Port does not match'
-
+ for field in self.__fields:
+ if field.strip() == self.__oltIpAddress + ':' + str(self.__oltPort):
+ hostPortCount = True
+ assert hostPortCount, 'hostPort field is empty or Olt IP and/or Port does not match'
+
def check_onu_fields_after_enabling(self):
statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__onuType, 'voltha_devices_after_enable.log')
assert statusLines, 'No Onu listed under devices'
lines = statusLines.splitlines()
lenLines = len(lines)
- assert lenLines == 1, 'Fixed single onu does not match, ONU Count was %d' % lenLines
+ assert lenLines == self.__onuCount, ' Discovered onu(s) does not match, ONU Count was %d' % lenLines
for line in lines:
self.__fields = testCaseUtils.parse_fields(line, '|')
assert (self.check_states(self.__onuType) is True), 'States of %s does match expected' % self.__onuType
@@ -128,10 +129,10 @@
testCaseUtils.print_log_file(self, 'voltha_devices_after_enable.log')
-def run_test(olt_ip_address, olt_port, olt_type, onu_type, log_dir):
+def run_test(olt_ip_address, olt_port, olt_type, onu_type, onu_count, log_dir):
preprovisioning = Preprovisioning()
preprovisioning.p_set_log_dirs(log_dir)
- preprovisioning.p_configure(olt_ip_address, olt_port, olt_type, onu_type)
+ preprovisioning.p_configure(olt_ip_address, olt_port, olt_type, onu_type, onu_count)
preprovisioning.preprovision_olt()
preprovisioning.status_should_be_success_after_preprovision_command()
preprovisioning.query_devices_before_enabling()
diff --git a/tests/atests/common/run_robot.sh b/tests/atests/common/run_robot.sh
index b86a267..84e6bcd 100755
--- a/tests/atests/common/run_robot.sh
+++ b/tests/atests/common/run_robot.sh
@@ -16,7 +16,13 @@
SRC_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
VOLTHA_DIR="$SRC_DIR/../../.."
-echo "Run Robot Framework TEST. Log: $1"
-cd $VOLTHA_DIR
+echo "Run Robot Framework TEST. Log: $1, Adapter: ${2:-ponsim}"
+cd ${VOLTHA_DIR}
source env.sh
-robot -d $1 -v LOG_DIR:$1/voltha_test_results ./tests/atests/robot/voltha_automated_test_suite.robot
+if [[ "${2:-ponsim}" == "ponsim" ]]
+ then
+ robot -d $1 -v LOG_DIR:$1/voltha_test_results -v ADAPTER:ponsim ./tests/atests/robot/voltha_automated_test_suite.robot
+elif [[ "${2}" == "bbsim" ]]
+ then
+ robot -d $1 -v LOG_DIR:$1/voltha_test_results -v ADAPTER:bbsim -e ponsim ./tests/atests/robot/voltha_automated_test_suite.robot
+fi
\ No newline at end of file
diff --git a/tests/atests/common/unicast.py b/tests/atests/common/unicast.py
index 66db06f..69d3d1a 100644
--- a/tests/atests/common/unicast.py
+++ b/tests/atests/common/unicast.py
@@ -22,7 +22,7 @@
import testCaseUtils
import logging
import subprocess
-import commands
+import json
class Unicast(object):
@@ -42,12 +42,20 @@
self.__rgName = testCaseUtils.discover_rg_pod_name()
self.__fields = None
self.__tcpdumpPid = None
+ self.__onuType = None
+ self.__onuCount = None
+ self.__onuSerialNum = []
self.__sadisCTag = None
self.__sadisSTag = None
+ self.__datastore = None
def u_set_log_dirs(self, root_dir, voltha_dir, log_dir):
testCaseUtils.config_dirs(self, log_dir, root_dir, voltha_dir)
+ def u_configure(self, onu_type, onu_count):
+ self.__onuType = onu_type
+ self.__onuCount = onu_count
+
def execute_ping_test(self):
logging.info('Ping 1.2.3.4 IP Test')
process_output = open('%s/%s' % (testCaseUtils.get_dir(self, 'log'), self.PING_TEST_FILENAME), 'w')
@@ -144,34 +152,47 @@
tagCount = line.count('802.1Q')
assert tagCount == 2, 'Found a non double tagged packet'
- def retrieve_stag_and_ctag_from_sadis_entries(self):
- logging.info('Retrieving sTag and cTag from Sadis entries')
- ctagGrepCommand = "grep %s %s/tests/atests/build/sadis_json" % ('cTag', testCaseUtils.get_dir(self, 'voltha'))
- statusLines = commands.getstatusoutput(ctagGrepCommand)[1]
- assert statusLines, 'No cTag found in sadis_json'
- self.__sadisCTag = statusLines.split(':')[1].strip(',')
- stagGrepCommand = "grep %s %s/tests/atests/build/sadis_json" % ('sTag', testCaseUtils.get_dir(self, 'voltha'))
- statusLines = commands.getstatusoutput(stagGrepCommand)[1]
- assert statusLines, 'No sTag found in sadis_json'
- self.__sadisSTag = statusLines.split(':')[1].strip(',')
+ def retrieve_onu_serial_numbers(self):
+ logging.info('Onu Serial Number Discovery')
+ statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__onuType, 'voltha_devices_after_enable.log')
+ assert statusLines, 'No Onu listed under devices'
+ lines = statusLines.splitlines()
+ assert len(lines) == self.__onuCount, 'Onu count mismatch found: %s, should be: %s' % (len(lines), self.__onuCount)
+ for line in lines:
+ self.__fields = testCaseUtils.parse_fields(line, '|')
+ onuSerialNum = self.__fields[5].strip()
+ self.__onuSerialNum.append(onuSerialNum)
+
+ def retrieve_stag_and_ctag_for_onu(self, onu_serial_num):
+ entries = self.__datastore['org.opencord.sadis']['sadis']['entries']
+ for entry in entries:
+ entry_id = entry['id']
+ if entry_id == onu_serial_num:
+ self.__sadisCTag = entry['cTag']
+ self.__sadisSTag = entry['sTag']
+
+ def read_sadis_entries_from_sadis_json(self):
+ with open('%s/tests/atests/build/sadis_json' % testCaseUtils.get_dir(self, 'voltha'), 'r') as sadis:
+ self.__datastore = json.load(sadis)
def stag_and_ctag_should_match_sadis_file(self, ctag, stag):
- assert ctag == self.__sadisCTag and stag == self.__sadisSTag, 'cTag and/or sTag do not match value in sadis file\n \
+ assert ctag == str(self.__sadisCTag) and stag == str(self.__sadisSTag), 'cTag and/or sTag do not match value in sadis file\n \
vlan cTag = %s, sadis cTag = %s : vlan sTag = %s, sadis sTag = %s' % (ctag, self.__sadisCTag, stag, self.__sadisSTag)
+ def manage_onu_testing(self):
+ for onuSerial in self.__onuSerialNum:
+ self.retrieve_stag_and_ctag_for_onu(onuSerial)
+ self.execute_ping_test()
+ self.ping_test_should_have_failed()
+ self.should_have_q_in_q_vlan_tagging()
+ self.stag_and_ctag_should_match_sadis_entry()
-def run_test(root_dir, voltha_dir, log_dir):
+
+def run_test(onu_type, onu_count, root_dir, voltha_dir, log_dir):
unicast = Unicast()
unicast.u_set_log_dirs(root_dir, voltha_dir, log_dir)
- unicast.execute_ping_test()
- unicast.should_have_q_in_q_vlan_tagging()
- unicast.retrieve_stag_and_ctag_from_sadis_entries()
- unicast.stag_and_ctag_should_match_sadis_entry()
-
-
-
-
-
-
-
+ unicast.u_configure(onu_type, onu_count)
+ unicast.read_sadis_entries_from_sadis_json()
+ unicast.retrieve_onu_serial_numbers()
+ unicast.manage_onu_testing()
diff --git a/tests/atests/common/volthaMngr.py b/tests/atests/common/volthaMngr.py
index 20b45bc..1751fa4 100755
--- a/tests/atests/common/volthaMngr.py
+++ b/tests/atests/common/volthaMngr.py
@@ -25,11 +25,15 @@
import logging
+
class VolthaMngr(object):
"""
This class implements voltha startup/shutdown callable helper functions
"""
+
+ DEFAULT_ADAPTER = 'ponsim'
+
def __init__(self):
self.dirs = dict()
self.dirs['root'] = None
@@ -38,25 +42,25 @@
def v_set_log_dirs(self, root_dir, voltha_dir, log_dir):
testCaseUtils.config_dirs(self, log_dir, root_dir, voltha_dir)
-
- def start_all_pods(self):
- proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'start'],
+
+ def start_all_pods(self, adapter=DEFAULT_ADAPTER):
+ proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'start', adapter],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output = proc1.communicate()[0]
print(output)
proc1.stdout.close()
- def stop_all_pods(self):
- proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'stop'],
+ def stop_all_pods(self, adapter=DEFAULT_ADAPTER):
+ proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'stop', adapter],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output = proc1.communicate()[0]
print(output)
proc1.stdout.close()
- def reset_kube_adm(self):
- proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'clear'],
+ def reset_kube_adm(self, adapter=DEFAULT_ADAPTER):
+ proc1 = subprocess.Popen([testCaseUtils.get_dir(self, 'root') + '/build.sh', 'clear', adapter],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output = proc1.communicate()[0]
@@ -123,11 +127,11 @@
return allRunningPods
-def voltha_initialize(root_dir, voltha_dir, log_dir):
+def voltha_initialize(root_dir, voltha_dir, log_dir, adapter):
voltha = VolthaMngr()
voltha.v_set_log_dirs(root_dir, voltha_dir, log_dir)
- voltha.stop_all_pods()
- voltha.reset_kube_adm()
- voltha.start_all_pods()
+ voltha.stop_all_pods(adapter)
+ voltha.reset_kube_adm(adapter)
+ voltha.start_all_pods(adapter)
voltha.alter_onos_net_cfg()
voltha.collect_pod_logs()