X-Git-Url: https://gerrit.onap.org/r/gitweb?p=multicloud%2Fframework.git;a=blobdiff_plain;f=multivimbroker%2Fmultivimbroker%2Fpub%2Futils%2Fsyscomm.py;h=0b2b557ebc2c1037f714df48dc7235dcc97bd5d9;hp=cdc64804e9f8d6823bcd5abc0f33b8b577623821;hb=2906f8863e3af3559a5ba288cbc2363f31c9f507;hpb=86f5bfc80a1c753c730e2d7cb3daceeeb67e6e6d diff --git a/multivimbroker/multivimbroker/pub/utils/syscomm.py b/multivimbroker/multivimbroker/pub/utils/syscomm.py index cdc6480..0b2b557 100644 --- a/multivimbroker/multivimbroker/pub/utils/syscomm.py +++ b/multivimbroker/multivimbroker/pub/utils/syscomm.py @@ -1,4 +1,5 @@ # Copyright (c) 2017 Wind River Systems, Inc. +# Copyright (c) 2017-2018 VMware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -10,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import inspect +import json +import os import re import multivimbroker.pub.exceptions as exceptions @@ -34,20 +37,16 @@ def getHeadersKeys(response): def findMultivimDriver(vim=None): - - if vim and vim["type"] == "openstack": - if vim["version"] == "kilo": - multivimdriver = "multicloud-kilo" - elif vim["version"] == "newton": - multivimdriver = "multicloud-newton" - else: - # if vim type is openstack, use latest "newton" version as default - multivimdriver = "multicloud-newton" - elif vim and vim["type"] == "vmware": - multivimdriver = "multicloud-vio" - else: + json_file = os.path.join(os.path.dirname(__file__), + '../config/provider-plugin.json') + with open(json_file, "r") as f: + plugins = json.load(f) + if not vim or vim.get("type") not in plugins.keys(): raise exceptions.NotFound("Not support VIM type") - return multivimdriver + plugin = plugins[vim["type"]] + if vim.get("version") in plugin["versions"].keys(): + return plugin["versions"][vim["version"]]["provider_plugin"] + return plugin["provider_plugin"] def getMultivimDriver(vimid, full_path=""):