vol-376 add curciut and rmeote ID
Change-Id: Iff55c9e724571813187f10fd9bf54b3c2bd559ad
diff --git a/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
index 49e0315..80ca685 100644
--- a/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
+++ b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
@@ -53,6 +53,12 @@
@JsonProperty(value = "nasId")
String nasId;
+ @JsonProperty(value = "circuitId")
+ String circuitId;
+
+ @JsonProperty(value = "remoteId")
+ String remoteId;
+
protected SubscriberAndDeviceInformation() {
}
@@ -127,6 +133,23 @@
public final void setNasId(final String nasId) {
this.nasId = nasId;
}
+
+ public final String circuitId() {
+ return this.circuitId;
+ }
+
+ public final void setCircuitId(final String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public final String remoteId() {
+ return this.remoteId;
+ }
+
+ public final void setRemoteId(final String remoteId) {
+ this.remoteId = remoteId;
+ }
+
/*
* (non-Javadoc)
*
@@ -145,6 +168,8 @@
result = prime * result + this.slot;
result = prime * result + (this.ipAddress == null ? 0 : this.ipAddress.hashCode());
result = prime * result + (this.nasId == null ? 0 : this.nasId.hashCode());
+ result = prime + result + (this.circuitId == null ? 0 : this.circuitId.hashCode());
+ result = prime + result + (this.remoteId == null ? 0 : this.remoteId.hashCode());
return result;
}
@@ -220,6 +245,20 @@
if (this.slot != other.slot) {
return false;
}
+ if (this.circuitId == null) {
+ if (other.circuitId != null) {
+ return false;
+ }
+ } else if (!this.circuitId.equals(other.circuitId)) {
+ return false;
+ }
+ if (this.remoteId == null) {
+ if (other.remoteId != null) {
+ return false;
+ }
+ } else if (!this.remoteId.equals(other.remoteId)) {
+ return false;
+ }
return true;
}
@@ -250,6 +289,10 @@
buf.append(this.ipAddress);
buf.append(",nasId:");
buf.append(this.nasId);
+ buf.append(",circuitId:");
+ buf.append(this.circuitId);
+ buf.append(",remoteId:");
+ buf.append(this.remoteId);
buf.append(']');
return buf.toString();
diff --git a/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java b/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
index 85a5bd6..c7efc21 100644
--- a/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
@@ -63,7 +63,9 @@
* "slot" : int,
* "hardwareidentifier" : string,
* "ipAddress" : string,
- * "nasId" : string
+ * "nasId" : string,
+ * "circuitId" : string,
+ * "removeId" : string
* }, ...
* ]
* }
diff --git a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
index 18b63ac..af3a71f 100644
--- a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
@@ -33,7 +33,10 @@
.put("hardwareIdentifier", (entry.hardwareIdentifier() == null) ? "" :
entry.hardwareIdentifier().toString())
.put("ipAddress", (entry.ipAddress() == null) ? "" : entry.ipAddress().toString())
- .put("nasId", entry.nasId());
+ .put("nasId", entry.nasId())
+ .put("circuiltId", (entry.circuitId() == null) ? "" : entry.circuitId())
+ .put("remoteId", (entry.remoteId() == null) ? "" : entry.remoteId());
+
return result;
}
}
diff --git a/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java b/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
index 70cfa23..3101f40 100644
--- a/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
+++ b/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
@@ -85,12 +85,14 @@
List<SubscriberAndDeviceInformation> entries = config.getEntries();
assertEquals(3, entries.size());
assertTrue(SubscriberAndDeviceInformationBuilder.build("1", (short) 2, (short) 2, "1/1/2", (short) 125,
- (short) 3, "aa:bb:cc:dd:ee:ff", "XXX-NASID", "10.10.10.10").checkEquals(entries.get(0)));
+ (short) 3, "aa:bb:cc:dd:ee:ff", "XXX-NASID", "10.10.10.10", "circuit123", "remote123")
+ .checkEquals(entries.get(0)));
assertTrue(SubscriberAndDeviceInformationBuilder.build("2", (short) 4, (short) 4, "1/1/2", (short) 129,
- (short) 4, "aa:bb:cc:dd:ee:ff", "YYY-NASID", "1.1.1.1").checkEquals(entries.get(1)));
+ (short) 4, "aa:bb:cc:dd:ee:ff", "YYY-NASID", "1.1.1.1", "circuit234", "remote234")
+ .checkEquals(entries.get(1)));
assertTrue(SubscriberAndDeviceInformationBuilder.build("cc:dd:ee:ff:aa:bb", (short) -1, (short) -1, null,
- (short) -1,
- (short) -1, "cc:dd:ee:ff:aa:bb", "CCC-NASID", "12.12.12.12").checkEquals(entries.get(2)));
+ (short) -1, (short) -1, "cc:dd:ee:ff:aa:bb", "CCC-NASID", "12.12.12.12", "circuit345", "remote345")
+ .checkEquals(entries.get(2)));
}
@@ -99,8 +101,8 @@
private static final class SubscriberAndDeviceInformationBuilder extends SubscriberAndDeviceInformation {
public static SubscriberAndDeviceInformationBuilder build(String id, short cTag, short sTag, String nasPortId,
- short port, short slot, String mac, String nasId, String ipAddress) {
- //SubscriberAndDeviceInformation info = new SubscriberAndDeviceInformation();
+ short port, short slot, String mac, String nasId, String ipAddress, String circuitId, String remoteId) {
+
SubscriberAndDeviceInformationBuilder info = new SubscriberAndDeviceInformationBuilder();
info.setId(id);
if (cTag != -1) {
@@ -119,6 +121,8 @@
info.setHardwareIdentifier(MacAddress.valueOf(mac));
info.setIPAddress(Ip4Address.valueOf(ipAddress));
info.setNasId(nasId);
+ info.setCircuitId(circuitId);
+ info.setRemoteId(remoteId);
return info;
}
@@ -181,6 +185,20 @@
if (this.slot() != other.slot()) {
return false;
}
+ if (this.circuitId() == null) {
+ if (other.circuitId() != null) {
+ return false;
+ }
+ } else if (!this.circuitId().equals(other.circuitId())) {
+ return false;
+ }
+ if (this.remoteId() == null) {
+ if (other.remoteId() != null) {
+ return false;
+ }
+ } else if (!this.remoteId().equals(other.remoteId())) {
+ return false;
+ }
return true;
}
}
diff --git a/app/src/main/resources/config.json b/app/src/test/resources/config.json
similarity index 69%
rename from app/src/main/resources/config.json
rename to app/src/test/resources/config.json
index eff6202..c6b8f37 100644
--- a/app/src/main/resources/config.json
+++ b/app/src/test/resources/config.json
@@ -21,7 +21,9 @@
"slot": 3,
"hardwareIdentifier": "aa:bb:cc:dd:ee:ff",
"ipAddress":"10.10.10.10",
- "nasId":"XXX-NASID"
+ "nasId":"XXX-NASID",
+ "circuitId":"circuit123",
+ "remoteId":"remote123"
},
{
@@ -33,14 +35,18 @@
"slot": 4,
"hardwareIdentifier": "aa:bb:cc:dd:ee:ff",
"ipAddress":"1.1.1.1",
- "nasId":"YYY-NASID"
+ "nasId":"YYY-NASID",
+ "circuitId":"circuit234",
+ "remoteId":"remote234"
},
{
"id": "cc:dd:ee:ff:aa:bb",
"hardwareIdentifier": "cc:dd:ee:ff:aa:bb",
"ipAddress":"12.12.12.12",
- "nasId":"CCC-NASID"
+ "nasId":"CCC-NASID",
+ "circuitId":"circuit345",
+ "remoteId":"remote345"
}
]
}