summaryrefslogtreecommitdiffstats
path: root/huawei
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2017-09-22 02:10:23 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 02:10:23 +0000
commitbfba762379d661890e079243d28f528796463eaa (patch)
tree75a5183b4263e78e06064b8ec58a95fb6cc68844 /huawei
parent8a28a7c393f346d7ee9b4d2f28ed9785cbaa113d (diff)
parent402f0e05c91db0d52cc91e360fd98f0aac455068 (diff)
Merge "Fix VNF instantiate problem"
Diffstat (limited to 'huawei')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java17
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java2
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java2
3 files changed, 13 insertions, 8 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 5e386376..98e3fa04 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
@@ -57,14 +57,14 @@ public class AdapterResourceManager implements IResourceManager {
@Override
public JSONObject uploadVNFPackage(JSONObject vnfpkg, Map<String, String> paramsMap) {
JSONObject resultObj = new JSONObject();
- JSONObject csarTempObj = new JSONObject();
-
+ String vnfDescriptorId = paramsMap.get("vnfDescriptorId");
try {
// if upper layer do not provide vnfpackage info,then get the
// vnfpackage info from JSON file.
if(vnfpkg == null || vnfpkg.isEmpty()) {
String vnfPkgInfo = readVfnPkgInfoFromJson();
- vnfpkg = JSONObject.fromObject(vnfPkgInfo); // NOSONAR
+ JSONObject vnfpkgJson = JSONObject.fromObject(vnfPkgInfo);
+ vnfpkg = vnfpkgJson.getJSONObject(vnfDescriptorId);
}
} catch(IOException e) {
LOG.error("function=uploadVNFPackage", e);
@@ -80,7 +80,7 @@ public class AdapterResourceManager implements IResourceManager {
String csarid = paramsMap.get("csarid");
String vnfmid = paramsMap.get("vnfmid");
String vnfdid = "";
- String vnfDescriptorId = paramsMap.get("vnfDescriptorId");
+
if(null == csarid || "".equals(csarid)) {
resultObj.put("reason", "csarid is null.");
resultObj.put("retCode", Constant.REST_FAIL);
@@ -104,7 +104,7 @@ public class AdapterResourceManager implements IResourceManager {
resultObj.put("retCode", Constant.REST_FAIL);
return resultObj;
}
-
+ JSONObject csarTempObj = new JSONObject();
csarTempObj = vnfpkg.getJSONObject("template");
String csarfilepath = csarTempObj.getString("csar_file_path");
String csarfilename = csarTempObj.getString("csar_file_name");
@@ -180,12 +180,17 @@ public class AdapterResourceManager implements IResourceManager {
}
// upload VNF package
- csarTempObj.getJSONArray("vim_list").getJSONObject(0).put("vim_id", vimId);
+ csarTempObj.put("vim_id", vimId);
vnfpkg.put("template", csarTempObj);
LOG.info("vnfpkg: " + vnfpkg);
JSONObject uploadPkgObject = upload(vnfpkg, vnfmUrl, connToken);
LOG.info("uploadPkgObject:" + uploadPkgObject);
+ if(!uploadPkgObject.isEmpty() && uploadPkgObject.get(Constant.RETCODE).equals(HttpStatus.SC_OK)) {
+ LOG.info("upload vnf package info successful.", uploadPkgObject.get(Constant.RETCODE));
+ vnfdid = uploadPkgObject.getString("id");
+ }
+
if(vnfdid == null || "".equals(vnfdid.trim())) {
JSONObject vnfdConf = readVnfdIdInfoFromJson();
LOG.info("vnfdConf=" + vnfdConf);
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java
index 33730fd2..d1508ba0 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java
@@ -159,7 +159,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr {
int statusCode = queryResult.getInt(Constant.RETCODE);
- if(statusCode == Constant.HTTP_NOCONTENT) {
+ if(statusCode == Constant.HTTP_NOCONTENT || statusCode == Constant.HTTP_OK) {
restJson.put(Constant.RETCODE, Constant.REST_SUCCESS);
JSONObject resultObj = new JSONObject();
resultObj.put(Constant.JOBID, vnfId + "_" + Constant.DELETE);
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
index 7d3c14c2..35f7ceaa 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
@@ -252,7 +252,7 @@ public class VnfRoa {
@Path("/{vnfmId}/jobs/{jobId}")
public String getJob(@PathParam("jobId") String jobId, @PathParam("vnfmId") String vnfmId,
@Context HttpServletResponse resp, @QueryParam("@responseId") String responseId) throws ServiceException {
- LOG.warn("function=getJob, msg=enter to get a job: jobId: {}", jobId);
+ LOG.warn("function=getJob, msg=enter to get a job: jobId: {}, responseId: {}", jobId, responseId);
JSONObject restJson = new JSONObject();
if(StringUtils.isEmpty(jobId) || StringUtils.isEmpty(vnfmId)) {