summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluxin <luxin7@huawei.com>2018-01-19 16:10:56 +0800
committerluxin <luxin7@huawei.com>2018-01-19 16:10:56 +0800
commitd1ea8d0291c33cf476e11ec1ee945f69bc15bdaa (patch)
treef0b1f180117979231ad2b1ebb4335ab038402769
parent61c585122c85c6b1133bc4eac16e55f164233ef8 (diff)
Update vnfpakge config file
Change-Id: Idff8f6664b9c8faf03a4b72a2bff3942cedab544 Issue-ID: VFC-668 Signed-off-by: luxin <luxin7@huawei.com>
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java
index 43feb8fc..68bc7f9e 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java
@@ -62,16 +62,17 @@ public class AdapterResourceManager implements IResourceManager {
private static final String VNFD_FILE_PATH = "vnfd_file_path";
@Override
- public JSONObject uploadVNFPackage(JSONObject vnfpkg, Map<String, String> paramsMap) {
+ public JSONObject uploadVNFPackage(JSONObject vnfpkge, Map<String, String> paramsMap) {
JSONObject resultObj = new JSONObject();
String vnfDescriptorId = paramsMap.get("vnfDescriptorId");
+ JSONObject vnfpkgJson = new JSONObject();
try {
// if upper layer do not provide vnfpackage info,then get the
// vnfpackage info from JSON file.
- if(vnfpkg == null || vnfpkg.isEmpty()) {
+ if(vnfpkge == null || vnfpkge.isEmpty()) {
String vnfPkgInfo = readVfnPkgInfoFromJson();
- JSONObject vnfpkgJson = JSONObject.fromObject(vnfPkgInfo);
- vnfpkg = vnfpkgJson.getJSONObject(vnfDescriptorId);
+ vnfpkgJson = JSONObject.fromObject(vnfPkgInfo);
+
}
} catch(IOException e) {
LOG.error("function=uploadVNFPackage", e);
@@ -102,15 +103,19 @@ public class AdapterResourceManager implements IResourceManager {
// obtain CSAR package info
JSONObject csarobj = getVnfmCsarInfo(csarid);
String downloadUri = "";
+ String csarName = "";
if(Integer.valueOf(csarobj.get(Constant.RETCODE).toString()) == Constant.HTTP_OK) {
LOG.info("get CSAR info successful.", csarobj.get(Constant.RETCODE));
downloadUri = csarobj.getJSONObject("packageInfo").getString("downloadUrl");
+ csarName = csarobj.getJSONObject("packageInfo").getString("csarName");
} else {
LOG.error("get CSAR info fail.", csarobj.get(Constant.RETCODE));
resultObj.put(Constant.REASON, csarobj.get(Constant.REASON).toString());
resultObj.put(Constant.RETCODE, Constant.REST_FAIL);
return resultObj;
}
+ String vnfdName = transferFromCsar(csarName);
+ JSONObject vnfpkg = vnfpkgJson.getJSONObject(vnfdName);
JSONObject csarTempObj = vnfpkg.getJSONObject("template");
String csarfilepath = csarTempObj.getString("csar_file_path");
String csarfilename = csarTempObj.getString("csar_file_name");
@@ -196,9 +201,9 @@ public class AdapterResourceManager implements IResourceManager {
if(vnfdid == null || "".equals(vnfdid.trim())) {
JSONObject vnfdConf = readVnfdIdInfoFromJson();
- LOG.info("vnfdConf=" + vnfdConf);
- if(vnfdConf.containsKey(vnfDescriptorId)) {
- vnfdid = vnfdConf.getString(vnfDescriptorId);
+ LOG.info("vnfdName:" + vnfdName + ", vnfdConf=" + vnfdConf);
+ if(vnfdConf.containsKey(vnfdName)) {
+ vnfdid = vnfdConf.getString(vnfdName);
}
}
LOG.info("set vnfdId=" + vnfdid);
@@ -271,6 +276,14 @@ public class AdapterResourceManager implements IResourceManager {
return resultObj;
}
+ private String transferFromCsar(String csarName) {
+ LOG.info("csarName: " + csarName);
+ if(csarName.toUpperCase().contains("HSS")) {
+ return "HSS";
+ }
+ return "";
+ }
+
private JSONObject uploadCsar(JSONObject vnfpkg, String csarfilepath) {
LOG.info("vnfpkg: " + vnfpkg + "csarfilepath:" + csarfilepath);
JSONObject resJson = new JSONObject();