// AAI
public static final String AAI_GET_TENANTS_PATH =
- "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$onap.cloudOwner/$onap.lcpCloudRegionId/tenants";
- public static final String AAI_GET_CUSTOMER_PATH = "/aai/v11/business/customers/customer/";
+ "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/$onap.cloudOwner/$onap.lcpCloudRegionId/tenants";
+ public static final String AAI_GET_CUSTOMER_PATH = "/aai/v14/business/customers/customer/";
public static final String AAI_GET_SERVICES_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions";
public static final String AAI_PUT_SERVICE_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/";
- public static final String AAI_GET_SERVICE_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/service-instance/$serviceId";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/";
+ public static final String AAI_GET_SERVICE =
+ "/aai/v14/nodes/service-instances/service-instance/$serviceId";
public static final String AAI_GET_SERVICE_INSTANCES_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
// MSO
public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
@PostConstruct
private void setUpAndlogAAIUrl() {
- aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_FOR_CUSTOMER_PATH).toString();
+ aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString();
aaiServicesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString();
aaiServicesInstancesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString();
}
return null;
}
+
+ public Map getService(String serviceId) {
+ String callUrlFormated = aaiServiceUrl.replace("$serviceId", serviceId);
+
+ ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI());
+ if (response != null && response.getStatusCode().equals(HttpStatus.OK)) {
+ return (LinkedHashMap) response.getBody();
+ }
+ return null;
+ }
public Map getVNF(String relatedLink) {
public Map get(String serviceId, MultiValueMap<String, String> params) {
- String clientId = params.getFirst("relatedParty.id");
- String serviceSpecId = params.getFirst("serviceSpecification.id");
- String serviceSpecName = params.getFirst("serviceSpecification.name");
-
- if (StringUtils.isEmpty(serviceSpecId) && StringUtils.isEmpty(serviceSpecName)) {
- throw new BackendFunctionalException(HttpStatus.NOT_FOUND,
- "serviceSpecName or serviceSpecId must be provided","serviceSpecName or serviceSpecId must be provided");
- }
-
- String customerId = getCustomerId(clientId);
- String serviceName = getServiceName(serviceSpecName, serviceSpecId);
- Map serviceResponse = aaiClient.getCatalogService(customerId, serviceName, serviceId);
+
+ Map serviceResponse = aaiClient.getService(serviceId);
if (serviceResponse != null) {
addVnfsToResponse(serviceResponse);
LinkedHashMap serviceInventoryResponse =
(LinkedHashMap) getServiceInventoryJsonTransformer.transform(serviceResponse);
- addRelatedPartyId(customerId, serviceInventoryResponse);
return serviceInventoryResponse;
} else {
throw new BackendFunctionalException(HttpStatus.NOT_FOUND, "no catalog service found","no catalog service found");
"operation": "default",
"spec": {
"type": "service-instance",
- "hasStarted": "yes",
"@type": "serviceONAP",
"serviceSpecification" : {
"@type" :"ONAPservice"
Scenario: testServiceResourceGetInventory
Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
-And params {serviceSpecification.name : 'vFW' , relatedParty.id : '6490'}
When method get
Then status 200
-And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', hasStarted : 'yes', type : 'service-instance', @type : 'serviceONAP' }
-And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
+And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', type : 'service-instance', @type : 'serviceONAP' }
And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
And match $.supportingResource[0] contains { id : 'cb80fbb6-9aa7-4ac5-9541-e14f45de533e' , name : 'NewFreeRadius-VNF-instance-01' , status : 'PREPROV' , modelInvariantId : 'f5993703-977f-4346-a1c9-c1884f8cfd8d' , modelVersionId : '902438f7-1e4c-492d-b7cc-8650e13b8aeb' , @referredType : 'ONAP resource' }
And match $.supportingResource == '#[2]'
Scenario: testServiceResourceGetInventoryWithStatus
-Given url 'http://localhost:8080/nbi/api/v3/service/405c8c00-44b9-4303-9f27-6797d22ca096?serviceSpecification.name=AnsibleService&relatedParty.id=6490'
+Given url 'http://localhost:8080/nbi/api/v3/service/405c8c00-44b9-4303-9f27-6797d22ca096'
When method get
Then status 200
And match $.state == 'Active'
Scenario: testServiceResourceGetInventoryWithoutRelationShipList
Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList'
-And params {serviceSpecification.name:'vFW',relatedParty.id:'6490'}
When method get
Then status 200
-And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' , hasStarted : 'yes' , type : 'service-instance' , @type : 'serviceONAP' }
-And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
+And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' , type : 'service-instance' , @type : 'serviceONAP' }
And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
And match $.supportingResource == '#[0]'
Scenario: testServiceResourceGetInventoryWithServiceSpecId
Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
-And params {serviceSpecification.id:'1e3feeb0-8e36-46c6-862c-236d9c626439', relatedParty.id:'6490'}
When method get
Then status 200
-And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', hasStarted : 'yes', type : 'service-instance', @type : 'serviceONAP' }
-And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
+And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', type : 'service-instance', @type : 'serviceONAP' }
And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
And match $.supportingResource[0] contains { id : 'cb80fbb6-9aa7-4ac5-9541-e14f45de533e' , name : 'NewFreeRadius-VNF-instance-01' , status : 'PREPROV' , modelInvariantId : 'f5993703-977f-4346-a1c9-c1884f8cfd8d' , modelVersionId : '902438f7-1e4c-492d-b7cc-8650e13b8aeb' , @referredType : 'ONAP resource' }
And match $.supportingResource == '#[2]'
Scenario: testCheckServiceOrderWithCustomerAAINotResponding
-* call Context.removeWireMockMapping("/aai/v11/business/customers/customer/new");
+* call Context.removeWireMockMapping("/aai/v14/business/customers/customer/new");
Given path 'serviceOrder'
And request data[4]
When method post
Scenario: testAAIPutServiceNotResponding
-* call Context.removeWireMockMapping("/aai/v11/business/customers/customer/new/service-subscriptions/service-subscription/vFW");
+* call Context.removeWireMockMapping("/aai/v14/business/customers/customer/new/service-subscriptions/service-subscription/vFW");
Given path 'serviceOrder'
And request data[4]
When method post
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions"
+ "url": "/aai/v14/business/customers/customer/6490/service-subscriptions"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490"
+ "url": "/aai/v14/business/customers/customer/6490"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/generic"
+ "url": "/aai/v14/business/customers/customer/generic"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/generic/service-subscriptions"
+ "url": "/aai/v14/business/customers/customer/generic/service-subscriptions"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/AnsibleService/service-instances/service-instance/405c8c00-44b9-4303-9f27-6797d22ca096"
+ "url": "/aai/v14/business/customers/customer/6490/service-subscriptions/service-subscription/AnsibleService/service-instances/service-instance/405c8c00-44b9-4303-9f27-6797d22ca096"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/vFW/service-instances/"
+ "url": "/aai/v14/business/customers/customer/6490/service-subscriptions/service-subscription/vFW/service-instances/"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/vFW-service-2VF-based/service-instances/"
+ "url": "/aai/v14/business/customers/customer/6490/service-subscriptions/service-subscription/vFW-service-2VF-based/service-instances/"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/vFW/service-instances/service-instance/e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList"
+ "url": "/aai/v14/nodes/service-instances/service-instance/e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
--- /dev/null
+{
+ "request": {
+ "method": "GET",
+ "url": "/aai/v14/nodes/service-instances/service-instance/405c8c00-44b9-4303-9f27-6797d22ca096"
+ },
+ "response": {
+ "status": 200,
+ "jsonBody": {
+ "service-instance-id": "405c8c00-44b9-4303-9f27-6797d22ca096",
+ "service-instance-name": "ansibleService-service-instance-065FYE",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "f3ec9092-5c98-41f1-9fea-96be80abd064",
+ "model-version-id": "0bf5f56a-4506-4e98-ab50-336d73ca4b07",
+ "resource-version": "1530200875713",
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/3f73377f-d9be-4a33-b068-e3f35b5b770b",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "3f73377f-d9be-4a33-b068-e3f35b5b770b"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "ansibleService-vnf-instance-DebianVNF_0_065FYE"
+ }
+ ]
+ },
+ {
+ "related-to": "owning-entity",
+ "related-link": "/aai/v11/business/owning-entities/owning-entity/OE-generic",
+ "relationship-data": [
+ {
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "OE-generic"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ }
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/vFW/service-instances/service-instance/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
+ "url": "/aai/v14/nodes/service-instances/service-instance/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "GET",
- "url": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants"
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants"
},
"response": {
"status": 200,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "PUT",
- "url": "/aai/v11/business/customers/customer/new"
+ "url": "/aai/v14/business/customers/customer/new"
},
"response": {
"status": 201,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}
{
"request": {
"method": "PUT",
- "url": "/aai/v11/business/customers/customer/new/service-subscriptions/service-subscription/vFW"
+ "url": "/aai/v14/business/customers/customer/new/service-subscriptions/service-subscription/vFW"
},
"response": {
"status": 201,
"Content-Type": "application/json"
}
}
-}
\ No newline at end of file
+}