aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2018-08-30 15:57:06 -0400
committerTait,Trevor(rt0435) <rtait@amdocs.com>2018-08-31 12:53:44 -0400
commit42eb3f556ceda1287bd80ad74cbe0c8919b33ded (patch)
treeb95088a63ca4a0d8e03a1ce67ba7bba95b7fceac
parent45e403d89794720689be5c8ee71f4c7174c022c3 (diff)
Stitching to new ModelContext V1
Issue-ID: LOG-401 Change-Id: Icaa0bf5d5c66a9a101adc9650c19a5b1e8dcf1da Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--config/application.properties6
-rw-r--r--config/networkdiscoveryspec.json127
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/exception/DiscoveryException.java3
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java195
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/unittest/service/NetworkDiscoveryContextBuilderTest.java7
5 files changed, 239 insertions, 99 deletions
diff --git a/config/application.properties b/config/application.properties
index 6a40904..ef63984 100644
--- a/config/application.properties
+++ b/config/application.properties
@@ -22,12 +22,6 @@ networkDiscoveryCtxBuilder.port=8080
# Basic Authorization credentials for Network Discovery Context Builder REST Service
networkDiscoveryCtxBuilder.userId=admin
networkDiscoveryCtxBuilder.password=OBF:1u2a1toa1w8v1tok1u30
-networkDiscoveryCtxBuilder.resourceList=vnfcs,vservers,l3-networks
-
-# Resource Type mapping from ServiceDecomposition type to CtxBuilder type
-networkDiscoveryCtxBuilder.resourceTypeMapping.vnfcs=vnfc
-networkDiscoveryCtxBuilder.resourceTypeMapping.vservers=vserver
-networkDiscoveryCtxBuilder.resourceTypeMapping.l3-networks=l3-network
# Service Decomposition REST Client Configuration
serviceDecomposition.httpProtocol=http
diff --git a/config/networkdiscoveryspec.json b/config/networkdiscoveryspec.json
index 093b81e..b01fbeb 100644
--- a/config/networkdiscoveryspec.json
+++ b/config/networkdiscoveryspec.json
@@ -1,25 +1,140 @@
[
+ // Use https://jolt-demo.appspot.com/#inception to develop/test
+ // any changes to this file
+
{
+ // This sections adds nfNamingCode and dataQuality to the json
+ // fields returned from service-decomposition that we are
+ // interested in
+
+ "operation": "default",
+ "spec": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "generic-vnfs[]": {
+ "*": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "nfNamingCode": "vf",
+ "vf-modules": {
+ "vf-module[]": {
+ "*": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "nfNamingCode": "vfModule"
+ }
+ }
+ },
+ "vservers[]": {
+ "*": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "nfNamingCode": "vserver"
+ }
+ },
+ "l3-networks[]": {
+ "*": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "nfNamingCode": "l3-network"
+ }
+ },
+ "vnfcList[]": {
+ "*": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "nfNamingCode": "vnfc"
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ // This section converts the updated json from service-decompostion
+ // to org.onap.pomba.common.datatypes.ModelContext
+
"operation": "shift",
"spec": {
- "service-instance-name": "service-instance-name",
- "uuid": "uuid",
- "service-instance-id": "service-instance-id",
- "model-invariant-id": "model-invariant-id",
+ "dataQuality": {
+ "status": "dataQuality.status"
+ },
+ "service-instance-name": "service.name",
+ "model-invariant-id": "service.invariantUUID",
+ "service-instance-id": "service.uuid",
"generic-vnfs": {
"*": {
+ "vnf-name": "vfList[&1].name",
+ "model-invariant-id": "vfList[&1].invariantUUID",
+ "vnf-id": "vfList[&1].uuid",
+ "nfNamingCode": "vfList[&1].nfNamingCode",
+ "dataQuality": {
+ "status": "vfList[&2].dataQuality.status"
+ },
+ "vf-modules": {
+ "vf-module": {
+ "*": {
+ "vf-module-name": "vfList[&4].vfModuleList[0].name",
+ "model-invariant-id": "vfList[&4].vfModuleList[0].invariantUUID",
+ "vf-module-id": "vfList[&4].vfModuleList[0].uuid",
+ "nfNamingCode": "vfList[&4].vfModuleList[0].nfNamingCode",
+ "dataQuality": {
+ "status": "vfList[&5].vfModuleList[0].dataQuality.status"
+ }
+ }
+ }
+ },
"vservers": {
"*": {
- "vserver-id": "generic-vnfs[&3].vservers[&1].uuid"
+ "vserver-name": "vfList[&3].vfModuleList[0].vmList[&1].name",
+ "model-invariant-id": "vfList[&3].vfModuleList[0].vmList[&1].invariantUUID",
+ "vserver-id": "vfList[&3].vfModuleList[0].vmList[&1].uuid",
+ "nfNamingCode": "vfList[&3].vfModuleList[0].vmList[&1].nfNamingCode",
+ "dataQuality": {
+ "status": "vfList[&4].vfModuleList[0].vmList[&2].dataQuality.status"
+ }
}
},
"l3-networks": {
"*": {
- "network-id": "generic-vnfs[&3].l3-networks[&1].uuid"
+ "network-name": "vfList[&3].vfModuleList[0].networkList[&1].name",
+ "model-invariant-id": "vfList[&3].vfModuleList[0].networkList[&1].invariantUUID",
+ "network-id": "vfList[&3].vfModuleList[0].networkList[&1].uuid",
+ "nfNamingCode": "vfList[&3].vfModuleList[0].networkList[&1].nfNamingCode",
+ "dataQuality": {
+ "status": "vfList[&4].vfModuleList[0].networkList[&2].dataQuality.status"
+ }
+ },
+ "vnfcs": {
+ "*": {
+ "vnfc-name": "vfList[&2].vnfcList[&1].name",
+ "model-invariant-id": "vfList[&2].vnfcList[&1].invariantUUID",
+ "vnfc-id": "vfList[&2].vnfcList[&1].uuid",
+ "nfNamingCode": "vfList[&2].vfModuleList[0].nfNamingCode",
+ "dataQuality": {
+ "status": "vfList[&3].vfModuleList[0].dataQuality.status"
+ }
+ }
}
}
}
}
}
+ },
+ {
+ "operation": "default",
+ "spec": {
+ "service": {
+ "dataQuality": {
+ "status": "ok"
+ }
+ }
}
+ }
]
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/exception/DiscoveryException.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/exception/DiscoveryException.java
index d2fd561..149efaa 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/exception/DiscoveryException.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/exception/DiscoveryException.java
@@ -48,6 +48,9 @@ public class DiscoveryException extends Exception {
}
private Status matchErrorCode(String errorMessage) {
+ if(null == errorMessage) {
+ return Status.INTERNAL_SERVER_ERROR;
+ }
if (errorMessage.toLowerCase().contains("auth")) {
return Status.UNAUTHORIZED;
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
index 7dbb1a9..d982ada 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
@@ -19,6 +19,7 @@ package org.onap.pomba.contextbuilder.networkdiscovery.service;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
+import com.google.gson.Gson;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -36,15 +37,20 @@ import javax.ws.rs.client.Client;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import org.onap.pomba.common.datatypes.Attribute;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Network;
+import org.onap.pomba.common.datatypes.VF;
+import org.onap.pomba.common.datatypes.VFModule;
+import org.onap.pomba.common.datatypes.VM;
+import org.onap.pomba.common.datatypes.VNFC;
import org.onap.pomba.contextbuilder.networkdiscovery.exception.DiscoveryException;
import org.onap.pomba.contextbuilder.networkdiscovery.model.NetworkDiscoveryRspInfo;
import org.onap.pomba.contextbuilder.networkdiscovery.service.rs.RestService;
import org.onap.pomba.contextbuilder.networkdiscovery.util.RestUtil;
import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.NetworkDiscoveryNotification;
import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.NetworkDiscoveryResponse;
+import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -97,30 +103,25 @@ public class SpringServiceImpl implements SpringService {
public static final String MDC_FROM_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS_UNKNOWN_REQ = "EntryRemoved_dueTo_timeOut_or_error_or_neverExisit";
public static final String MDC_FROM_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS_SUCCESS = "SUCCESS";
- private static final String ENTITY_GENERIC_VNFS = "generic-vnfs";
- private static final String ENTITY_UUID = "uuid";
-
private static UUID instanceUUID = UUID.randomUUID();
private static Map<String, NetworkDiscoveryRspInfo> networkDiscoveryInfoList = new HashMap<>();
private static final AtomicLong uniqueSeq = new AtomicLong();
- private class Resource {
+ private class NdResource {
private String resourceType;
private String resourceId;
+ public NdResource(String type, String id) {
+ this.resourceType = type;
+ this.resourceId = id; };
+
public String getResourceType() {
return this.resourceType;
}
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
public String getResourceId() {
return this.resourceId;
}
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
}
@@ -134,9 +135,6 @@ public class SpringServiceImpl implements SpringService {
private String networkDiscoveryCtxBuilderBasicAuthorization;
@Autowired
- private String networkDiscoveryCtxBuilderResources;
-
- @Autowired
private String serviceDecompositionBasicAuthorization;
@Autowired
@@ -154,9 +152,6 @@ public class SpringServiceImpl implements SpringService {
@Autowired
private Client jerseyClient;
- @javax.annotation.Resource
- private Map<String, String> networkDiscoveryCtxBuilderResourceTypeMapping;
-
private static final ReentrantLock lock = new ReentrantLock();
@Override
@@ -170,17 +165,16 @@ public class SpringServiceImpl implements SpringService {
RestUtil.validateServiceInstanceId(serviceInstanceId);
RestUtil.validatePartnerName(partnerName);
validateBasicAuth(authorization);
- ModelContext serviceDecompCtx = new ModelContext();
- List<Resource> resourceList = getServiceDeomposition(serviceInstanceId, partnerName, requestId);
+ ModelContext networkDiscoveryCtx = getServiceDeomposition(serviceInstanceId, partnerName, requestId);
- CountDownLatch latchSignal = createCountDownLatch(resourceList);
+ CountDownLatch latchSignal = createCountDownLatch(networkDiscoveryCtx);
if (latchSignal == null) {
// Nothing to send
- return serviceDecompCtx;
+ return networkDiscoveryCtx;
}
- List<String> sentRequestIdList = sendNetworkDiscoveryRequest(resourceList, serviceInstanceId, requestId,
+ List<String> sentRequestIdList = sendNetworkDiscoveryRequest(networkDiscoveryCtx, serviceInstanceId, requestId,
partnerName, latchSignal);
int numOfMsgSent = sentRequestIdList.size();
@@ -190,9 +184,9 @@ public class SpringServiceImpl implements SpringService {
// When it comes here, it is due to time out.
log.info("Wait for Latch Signal time out " + serviceInstanceId);
}
- return updateServiceDecompCtx_and_networkDiscoveryInfoList(serviceDecompCtx, sentRequestIdList);
+ return updateServiceDecompCtx(networkDiscoveryCtx, sentRequestIdList);
} else {
- return serviceDecompCtx;
+ return networkDiscoveryCtx;
}
} catch (Exception x) {
@@ -223,14 +217,14 @@ public class SpringServiceImpl implements SpringService {
// If, for some reason we are unable to get the canonical host name,
// we
// just want to leave the field null.
- log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
}
}
/**
* Given a service instance ID, GET the resources from Service Decompostion.
*/
- private List<Resource> getServiceDeomposition(String serviceInstanceId, String partnerName, String requestId)
+ private ModelContext getServiceDeomposition(String serviceInstanceId, String partnerName, String requestId)
throws DiscoveryException {
if (serviceInstanceId == null) {
return null;
@@ -241,8 +235,10 @@ public class SpringServiceImpl implements SpringService {
String urlStr = getUrl(serviceInstanceId);
try {
- Response response = jerseyClient.target(urlStr).request().header("Accept", "application/json")
- .header("Authorization", getSdBasicAuthorization()).header("X-ONAP-PartnerName", partnerName)
+ Response response = jerseyClient.target(urlStr).request()
+ .header("Accept", "application/json")
+ .header("Authorization", getSdBasicAuthorization())
+ .header("X-ONAP-PartnerName", partnerName)
.header("X-ONAP-RequestID", requestId).get();
String reply = null;
@@ -264,9 +260,8 @@ public class SpringServiceImpl implements SpringService {
Object jsonInput = JsonUtils.jsonToObject(reply);
Chainr chainr = Chainr.fromSpec(jsonSpec);
Object transObject = chainr.transform(jsonInput);
- System.out.println(JsonUtils.toPrettyJsonString(transObject));
- JSONObject transJobject = new JSONObject(JsonUtils.toPrettyJsonString(transObject));
- return parseServiceDecomposition(transJobject);
+ Gson gson = new Gson();
+ return gson.fromJson(JsonUtils.toPrettyJsonString(transObject), ModelContext.class);
} catch (Exception x) {
throw new DiscoveryException(x.getMessage(), x);
}
@@ -281,35 +276,6 @@ public class SpringServiceImpl implements SpringService {
return serviceDecompositionBasicAuthorization;
}
- private List<Resource> parseServiceDecomposition(JSONObject jObject) {
-
- List<Resource> response = new ArrayList<Resource>();
- // Find generic-vnfs
- if (jObject.has(ENTITY_GENERIC_VNFS)) {
- JSONArray genericVnfs = jObject.getJSONArray(ENTITY_GENERIC_VNFS);
- for (int i = 0; i < genericVnfs.length(); i++) {
- JSONObject genericVnfInst = genericVnfs.getJSONObject(i);
- // Find resources
- String[] resources = networkDiscoveryCtxBuilderResources.split(",");
- for (int j = 0; j< resources.length; j++) {
- if (genericVnfInst.has(resources[j])) {
- JSONArray resourceList = genericVnfInst.getJSONArray(resources[j]);
- for (int k = 0; k < resourceList.length(); k++) {
- Resource resource = new Resource();
- JSONObject resourceInst = resourceList.getJSONObject(k);
- if (resourceInst.has(ENTITY_UUID)) {
- resource.setResourceId(resourceInst.getString(ENTITY_UUID));
- }
- resource.setResourceType(resources[j]);
- response.add(resource);
- }
- }
- }
- }
- }
-
- return response;
- }
/**
* Validates the Basic authorization header as admin:admin.
@@ -370,10 +336,10 @@ public class SpringServiceImpl implements SpringService {
return;
}
- private ModelContext updateServiceDecompCtx_and_networkDiscoveryInfoList(ModelContext serviceDecompCtx,
+ private ModelContext updateServiceDecompCtx(ModelContext networkDiscoveryCtx,
List<String> sentRequestIdList) {
/*
- * TO DO: We can't add network discovery data to serviceDecompCtx
+ * TO DO: We can't add network discovery data to networkDiscoveryCtx
* because the existing "v0" context aggregator context model doesn't
* support it. We will have to wait for the real "v1" context model
* which contains attributes, vservers and networks.
@@ -397,15 +363,15 @@ public class SpringServiceImpl implements SpringService {
lock.unlock();
sbl.append(", Resource :" + tNdRspInfo.getResourceType());
- sbl.append(", ServerId :" + tNdRspInfo.getResourceId());
+ sbl.append(", ResourceId :" + tNdRspInfo.getResourceId());
sbl.append(", RelatedRequestId :" + tNdRspInfo.getRelatedRequestIdList());
- List<NetworkDiscoveryNotification> nList = tNdRspInfo.getNetworkDiscoveryNotificationList();
- if (nList.size() > 0) {
- for (NetworkDiscoveryNotification nt : tNdRspInfo.getNetworkDiscoveryNotificationList()) {
- sbl.append(" Notification :" + nt.toString());
+ for (NetworkDiscoveryNotification nt : tNdRspInfo.getNetworkDiscoveryNotificationList()) {
+ List <Resource> resourceList = nt.getResources();
+ for (Resource resource : resourceList) {
+ updateServiceDecompCtx(networkDiscoveryCtx, resource);
}
+ sbl.append(" Notification :" + nt.toString());
}
-
}
String infoStr = sbl.toString();
@@ -413,14 +379,68 @@ public class SpringServiceImpl implements SpringService {
"updateServiceDecompCtx_and_networkDiscoveryInfoList: All Notifications from NetworkDiscoveryMicroService: "
+ infoStr);
- return serviceDecompCtx;
+ return networkDiscoveryCtx;
+ }
+
+ private void updateServiceDecompCtx(ModelContext networkDiscoveryCtx, Resource resource) {
+ for (VF vf : networkDiscoveryCtx.getVfs()) {
+ for (VFModule vfModule : vf.getVfModules()) {
+ for (VM vm : vfModule.getVms()) {
+ if (vm.getUuid().equals(resource.getId())) {
+ vm.setDataQuality(resource.getDataQuality());
+ if (null != resource.getAttributeList()) {
+ for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) {
+ try {
+ Attribute attribute = new Attribute();
+ attribute.setName(Attribute.Name.valueOf(ndattribute.getName()));
+ attribute.setValue(ndattribute.getValue());
+ attribute.setDataQuality(ndattribute.getDataQuality());
+ vm.addAttribute(attribute);
+ } catch (IllegalArgumentException ex) {
+ // The attribute Name passed back from Network Discovery is not in our enum
+ log.info("Atribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" +resource.getId() + " is invalid");
+ }
+
+ }
+ }
+ }
+ }
+ for (Network network : vfModule.getNetworks()) {
+ if (network.getUuid().equals(resource.getId())) {
+ network.setDataQuality(resource.getDataQuality());
+ if (null != resource.getAttributeList()) {
+ for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) {
+ try {
+ Attribute attribute = new Attribute();
+ attribute.setName(Attribute.Name.valueOf(ndattribute.getName()));
+ attribute.setValue(ndattribute.getValue());
+ network.addAttribute(attribute);
+ } catch (IllegalArgumentException ex) {
+ // The attribute Name passed back from Network Discovery is not in our enum
+ log.info("Atribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" + resource.getId() + " is invalid");
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
}
- private CountDownLatch createCountDownLatch(List<Resource> resourceList) {
+
+ private CountDownLatch createCountDownLatch(ModelContext networkDiscoveryCtx) {
// Obtain the possible total count of messages to NetworkDiscovery
// for CountDownLatch.
- int latch_count = resourceList.size();
+ int latch_count = 0;
+ for (VF vf : networkDiscoveryCtx.getVfs()) {
+ latch_count += vf.getVnfcs().size();
+ for (VFModule vfModule : vf.getVfModules()) {
+ latch_count += vfModule.getVms().size();
+ latch_count += vfModule.getNetworks().size();
+ }
+ }
if (latch_count > 0) {
// Let us create task that is going to
// wait for all threads before it starts
@@ -432,19 +452,26 @@ public class SpringServiceImpl implements SpringService {
}
/* Return list of requestIds sent to network-discovery microService. */
- private List<String> sendNetworkDiscoveryRequest(List<Resource> resourceList, String serviceInstanceId, String parent_requestId,
+ private List<String> sendNetworkDiscoveryRequest(ModelContext networkDiscoveryCtx, String serviceInstanceId, String parent_requestId,
String partner_name, CountDownLatch latchSignal) throws DiscoveryException {
- List<String> relatedRequestIdList = new ArrayList<>();
+ List<String> relatedRequestIdList = new ArrayList<String>();
+ List<NdResource> ndresourceList = new ArrayList<NdResource>();
- for (Resource resource : resourceList) {
- String resourceId = resource.getResourceId();
- String origResourceType = resource.getResourceType();
- String resourceType = networkDiscoveryCtxBuilderResourceTypeMapping.get(origResourceType);
- if (resourceType == null) {
- log.error("Unable to find " + origResourceType + " from networkDiscoveryCtxBuilderResourceTypeMapping");
- continue;
+ for (VF vf : networkDiscoveryCtx.getVfs()) {
+ for (VNFC vnfc : vf.getVnfcs()) {
+ ndresourceList.add(new NdResource(vnfc.getNfcNamingCode(), vnfc.getUuid()));
}
+ for (VFModule vfModule : vf.getVfModules()) {
+ for (VM vm : vfModule.getVms() ) {
+ ndresourceList.add(new NdResource(vm.getNfcNamingCode(), vm.getUuid()));
+ }
+ for (Network network : vfModule.getNetworks()) {
+ ndresourceList.add(new NdResource(network.getNfcNamingCode(), network.getUuid()));
+ }
+ }
+ }
+ for (NdResource resource : ndresourceList) {
// The old_requestId is inherited from ServiceDecomposition.
// Before we send a
@@ -455,7 +482,7 @@ public class SpringServiceImpl implements SpringService {
+ uniqueSeq.incrementAndGet();
if (true == sendNetworkDiscoveryRequestToSpecificServer(partner_name, parent_requestId, requestId,
- resourceId, resourceType, latchSignal)) {
+ resource.getResourceId(), resource.getResourceType(), latchSignal)) {
relatedRequestIdList.add(requestId);
}
}
@@ -586,7 +613,7 @@ public class SpringServiceImpl implements SpringService {
// If, for some reason we are unable to get the canonical host name,
// we
// just want to leave the field null.
- log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
}
}
@@ -609,7 +636,7 @@ public class SpringServiceImpl implements SpringService {
// If, for some reason we are unable to get the canonical host name,
// we
// just want to leave the field null.
- log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
}
}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/unittest/service/NetworkDiscoveryContextBuilderTest.java b/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/unittest/service/NetworkDiscoveryContextBuilderTest.java
index 5485535..19af1f3 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/unittest/service/NetworkDiscoveryContextBuilderTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/unittest/service/NetworkDiscoveryContextBuilderTest.java
@@ -255,15 +255,14 @@ public class NetworkDiscoveryContextBuilderTest {
}
private NetworkDiscoveryNotification simulateNetworkDiscoveryNotification() {
- NetworkDiscoveryNotification notification = new NetworkDiscoveryNotification();
Resource myResource = new Resource();
myResource.setId("25fb07ab-0478-465e-a021-6384ac299671");
myResource.setType("vserver");
DataQuality dataQuality = new DataQuality();
dataQuality.setStatus(DataQuality.Status.ok);
myResource.setDataQuality(dataQuality);
- List<Attribute> attributeList = new ArrayList<>();;
Attribute attribute = new Attribute();
+ List<Attribute> attributeList = new ArrayList<>();
attribute.setName("vserver-id");
attribute.setValue("25fb07ab-0478-465e-a021-6384ac299671");
attribute.setDataQuality(dataQuality);
@@ -315,6 +314,7 @@ public class NetworkDiscoveryContextBuilderTest {
attributeList.add(attribute);
myResource.setAttributeList(attributeList);
+ NetworkDiscoveryNotification notification = new NetworkDiscoveryNotification();
notification.setResources(Arrays.asList(myResource));
notification.setAckFinalIndicator(true);
notification.setCode(200);
@@ -325,7 +325,6 @@ public class NetworkDiscoveryContextBuilderTest {
}
private void simulateNetworkDiscoveryInfoList() {
- NetworkDiscoveryInfoAccess networkDiscoveryInfoAccess = new NetworkDiscoveryInfoAccess();
String requestId2 = "2131__2";
List<String> related_request_list = new ArrayList<>();
@@ -337,6 +336,8 @@ public class NetworkDiscoveryContextBuilderTest {
notif1.setResourceType(resourceType);
notif1.setResourceId(resourceId);
notif1.setRelatedRequestIdList(related_request_list);
+
+ NetworkDiscoveryInfoAccess networkDiscoveryInfoAccess = new NetworkDiscoveryInfoAccess();
networkDiscoveryInfoAccess.updateList(requestId, notif1);
NetworkDiscoveryRspInfo notif2 = new NetworkDiscoveryRspInfo();