summaryrefslogtreecommitdiffstats
path: root/ResmanagementService/service/src
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2017-10-06 11:52:18 +0530
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2017-10-19 05:05:51 +0000
commitbff486388c23b65fb0ca3dc1f77b376576af9e48 (patch)
treed386747b017b331737516960b11693f2ef5a868e /ResmanagementService/service/src
parentb3b8ced6e86f62e681996304391006ca80a2fb06 (diff)
Relationship implementation for generic-vnf
Add relationship between generic-vnf, service-instance and esr-vnfm to store vnfm related info. Issue-ID: VFC-462 Change-Id: I917d1f22065f46a663cb58f1c5be289bb4275648 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'ResmanagementService/service/src')
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/util/restclient/RestfulResponse.java4
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/dao/impl/aai/VnfAaiDaoImpl.java154
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/entity/VnfEntity.java120
-rw-r--r--ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfServiceImpl.java14
4 files changed, 259 insertions, 33 deletions
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/util/restclient/RestfulResponse.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/util/restclient/RestfulResponse.java
index c805532..f71122c 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/util/restclient/RestfulResponse.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/util/restclient/RestfulResponse.java
@@ -141,4 +141,8 @@ public class RestfulResponse {
public void setResponseJson(final String responseString) {
this.responseContent = responseString;
}
+
+ public boolean isSuccess() {
+ return this.getStatus() / 100 == 2;
+ }
}
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/dao/impl/aai/VnfAaiDaoImpl.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/dao/impl/aai/VnfAaiDaoImpl.java
index abc4ccb..bda5822 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/dao/impl/aai/VnfAaiDaoImpl.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/dao/impl/aai/VnfAaiDaoImpl.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.onap.vfc.nfvo.resmanagement.common.util.RestfulUtil;
import org.onap.vfc.nfvo.resmanagement.common.util.request.RequestUtil;
import org.onap.vfc.nfvo.resmanagement.common.util.restclient.RestfulParametes;
@@ -40,8 +41,11 @@ public class VnfAaiDaoImpl implements VnfDao {
public List<VnfEntity> getVnfs(Map<String, Object> condition) {
ArrayList<VnfEntity> vnfList = new ArrayList<>();
- if(condition.containsKey("id")) {
- vnfList.add(getVnf((String)condition.get("id")));
+ if (condition.containsKey("id")) {
+ VnfEntity vnf = getVnf((String)condition.get("id"));
+ if(vnf != null) {
+ vnfList.add(vnf);
+ }
} else {
RestfulParametes restfulParametes = new RestfulParametes();
restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
@@ -49,38 +53,156 @@ public class VnfAaiDaoImpl implements VnfDao {
RestfulResponse response = RestfulUtil.getRestfulResponse(
"https://192.168.17.24:8443/aai/v11/network/generic-vnfs", restfulParametes, "get");
- JSONObject jsonObject = JSONObject.fromObject(response.getResponseContent());
- JSONArray jsonArray = jsonObject.getJSONArray("generic-vnf");
+ if(response.isSuccess()) {
+ JSONObject jsonObject = JSONObject.fromObject(response.getResponseContent());
+ JSONArray jsonArray = jsonObject.getJSONArray("generic-vnf");
- jsonArray.forEach(genericVnf -> vnfList.add(VnfEntity.toEntityFromAai((JSONObject)genericVnf)));
+ for(int i = 0; i < jsonArray.size(); i++) {
+ JSONObject genericVnf = jsonArray.getJSONObject(i);
+ VnfEntity entityFromAai = VnfEntity.toEntityFromAai(genericVnf);
+ vnfList.add(updateVnfInfo(entityFromAai, genericVnf));
+ }
+ }
}
return vnfList;
}
+ private VnfEntity updateVnfInfo(VnfEntity vnfEntity, JSONObject jsonObject) {
+ updateVnfInfo(vnfEntity, jsonObject);
+ updateNsInfo(vnfEntity, jsonObject);
+ return vnfEntity;
+ }
+
+ private VnfEntity updateVnfmInfo(VnfEntity vnfEntity, JSONObject jsonObject) {
+ if(!jsonObject.has("relationship-list")) {
+ return vnfEntity;
+ }
+
+ JSONArray relList = (JSONArray)((JSONObject)jsonObject.get("relationship-list")).get("relationship");
+ for(int i = 0; i < relList.size(); i++) {
+ JSONObject obj = relList.getJSONObject(i);
+ if("esr-vnfm".equals(obj.getString("related-to"))) {
+ String relatedLink = obj.getString("related-link");
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ RestfulResponse restfulResponse = RestfulUtil
+ .getRestfulResponse("https://192.168.17.24:8443" + relatedLink, restfulParametes, "get");
+
+ if(restfulResponse.isSuccess()) {
+ VnfEntity.updateEntityWithVnfmInfo(vnfEntity,
+ JSONObject.fromObject(restfulResponse.getResponseContent()));
+ break;
+ }
+ }
+ }
+ return vnfEntity;
+ }
+
+ private VnfEntity updateNsInfo(VnfEntity vnfEntity, JSONObject jsonObject) {
+ if(!jsonObject.has("relationship-list")) {
+ return vnfEntity;
+ }
+
+ JSONArray relList = (JSONArray)((JSONObject)jsonObject.get("relationship-list")).get("relationship");
+ for(int i = 0; i < relList.size(); i++) {
+ JSONObject obj = relList.getJSONObject(i);
+ if("service-instance".equals(obj.getString("related-to"))) {
+ String relatedLink = obj.getString("related-link");
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ RestfulResponse restfulResponse = RestfulUtil
+ .getRestfulResponse("https://192.168.17.24:8443" + relatedLink, restfulParametes, "get");
+
+ if(restfulResponse.isSuccess()) {
+ VnfEntity.updateEntityWithNsInfo(vnfEntity,
+ JSONObject.fromObject(restfulResponse.getResponseContent()));
+ break;
+ }
+ }
+ }
+ return vnfEntity;
+ }
+
@Override
public VnfEntity getVnf(String id) {
+ VnfEntity vnfEntity = null;
RestfulParametes restfulParametes = new RestfulParametes();
restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
RestfulResponse response = RestfulUtil.getRestfulResponse(
"https://192.168.17.24:8443/aai/v11/network/generic-vnfs/generic-vnf/" + id, restfulParametes, "get");
- JSONObject jsonObject = JSONObject.fromObject(response.getResponseContent());
- VnfEntity vnfEntity = VnfEntity.toEntityFromAai(jsonObject);
+ if(response.isSuccess()) {
+ JSONObject jsonObject = JSONObject.fromObject(response.getResponseContent());
+ vnfEntity = VnfEntity.toEntityFromAai(jsonObject);
+ updateVnfInfo(vnfEntity, jsonObject);
+ }
return vnfEntity;
}
- @Override
- public int addVnf(VnfEntity vnfEntity) {
+ private int checkVnfmEntity(VnfEntity vnfEntity) {
+ RestfulParametes restfulParametes = new RestfulParametes();
+
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ // restfulParametes.setRawData(vnfEntity.toEsrVnfmStringForAai());
+ RestfulResponse response = RestfulUtil.getRestfulResponse(
+ "https://192.168.17.24:8443/aai/v11/external-system/esr-vnfm-list/esr-vnfm/" + vnfEntity.getVnfmId(),
+ restfulParametes, "get");
+ return response == null || !response.isSuccess() ? VNF_AAI_DAO_FAIL : VNF_AAI_DAO_SUCCESS;
+ }
+
+ private int checkServiceInstanceEntity(VnfEntity vnfEntity) {
RestfulParametes restfulParametes = new RestfulParametes();
+
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ RestfulResponse response = RestfulUtil.getRestfulResponse(
+ "https://192.168.17.24:8443/aai/v11/business/customers/customer/vfc/service-subscriptions/service-subscription"
+ + "/vfc-service/service-instances/service-instance/" + vnfEntity.getNsId(), restfulParametes, "get");
+ return response == null || !response.isSuccess() ? VNF_AAI_DAO_FAIL : VNF_AAI_DAO_SUCCESS;
+ }
+
+
+ private int addVnfToAAI(VnfEntity vnfEntity) {
+ RestfulParametes restfulParametes = new RestfulParametes();
+
restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
restfulParametes.setRawData(vnfEntity.toStringForAai());
RestfulResponse response = RestfulUtil.getRestfulResponse(
- "https://192.168.17.24:8443/aai/v11/network/generic-vnfs/generic-vnf/" + vnfEntity.getVnfInstanceId(),
+ "https://192.168.17.24:8443/aai/v11/network/generic-vnfs/generic-vnf/" + vnfEntity.getId(),
restfulParametes, "put");
+ return response == null || !response.isSuccess() ? VNF_AAI_DAO_FAIL : VNF_AAI_DAO_SUCCESS;
+ }
+
+ @Override
+ public int addVnf(VnfEntity vnfEntity) {
- return response == null || response.getStatus() == -1 ? VNF_AAI_DAO_FAIL : VNF_AAI_DAO_SUCCESS;
+ if(checkVnfmEntity(vnfEntity) == VNF_AAI_DAO_SUCCESS) {
+ if(checkServiceInstanceEntity(vnfEntity) == VNF_AAI_DAO_SUCCESS){
+ if(addVnfToAAI(vnfEntity) == VNF_AAI_DAO_SUCCESS) {
+ return VNF_AAI_DAO_SUCCESS;
+ }
+
+ }
+ }
+
+ return VNF_AAI_DAO_FAIL;
+ }
+
+ private int deteletVnfm(VnfEntity vnfEntity) {
+ if(!StringUtils.isEmpty(vnfEntity.getVnfmResourceVersion())) {
+ RestfulParametes restfulParametes = new RestfulParametes();
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ restfulParametes.put("resource-version", vnfEntity.getVnfmResourceVersion());
+
+ RestfulResponse response = RestfulUtil
+ .getRestfulResponse("https://192.168.17.24:8443/aai/v11/external-system/esr-vnfm-list/esr-vnfm/"
+ + vnfEntity.getVnfmId(), restfulParametes, "delete");
+ return response == null || !response.isSuccess() ? VNF_AAI_DAO_FAIL : VNF_AAI_DAO_SUCCESS;
+ }
+ return VNF_AAI_DAO_FAIL;
}
@Override
@@ -90,12 +212,16 @@ public class VnfAaiDaoImpl implements VnfDao {
if(vnfEntity != null) {
RestfulParametes restfulParametes = new RestfulParametes();
restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
- restfulParametes.put("resource-version", vnfEntity.getResourceVersion());
-
+ restfulParametes.put("resource-version", vnfEntity.getVnfResourceVersion());
RestfulResponse response = RestfulUtil
.getRestfulResponse("https://192.168.17.24:8443/aai/v11/network/generic-vnfs/generic-vnf/"
+ vnfEntity.getVnfInstanceId(), restfulParametes, "delete");
+
+ if(response.isSuccess()) {
+ deteletVnfm(vnfEntity);
+ return VNF_AAI_DAO_SUCCESS;
+ }
}
- return 1;
+ return VNF_AAI_DAO_FAIL;
}
}
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/entity/VnfEntity.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/entity/VnfEntity.java
index 2d09546..84b8620 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/entity/VnfEntity.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/entity/VnfEntity.java
@@ -20,7 +20,12 @@ import java.io.Serializable;
import org.apache.commons.lang.StringUtils;
import org.onap.vfc.nfvo.resmanagement.common.util.JsonUtil;
+import org.onap.vfc.nfvo.resmanagement.common.util.RestfulUtil;
+import org.onap.vfc.nfvo.resmanagement.common.util.request.RequestUtil;
+import org.onap.vfc.nfvo.resmanagement.common.util.restclient.RestfulParametes;
+import org.onap.vfc.nfvo.resmanagement.common.util.restclient.RestfulResponse;
+import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
@@ -96,7 +101,9 @@ public class VnfEntity implements Serializable {
private String name;
/** */
- private String resourceVersion;
+ private String vnfResourceVersion;
+
+ private String vnfmResourceVersion;
private static final long serialVersionUID = 1L;
@@ -278,7 +285,7 @@ public class VnfEntity implements Serializable {
/**
* <br>
- *
+ *
* @param jsonObject
* @return
* @since VFC 1.0
@@ -307,30 +314,62 @@ public class VnfEntity implements Serializable {
vnfEntity.setMaxRam(JsonUtil.getJsonFieldInt(jsonObject, "maxRam"));
vnfEntity.setMaxShd(JsonUtil.getJsonFieldInt(jsonObject, "maxShd"));
vnfEntity.setMaxNet(JsonUtil.getJsonFieldInt(jsonObject, "maxNet"));
- vnfEntity.setResourceVersion(JsonUtil.getJsonFieldStr(jsonObject, "resource-version"));
+ vnfEntity.setVnfResourceVersion(JsonUtil.getJsonFieldStr(jsonObject, "resource-version"));
return vnfEntity;
}
public static VnfEntity toEntityFromAai(JSONObject jsonObject) {
VnfEntity vnfEntity = new VnfEntity();
+ vnfEntity.setId(JsonUtil.getJsonFieldStr(jsonObject, "vnf-id"));
vnfEntity.setVnfInstanceId(JsonUtil.getJsonFieldStr(jsonObject, "vnf-id"));
vnfEntity.setVnfInstanceName(JsonUtil.getJsonFieldStr(jsonObject, "vnf-name"));
vnfEntity.setName(JsonUtil.getJsonFieldStr(jsonObject, "vnf-name2"));
vnfEntity.setNsId(JsonUtil.getJsonFieldStr(jsonObject, "service-id"));
vnfEntity.setVnfStatus(JsonUtil.getJsonFieldStr(jsonObject, "orchestration-status"));
vnfEntity.setVnfType(JsonUtil.getJsonFieldStr(jsonObject, "vnf-type"));
+ vnfEntity.setVnfPackageName(JsonUtil.getJsonFieldStr(jsonObject, "vnf-package-name"));
+ vnfEntity.setVnfDescriptorName(JsonUtil.getJsonFieldStr(jsonObject, "vnf-discriptor-name"));
+ vnfEntity.setJobId(JsonUtil.getJsonFieldStr(jsonObject, "job-id"));
vnfEntity.setMaxCpu(JsonUtil.getJsonFieldInt(jsonObject, "vcpu"));
vnfEntity.setMaxDisk(JsonUtil.getJsonFieldInt(jsonObject, "vdisk"));
vnfEntity.setMaxRam(JsonUtil.getJsonFieldInt(jsonObject, "vmemory"));
- vnfEntity.setMaxShd(JsonUtil.getJsonFieldInt(jsonObject, "vdisk-units"));
- vnfEntity.setResourceVersion(JsonUtil.getJsonFieldStr(jsonObject, "resource-version"));
+ vnfEntity.setMaxNet(JsonUtil.getJsonFieldInt(jsonObject, "vnet"));
+ vnfEntity.setMaxShd(JsonUtil.getJsonFieldInt(jsonObject, "nshd"));
+ vnfEntity.setMaxVm(JsonUtil.getJsonFieldInt(jsonObject, "nvm"));
+ vnfEntity.setVnfResourceVersion(JsonUtil.getJsonFieldStr(jsonObject, "resource-version"));
return vnfEntity;
}
- public String toStringForAai() {
+ public static void updateEntityWithVnfmInfo(VnfEntity vnfEntity, JSONObject jsonObject) {
+ vnfEntity.setVnfmId(JsonUtil.getJsonFieldStr(jsonObject, "vnfm-id"));
+ vnfEntity.setVnfmName(JsonUtil.getJsonFieldStr(jsonObject, "vnfm-name"));
+ vnfEntity.setVnfmResourceVersion(JsonUtil.getJsonFieldStr(jsonObject, "resource-version"));
+
+ // vim id stores the info as vim-id: <cloud-region-owner>_<cloud-region-id>
+ // and esr-sysstem-info contains vim info.
+ String str = JsonUtil.getJsonFieldStr(jsonObject, "vim-id");
+ String[] result = str.split("_");
+ RestfulParametes restfulParametes = new RestfulParametes();
+ restfulParametes.setHeaderMap(RequestUtil.getAAIHeaderMap());
+ RestfulResponse restfulResponse = RestfulUtil
+ .getRestfulResponse("https://192.168.17.24:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/"
+ + result[0] + "/" + result[1] + "/esr-system-info-list/esr-system-info", restfulParametes, "get");
+
+ if(restfulResponse.isSuccess()) {
+ vnfEntity.setVimId(JsonUtil.getJsonFieldStr(jsonObject, "esr-system-info-id"));
+ vnfEntity.setVimName(JsonUtil.getJsonFieldStr(jsonObject, "system-name"));
+ vnfEntity.setVimTenant(JsonUtil.getJsonFieldStr(jsonObject, "default-tenant"));
+ }
+ }
+
+ public static void updateEntityWithNsInfo(VnfEntity vnfEntity, JSONObject jsonObject) {
+ vnfEntity.setNsId(JsonUtil.getJsonFieldStr(jsonObject, "service-instance-id"));
+ vnfEntity.setNsName(JsonUtil.getJsonFieldStr(jsonObject, "service-instance-name"));
+ }
+ public String toStringForAai() {
JSONObject vnfResJson = new JSONObject();
- vnfResJson.put("vnf-id", StringUtils.trimToEmpty(this.getVnfInstanceId()));
+ vnfResJson.put("vnf-id", StringUtils.trimToEmpty(this.getId()));
vnfResJson.put("vnf-name", StringUtils.trimToEmpty(this.getVnfInstanceName()));
vnfResJson.put("vnf-name2", StringUtils.trimToEmpty(this.getName()));
vnfResJson.put("service-id", StringUtils.trimToEmpty(this.getNsId()));
@@ -338,10 +377,59 @@ public class VnfEntity implements Serializable {
vnfResJson.put("vcpu", this.getMaxCpu());
vnfResJson.put("vdisk", this.getMaxDisk());
vnfResJson.put("vmemory", this.getMaxRam());
- vnfResJson.put("vdisk-units", this.getMaxShd());
+ vnfResJson.put("nshd", this.getMaxShd());
+ vnfResJson.put("nvm", this.getMaxVm());
+ vnfResJson.put("nnet", this.getMaxNet());
+ vnfResJson.put("vnf-package-name", StringUtils.trimToEmpty(this.getVnfPackageName()));
+ vnfResJson.put("vnf-discriptor-name", StringUtils.trimToEmpty(this.getVnfDescriptorName()));
+ vnfResJson.put("job-id", StringUtils.trimToEmpty(this.getJobId()));
+ vnfResJson.put("orchestration-status", StringUtils.trimToEmpty(this.getVnfStatus()));
+
+ JSONObject relationshipDataEntry = new JSONObject();
+ relationshipDataEntry.put("relationship-key", "esr-vnfm.vnfm-id");
+ relationshipDataEntry.put("relationship-value", this.getVnfmId());
+
+ JSONArray relationshipData1 = new JSONArray();
+ JSONObject customer = new JSONObject();
+ customer.put("relationship-key", "customer.global-customer-id");
+ customer.put("relationship-value", "ResManagement-Customer-id");
+ JSONObject service = new JSONObject();
+ service.put("relationship-key", "service-subscription.service-type");
+ service.put("relationship-value", "ResManagement-NSID-Service-Type");
+ JSONObject serviceInstance = new JSONObject();
+ serviceInstance.put("relationship-key", "service-instance.service-instance-id");
+ serviceInstance.put("relationship-value", this.getNsId());
+ relationshipData1.add(customer);
+ relationshipData1.add(service);
+ relationshipData1.add(serviceInstance);
+
+
+ JSONArray relationshipData = new JSONArray();
+ relationshipData.add(relationshipDataEntry);
+ JSONArray relationship = new JSONArray();
+ JSONObject relationshipEntry = new JSONObject();
+ relationshipEntry.put("related-to", "esr-vnfm");
+ relationshipEntry.put("relationship-data", relationshipData);
+ JSONObject relationshipEntry1 = new JSONObject();
+ relationshipEntry1.put("related-to", "service-instance");
+ relationshipEntry1.put("relationship-data", relationshipData1);
+ relationship.add(relationshipEntry);
+ relationship.add(relationshipEntry1);
+
+ JSONObject relation = new JSONObject();
+ relation.put("relationship", relationship);
+
+ vnfResJson.put("relationship-list", relation);
return vnfResJson.toString();
}
+ public String toEsrVnfmStringForAai() {
+ JSONObject esrVnfm = new JSONObject();
+ esrVnfm.put("vnfm-id", StringUtils.trimToEmpty(this.getVnfmId()));
+ esrVnfm.put("vim-id", StringUtils.trimToEmpty(this.getVimId()));
+ return esrVnfm.toString();
+ }
+
@Override
public String toString() {
JSONObject vnfResJson = new JSONObject();
@@ -370,11 +458,19 @@ public class VnfEntity implements Serializable {
return vnfResJson.toString();
}
- public String getResourceVersion() {
- return resourceVersion;
+ public String getVnfmResourceVersion() {
+ return vnfmResourceVersion;
+ }
+
+ public void setVnfmResourceVersion(String vnfmResourceVersion) {
+ this.vnfmResourceVersion = vnfmResourceVersion;
+ }
+
+ public String getVnfResourceVersion() {
+ return vnfResourceVersion;
}
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
+ public void setVnfResourceVersion(String vnfResourceVersion) {
+ this.vnfResourceVersion = vnfResourceVersion;
}
}
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfServiceImpl.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfServiceImpl.java
index d5b40fc..8639ae4 100644
--- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfServiceImpl.java
+++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfServiceImpl.java
@@ -36,7 +36,7 @@ import net.sf.json.JSONObject;
* <br>
* <p>
* </p>
- *
+ *
* @author
* @version VFC 1.0 Oct 28, 2016
*/
@@ -50,7 +50,7 @@ public class VnfServiceImpl implements VnfService {
/**
* <br>
- *
+ *
* @param vnfEntity
* @return
* @throws ServiceException
@@ -80,14 +80,14 @@ public class VnfServiceImpl implements VnfService {
/**
* <br>
- *
+ *
* @param id
* @return
* @since VFC 1.0
*/
private boolean checkId(String id) {
VnfEntity vnf = vnfDao.getVnf(id);
- if(null == vnf) {
+ if(null == vnf || StringUtils.isEmpty(vnf.getId())) {
return true;
}
return false;
@@ -95,7 +95,7 @@ public class VnfServiceImpl implements VnfService {
/**
* <br>
- *
+ *
* @param map
* @return
* @throws ServiceException
@@ -108,7 +108,7 @@ public class VnfServiceImpl implements VnfService {
/**
* <br>
- *
+ *
* @param id
* @return
* @throws ServiceException
@@ -122,7 +122,7 @@ public class VnfServiceImpl implements VnfService {
/**
* <br>
- *
+ *
* @param vnfInstanceId
* @throws ServiceException
* @since VFC 1.0