summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'sdnvpn/lib/utils.py')
-rw-r--r--sdnvpn/lib/utils.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 149a37e..8c4aebf 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -7,6 +7,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
+import os
import sys
import time
import requests
@@ -15,6 +16,7 @@ import subprocess
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
+from opnfv.deployment.factory import Factory as DeploymentFactory
from sdnvpn.lib import config as sdnvpn_config
@@ -200,6 +202,38 @@ def generate_userdata_with_ssh(ips_array):
return (u1 + u2)
+def get_installerHandler():
+ installer_type = str(os.environ['INSTALLER_TYPE'].lower())
+ installer_ip = get_installer_ip()
+
+ if installer_type not in ["fuel", "apex"]:
+ raise ValueError("%s is not supported" % installer_type)
+ else:
+ if installer_type in ["apex"]:
+ developHandler = DeploymentFactory.get_handler(
+ installer_type,
+ installer_ip,
+ 'root',
+ pkey_file="/root/.ssh/id_rsa")
+
+ if installer_type in ["fuel"]:
+ developHandler = DeploymentFactory.get_handler(
+ installer_type,
+ installer_ip,
+ 'root',
+ 'r00tme')
+ return developHandler
+
+
+def get_nodes():
+ developHandler = get_installerHandler()
+ return developHandler.get_nodes()
+
+
+def get_installer_ip():
+ return str(os.environ['INSTALLER_IP'])
+
+
def wait_for_instance(instance):
logger.info("Waiting for instance %s to get a DHCP lease..." % instance.id)
# The sleep this function replaced waited for 80s