diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2017-11-07 15:20:33 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2017-11-07 15:20:38 +0800 |
commit | a7b9f3b17a24ec6863bba358e65833a5f36c9caf (patch) | |
tree | 816e4afbf069eaf4e7aea1e6835bfe3a858175c1 | |
parent | 51aacdf7e399b68d838aea4ae0f7eb1d39722ad3 (diff) |
add onboard result
Change-Id: I0d3ff6dbaf26ef3e28da854d749f4bfae29cd5e2
Issue-id: USECASEUI-55
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
5 files changed, 66 insertions, 6 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java index 0de43e1d..ab0780f3 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java @@ -66,4 +66,16 @@ public class PackageDistributionController { public JobStatus getJobStatus(@PathVariable(value="jobId") String jobId){ return packageDistributionService.getJobStatus(jobId); } + + @ResponseBody + @RequestMapping(value = {"/uui-lcm/ns-packages/{casrId}"}, method = RequestMethod.GET , produces = "application/json") + public DistributionResult deleteNsPackage(@PathVariable("casrId") String casrId){ + return packageDistributionService.deleteNsPackage(casrId); + } + + @ResponseBody + @RequestMapping(value = {"/uui-lcm/vf-packages/{casrId}"}, method = RequestMethod.GET , produces = "application/json") + public DistributionResult deleteVfPackage(@PathVariable("casrId") String casrId){ + return packageDistributionService.deleteVfPackage(casrId); + } } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java index 2778613e..76f6eef4 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java @@ -30,4 +30,8 @@ public interface PackageDistributionService { Job postVfPackage(Csar csar); JobStatus getJobStatus(String jobId); + + DistributionResult deleteNsPackage(String csarId); + + DistributionResult deleteVfPackage(String csarId); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java index ca3b9c11..6e401cef 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java @@ -30,6 +30,8 @@ public class Vnf { private String name; + private String version; + public String getUuid() { return uuid; } @@ -54,6 +56,14 @@ public class Vnf { this.name = name; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -61,11 +71,12 @@ public class Vnf { Vnf vnf = (Vnf) o; return Objects.equals(uuid, vnf.uuid) && Objects.equals(invariantUUID, vnf.invariantUUID) && - Objects.equals(name, vnf.name); + Objects.equals(name, vnf.name) && + Objects.equals(version, vnf.version); } @Override public int hashCode() { - return Objects.hash(uuid, invariantUUID, name); + return Objects.hash(uuid, invariantUUID, name, version); } } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java index f7620742..6f81b5c6 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java @@ -20,10 +20,7 @@ import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job; import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus; import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.POST; -import retrofit2.http.Path; +import retrofit2.http.*; public interface VfcService { @@ -35,4 +32,10 @@ public interface VfcService { @GET("/api/nslcm/v1/jobs/{jobId}") Call<JobStatus> getJobStatus(@Path("jobId") String jobId); + + @DELETE("/api/catalog/v1/nspackages/{csarId}") + Call<DistributionResult> deleteNsPackage(@Path("csarId") String csarId); + + @DELETE("/api/catalog/v1/vnfpackages/{csarId}") + Call<DistributionResult> deleteVnfPackage(@Path("csarId") String csarId); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java index da8fd699..a0e07948 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java @@ -135,4 +135,34 @@ public class DefaultPackageDistributionService implements PackageDistributionSer throw new VfcException("VFC service is not available!", e); } } + + @Override + public DistributionResult deleteNsPackage(String csarId) { + try { + Response<DistributionResult> response = vfcService.deleteNsPackage(csarId).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not delete NS packages[code=%s, message=%s]", response.code(), response.message())); + throw new VfcException("VFC service is not available!"); + } + } catch (IOException e) { + throw new VfcException("VFC service is not available!", e); + } + } + + @Override + public DistributionResult deleteVfPackage(String csarId) { + try { + Response<DistributionResult> response = vfcService.deleteVnfPackage(csarId).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not delete VF packages[code=%s, message=%s]", response.code(), response.message())); + throw new VfcException("VFC service is not available!"); + } + } catch (IOException e) { + throw new VfcException("VFC service is not available!", e); + } + } } |