Changing Intent Ids to use explicit id assignment
Change-Id: I5a4bff87842c37a869e7691b353529eaefc929db
diff --git a/core/net/src/test/java/org/onlab/onos/core/impl/DummyIdBlockAllocator.java b/core/net/src/test/java/org/onlab/onos/core/impl/DummyIdBlockAllocator.java
new file mode 100644
index 0000000..d4c0e64
--- /dev/null
+++ b/core/net/src/test/java/org/onlab/onos/core/impl/DummyIdBlockAllocator.java
@@ -0,0 +1,33 @@
+package org.onlab.onos.core.impl;
+
+import org.onlab.onos.core.IdBlock;
+
+public class DummyIdBlockAllocator implements IdBlockAllocator {
+ private long blockTop;
+ private static final long BLOCK_SIZE = 0x1000000L;
+
+ /**
+ * Returns a block of IDs which are unique and unused.
+ * Range of IDs is fixed size and is assigned incrementally as this method
+ * called.
+ *
+ * @return an IdBlock containing a set of unique IDs
+ */
+ @Override
+ public IdBlock allocateUniqueIdBlock() {
+ synchronized (this) {
+ long blockHead = blockTop;
+ long blockTail = blockTop + BLOCK_SIZE;
+
+ IdBlock block = new IdBlock(blockHead, BLOCK_SIZE);
+ blockTop = blockTail;
+
+ return block;
+ }
+ }
+
+ @Override
+ public IdBlock allocateUniqueIdBlock(long range) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+}