import org.onap.so.db.request.client.RequestsDbClient;
@Component
-@Path("/onap/so/infra/onap3gppServiceInstances")
-@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/onap3gppServiceInstances",
- description = "API Requests for 3GPP Service Instances"))
+@Path("/onap/so/infra/3gppservices")
+@OpenAPIDefinition(
+ info = @Info(title = "/onap/so/infra/3gppservices", description = "API Requests for 3GPP Service Instances"))
public class Onap3gppServiceInstances {
private static final Logger logger = LoggerFactory.getLogger(Onap3gppServiceInstances.class);
private static final String SAVE_TO_DB = "save instance to db";
- private static String uriPrefix = "/onap3gppServiceInstances/";
+ private static final String URI_PREFIX = "/3gppservices/";
@Autowired
private MsoRequest msoRequest;
@Context ContainerRequestContext requestContext) throws ApiException {
String requestId = requestHandlerUtils.getRequestId(requestContext);
return processServiceInstanceRequest(request, Action.createInstance, version, requestId, null,
- requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
}
/**
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
return updateServiceInstances(request, Action.updateInstance, version, requestId, instanceIdMap,
- requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
}
/**
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
return deleteServiceInstances(request, Action.deleteInstance, version, requestId, instanceIdMap,
- requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
}
/**
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
return activateOrDeactivateServiceInstances(request, Action.activateInstance, version, requestId, instanceIdMap,
- requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
}
/**
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
return activateOrDeactivateServiceInstances(request, Action.deactivateInstance, version, requestId,
- instanceIdMap, requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ instanceIdMap, requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
}
/**
public class Onap3gppServiceInstancesTest extends BaseTest {
- private String onap3gppServicesUri = "/onap/so/infra/onap3gppServiceInstances/";
+ private static final String ONAP3GPPSERVICES_URI = "/onap/so/infra/3gppservices/";
- private final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper MAPPER = new ObjectMapper();
@Autowired
private Onap3gppServiceInstances objUnderTest;
wireMockServer.stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ .withBody(MAPPER.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
+ .withBody(MAPPER.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
@Test
public void createServiceInstanceTest() throws IOException {
- String uri = onap3gppServicesUri + "v1/allocate";
+ String uri = ONAP3GPPSERVICES_URI + "v1/allocate";
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
.withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
@Test
public void updateServiceInstanceTest() throws IOException {
- String uri = onap3gppServicesUri + "v1/modify";
+ String uri = ONAP3GPPSERVICES_URI + "v1/modify";
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
.withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
@Test
public void deleteServiceInstanceTest() throws IOException {
- String uri = onap3gppServicesUri + "v1/deAllocate";
+ String uri = ONAP3GPPSERVICES_URI + "v1/deAllocate";
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
.withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
@Test
public void activateServiceInstanceTest() throws IOException {
- String uri = onap3gppServicesUri + "v1/activate";
+ String uri = ONAP3GPPSERVICES_URI + "v1/activate";
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
.withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
@Test
public void deActivateServiceInstance() throws IOException {
- String uri = onap3gppServicesUri + "v1/deActivate";
+ String uri = ONAP3GPPSERVICES_URI + "v1/deActivate";
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
.withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
@Test
public void getSliceSubnetCapabilitiesTest() throws IOException, ApiException {
String request = "{\"subnetTypes\":[\"AN\"]}";
- QuerySubnetCapability subnetCapabilityRequest = mapper.readValue(request, QuerySubnetCapability.class);
+ QuerySubnetCapability subnetCapabilityRequest = MAPPER.readValue(request, QuerySubnetCapability.class);
String expectedResponse =
"{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");