[ONOS-5919] (vCore) separate Intent store
Change-Id: I3b5b67d7286dafdf11bf3d8d4acafb59a3034e22
diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkIntentManagerTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkIntentManagerTest.java
index 4b7cf84..3b59e9a 100644
--- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkIntentManagerTest.java
+++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkIntentManagerTest.java
@@ -37,8 +37,10 @@
import org.onosproject.incubator.net.virtual.VirtualLink;
import org.onosproject.incubator.net.virtual.VirtualNetwork;
import org.onosproject.incubator.net.virtual.VirtualNetworkIntent;
+import org.onosproject.incubator.net.virtual.VirtualNetworkIntentStore;
import org.onosproject.incubator.net.virtual.VirtualNetworkStore;
import org.onosproject.incubator.store.virtual.impl.DistributedVirtualNetworkStore;
+import org.onosproject.incubator.store.virtual.impl.SimpleVirtualIntentStore;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultPort;
import org.onosproject.net.EncapsulationType;
@@ -100,6 +102,7 @@
private VirtualNetworkManager manager;
private static DistributedVirtualNetworkStore virtualNetworkManagerStore;
+ private VirtualNetworkIntentStore intentStore;
private CoreService coreService;
private TestableIntentService intentService = new FakeIntentManager();
private VirtualNetworkIntentManager vnetIntentService;
@@ -117,6 +120,7 @@
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
+ intentStore = new SimpleVirtualIntentStore();
coreService = new VirtualNetworkIntentManagerTest.TestCoreService();
@@ -215,7 +219,7 @@
vnetIntentService = new VirtualNetworkIntentManager(manager, virtualNetwork.id());
vnetIntentService.intentService = intentService;
- vnetIntentService.store = virtualNetworkManagerStore;
+ vnetIntentService.intentStore = intentStore;
vnetIntentService.partitionService = workPartitionService;
return virtualNetwork;
}
@@ -347,12 +351,12 @@
switch (event.type()) {
case INSTALLED:
// Release one permit on the created semaphore since the Intent event was received.
- virtualNetworkManagerStore.addOrUpdateIntent(event.subject(), IntentState.INSTALLED);
+// virtualNetworkManagerStore.addOrUpdateIntent(event.subject(), IntentState.INSTALLED);
created.release();
break;
case WITHDRAWN:
// Release one permit on the removed semaphore since the Intent event was received.
- virtualNetworkManagerStore.addOrUpdateIntent(event.subject(), IntentState.WITHDRAWN);
+// virtualNetworkManagerStore.addOrUpdateIntent(event.subject(), IntentState.WITHDRAWN);
withdrawn.release();
break;
case PURGED:
@@ -396,4 +400,15 @@
super(APP_ID, Collections.singletonList(new IntentTestsMocks.MockFlowRule(100)), Collections.emptyList());
}
}
+
+// private void addOrUpdateIntent(Intent intent, IntentState state) {
+// checkNotNull(intent, "Intent cannot be null");
+// IntentData intentData = intentStore.(intent.key());
+// if (intentData == null) {
+// intentData = new IntentData(intent, state, new WallClockTimestamp(System.currentTimeMillis()));
+// } else {
+// intentData = new IntentData(intent, state, intentData.version());
+// }
+// intentKeyIntentDataMap.put(intent.key(), intentData);
+// }
}