diff options
-rw-r--r-- | config/application.properties | 1 | ||||
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java | 20 |
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; - } + } } |