nodes) {
- this.nodes = nodes;
- }
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java
index 493266e..2e849df 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java
@@ -16,34 +16,12 @@
package org.onap.sfc.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
@JsonIgnoreProperties(ignoreUnknown = true)
+@Data
public class NodeEntity {
private String ip;
private String port;
private String ttl;
-
- public String getIp() {
- return ip;
- }
-
- public void setIp(String ip) {
- this.ip = ip;
- }
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-
- public String getTtl() {
- return ttl;
- }
-
- public void setTtl(String ttl) {
- this.ttl = ttl;
- }
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java
index 9d5922b..96e0ed6 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java
@@ -15,6 +15,9 @@
*/
package org.onap.sfc.entity;
+import lombok.Data;
+
+@Data
public class Result {
private String id;
@@ -23,12 +26,4 @@ public class Result {
this.id = uuid;
}
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java
index 5aee863..8630095 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java
@@ -16,32 +16,11 @@
package org.onap.sfc.entity;
+import lombok.Data;
+
+@Data
public class SdnControllerInfo {
String url;
String userName;
String password;
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java
index 0eda970..a2f2a9f 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java
@@ -18,44 +18,13 @@ package org.onap.sfc.entity.portpair;
import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+@Data
public class PortInfo {
private String encapsulation;
private String ip;
private String mac;
@SerializedName("port-name")
private String portName;
-
- public String getEncapsulation() {
- return encapsulation;
- }
-
-
- public String getPortName() {
- return portName;
- }
-
- public void setPortName(String portName) {
- this.portName = portName;
- }
-
- public void setEncapsulation(String encapsulation) {
- this.encapsulation = encapsulation;
- }
-
- public String getIp() {
- return ip;
- }
-
- public void setIp(String ip) {
- this.ip = ip;
- }
-
- public String getMac() {
- return mac;
- }
-
- public void setMac(String mac) {
- this.mac = mac;
- }
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java
index 28dd1b8..569a05b 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java
@@ -16,26 +16,12 @@
package org.onap.sfc.entity.portpair;
import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+@Data
public class ServiceFunctionParameter {
@SerializedName("service-function-parameter")
private String serviceFunctionParamter;
@SerializedName("service-function-parameter-value")
private String getServiceFunctionParamterValue;
-
- public String getServiceFunctionParamter() {
- return serviceFunctionParamter;
- }
-
- public void setServiceFunctionParamter(String serviceFunctionParamter) {
- this.serviceFunctionParamter = serviceFunctionParamter;
- }
-
- public String getGetServiceFunctionParamterValue() {
- return getServiceFunctionParamterValue;
- }
-
- public void setGetServiceFunctionParamterValue(String getServiceFunctionParamterValue) {
- this.getServiceFunctionParamterValue = getServiceFunctionParamterValue;
- }
}
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java
index aa52050..e801578 100644
--- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java
+++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java
@@ -15,6 +15,7 @@
*/
package org.onap.sfc.resources;
+import lombok.Setter;
import org.onap.sfc.utils.SfcDriverUtil;
import org.onap.sfc.entity.MsbRegisterEntity;
import org.onap.sfc.service.ConfigInfo;
@@ -25,6 +26,13 @@ import org.slf4j.LoggerFactory;
public class MsbServiceRegister implements Runnable {
private final Logger LOGGER = LoggerFactory.getLogger(MsbServiceRegister.class);
MsbRegisterEntity entity;
+
+ @Setter
+ private int sleepSeconds = 30000;
+
+ @Setter
+ private int retry = 20;
+
public MsbServiceRegister()
{
initInfo();
@@ -40,7 +48,7 @@ public class MsbServiceRegister implements Runnable {
public void run() {
boolean flag = false;
int retryTimes=0;
- while (!flag && retryTimes<20)
+ while (!flag && retryTimes< retry)
{
try {
LOGGER.info("Register Msb start:");
@@ -53,7 +61,8 @@ public class MsbServiceRegister implements Runnable {
} catch (Exception e) {
LOGGER.error("Register Msb failed",e);
//e.printStackTrace();
- threadSleep(30000);
+ threadSleep(sleepSeconds);
+ retryTimes++;
}
}
diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java
index 64fe21b..994a701 100644
--- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java
+++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java
@@ -19,6 +19,7 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.sfc.entity.MsbRegisterEntity;
+import org.onap.sfc.service.ConfigInfo;
import org.onap.sfc.utils.SfcDriverUtil;
public class TestMsbRegister {
@@ -26,6 +27,9 @@ public class TestMsbRegister {
@Test
public void test_registerMsb()
{
+ SfcDriverConfig sfcDriverConfig = new SfcDriverConfig();
+ sfcDriverConfig.setServiceIp("127.0.0.1");
+ ConfigInfo.setConfig(sfcDriverConfig);
MsbRegisterEntity entity = SfcDriverUtil.getMsbRegisterInfo();
assert entity.getUrl().equals("/api/ztesdncdriver/v1");
}
diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java
new file mode 100644
index 0000000..4dc0209
--- /dev/null
+++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java
@@ -0,0 +1,28 @@
+package org.onap.sfc.entity;
+
+import org.junit.Test;
+
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class ResultTest {
+ @Test
+ public void getId() throws Exception {
+ String uuid = "123";
+ Result result = new Result(uuid);
+ assert result.getId().equals(uuid);
+ }
+
+}
\ No newline at end of file
diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/resources/MsbServiceRegisterTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/resources/MsbServiceRegisterTest.java
new file mode 100644
index 0000000..03b9fbf
--- /dev/null
+++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/resources/MsbServiceRegisterTest.java
@@ -0,0 +1,35 @@
+package org.onap.sfc.resources;
+
+import org.junit.Test;
+import org.onap.sfc.SfcDriverConfig;
+import org.onap.sfc.service.ConfigInfo;
+
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class MsbServiceRegisterTest {
+ @Test
+ public void run() throws Exception {
+ SfcDriverConfig sfcDriverConfig = new SfcDriverConfig();
+ sfcDriverConfig.setServiceIp("127.0.0.1");
+ sfcDriverConfig.setMsbServiceUrl("http://127.0.0.0:21180/microservices");
+ ConfigInfo.setConfig(sfcDriverConfig);
+ MsbServiceRegister msbServiceRegister = new MsbServiceRegister();
+ msbServiceRegister.setSleepSeconds(1);
+ msbServiceRegister.setRetry(1);
+ msbServiceRegister.run();
+ }
+
+}
\ No newline at end of file
--
cgit 1.2.3-korg