package org.onap.so.svnfm.simulator.controller;
-import java.util.UUID;
-import javax.ws.rs.core.MediaType;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
import org.onap.so.svnfm.simulator.constants.Constant;
import org.onap.so.svnfm.simulator.repository.VnfmCacheRepository;
import org.onap.so.svnfm.simulator.services.SvnfmService;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import javax.ws.rs.core.MediaType;
+import java.util.UUID;
/**
- *
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
* @author Ronan Kenny (ronan.kenny@est.tech)
*/
@RequestMapping(path = Constant.BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public class SvnfmController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class);
@Autowired
private SvnfmService svnfmService;
-
@Autowired
private VnfmCacheRepository vnfmCacheRepository;
- private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class);
-
/**
* To create the Vnf and stores the response in cache
*
LOGGER.info("Subscription request received: {}", lccnSubscriptionRequest);
svnfmService.registerSubscription(lccnSubscriptionRequest);
final InlineResponse2001 response = new InlineResponse2001();
-
+ response.setId(UUID.randomUUID().toString());
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
return new ResponseEntity<>(response, headers, HttpStatus.CREATED);
}
+
+ @GetMapping(value = "/subscriptions/{id}")
+ public ResponseEntity<InlineResponse2001> getSubscribeId(@PathVariable("id") final String id) {
+ LOGGER.info("Subscription/id request received with id: {}", id);
+ final InlineResponse2001 response = new InlineResponse2001();
+ response.setId(id);
+ final HttpHeaders headers = new HttpHeaders();
+ headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ return new ResponseEntity<>(response, headers, HttpStatus.OK);
+ }
}