Adding util functions in testing service onboarding
module.

Change-Id: Id886246417cc3bf6a34eb564ff83c884bea999d6
diff --git a/src/test/utils/OnboardingServiceUtils.py b/src/test/utils/OnboardingServiceUtils.py
index db52e53..6ed4c16 100644
--- a/src/test/utils/OnboardingServiceUtils.py
+++ b/src/test/utils/OnboardingServiceUtils.py
@@ -2,6 +2,7 @@
 import shutil
 import re
 from novaclient import client as nova_client
+import novaclient.v1_1.client as novaclient
 from SSHTestAgent import SSHTestAgent
 from CordTestUtils import *
 from CordTestUtils import log_test as log
@@ -114,6 +115,48 @@
         env = os.environ.copy()
         return env
 
+    @classmethod
+    def discover_exampleservice_vm_instance_on_cord(cls, tenant_name):
+        name=None
+        status=None
+        try:
+            credentials = cls.get_nova_credentials_v2()
+            nvclient = nova_client.Client('2', **credentials)
+            instance_list=nvclient.servers.list()
+            if instance_list > 0:
+
+               for inst in instance_list:
+
+                   instance_id = inst.id
+                   name=inst.name
+                   inst_find=nvclient.servers.find(id=instance_id)
+                   print('   - Instance %s Discovered' % inst.name)
+                   print('   - Instance ID %s Discovered' % instance_id)
+                   print('   - Instance %s Status' % inst.status)
+                   status=inst.status
+        except Exception:
+            print('   - Instance Not Found')
+            status = False
+
+        instance_data = {'instance_name': name,
+                                'status': status }
+        return instance_data
+
+
+    @classmethod
+    def terminate_exampleservice_instance_vm_on_cord(cls, tenant_name, vm_name, network_id):
+        credentials = cls.get_nova_credentials_v2()
+        nvclient = nova_client.Client('2', **credentials)
+        nvclient.quotas.delete(tenant_name)
+        try:
+            instance = nvclient.servers.find(name=vm_name)
+            nvclient.servers.delete(instance.id)
+            print "  * Instance terminated on cord: " + str(network_id)
+        except Exception:
+            print "  * Instance Not Found on cord: " + str(network_id)
+            pass
+        return True
+
 class ExampleSeviceWrapper(object):
 
     def __init__(self, exampleservice):