2  * Copyright 2016-2017, Nokia Corporation
 
   4  * Licensed under the Apache License, Version 2.0 (the "License");
 
   5  * you may not use this file except in compliance with the License.
 
   6  * You may obtain a copy of the License at
 
   8  *     http://www.apache.org/licenses/LICENSE-2.0
 
  10  * Unless required by applicable law or agreed to in writing, software
 
  11  * distributed under the License is distributed on an "AS IS" BASIS,
 
  12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  13  * See the License for the specific language governing permissions and
 
  14  * limitations under the License.
 
  17 package com.nokia.vfcadaptor.cbam.controller;
 
  19 import org.springframework.http.MediaType;
 
  20 import org.springframework.stereotype.Controller;
 
  21 import org.springframework.web.bind.annotation.PathVariable;
 
  22 import org.springframework.web.bind.annotation.RequestMapping;
 
  23 import org.springframework.web.bind.annotation.RequestMethod;
 
  24 import org.springframework.web.bind.annotation.ResponseBody;
 
  26 import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse;
 
  27 import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest;
 
  28 import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse;
 
  29 import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest;
 
  30 import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse;
 
  31 import com.nokia.vfcadaptor.cbam.bo.CBAMOperExecutVnfRequest;
 
  32 import com.nokia.vfcadaptor.cbam.bo.CBAMOperExecutVnfResponse;
 
  33 import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse;
 
  34 import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest;
 
  35 import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse;
 
  36 import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest;
 
  37 import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse;
 
  38 import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution;
 
  39 import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails;
 
  40 import com.nokia.vfcadaptor.cbam.bo.entity.VnfInfo;
 
  43 @RequestMapping(value = "/vnfm/lcm/v3")
 
  44 public class CbamController {
 
  46         @RequestMapping(value = "/vnfs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
 
  48     public CBAMCreateVnfResponse createVnf(CBAMInstantiateVnfRequest request)
 
  50                  CBAMCreateVnfResponse response = new  CBAMCreateVnfResponse();
 
  51                  VnfInfo op=new VnfInfo();
 
  52                 op.setName("VNF_001");
 
  53                 ProblemDetails pr=new ProblemDetails();
 
  55                 response.setVnfInfo(op);
 
  56                 response.setProblemDetails(pr);
 
  59         @RequestMapping(value = "/vnfs/{vnfInstanceId}/instantiate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
 
  61     public CBAMInstantiateVnfResponse initiateVnf(CBAMInstantiateVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId)
 
  63                 CBAMInstantiateVnfResponse response = new CBAMInstantiateVnfResponse();
 
  64 //              response.setJobid("11234");
 
  69         @RequestMapping(value = "/vnfs/{vnfInstanceId}/terminate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
 
  71     public CBAMTerminateVnfResponse terminateVnf(CBAMTerminateVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId)
 
  73                 CBAMTerminateVnfResponse response = new CBAMTerminateVnfResponse();
 
  74                 OperationExecution op=new OperationExecution();
 
  76                 ProblemDetails pr=new ProblemDetails();
 
  78                 response.setOperationExecution(op);
 
  79                 response.setProblemDetails(pr);
 
  83         @RequestMapping(value = "/vnfs/{vnfInstanceId}/scale", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
 
  85     public CBAMScaleVnfResponse scaleVnf(CBAMScaleVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId)
 
  87                 CBAMScaleVnfResponse response = new CBAMScaleVnfResponse();
 
  88                 OperationExecution op=new OperationExecution();
 
  90                 ProblemDetails pr=new ProblemDetails();
 
  92                 response.setOperationExecution(op);
 
  93                 response.setProblemDetails(pr);
 
  97         @RequestMapping(value = "/vnfs/{vnfInstanceId}/heal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
 
  99     public CBAMHealVnfResponse healVnf(CBAMHealVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId)
 
 101                  CBAMHealVnfResponse response = new  CBAMHealVnfResponse();
 
 102                 OperationExecution op=new OperationExecution();
 
 104                 ProblemDetails pr=new ProblemDetails();
 
 106                 response.setOperationExecution(op);
 
 107                 response.setProblemDetails(pr);
 
 112         @RequestMapping(value = "/vnfs/{vnfInstanceId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
 
 114     public CBAMQueryVnfResponse queryVnf(@PathVariable("vnfInstanceId") String vnfInstanceId)
 
 116                 CBAMQueryVnfResponse response = new  CBAMQueryVnfResponse();
 
 117                 VnfInfo op=new VnfInfo();
 
 118                 op.setName("VNF_001");
 
 119                 ProblemDetails pr=new ProblemDetails();
 
 121                 response.setVnfInfo(op);
 
 122                 response.setProblemDetails(pr);
 
 127         @RequestMapping(value = "/operation_executions/{operationExecutionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
 
 129     public CBAMOperExecutVnfResponse operVnf(@PathVariable("operationExecutionId") String operationExecutionId)
 
 131                 CBAMOperExecutVnfResponse response = new  CBAMOperExecutVnfResponse();
 
 132                 ProblemDetails pr=new ProblemDetails();
 
 134                 response.setProblemDetails(pr);
 
 138         @RequestMapping(value = "/operation_executions/{operationExecutionId}/cancel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE)
 
 140     public CBAMOperExecutVnfResponse operCancelVnf(CBAMOperExecutVnfRequest request,@PathVariable("operationExecutionId") String operationExecutionId)
 
 142                 CBAMOperExecutVnfResponse response = new  CBAMOperExecutVnfResponse();
 
 143                 ProblemDetails pr=new ProblemDetails();
 
 145                 response.setProblemDetails(pr);