summaryrefslogtreecommitdiffstats
path: root/ResmanagementService/service/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'ResmanagementService/service/src/main/java')
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/VimUtil.java69
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/UrlConstant.java10
2 files changed, 73 insertions, 6 deletions
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/VimUtil.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/VimUtil.java
index 92ab459..2e595d6 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/VimUtil.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/VimUtil.java
@@ -61,9 +61,11 @@ public class VimUtil {
}
/**
- * Get vimId by vimName.
+ * Get vimId by vimName.<br>
*
+ * @param name
* @return
+ * @since VFC 1.0
*/
public static String getVimIdByName(String name) {
JSONArray vims = getVims();
@@ -86,7 +88,21 @@ public class VimUtil {
* Get VIM.
*
* @param vimId
- * @return
+ * @return vimInfo
+ * {
+ * "vimId": "57674786-5b2e-4c92-bb68-578dbd79e2f5",
+ * "name": "vim",
+ * "url": "http://10.74.151.13:5000/v2.0",
+ * "userName": "admin",
+ * "password": "admin",
+ * "tenant": "admin",
+ * "vendor": "HW",
+ * "version": "v1.0",
+ * "description": "",
+ * "domain": "",
+ * "type": "openstack",
+ * "createTime": "2016-07-18 12:22:53"
+ * }
*/
public static JSONObject getVimById(String vimId) {
if(vimId == null || "".equals(vimId.trim())) {
@@ -99,11 +115,58 @@ public class VimUtil {
LOG.error("ESR return fail.");
return null;
} else {
- return esrResponse;
+ return parseEsrResponse(vimId, esrResponse);
}
}
/**
+ * <br>
+ *
+ * @param vimId
+ * @param esrResponse
+ * {
+ * "esr-system-info-id": "",
+ * "system-name": "",
+ * "type": "",
+ * "vendor": "",
+ * "version": "",
+ * "service-url": "",
+ * "user-name": "",
+ * "password": "",
+ * "system-type": "",
+ * "protocal": "",
+ * "ssl-cacert": "",
+ * "ssl-insecure": "",
+ * "ip-address": "",
+ * "port": "",
+ * "cloud-domain": "",
+ * "default-tenant": "",
+ * "resource-version": "",
+ * "relationship-list": [
+ * ]
+ * }
+ * @return
+ * @since VFC 1.0
+ */
+ private static JSONObject parseEsrResponse(String vimId, JSONObject esrResponse) {
+ JSONObject vimInfo = new JSONObject();
+ vimInfo.put("vimId", vimId);
+ vimInfo.put("name", esrResponse.getString("system-name"));
+ vimInfo.put("url", esrResponse.getString("service-url"));
+ vimInfo.put("userName", esrResponse.getString("user-name"));
+ vimInfo.put("password", esrResponse.getString("password"));
+ vimInfo.put("tenant", esrResponse.getString("default-tenant"));
+ vimInfo.put("vendor", esrResponse.getString("vendor"));
+ vimInfo.put("version", esrResponse.getString("version"));
+ vimInfo.put("description", "");
+ vimInfo.put("domain", esrResponse.getString("cloud-domain"));
+ vimInfo.put("type", esrResponse.getString("type"));
+ vimInfo.put("createTime", "");
+ LOG.info("parseEsrResponse vimInfo: {}", vimInfo);
+ return vimInfo;
+ }
+
+ /**
* Get tenants.
*
* @param vimId
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/UrlConstant.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/UrlConstant.java
index 8fd7702..0a32f0f 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/UrlConstant.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/UrlConstant.java
@@ -37,9 +37,13 @@ public class UrlConstant {
*/
public static final String REST_MSB_REGISTER = "/api/microservices/v1/services";
- public static final String ESR_GET_VIM_URL = "/api/extsys/v1/vims/%s";
+ // /api/extsys/v1/vims/%s
+ public static final String ESR_GET_VIM_URL =
+ "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/%s/%s/esr-system-info-list/esr-system-info/%s";
- public static final String ESR_GET_VIMS_URL = "/api/extsys/v1/vims";
+ // /api/extsys/v1/vims
+ public static final String ESR_GET_VIMS_URL =
+ "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/%s/%s/esr-system-info-list";
/**
* send resource info to monitor url
@@ -154,7 +158,7 @@ public class UrlConstant {
/**
* getTenantURL.
*/
- public static final String GET_TENANT_URL = "/api/multivim/v1/%s/tenants";
+ public static final String GET_TENANT_URL = "/api/multicloud/v0/%s/tenants";
/**
* getHostURL.