aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2018-09-26 15:17:36 -0400
committerTait,Trevor(rt0435) <rtait@amdocs.com>2018-09-26 15:23:24 -0400
commitf17906f0dcff8c17258117c72376850840d3b21a (patch)
tree18c11c4830ef43b3587ebc09e6100ece1ec324b8
parent28056dd6cbb5366d781e1e601124e5aea7747b7f (diff)
Network Discovery callback URL is incorrect
Issue-ID: LOG-700 The Network Discovery Context Builder should use the serviceName when building the callback URL for Network Discovery Micro Servie. Make this configurable. Change-Id: I97ed8e78b006ff5d587beedcefc577701c0d33b9 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--config/application.properties1
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java20
2 files changed, 10 insertions, 11 deletions
diff --git a/config/application.properties b/config/application.properties
index 95ae244..b9b8601 100644
--- a/config/application.properties
+++ b/config/application.properties
@@ -18,6 +18,7 @@ server.tomcat.max-idle-time=60000
# Network Discovery Context Builder REST Service
networkDiscoveryCtxBuilder.httpProtocol=http
+networkDiscoveryCtxBuilder.serviceName=pomba-networkdiscoveryctxbuilder
networkDiscoveryCtxBuilder.port=8080
# Basic Authorization credentials for Network Discovery Context Builder REST Service
networkDiscoveryCtxBuilder.userId=admin
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java
index a8f6f7f..7781d1a 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java
@@ -52,6 +52,9 @@ public class NdctxbConfiguration {
@Value("${networkDiscoveryCtxBuilder.port}")
private String networkDiscoveryCtxBuilderPort;
+ @Value("${networkDiscoveryCtxBuilder.serviceName}")
+ private String networkDiscoveryCtxBuilderServiceName;
+
@Value("${networkDiscoveryCtxBuilder.userId:admin}")
private String networkDiscoveryCtxBuilderUserId;
@@ -129,15 +132,10 @@ public class NdctxbConfiguration {
@Bean(name = "networkDiscoveryCtxBuilderBaseUrl")
public String getNetworkDiscoveryCtxBuilderBaseUrl() throws DiscoveryException {
String url = null;
- try {
- String localIp = InetAddress.getLocalHost().getHostAddress();
- url = this.httpNetworkDiscoveryCtxBuilderProtocol + "://" + localIp + ":"
+ url = this.httpNetworkDiscoveryCtxBuilderProtocol
+ + "://" + this.networkDiscoveryCtxBuilderServiceName
+ + ":"
+ this.networkDiscoveryCtxBuilderPort;
- } catch (Exception e) {
- log.error("Unable to obtain localIp: " + e.getMessage());
- throw new DiscoveryException(e.getMessage(), e);
- }
-
return url;
}
@@ -175,7 +173,7 @@ public class NdctxbConfiguration {
@Autowired
private Environment env;
-
+
// This method builds a map between Service Decomposition resource type and Network Discovery
// Context Builder resource type using dynamic mapping technique.
// It scans the contents of the configuration file "application.properties",
@@ -183,7 +181,7 @@ public class NdctxbConfiguration {
// anything from the remaining string will be used as the key (Service Decomposition resource Type)
// to match to the value of assignment (network discovery context builder resource type).
// For example,"networkDiscoveryCtxBuilder.resourceTypeMapping.BBB = bbb",
- // Service Decomposition resource type BBB matches to context builder resource type bbb
+ // Service Decomposition resource type BBB matches to context builder resource type bbb
@Bean(name = "networkDiscoveryCtxBuilderResourceTypeMapping")
public Map<String, String> getResourceTypeMapping() {
Map<String, String> props = new HashMap<>();
@@ -202,5 +200,5 @@ public class NdctxbConfiguration {
log.info(props.toString());
return props;
- }
+ }
}