Test: Restart ONOS with default network cfg after vrouter/dhcprelay tests are run.
This puts ONOS back to initial state for other tests.

Change-Id: Ib20538399737789c11def76189a77bc651289506
diff --git a/src/test/dhcprelay/dhcprelayTest.py b/src/test/dhcprelay/dhcprelayTest.py
index c9de4e4..a5a7cf6 100644
--- a/src/test/dhcprelay/dhcprelayTest.py
+++ b/src/test/dhcprelay/dhcprelayTest.py
@@ -23,6 +23,7 @@
 from DHCP import DHCPTest
 from OnosCtrl import OnosCtrl, get_mac
 from OltConfig import OltConfig
+from CordTestServer import cord_test_onos_restart
 from portmaps import g_subscriber_port_map
 import threading, random
 from threading import current_thread
@@ -64,6 +65,8 @@
     running_time = 0
     total_success = 0
     total_failure = 0
+    #just in case we want to reset ONOS to default network cfg after relay tests
+    onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
 
     @classmethod
     def setUpClass(cls):
@@ -87,6 +90,7 @@
         except: pass
         cls.onos_ctrl.deactivate()
         cls.dhcpd_stop()
+        cls.dhcp_relay_cleanup()
 
     @classmethod
     def dhcp_relay_setup(cls):
@@ -117,6 +121,13 @@
             cls.onos_interface_load(interface_list)
 
     @classmethod
+    def dhcp_relay_cleanup(cls):
+        ##reset the ONOS port configuration back to default
+        if cls.onos_restartable is True:
+            log.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
+            return cord_test_onos_restart(config = {})
+
+    @classmethod
     def onos_load_config(cls, config):
         status, code = OnosCtrl.config(config)
         if status is False: