Fix emsdriver register to msb issue. 01/43301/3
authoryangyan <yangyanyj@chinamobile.com>
Tue, 17 Apr 2018 10:05:03 +0000 (18:05 +0800)
committeryunlong ying <ying.yunlong@zte.com.cn>
Wed, 18 Apr 2018 01:50:33 +0000 (01:50 +0000)
Issue-ID: VFC-883
Change-Id: Id7d4c8b189fcf3dbf235f26e4a6efe2a623aa581
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverApplication.java
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/EmsDriverConfiguration.java
ems/microservice-standalone/src/main/assembly/conf/emsdriver.yml
ems/microservice-standalone/src/main/assembly/docker/instance_config.sh

index 8d13d18..cda7982 100644 (file)
@@ -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);
 
index 33bf306..3903903 100644 (file)
@@ -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;
+       }
 }
index 4259c54..6cde690 100644 (file)
@@ -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/*'
index 476c856..d856f57 100755 (executable)
@@ -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