Preparation for voltha rest server to change to envoy, port 8882
And formatting changes to test case config file
Change-Id: Ia3bae43ec0a89636d97dfd557204e87cd6288f0e
diff --git a/src/test/igmp/igmpTest.json b/src/test/igmp/igmpTest.json
index 1cba515..9a8c163 100644
--- a/src/test/igmp/igmpTest.json
+++ b/src/test/igmp/igmpTest.json
@@ -1,21 +1,21 @@
{
- "V_INF1" : "veth0",
- "V_INF2" : "veth1",
- "MGROUP1" : "239.1.2.3",
- "MGROUP2" : "239.2.2.3",
- "MINVALIDGROUP1" : "255.255.255.255",
- "MINVALIDGROUP2" : "239.255.255.255",
- "IGMP_DST_MAC" : "01:00:5e:00:00:16",
- "IGMP_SRC_MAC" : "5a:e1:ac:ec:4d:a1",
- "IP_SRC" : "1.2.3.4",
- "IP_DST" : "224.0.0.22",
- "NEGATIVE_TRAFFIC_STATUS" : 1,
- "IGMP_TEST_TIMEOUT" : 5,
- "IGMP_QUERY_TIMEOUT" : 60,
- "MCAST_TRAFFIC_TIMEOUT" : 10,
- "PORT_TX_DEFAULT" : 2,
- "PORT_RX_DEFAULT" : 1,
- "ROVER_TEST_TIMEOUT" : 300,
- "ROVER_TIMEOUT" : 200,
- "ROVER_JOIN_TIMEOUT" : 60
-}
+ "ROVER_TIMEOUT": 200,
+ "MGROUP2": "239.2.2.3",
+ "MCAST_TRAFFIC_TIMEOUT": 10,
+ "ROVER_TEST_TIMEOUT": 300,
+ "V_INF1": "veth0",
+ "V_INF2": "veth1",
+ "MINVALIDGROUP2": "239.255.255.255",
+ "MINVALIDGROUP1": "255.255.255.255",
+ "NEGATIVE_TRAFFIC_STATUS": 1,
+ "MGROUP1": "239.1.2.3",
+ "IP_DST": "224.0.0.22",
+ "PORT_RX_DEFAULT": 1,
+ "IGMP_DST_MAC": "01:00:5e:00:00:16",
+ "IGMP_QUERY_TIMEOUT": 60,
+ "IGMP_SRC_MAC": "5a:e1:ac:ec:4d:a1",
+ "IGMP_TEST_TIMEOUT": 5,
+ "ROVER_JOIN_TIMEOUT": 60,
+ "PORT_TX_DEFAULT": 2,
+ "IP_SRC": "1.2.3.4"
+}
\ No newline at end of file
diff --git a/src/test/tls/tlsTest.json b/src/test/tls/tlsTest.json
index fd88ff0..ef966f8 100644
--- a/src/test/tls/tlsTest.json
+++ b/src/test/tls/tlsTest.json
@@ -1,6 +1,6 @@
{
- "VOLTHA_HOST" : "172.17.0.1",
- "VOLTHA_REST_PORT" : 8881,
- "VOLTHA_OLT_TYPE" : "ponsim_olt",
- "VOLTHA_OLT_MAC" : "00:0c:e2:31:12:00"
-}
+ "VOLTHA_OLT_MAC": "00:0c:e2:31:12:00",
+ "VOLTHA_HOST": "172.17.0.1",
+ "VOLTHA_OLT_TYPE": "ponsim_olt",
+ "VOLTHA_REST_PORT": 8881
+}
\ No newline at end of file
diff --git a/src/test/utils/CordTestConfig.py b/src/test/utils/CordTestConfig.py
index f82be0e..95320e5 100644
--- a/src/test/utils/CordTestConfig.py
+++ b/src/test/utils/CordTestConfig.py
@@ -22,7 +22,7 @@
from nose.plugins import Plugin
from CordTestUtils import log_test as log
from CordTestUtils import running_on_pod
-from VolthaCtrl import voltha_setup, voltha_teardown, VolthaService
+from VolthaCtrl import voltha_setup, voltha_teardown, VolthaService, VolthaCtrl
from SSHTestAgent import SSHTestAgent
log.setLevel('INFO')
@@ -93,7 +93,7 @@
#check for voltha and configure as appropriate
voltha_attrs = dict(host = VolthaService.DOCKER_HOST_IP,
ponsim_host = VolthaService.PONSIM_HOST,
- rest_port = 8881,
+ rest_port = VolthaCtrl.REST_PORT,
config_fake = False,
olt_type = 'ponsim_olt',
olt_mac = '00:0c:e2:31:12:00',
diff --git a/src/test/utils/VolthaCtrl.py b/src/test/utils/VolthaCtrl.py
index 82268db..812467b 100644
--- a/src/test/utils/VolthaCtrl.py
+++ b/src/test/utils/VolthaCtrl.py
@@ -26,7 +26,7 @@
class VolthaService(object):
services = ('consul', 'kafka', 'zookeeper', 'registrator', 'fluentd')
- standalone_services = ('voltha', 'ofagent', 'vcli')
+ standalone_services = ('voltha', 'ofagent', 'vcli',)
compose_file = 'docker-compose-system-test.yml'
service_map = {}
PROJECT = 'cordtester'
@@ -214,11 +214,19 @@
REST_PORT = 8881
HOST = '172.17.0.1'
ONOS_APPS = ('org.onosproject.dhcp', 'org.onosproject.dhcp-relay', 'org.ciena.cordigmp')
+ ADMIN_STATE = 'admin_state'
+ OPER_STATUS = 'oper_status'
+ CONNECT_STATUS = 'connect_status'
def __init__(self, host = HOST, rest_port = REST_PORT, uplink_vlan_map = UPLINK_VLAN_MAP, uplink_vlan_start = UPLINK_VLAN_START):
self.host = host
self.rest_port = rest_port
- self.rest_url = 'http://{}:{}/api/v1'.format(host, rest_port)
+ self.rest_url = 'http://{}:{}/api/v1/local'.format(host, rest_port)
+ if rest_port == 8882:
+ self.rest_url = 'http://{}:{}/api/v1'.format(host, rest_port)
+ self.ADMIN_STATE = 'adminState'
+ self.OPER_STATUS = 'operStatus'
+ self.CONNECT_STATUS = 'connectStatus'
self.uplink_vlan_map = uplink_vlan_map
VolthaCtrl.UPLINK_VLAN_START = uplink_vlan_start
self.switches = []
@@ -283,14 +291,14 @@
return self.switch_map
def get_devices(self):
- url = '{}/local/devices'.format(self.rest_url)
+ url = '{}/devices'.format(self.rest_url)
resp = requests.get(url)
if resp.ok is not True or resp.status_code != 200:
return None
return resp.json()
def enable_device(self, olt_type, olt_mac = None, address = None):
- url = '{}/local/devices'.format(self.rest_url)
+ url = '{}/devices'.format(self.rest_url)
if olt_mac is None and address is None:
log.error('Either olt mac or address needs to be specified')
return None, False
@@ -322,16 +330,16 @@
if resp.ok is not True or resp.status_code != 200:
return device_id, False
device_info = resp.json()
- if device_info['oper_status'] != 'ACTIVE' or \
- device_info['admin_state'] != 'ENABLED' or \
- device_info['connect_status'] != 'REACHABLE':
+ if device_info[self.OPER_STATUS] != 'ACTIVE' or \
+ device_info[self.ADMIN_STATE] != 'ENABLED' or \
+ device_info[self.CONNECT_STATUS] != 'REACHABLE':
return device_id, False
return device_id, True
def disable_device(self, device_id, delete = True):
log.info('Disabling device %s' %(device_id))
- disable_url = '{}/local/devices/{}/disable'.format(self.rest_url, device_id)
+ disable_url = '{}/devices/{}/disable'.format(self.rest_url, device_id)
resp = requests.post(disable_url)
if resp.ok is not True or resp.status_code != 200:
return False
@@ -339,7 +347,7 @@
#rest for disable completion
time.sleep(10)
log.info('Deleting device %s' %(device_id))
- delete_url = '{}/local/devices/{}/delete'.format(self.rest_url, device_id)
+ delete_url = '{}/devices/{}/delete'.format(self.rest_url, device_id)
resp = requests.delete(delete_url)
if resp.status_code not in [204, 202, 200]:
return False
@@ -347,7 +355,7 @@
def restart_device(self, device_id):
log.info('Restarting olt or onu device %s' %(device_id))
- disable_url = '{}/local/devices/{}/restart'.format(self.rest_url, device_id)
+ disable_url = '{}/devices/{}/restart'.format(self.rest_url, device_id)
resp = requests.post(disable_url)
if resp.ok is not True or resp.status_code != 200:
return False
@@ -355,33 +363,33 @@
def pause_device(self, device_id):
log.info('Restarting olt or onu device %s' %(device_id))
- disable_url = '{}/local/devices/{}/pause'.format(self.rest_url, device_id)
+ disable_url = '{}/devices/{}/pause'.format(self.rest_url, device_id)
resp = requests.post(disable_url)
if resp.ok is not True or resp.status_code != 200:
return False
return True
def get_operational_status(self, device_id):
- url = '{}/local/devices'.format(self.rest_url)
+ url = '{}/devices'.format(self.rest_url)
log.info('Checking operational status for device %s' %(device_id))
resp = requests.get('{}/{}'.format(url, device_id))
if resp.ok is not True or resp.status_code != 200:
return False
device_info = resp.json()
- if device_info['oper_status'] != 'ACTIVE' or \
- device_info['admin_state'] != 'ENABLED' or \
- device_info['connect_status'] != 'REACHABLE':
+ if device_info[self.OPER_STATUS] != 'ACTIVE' or \
+ device_info[self.ADMIN_STATE] != 'ENABLED' or \
+ device_info[self.CONNECT_STATUS] != 'REACHABLE':
return False
return True
def check_preprovision_status(self, device_id):
- url = '{}/local/devices'.format(self.rest_url)
+ url = '{}/devices'.format(self.rest_url)
log.info('Check if device %s is in Preprovisioning state'%(device_id))
resp = requests.get('{}/{}'.format(url, device_id))
if resp.ok is not True or resp.status_code != 200:
return False
device_info = resp.json()
- if device_info['admin_status'] == 'PREPROVISIONED':
+ if device_info[self.ADMIN_STATE] == 'PREPROVISIONED':
return True
return False