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);
+ }
}
Job postVfPackage(Csar csar);
JobStatus getJobStatus(String jobId);
+
+ DistributionResult deleteNsPackage(String csarId);
+
+ DistributionResult deleteVfPackage(String csarId);
}
private String name;
+ private String version;
+
public String getUuid() {
return uuid;
}
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;
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);
}
}
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 {
@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);
}
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);
+ }
+ }
}