Restore the vsg interface/configuration on test case failures/timeouts correctly

Change-Id: I95ece6232e4d2bdf881d0cd32294547b2f4e27ad
diff --git a/src/test/vsg/vsgTest.py b/src/test/vsg/vsgTest.py
index a94711c..67dd4e9 100644
--- a/src/test/vsg/vsgTest.py
+++ b/src/test/vsg/vsgTest.py
@@ -187,8 +187,13 @@
 
     @classmethod
     def tearDownClass(cls):
+        self.config_restore()
         cls.vsgTeardown()
 
+    def tearDown(self):
+        self.config_restore()
+        super(vsg_exchange, self).tearDown()
+
     def onos_shutdown(self, controller = None):
         status = True
         cli = Onos.cliEnter(onos_ip = controller)
@@ -219,7 +224,8 @@
     @classmethod
     def config_restore(cls):
         """Restore the vsg test configuration on test case failures"""
-        for restore_method in cls.restore_methods:
+        while cls.restore_methods:
+            restore_method = cls.restore_methods.pop()
             restore_method()
 
     def get_vsg_vcpe_pair(self):
@@ -300,12 +306,13 @@
         host = '8.8.8.8'
         self.success = False
         assert_not_equal(vcpe, None)
-        vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
+        vcpe_ip = self.get_dhcp(vcpe, mgmt = mgmt)
         assert_not_equal(vcpe_ip, None)
         log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
         log.info('Sending icmp echo requests to external network 8.8.8.8')
         st, _ = getstatusoutput('ping -c 3 8.8.8.8')
         VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
+        self.restore_methods.pop()
         assert_equal(st, 0)
 
     def get_vsg_health_check(self, vsg_name=None):