diff --git a/src/test/utils/CordSubscriberUtils.py b/src/test/utils/CordSubscriberUtils.py
index b8d0c2c..72cc9b5 100644
--- a/src/test/utils/CordSubscriberUtils.py
+++ b/src/test/utils/CordSubscriberUtils.py
@@ -154,20 +154,36 @@
                 break
         return subscriberInfo, subscriberId
 
-    def getVoltId(self, result, subInfo):
+    def getVoltId(self, result, subInfo, s_tag = None, c_tag = None):
         subscribed_link_ids_list = self.getFieldValueFromDict(subInfo,
                                                               'subscribed_links_ids')
-        assert_not_equal( len(subscribed_link_ids_list), 0)
-        subscribed_link_ids = subscribed_link_ids_list[0]
-        service_link = self.restApi.ApiChameleonGet('CH_CORE_SERVICELINK',
-                                                    subscribed_link_ids)
-        assert_not_equal(service_link, None)
-        provider_service_instance_id = service_link.get('provider_service_instance_id',
-                                                        None)
-        assert_not_equal(provider_service_instance_id, None)
-        return provider_service_instance_id
+        if len(subscribed_link_ids_list) > 0:
+            subscribed_link_ids = subscribed_link_ids_list[0]
+            service_link = self.restApi.ApiChameleonGet('CH_CORE_SERVICELINK',
+                                                        subscribed_link_ids)
+            assert_not_equal(service_link, None)
+            provider_service_instance_id = service_link.get('provider_service_instance_id',
+                                                            None)
+            assert_not_equal(provider_service_instance_id, None)
+            return provider_service_instance_id
+
+        #find the tenant for the s_tag/c_tag
+        if s_tag is None or c_tag is None:
+            return None
+
+        if result is None:
+            result = self.restApi.ApiGet('VOLT_TENANT')
+            result = result['items']
+
+        tenant = filter(lambda t: int(t['s_tag']) == int(s_tag) and \
+                        int(t['c_tag']) == int(c_tag), result)
+        if not tenant:
+            return None
+
+        return tenant[0]['id']
 
     def getProviderInstance(self, info):
+        return info['id']
         provided_link_ids_list = self.getFieldValueFromDict(info,
                                                             'provided_links_ids')
         assert_not_equal(provided_link_ids_list, None)
@@ -247,7 +263,7 @@
         finally:
             return subId
 
-    def subscriberDelete(self, account_num, subId = '', voltId = ''):
+    def subscriberDelete(self, account_num, s_tag = None, c_tag = None, subId = '', voltId = ''):
         result = self.restApi.ApiGet('VOLT_SUBSCRIBER')
         assert_not_equal(result, None)
         result = result['items']
@@ -265,7 +281,7 @@
             result = self.restApi.ApiGet('VOLT_TENANT')
             assert_not_equal(result, None)
             result = result['items']
-            voltId = self.getVoltId(result, subInfo)
+            voltId = self.getVoltId(result, subInfo, s_tag = s_tag, c_tag = c_tag)
             assert_not_equal(voltId, None)
         log.info('Deleting VOLT Tenant ID %s for subscriber %s' %(voltId, subId))
         status = self.restApi.ApiChameleonDelete('VOLT_TENANT', voltId)
@@ -300,6 +316,7 @@
         self.c_tag = c_tag
         self.subscribers_per_s_tag = subscribers_per_s_tag
         self.subscriber_map = {}
+        self.tenant_map = {}
         self.subscriber_info = self.getConfig()
         self.volt_subscriber_info = self.getVoltConfig()
         self.xos = XosUtils()
@@ -315,6 +332,7 @@
         if self.c_tag % self.subscribers_per_s_tag == 0:
             self.s_tag += 1
         self.subscriber_map[subId] = account_num, s_tag, c_tag
+        self.tenant_map[account_num] = (s_tag, c_tag)
         return self.subscriber_map[subId]
 
     def getConfig(self):
@@ -339,6 +357,12 @@
 
         return subscriber_map
 
+    def getVoltInfo(self, account_num):
+        num = int(account_num)
+        if num in self.tenant_map:
+            return self.tenant_map[num]
+        return None, None
+
     def getVoltConfig(self):
         voltSubscriberMap = []
         for i in xrange(self.num_subscribers):
@@ -353,7 +377,8 @@
         return voltSubscriberMap
 
     def getVoltId(self, subInfo):
-        return self.xos.getVoltId(None, subInfo)
+        s_tag, c_tag = self.getVoltInfo(subInfo['service_specific_id'])
+        return self.xos.getVoltId(None, subInfo, s_tag = s_tag, c_tag = c_tag)
 
     def getProviderInstance(self, tenant_info):
         return self.xos.getProviderInstance(tenant_info)
@@ -377,7 +402,7 @@
         s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
         c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
         log.info('Deleting tenant with s_tag: %d, c_tag: %d' %(s_tag, c_tag))
-        self.xos.subscriberDelete(volt_subscriber_info['service_specific_id'], subId = subId, voltId = voltId)
+        self.xos.subscriberDelete(volt_subscriber_info['service_specific_id'], s_tag = s_tag, c_tag = c_tag, subId = subId, voltId = voltId)
 
     def subscriberId(self, index):
         volt_subscriber_info = self.volt_subscriber_info[index]
diff --git a/src/test/vsg/vsgTest.py b/src/test/vsg/vsgTest.py
index 41ebeab..a94711c 100644
--- a/src/test/vsg/vsgTest.py
+++ b/src/test/vsg/vsgTest.py
@@ -2371,6 +2371,44 @@
     def test_vsg_xos_subscriber_delete_all(self):
         self.vsg_delete(len(self.cord_subscriber.subscriber_info))
 
+    def __vsg_xos_subscriber_create(self, index):
+        subId = self.vsg_xos_subscriber_create(index)
+        assert_not_equal(subId, '')
+        assert_not_equal(subId, '0')
+
+    def __vsg_xos_subscriber_delete(self, index):
+        self.vsg_xos_subscriber_delete(index)
+
+    def test_vsg_xos_subscriber_create(self):
+        self.__vsg_xos_subscriber_create(0)
+
+    def test_vsg_xos_subscriber_create_2(self):
+        self.__vsg_xos_subscriber_create(1)
+
+    def test_vsg_xos_subscriber_create_3(self):
+        self.__vsg_xos_subscriber_create(2)
+
+    def test_vsg_xos_subscriber_create_4(self):
+        self.__vsg_xos_subscriber_create(3)
+
+    def test_vsg_xos_subscriber_create_5(self):
+        self.__vsg_xos_subscriber_create(4)
+
+    def test_vsg_xos_subscriber_delete(self):
+        self.__vsg_xos_subscriber_delete(0)
+
+    def test_vsg_xos_subscriber_delete_2(self):
+        self.__vsg_xos_subscriber_delete(1)
+
+    def test_vsg_xos_subscriber_delete_3(self):
+        self.__vsg_xos_subscriber_delete(2)
+
+    def test_vsg_xos_subscriber_delete_4(self):
+        self.__vsg_xos_subscriber_delete(3)
+
+    def test_vsg_xos_subscriber_delete_5(self):
+        self.__vsg_xos_subscriber_delete(4)
+
     def test_vsg_xos_subscriber_create_and_delete(self):
         subId = self.vsg_xos_subscriber_create(0)
         if subId and subId != '0':
