SEBA-814 To support Multi-Tcont on TT-workflow, SADIS configuration
is updated.
Change-Id: I48cb3c3894f8e711b74165152d5712c593cc3c03
diff --git a/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java b/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
index 6ff5cc3..fa68966 100644
--- a/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
+++ b/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
@@ -24,34 +24,17 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.opencord.sadis.BaseConfig;
-import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.BaseInformation;
+import org.opencord.sadis.BaseInformationService;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
/**
* Set of tests of the SADIS ONOS application component.
*/
public class SubscriberAndDeviceManagerTest extends BaseSadis {
- SubscriberAndDeviceInformationBuilder entry1 = 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",
- "circuit123", "remote123", 64, "1Gb", "1Gb");
- SubscriberAndDeviceInformationBuilder entry2 = 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",
- "circuit234", "remote234", 64, "10Gb", "10Gb");
- SubscriberAndDeviceInformationBuilder entry3 = SubscriberAndDeviceInformationBuilder.build("3", (short) 7,
- (short) 8, "1/1/2", (short) 130, (short) 7, "ff:aa:dd:cc:bb:ee", "MNO-NASID", "30.30.30.30",
- "circuit567", "remote567", 64, "10Gb", "10Gb");
- SubscriberAndDeviceInformationBuilder entry4 = SubscriberAndDeviceInformationBuilder.build("4", (short) 2,
- (short) 1, "1/1/2", (short) 132, (short) 1, "ff:cc:dd:aa:ee:bb", "PQR-NASID", "15.15.15.15",
- "circuit678", "remote678", 64, "5Gb", "5Gb");
-
-
@Before
public void setUp() throws Exception {
config = new SubscriberAndDeviceInformationConfig();
@@ -74,23 +57,9 @@
private void checkEntriesForSubscriberAndAccessDevice(BaseConfig config) {
List<SubscriberAndDeviceInformation> entries = config.getEntries();
assertEquals(3, entries.size());
-
- SubscriberAndDeviceInformation sub = 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", "circuit123", "remote123",
- 64, "1Gb", "1Gb");
- assertTrue(checkEquality(sub, entries.get(0)));
-
-
- sub = 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", "circuit234", "remote234",
- 64, "10Gb", "10Gb");
- assertTrue(checkEquality(sub, entries.get(1)));
-
- sub = 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", "circuit345", "remote345",
- 64, "10Gb", "10Gb");
- assertTrue(checkEquality(sub, entries.get(2)));
+ assertTrue(checkEquality(entry1, entries.get(0)));
+ assertTrue(checkEquality(entry2, entries.get(1)));
+ assertTrue(checkEquality(entry5, entries.get(2)));
}
@Test
@@ -98,14 +67,15 @@
BaseInformationService<SubscriberAndDeviceInformation> subscriberService = sadis.getSubscriberInfoService();
- checkGetForExisting("1", entry1, subscriberService);
- checkGetForExisting("2", entry2, subscriberService);
+ checkGetForExisting(ID1, entry1, subscriberService);
+ checkGetForExisting(ID2, entry2, subscriberService);
+ checkGetForExisting(ID5, entry5, subscriberService);
- invalidateId("1", subscriberService);
- checkFromBoth("1", entry1, subscriberService);
+ invalidateId(ID1, subscriberService);
+ checkFromBoth(ID1, entry1, subscriberService);
invalidateAll(subscriberService);
- checkFromBoth("2", entry2, subscriberService);
+ checkFromBoth(ID2, entry2, subscriberService);
}
@@ -120,14 +90,14 @@
config.init(subject, "sadis-remote-mode-test", node("/RemoteConfig.json"), mapper, delegate);
configListener.event(event);
- checkGetForExisting("3", entry3, subscriberService);
- checkGetForExisting("4", entry4, subscriberService);
+ checkGetForExisting(ID3, entry3, subscriberService);
+ checkGetForExisting(ID4, entry4, subscriberService);
- invalidateId("3", subscriberService);
- checkFromBoth("3", entry3, subscriberService);
+ invalidateId(ID3, subscriberService);
+ checkFromBoth(ID3, entry3, subscriberService);
invalidateAll(subscriberService);
- checkFromBoth("4", entry4, subscriberService);
+ checkFromBoth(ID4, entry4, subscriberService);
}
@Test
@@ -136,60 +106,16 @@
config.init(subject, "sadis-remote-mode-test", node("/RemoteConfig.json"), mapper, delegate);
configListener.event(event);
- checkGetForExisting("3", null, service);
- checkGetForNonExist("1", service);
+ checkGetForExisting(ID3, null, service);
+ checkGetForNonExist(ID1, service);
config.init(subject, "sadis-local-mode-test", node("/LocalSubConfig.json"), mapper, delegate);
configListener.event(event);
- checkGetForExisting("1", null, service);
- checkGetForNonExist("3", service);
+ checkGetForExisting(ID1, null, service);
+ checkGetForNonExist(ID3, service);
}
-
- 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, String circuitId, String remoteId,
- int technologyProfileId,
- String upstreamBandwidthProfile,
- String downstreamBandwidthProfile) {
-
- SubscriberAndDeviceInformationBuilder info = new SubscriberAndDeviceInformationBuilder();
- info.setId(id);
- if (cTag != -1) {
- info.setCTag(VlanId.vlanId(cTag));
- }
- if (sTag != -1) {
- info.setSTag(VlanId.vlanId(sTag));
- }
- info.setNasPortId(nasPortId);
- if (port != -1) {
- info.setUplinkPort(port);
- }
- if (slot != -1) {
- info.setSlot(slot);
- }
- info.setHardwareIdentifier(MacAddress.valueOf(mac));
- info.setIPAddress(Ip4Address.valueOf(ipAddress));
- info.setNasId(nasId);
- info.setCircuitId(circuitId);
- info.setRemoteId(remoteId);
-
- if (technologyProfileId != -1) {
- info.setTechnologyProfileId(technologyProfileId);
- }
-
- info.setUpstreamBandwidthProfile(upstreamBandwidthProfile);
- info.setDownstreamBandwidthProfile(downstreamBandwidthProfile);
-
- return info;
- }
-
- }
-
- @Override
public boolean checkEquality(BaseInformation localEntry, BaseInformation entry) {
SubscriberAndDeviceInformation sub = (SubscriberAndDeviceInformation) localEntry;
SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) localEntry;
@@ -197,13 +123,6 @@
if (other == null) {
return false;
}
- if (sub.cTag() == null) {
- if (other.cTag() != null) {
- return false;
- }
- } else if (!sub.cTag().equals(other.cTag())) {
- return false;
- }
if (sub.hardwareIdentifier() == null) {
if (other.hardwareIdentifier() != null) {
return false;
@@ -242,13 +161,6 @@
if (sub.uplinkPort() != other.uplinkPort()) {
return false;
}
- if (sub.sTag() == null) {
- if (other.sTag() != null) {
- return false;
- }
- } else if (!sub.sTag().equals(other.sTag())) {
- return false;
- }
if (sub.slot() != other.slot()) {
return false;
}
@@ -266,25 +178,13 @@
} else if (!sub.remoteId().equals(other.remoteId())) {
return false;
}
- if (sub.technologyProfileId() != other.technologyProfileId()) {
- return false;
- }
- if (sub.upstreamBandwidthProfile() == null) {
- if (other.upstreamBandwidthProfile() != null) {
+ if (sub.uniTagList() == null) {
+ if (other.uniTagList() != null) {
return false;
}
- } else if (!sub.upstreamBandwidthProfile().equals(other.upstreamBandwidthProfile())) {
- return false;
- }
- if (sub.downstreamBandwidthProfile() == null) {
- if (other.downstreamBandwidthProfile() != null) {
- return false;
- }
- } else if (!sub.downstreamBandwidthProfile().equals(other.downstreamBandwidthProfile())) {
+ } else if (!sub.uniTagList().equals(other.uniTagList())) {
return false;
}
return true;
}
-
-
}