summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2018-04-17 18:05:03 +0800
committeryunlong ying <ying.yunlong@zte.com.cn>2018-04-18 01:50:33 +0000
commite8d4d8c19ac1eaf1230a0add0b6b0bc7fc5aa588 (patch)
treed8bbc668b81c594821dd6fbd21cb7efa40d41fea
parent2dbcd2c60cb63448f829b72470430cff616abace (diff)
Fix emsdriver register to msb issue.
Issue-ID: VFC-883 Change-Id: Id7d4c8b189fcf3dbf235f26e4a6efe2a623aa581 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java8
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java14
-rw-r--r--ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml1
-rwxr-xr-xems/microservice-standalone/src/main/assembly/docker/instance_config.sh3
4 files changed, 21 insertions, 5 deletions
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java
index 8d13d18..cda7982 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java
@@ -82,7 +82,7 @@ public class EmsDriverApplication extends Application<EmsDriverConfiguration> {
MsbConfiguration.setMsbAddress(configuration.getMsbAddress());
//MSB register
String registerFlag = configuration.getAutoServiceRegister();
- if ("false".equalsIgnoreCase(registerFlag)) {
+ if ("true".equalsIgnoreCase(registerFlag)) {
this.msbRegisteEmsDriverService(configuration);
}
//Start workThread
@@ -130,7 +130,7 @@ public class EmsDriverApplication extends Application<EmsDriverConfiguration> {
HttpConnectorFactory connector = (HttpConnectorFactory) simpleServerFactory.getConnector();
MsbRegisterVo registerVo = new MsbRegisterVo();
ServiceNodeVo serviceNode = new ServiceNodeVo();
- String ip = "";
+/* String ip = "";
try {
ip = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
@@ -138,8 +138,8 @@ public class EmsDriverApplication extends Application<EmsDriverConfiguration> {
}
if ("".equals(ip)) {
ip = connector.getBindHost();
- }
- serviceNode.setIp(ip);
+ }*/
+ serviceNode.setIp(configuration.getServiceIp());
serviceNode.setPort(String.valueOf(connector.getPort()));
serviceNode.setTtl(0);
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java
index 33bf306..3903903 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java
@@ -29,7 +29,9 @@ public class EmsDriverConfiguration extends Configuration {
@NotEmpty
private String defaultName = "EmsDriver-Stranger";
- @JsonProperty
+ private String serviceIp;
+
+ @JsonProperty
public String getMsbAddress() {
return msbAddress;
}
@@ -58,4 +60,14 @@ public class EmsDriverConfiguration extends Configuration {
public void setDefaultName(String name) {
this.defaultName = name;
}
+
+ @JsonProperty
+ public String getServiceIp() {
+ return serviceIp;
+ }
+
+ @JsonProperty
+ public void setServiceIp(String serviceIp) {
+ this.serviceIp = serviceIp;
+ }
}
diff --git a/ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml b/ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml
index 4259c54..6cde690 100644
--- a/ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml
+++ b/ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml
@@ -20,6 +20,7 @@ defaultName: EmsDriver-Stranger
#microservice Bus address
msbAddress: 10.74.205.123:80
autoServiceRegister: false
+serviceIp: 127.0.0.1
server:
type: simple
rootPath: '/api/emsdriver/v1/*'
diff --git a/ems/microservice-standalone/src/main/assembly/docker/instance_config.sh b/ems/microservice-standalone/src/main/assembly/docker/instance_config.sh
index 476c856..d856f57 100755
--- a/ems/microservice-standalone/src/main/assembly/docker/instance_config.sh
+++ b/ems/microservice-standalone/src/main/assembly/docker/instance_config.sh
@@ -10,6 +10,9 @@ PASSWORD=`echo $VES_AUTHINFO | cut -d: -f 2`
sed -i "s|msbAddress.*|msbAddress: $MSB_IP:$MSB_PORT|" emsdriver/conf/emsdriver.yml
sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" emsdriver/conf/emsdriver.yml
+if [ $SERVICE_IP ]; then
+ sed -i "s|serviceIp.*|serviceIp: $SERVICE_IP|" emsdriver/conf/emsdriver.yml
+fi
sed -i "s|msbAddress=.*|msbAddress=$MSB_IP:$MSB_PORT|" emsdriver/conf/config.properties
sed -i "s|event_api_url=.*|event_api_url=$VES_IP|" emsdriver/conf/config.properties
sed -i "s|port=.*|port=$VES_PORT|" emsdriver/conf/config.properties