Move cord-tester voltha rest interface to use envoy.
Plus other misc. changes

Change-Id: I03c40841ef07d9c0523799dc2efbd7e0caa1e536
diff --git a/src/test/cordSubscriber/cordSubscriberTest.json b/src/test/cordSubscriber/cordSubscriberTest.json
index fb29f57..859baf7 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.json
+++ b/src/test/cordSubscriber/cordSubscriberTest.json
@@ -1,9 +1,9 @@
 {
-    "VOLTHA_HOST": "172.17.0.1", 
-    "VOLTHA_REST_PORT": 8881, 
-    "VOLTHA_IGMP_ITERATIONS": 100, 
-    "VOLTHA_CONFIG_FAKE": true, 
-    "VOLTHA_OLT_TYPE": "ponsim_olt", 
-    "VOLTHA_OLT_MAC": "00:0c:e2:31:12:00", 
+    "VOLTHA_HOST": "172.17.0.1",
+    "VOLTHA_REST_PORT": 8882,
+    "VOLTHA_IGMP_ITERATIONS": 100,
+    "VOLTHA_CONFIG_FAKE": true,
+    "VOLTHA_OLT_TYPE": "ponsim_olt",
+    "VOLTHA_OLT_MAC": "00:0c:e2:31:12:00",
     "VOLTHA_UPLINK_VLAN_START": 333
-}
\ No newline at end of file
+}
diff --git a/src/test/cordSubscriber/cordSubscriberTest.py b/src/test/cordSubscriber/cordSubscriberTest.py
index a05399f..9d1f268 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.py
+++ b/src/test/cordSubscriber/cordSubscriberTest.py
@@ -55,6 +55,7 @@
 from CordLogger import CordLogger
 from CordTestConfig import setup_module, teardown_module
 from CordContainer import Onos
+from VolthaCtrl import VolthaCtrl
 
 log_test.setLevel('INFO')
 
@@ -284,7 +285,7 @@
 
       VOLTHA_HOST = None
       VOLTHA_TEARDOWN = True
-      VOLTHA_REST_PORT = 8881
+      VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
       VOLTHA_UPLINK_VLAN_MAP = { 'of:0001000000000001' : '222' }
       VOLTHA_UPLINK_VLAN_START = 333
       VOLTHA_IGMP_ITERATIONS = 100
diff --git a/src/test/dhcpl2relay/dhcpl2relayTest.py b/src/test/dhcpl2relay/dhcpl2relayTest.py
index bd98557..e6a7745 100644
--- a/src/test/dhcpl2relay/dhcpl2relayTest.py
+++ b/src/test/dhcpl2relay/dhcpl2relayTest.py
@@ -44,6 +44,7 @@
 from CordLogger import CordLogger
 from portmaps import g_subscriber_port_map
 from CordContainer import Onos
+from VolthaCtrl import VolthaCtrl
 import threading, random
 from threading import current_thread
 log_test.setLevel('INFO')
@@ -51,7 +52,7 @@
 class dhcpl2relay_exchange(CordLogger):
 
     VOLTHA_HOST = None
-    VOLTHA_REST_PORT = 8881
+    VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
     VOLTHA_ENABLED = bool(int(os.getenv('VOLTHA_ENABLED', 0)))
     VOLTHA_OLT_TYPE = 'simulated_olt'
     VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
diff --git a/src/test/setup/webserver-test-tls.curl b/src/test/setup/webserver-test-tls.curl
index 7cace25..6af5b95 100755
--- a/src/test/setup/webserver-test-tls.curl
+++ b/src/test/setup/webserver-test-tls.curl
@@ -8,7 +8,7 @@
     "test" : "tls:eap_auth_exchange.test_eap_tls",
     "config" : {
         "VOLTHA_HOST" : "172.17.0.1",
-        "VOLTHA_REST_PORT" : 8881,
+        "VOLTHA_REST_PORT" : 8882,
         "VOLTHA_OLT_TYPE" : "ponsim_olt",
         "VOLTHA_OLT_MAC" : "00:0c:e2:31:10:00"
     }
@@ -29,4 +29,4 @@
   echo "Test cleanup failed with status code $status"
 fi
 rm -f /tmp/testrun.json
-echo "Test successful"
\ No newline at end of file
+echo "Test successful"
diff --git a/src/test/tls/tlsTest.json b/src/test/tls/tlsTest.json
index ef966f8..ddc442b 100644
--- a/src/test/tls/tlsTest.json
+++ b/src/test/tls/tlsTest.json
@@ -2,5 +2,5 @@
     "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
+    "VOLTHA_REST_PORT": 8882
+}
diff --git a/src/test/tls/tlsTest.py b/src/test/tls/tlsTest.py
index 300201c..8735f02 100644
--- a/src/test/tls/tlsTest.py
+++ b/src/test/tls/tlsTest.py
@@ -40,6 +40,7 @@
 from CordLogger import CordLogger
 from CordTestUtils import log_test
 from CordTestConfig import setup_module, teardown_module
+from VolthaCtrl import VolthaCtrl
 from scapy.all import *
 from scapy_ssl_tls.ssl_tls import *
 from scapy_ssl_tls.ssl_tls_crypto import *
@@ -51,7 +52,7 @@
     TLS_TIMEOUT = 20
     TEST_TIMEOUT = 3600
     VOLTHA_HOST = None
-    VOLTHA_REST_PORT = 8881
+    VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
     VOLTHA_ENABLED = bool(int(os.getenv('VOLTHA_ENABLED', 0)))
     VOLTHA_OLT_TYPE = 'simulated_olt'
     VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
diff --git a/src/test/utils/OnosCtrl.py b/src/test/utils/OnosCtrl.py
index 1742f43..a2daf20 100644
--- a/src/test/utils/OnosCtrl.py
+++ b/src/test/utils/OnosCtrl.py
@@ -330,7 +330,13 @@
             radius_ip = '{}.{}'.format(radius_subnet, radius_port)
             aaa_cfg['radiusIp'] = radius_ip
             for dev in ovs_devices:
-                connect_point = '{}/{}'.format(dev['id'], radius_port)
+                device_id = dev['id']
+                ports = OnosCtrl.get_ports_device(device_id, controller = controller)
+                radius_ports = filter(lambda p: p['isEnabled'] and 'annotations' in p and \
+                                      p['annotations']['portName'].startswith('r'),
+                                      ports)
+                radius_port = radius_ports[0]['port']
+                connect_point = '{}/{}'.format(device_id, radius_port)
                 connect_points.append(connect_point)
             aaa_cfg['radiusServerConnectPoints'] = connect_points
             break
diff --git a/src/test/utils/VolthaCtrl.py b/src/test/utils/VolthaCtrl.py
index 41ef8dc..7d6e2b5 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 = ('envoy', 'voltha', 'ofagent', 'vcli',)
     compose_file = 'docker-compose-system-test.yml'
     service_map = {}
     PROJECT = 'cordtester'
@@ -211,7 +211,7 @@
 class VolthaCtrl(object):
     UPLINK_VLAN_START = 333
     UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
-    REST_PORT = 8881
+    REST_PORT = 8882
     HOST = '172.17.0.1'
     ONOS_APPS = ('org.onosproject.dhcp', 'org.onosproject.dhcp-relay', 'org.ciena.cordigmp')
     ADMIN_STATE = 'admin_state'
@@ -225,9 +225,9 @@
         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.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 = []
diff --git a/src/test/voltha/volthaTest.json b/src/test/voltha/volthaTest.json
index 6ad9afd..6594e73 100644
--- a/src/test/voltha/volthaTest.json
+++ b/src/test/voltha/volthaTest.json
@@ -2,6 +2,6 @@
     "OLT_TYPE" : "simulated_olt",
     "OLT_MAC"  : "00:0c:e2:31:12:00",
     "VOLTHA_HOST" : "172.17.0.1",
-    "VOLTHA_REST_PORT" : 8881,
+    "VOLTHA_REST_PORT" : 8882,
     "VOLTHA_UPLINK_VLAN_START" : 444
 }
diff --git a/src/test/voltha/volthaTest.py b/src/test/voltha/volthaTest.py
index 4cced32..39de312 100644
--- a/src/test/voltha/volthaTest.py
+++ b/src/test/voltha/volthaTest.py
@@ -213,7 +213,7 @@
     OLT_MAC = '00:0c:e2:31:12:00'
     VOLTHA_HOST = VolthaService.DOCKER_HOST_IP
     VOLTHA_PONSIM_HOST = VolthaService.PONSIM_HOST
-    VOLTHA_REST_PORT = 8881
+    VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
     VOLTHA_OLT_TYPE = 'ponsim_olt'
     VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
     VOLTHA_IGMP_ITERATIONS = 100