summaryrefslogtreecommitdiffstats
path: root/modules/opnfv/deployment/factory.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-02-10 15:41:01 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-10 15:41:01 +0000
commit5ca936001bf36d177f81131de079b4ff314e5cc2 (patch)
treeab490d7aa41ecaa46d08a19c2060d0175cd34d19 /modules/opnfv/deployment/factory.py
parenta7d6727b96e3244b55106481275686f59487036b (diff)
parentba25afb8b30e8f757ea1a6a2819d30dd1644e5d3 (diff)
Merge changes from topics 'deployment_handler_refactor', 'deployment_handler'
* changes: [deployment handler] Refactor the old installer_handler [deployment_handler] Remove current scripts
Diffstat (limited to 'modules/opnfv/deployment/factory.py')
-rw-r--r--modules/opnfv/deployment/factory.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/opnfv/deployment/factory.py b/modules/opnfv/deployment/factory.py
new file mode 100644
index 000000000..e48a751ad
--- /dev/null
+++ b/modules/opnfv/deployment/factory.py
@@ -0,0 +1,44 @@
+##############################################################################
+# Copyright (c) 2017 Ericsson AB and others.
+# Author: Jose Lausuch (jose.lausuch@ericsson.com)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+from opnfv.deployment.apex import adapter as apex_adapter
+from opnfv.deployment.fuel import adapter as fuel_adapter
+from opnfv.utils import opnfv_logger as logger
+
+logger = logger.Logger(__name__).getLogger()
+
+
+class Factory(object):
+
+ INSTALLERS = ["fuel", "apex", "compass", "joid", "daisy"]
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def get_handler(installer,
+ installer_ip,
+ installer_user,
+ installer_pwd=None,
+ pkey_file=None):
+
+ if installer not in Factory.INSTALLERS:
+ raise Exception("This is not an OPNFV installer.")
+
+ if installer.lower() == "apex":
+ return apex_adapter.ApexAdapter(installer_ip=installer_ip,
+ installer_user=installer_user,
+ pkey_file=pkey_file)
+ elif installer.lower() == "fuel":
+ return fuel_adapter.FuelAdapter(installer_ip=installer_ip,
+ installer_user=installer_user,
+ installer_pwd=installer_pwd)
+ else:
+ raise Exception("Installer adapter is not implemented.")