Merge "Revise vim_types API"
[multicloud/framework.git] / multivimbroker / multivimbroker / forwarder / views.py
index e098065..7935642 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright 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.
@@ -86,8 +87,13 @@ class VIMTypes(BaseServer):
                                  '../pub/config/provider-plugin.json')
         with open(json_file, "r") as f:
             plugins = json.load(f)
-        data = {"vim_types": plugins}
-        return Response(data=data, status=status.HTTP_200_OK)
+        ret = []
+        for k, v in plugins.items():
+            item = {}
+            item["vim_type"] = v.get("vim_type")
+            item["versions"] = [k for k in v.get('versions', {})]
+            ret.append(item)
+        return Response(data=ret, status=status.HTTP_200_OK)
 
 
 # forward  handler