VOL-572: Integration testing with Kubernetes

This update is an attempt to modify the Voltha integration test suite to support
multiple run-time environments: single-node Kubernetes, single-node Docker swarm,
as well as the current docker-compose environment. To run tests in environments
other than docker-compose, a config file containing test parameters is passed to
the test code via a nose plugin call nose-testconfig. The path to this file is
specified via a "tc-file" argument supplied to the nosetests command.

Thus far, only test_cold_activation_sequence and test_voltha_rest_apis have been
modified. The intent is to update the remaining integration tests as well. The
README.md file has been updated for these 2 tests but this is not necessarily
how the documentation will evolve with this feature.

Change-Id: I6d9b260c34ef069935ae30958f3c3012ffe603b6
diff --git a/tests/itests/docutests/test_utils.py b/tests/itests/docutests/test_utils.py
index f987b0f..8df65e6 100644
--- a/tests/itests/docutests/test_utils.py
+++ b/tests/itests/docutests/test_utils.py
@@ -119,3 +119,20 @@
         return True
     except socket.error:
         return False
+
+def get_pod_ip(pod_name_prefix):
+    '''
+    This function works only in the single-node Kubernetes environment, where
+    the name of a Voltha pod may look something like 'vcore-64ffb9b49c-sstfn'.
+    The function searches for the pod whose name is prefixed with 'vcore-'
+    and returns the IP address of that pod.
+    In the Kubernetes clustered environment, there would likely be multiple pods
+    so named, in which case the target pod sought could not be found.
+
+    TODO: Investigate other CLIs or APIs that could be used to determine the pod IP.
+    '''
+    pod_name_prefix = pod_name_prefix + "-"
+    out, err, rc = run_command_to_completion_with_raw_stdout('kubectl -n voltha get pods -o wide | grep ' +
+                                                             pod_name_prefix)
+    tokens = out.split()
+    return tokens[5]