aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-28 18:14:33 -0500
committerLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-03-05 14:26:12 -0500
commitf0c44b14013d7418c19ba4cd7f9a5a3043648d5c (patch)
treedbdab863ae7d3c33e0c3c9b8e8d2814b950c68a6 /src
parentd20e0ddf4b8953ce539f1dc7bf7cb4dca30fd189 (diff)
AaiCtxBuldr:Set MaxInstanceMap to 0 & fix macAddr
This fix also address the resourceLink issue. Issue-ID: LOG-998 Issue-ID: LOG-766 Change-Id: I8b3eef61cebf93690aaa0291f201902281817020 Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java84
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java82
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java52
-rw-r--r--src/test/resources/junit/queryNodeData-1.json8
-rw-r--r--src/test/resources/junit/queryNodeData-nullResourceLink.json8
5 files changed, 50 insertions, 184 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
index 9f3e953..581ef32 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
@@ -67,6 +67,7 @@ import com.bazaarvoice.jolt.JsonUtils;
import org.onap.pomba.common.datatypes.Pserver;
import org.onap.pomba.common.datatypes.LInterface;
import org.onap.pomba.common.datatypes.LogicalLink;
+import java.text.MessageFormat;
public class RestUtil {
@@ -87,7 +88,6 @@ public class RestUtil {
// Service Catalog - "related-to"
private static final String CATALOG_GENERIC_VNF = "generic-vnf";
private static final String CATALOG_VNFC = "vnfc";
- private static final String CATALOG_SERVICE_INSTANCE = "service-instance";
private static final String CATALOG_VSERVER = "vserver";
private static final String CATALOG_IMAGE = "image";
private static final String CATALOG_PSERVER = "pserver";
@@ -102,12 +102,9 @@ public class RestUtil {
// Relationship Json Path
private static final String RELATIONSHIP_LIST = "relationship-list";
private static final String RELATIONSHIP = "relationship";
- private static final String RESULT_DATA = "result-data";
private static final String JSON_ATT_RELATED_TO = "related-to";
private static final String JSON_ATT_RELATED_LINK = "related-link";
- private static final String JSON_ATT_RESOURCE_TYPE = "resource-type";
- private static final String JSON_ATT_RESOURCE_LINK = "resource-link";
private static final String EMPTY_JSON_STRING = "{}";
private static final String DELIMITER = "$";
@@ -146,7 +143,7 @@ public class RestUtil {
private static final String ATTRIBUTE_SHARED_NETWORK_BOOLEAN = "sharedNetworkBoolean";
private static final String ATTRIBUTE_IS_PORT_MIRRORED = "isPortMirrored";
private static final String ATTRIBUTE_NETWORK_NAME = "networkName";
- private static final String ATTRIBUTE_MAC_ADDR = "macAddr";
+ private static final String ATTRIBUTE_MAC_ADDRESS = "macAddress";
private static final String ATTRIBUTE_ADMIN_STATUS = "adminStatus";
private static final String ATTRIBUTE_NFC_NAMING_CODE = "nfcNamingCode";
private static final String ATTRIBUTE_NF_NAMING_CODE = "nfNamingCode";
@@ -237,18 +234,7 @@ public class RestUtil {
//Map to track multiple l3-network under the Gerneric VNF id. The key = vnf-id. The value = list of l3-network instance
Map<String, List<L3networkInstance>> l3networkMapInVnf = new HashMap<>();
- // Obtain resource-link based on resource-type = service-Instance
- String resourceLink = obtainResouceLinkBasedOnServiceInstanceFromAAI(aaiClient, baseURL, aaiPathToSearchNodeQuery, serviceInstanceId, transactionId, aaiBasicAuthorization);
-
- // Handle the case if the service instance is not found in AAI
- if (resourceLink==null) {
- // return the empty Json on the root level. i.e service instance
- return null;
- }
-
- log.info(String.format("ResourceLink from AAI: %s", resourceLink));
- // Build URl to get ServiceInstance Payload
- String url = baseURL + resourceLink;
+ String url = generateGetCustomerInfoUrl(baseURL, aaiPathToSearchNodeQuery, serviceInstanceId);
// Response from service instance API call
serviceInstancePayload =
@@ -261,7 +247,7 @@ public class RestUtil {
return null;
}
- log.info("Message from AAI:%s", JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(serviceInstancePayload)));
+ log.info(String.format("Message from AAI for serviceInstance, url %s ,message body: %s", url, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(serviceInstancePayload))));
List<String> genericVNFLinkLst = extractRelatedLink(serviceInstancePayload, CATALOG_GENERIC_VNF);
log.info(LogMessages.NUMBER_OF_API_CALLS, "genericVNF", genericVNFLinkLst.size());
@@ -654,7 +640,8 @@ public class RestUtil {
if (isEmptyJson(pserverPayload)) {
log.info(LogMessages.NOT_FOUND, "PSERVER with url", pserverURL);
} else {
- log.info("Message from AAI for pserver %s ,message body: %s", pserverURL,pserverPayload);
+ log.info(String.format("Message from AAI for pserver url %s ,message body: %s", pserverURL, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(pserverPayload))));
+
// Logic to Create the Pserver POJO object
PserverInstance pserverInst = PserverInstance.fromJson(pserverPayload);
@@ -1145,7 +1132,7 @@ public class RestUtil {
attributeList.add(att);
}
- if ((name.name().equals(ATTRIBUTE_MAC_ADDR ))
+ if ((name.name().equals(ATTRIBUTE_MAC_ADDRESS ))
&& isValid(lInterfaceInstance.getMacAddr())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
@@ -1715,8 +1702,7 @@ public class RestUtil {
.append(vfModule.getModelInvariantId()).toString();
if (key.length() > 0) {
- map.putIfAbsent(key, new AtomicInteger(0));
- map.get(key).incrementAndGet();
+ map.putIfAbsent(key, new AtomicInteger(0)); //alway 0
}
}
@@ -1952,62 +1938,10 @@ public class RestUtil {
}
}
-
- public static String obtainResouceLinkBasedOnServiceInstanceFromAAI(RestClient aaiClient, String baseURL, String aaiPathToSearchNodeQuery, String serviceInstanceId,
- String transactionId, String aaiBasicAuthorization) throws AuditException {
-
- String url = generateGetCustomerInfoUrl(baseURL, aaiPathToSearchNodeQuery, serviceInstanceId);
- String customerInfoString = getResource(aaiClient, url, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
-
- // Handle the case if the service instance is not found in AAI
- if (isEmptyJson(customerInfoString)) {
- log.info(LogMessages.NOT_FOUND, "Service Instance" , serviceInstanceId);
- // Only return the empty Json on the root level. i.e service instance
- return null;
- }
-
- return extractResourceLinkBasedOnResourceType(customerInfoString, CATALOG_SERVICE_INSTANCE);
- }
-
private static String generateGetCustomerInfoUrl (String baseURL, String aaiPathToSearchNodeQuery,String serviceInstanceId) {
- return baseURL + aaiPathToSearchNodeQuery + serviceInstanceId;
+ return baseURL + MessageFormat.format(aaiPathToSearchNodeQuery, serviceInstanceId);
}
- /*
- * Extract the resource-Link from Json payload. For example
- * {
- * "result-data": [
- * {
- * "resource-type": "service-instance",
- * "resource-link": "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
- * }
- * ]
- * }
- */
- private static String extractResourceLinkBasedOnResourceType(String payload, String catalog) throws AuditException {
- String resourceLink = null;
- log.info(String.format("Fetching the resource-link based on resource-type= %s", catalog));
- try {
- JSONArray result_data_list = new JSONObject(payload).getJSONArray(RESULT_DATA);
- if (result_data_list != null) {
- for (int i = 0; i < result_data_list.length(); i++) {
- JSONObject obj = result_data_list.optJSONObject(i);
- if (obj.has(JSON_ATT_RESOURCE_TYPE) && (obj.getString(JSON_ATT_RESOURCE_TYPE).equals(catalog) )) {
- resourceLink = obj.getString(JSON_ATT_RESOURCE_LINK);
- log.info(resourceLink);
- return resourceLink;
- }
- }
- }
- } catch (JSONException e) {
- log.error(e.getMessage());
- throw new AuditException(AuditError.JSON_READER_PARSE_ERROR + " " + e.getMessage());
- }
-
- log.warn("resource-link CANNOT be found: ", payload );
-
- return resourceLink;
- }
private static boolean isValid ( String inputField) {
if (inputField == null) {
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
index e184f4d..8c445c1 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.text.MessageFormat;
import java.util.List;
import java.util.UUID;
import org.junit.Rule;
@@ -92,33 +93,6 @@ public class RestUtilTest {
assertTrue(!RestUtil.isEmptyJson("{Not Empty}"));
}
- @Test
- public void testObtainResouceLinkBasedOnServiceInstanceFromAAI() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
-
- String resourceLinkUlr = RestUtil.obtainResouceLinkBasedOnServiceInstanceFromAAI(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, serviceInstanceId, transactionId, aaiBasicAuthorization);
-
- String returnedInstanceId = resourceLinkUlr.substring(resourceLinkUlr.lastIndexOf("/")+1).trim();
- assertEquals(serviceInstanceId, returnedInstanceId);
- }
-
- @Test
- public void testObtainResouceLinkBasedOnServiceInstanceFromAAI_nullResourceLink() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-nullResourceLink.json", aaiEnricherRule);
-
- try {
- RestUtil.obtainResouceLinkBasedOnServiceInstanceFromAAI(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, serviceInstanceId, transactionId, aaiBasicAuthorization);
- } catch (AuditException e) {
- assertTrue(e.getMessage().contains("JSONObject[\"resource-link\"] not found"));
- }
- }
-
private void addResponse(String path, String classpathResource, WireMockRule thisMock) throws IOException {
String payload = readFully(ClassLoader.getSystemResourceAsStream(classpathResource));
thisMock.stubFor(get(path).willReturn(okJson(payload)));
@@ -136,6 +110,9 @@ public class RestUtilTest {
return content.toString();
}
+ private static String generateGetCustomerInfoUrl (String baseURL, String aaiPathToSearchNodeQuery,String serviceInstanceId) {
+ return baseURL + MessageFormat.format(aaiPathToSearchNodeQuery, serviceInstanceId);
+ }
////
@Test
@@ -143,11 +120,11 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
+
// 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance.json", aaiEnricherRule);
// 3. simulate the rsp of VNF
@@ -171,12 +148,11 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
+
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -216,11 +192,9 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance.json", aaiEnricherRule);
// 3. simulate the rsp of VNF
@@ -247,12 +221,9 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -295,12 +266,9 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set3.json", aaiEnricherRule);
// 3. simulate the rsp of l3-network
@@ -328,12 +296,9 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -369,12 +334,9 @@ public class RestUtilTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
index 8e50484..c97ea1a 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@@ -111,23 +112,25 @@ public class RestServiceTest {
return headers;
}
+ private static String generateGetCustomerInfoUrl (String baseURL, String aaiPathToSearchNodeQuery,String serviceInstanceId) {
+ return baseURL + MessageFormat.format(aaiPathToSearchNodeQuery, serviceInstanceId);
+ }
+
///Verify the relationship serviceInstanceId -> vnf -> vserver -> pserver
@Test
public void testGetContext_VSERVER_PSERVER() throws Exception {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
// note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -175,17 +178,14 @@ public class RestServiceTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -255,17 +255,14 @@ public class RestServiceTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -314,17 +311,14 @@ public class RestServiceTest {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
@@ -372,17 +366,14 @@ public class RestServiceTest {
public void testGetContext_LogicalLink_in_service_level() throws Exception {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set4.json", aaiEnricherRule);
// 3. simulate the rsp of logical-link
@@ -411,16 +402,14 @@ public class RestServiceTest {
public void testGetContext_LogicalLink_in_PInterface_level_with_PNF() throws Exception {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance.json", aaiEnricherRule);
// 3. simulate the rsp of VNF
@@ -464,17 +453,14 @@ public class RestServiceTest {
public void testGetContext_LogicalLink_in_PInterface_level_with_PSERVER() throws Exception {
String transactionId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
transactionId, testRestHeaders, httpBasicAuthorization);
- // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
// 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ addResponse( queryNodeUrl,
"junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
diff --git a/src/test/resources/junit/queryNodeData-1.json b/src/test/resources/junit/queryNodeData-1.json
deleted file mode 100644
index ea4bd89..0000000
--- a/src/test/resources/junit/queryNodeData-1.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "result-data": [
- {
- "resource-type": "service-instance",
- "resource-link": "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
- }
- ]
-}
diff --git a/src/test/resources/junit/queryNodeData-nullResourceLink.json b/src/test/resources/junit/queryNodeData-nullResourceLink.json
deleted file mode 100644
index 5b7a272..0000000
--- a/src/test/resources/junit/queryNodeData-nullResourceLink.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "result-data": [
- {
- "resource-type": "service-instance",
- "related-link": "/aai/v13/network/vnfcs/vnfc/zrdm5aepdg01vmg003"
- }
- ]
-}