diff --git a/src/test/cordSubscriber/cordSubscriberTest.py b/src/test/cordSubscriber/cordSubscriberTest.py
index f4f5df8..a713199 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.py
+++ b/src/test/cordSubscriber/cordSubscriberTest.py
@@ -35,7 +35,7 @@
 from threadPool import ThreadPool
 from portmaps import g_subscriber_port_map
 from OltConfig import *
-from CordTestServer import cord_test_onos_restart, cord_test_shell
+from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
 from CordTestUtils import log_test, get_controller
 from CordLogger import CordLogger
 from CordTestConfig import setup_module
@@ -209,6 +209,7 @@
       table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
       app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
       olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
+      olt_app_name = 'org.onosproject.olt'
       onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
       olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
       cpqd_path = os.path.join(test_path, '..', 'setup')
@@ -498,11 +499,17 @@
                   return self.test_status
 
       def tls_verify(self, subscriber):
+            def tls_fail_cb():
+                  log_test.info('TLS verification failed')
             if subscriber.has_service('TLS'):
+                  OnosCtrl('org.opencord.aaa').deactivate()
                   time.sleep(2)
-                  tls = TLSAuthTest(intf = subscriber.rx_intf)
+                  OnosCtrl('org.opencord.aaa').activate()
+                  time.sleep(5)
+                  tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = subscriber.rx_intf)
                   log_test.info('Running subscriber %s tls auth test' %subscriber.name)
                   tls.runTest()
+                  assert_equal(tls.failTest, False)
                   self.test_status = True
                   return self.test_status
             else:
@@ -2602,13 +2609,25 @@
 
 
 
-      def remove_olt(self):
-          OnosCtrl.uninstall_app(self.olt_app_file)
+      def remove_olt(self, switch_map):
+          controller = get_controller()
+          auth = ('karaf', 'karaf')
+          #remove subscriber for every port on all the voltha devices
+          for device, device_map in switch_map.iteritems():
+              uni_ports = device_map['ports']
+              uplink_vlan = device_map['uplink_vlan']
+              for port in uni_ports:
+                  rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
+                                                                           device,
+                                                                           port)
+                  resp = requests.delete(rest_url, auth = auth)
+                  if resp.status_code not in [204, 202, 200]:
+                        log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
+                  else:
+                        log_test.info('Deleted subscriber for device %s on port  %s' %(device, port))
 
       def config_olt(self, switch_map):
           controller = get_controller()
-          OnosCtrl.install_app(self.olt_app_file)
-          time.sleep(5)
           auth = ('karaf', 'karaf')
           #configure subscriber for every port on all the voltha devices
           for device, device_map in switch_map.iteritems():
@@ -2634,28 +2653,46 @@
           if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
                 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
                 log_test.info('Enabling ponsim olt')
-                status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
+                device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
           else:
                 log_test.info('Enabling OLT instance for %s with mac %s' %(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC))
-                status = voltha.enable_device(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC)
+                device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC)
 
+          assert_not_equal(device_id, None)
+          if status == False:
+                voltha.disable_device(device_id, delete = True)
           assert_equal(status, True)
           time.sleep(10)
-          switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
-          if not switch_map:
-                log_test.info('No voltha devices found')
-                return
-          log_test.info('Adding subscribers through OLT app')
-          self.config_olt(switch_map)
-          time.sleep(5)
-          self.num_subscribers = 1
-          self.num_channels = 1
-          services = ('TLS', 'IGMP')
-          test_status = self.subscriber_join_verify(num_subscribers = self.num_subscribers,
-                                                    num_channels = self.num_channels,
-                                                    cbs = (self.tls_verify, self.dhcp_next_verify,
-                                                           self.voltha_igmp_next_verify, self.traffic_verify),
-                                                    port_list = self.generate_port_list(self.num_subscribers,
-                                                                                        self.num_channels),
-                                                    services = services)
-          assert_equal(test_status, True)
+          switch_map = None
+          olt_configured = False
+          try:
+                switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
+                if not switch_map:
+                      log_test.info('No voltha devices found')
+                      return
+                log_test.info('Installing OLT app')
+                OnosCtrl.install_app(self.olt_app_file)
+                time.sleep(5)
+                log_test.info('Adding subscribers through OLT app')
+                self.config_olt(switch_map)
+                olt_configured = True
+                time.sleep(5)
+                self.num_subscribers = 1
+                self.num_channels = 1
+                services = ('TLS', 'IGMP')
+                test_status = self.subscriber_join_verify(num_subscribers = self.num_subscribers,
+                                                          num_channels = self.num_channels,
+                                                          cbs = (self.tls_verify, self.dhcp_next_verify,
+                                                                 self.voltha_igmp_next_verify, self.traffic_verify),
+                                                          port_list = self.generate_port_list(self.num_subscribers,
+                                                                                              self.num_channels),
+                                                          services = services)
+                assert_equal(test_status, True)
+          finally:
+                if switch_map is not None:
+                      if olt_configured is True:
+                            self.remove_olt(switch_map)
+                      voltha.disable_device(device_id, delete = True)
+                      time.sleep(10)
+                      log_test.info('Uninstalling OLT app')
+                      OnosCtrl.uninstall_app(self.olt_app_name)
diff --git a/src/test/utils/VolthaCtrl.py b/src/test/utils/VolthaCtrl.py
index 86d17e9..d018edb 100644
--- a/src/test/utils/VolthaCtrl.py
+++ b/src/test/utils/VolthaCtrl.py
@@ -192,7 +192,7 @@
         url = '{}/local/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 False
+            return None, False
         if olt_mac is not None:
             device_config = { 'type' : olt_type, 'mac_address' : olt_mac }
         else:
@@ -204,25 +204,39 @@
             log.info('Pre-provisioning %s with address %s' %(olt_type, address))
         resp = requests.post(url, data = json.dumps(device_config))
         if resp.ok is not True or resp.status_code != 200:
-            return False
+            return None, False
         device_id = resp.json()['id']
         log.info('Enabling device %s' %(device_id))
         enable_url = '{}/{}/enable'.format(url, device_id)
         resp = requests.post(enable_url)
         if resp.ok is not True or resp.status_code != 200:
-            return False
+            return None, False
         #get operational status
         time.sleep(5)
         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
+            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':
-            return False
+            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)
+        resp = requests.post(disable_url)
+        if resp.ok is not True or resp.status_code != 200:
+            return False
+        if delete is True:
+            log.info('Deleting device %s' %(device_id))
+            delete_url = '{}/local/devices/{}/delete'.format(self.rest_url, device_id)
+            resp = requests.delete(delete_url)
+            if resp.status_code not in [204, 202, 200]:
+                return False
         return True
 
     def get_operational_status(self, device_id):
diff --git a/src/test/voltha/volthaTest.py b/src/test/voltha/volthaTest.py
index db65d69..b74753e 100644
--- a/src/test/voltha/volthaTest.py
+++ b/src/test/voltha/volthaTest.py
@@ -1,6 +1,7 @@
 import os
 import sys
 import unittest
+import time
 from nose.tools import *
 from CordTestConfig import setup_module
 from CordTestUtils import log_test
@@ -18,16 +19,26 @@
     def setUpClass(cls):
         cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
 
-    def test_olt_enable(self):
+    def test_olt_enable_disable(self):
         log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
-        status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
-        assert_equal(status, True)
+        device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
+        assert_not_equal(device_id, None)
+        try:
+            assert_equal(status, True)
+            time.sleep(10)
+        finally:
+            self.voltha.disable_device(device_id, delete = True)
 
-    def test_ponsim_enable(self):
+    def test_ponsim_enable_disable(self):
         log_test.info('Enabling ponsim_olt')
         ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
-        status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
-        assert_equal(status, True)
+        device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
+        assert_not_equal(device_id, None)
+        try:
+            assert_equal(status, True)
+            time.sleep(10)
+        finally:
+            self.voltha.disable_device(device_id, delete = True)
 
     def test_subscriber_with_voltha_for_eap_tls_authentication(self):
         """
