Update list of known strategies and other management protocol constants
Change-Id: I0cf27a2686c26a0bf22242c829ca50b3b8d62c81
diff --git a/src/main/java/com/intel/jndn/management/Nfdc.java b/src/main/java/com/intel/jndn/management/Nfdc.java
index 1be2d07..74e56b1 100644
--- a/src/main/java/com/intel/jndn/management/Nfdc.java
+++ b/src/main/java/com/intel/jndn/management/Nfdc.java
@@ -169,6 +169,7 @@
throw new ManagementException(e.getMessage(), e);
}
}
+
/**
* Retrieve the {@link KeyLocator} for an NFD.
*
diff --git a/src/main/java/com/intel/jndn/management/enums/FacePersistency.java b/src/main/java/com/intel/jndn/management/enums/FacePersistency.java
index 48aa0bc..da5c15c 100644
--- a/src/main/java/com/intel/jndn/management/enums/FacePersistency.java
+++ b/src/main/java/com/intel/jndn/management/enums/FacePersistency.java
@@ -20,8 +20,8 @@
* @see <a href="https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt">Face Management</a>
*/
public enum FacePersistency {
- NONE(-1), // invalid value
+ NONE(-1), // invalid value
PERSISTENT(0),
ON_DEMAND(1),
PERMANENT(2);
diff --git a/src/main/java/com/intel/jndn/management/enums/FaceScope.java b/src/main/java/com/intel/jndn/management/enums/FaceScope.java
index fa584de..148d80f 100644
--- a/src/main/java/com/intel/jndn/management/enums/FaceScope.java
+++ b/src/main/java/com/intel/jndn/management/enums/FaceScope.java
@@ -23,7 +23,6 @@
public enum FaceScope {
NONE(-1), // invalid value
-
NON_LOCAL(0),
LOCAL(1);
diff --git a/src/main/java/com/intel/jndn/management/enums/NfdTlv.java b/src/main/java/com/intel/jndn/management/enums/NfdTlv.java
index 253bcbc..716e426 100644
--- a/src/main/java/com/intel/jndn/management/enums/NfdTlv.java
+++ b/src/main/java/com/intel/jndn/management/enums/NfdTlv.java
@@ -67,7 +67,6 @@
public static final int FaceScope = 132;
public static final int FacePersistency = 133;
public static final int LinkType = 134;
-
public static final int FaceQueryFilter = 150;
public static final int FaceEventNotification = 192;
public static final int FaceEventKind = 193;
@@ -75,14 +74,16 @@
// ForwarderStatus and FaceStatus counters
// https://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus
// https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
+ public static final int NInBytes = 148;
+ public static final int NOutBytes = 149;
public static final int NInInterests = 144;
public static final int NInData = 145;
public static final int NInNacks = 151;
public static final int NOutInterests = 146;
public static final int NOutData = 147;
public static final int NOutNacks = 152;
- public static final int NInBytes = 148;
- public static final int NOutBytes = 149;
+ public static final int NSatisfiedInterests = 153;
+ public static final int NUnsatisfiedInterests = 154;
// FIB Management
// https://redmine.named-data.net/projects/nfd/wiki/FibMgmt
diff --git a/src/main/java/com/intel/jndn/management/enums/RouteFlags.java b/src/main/java/com/intel/jndn/management/enums/RouteFlags.java
index 7cafad4..9b26838 100644
--- a/src/main/java/com/intel/jndn/management/enums/RouteFlags.java
+++ b/src/main/java/com/intel/jndn/management/enums/RouteFlags.java
@@ -22,6 +22,7 @@
* @see <a href="https://redmine.named-data.net/projects/nfd/wiki/RibMgmt">RIB Management</a>
*/
public enum RouteFlags {
+
NONE(0),
CHILD_INHERIT(1),
CAPTURE(2);
diff --git a/src/main/java/com/intel/jndn/management/enums/RouteOrigin.java b/src/main/java/com/intel/jndn/management/enums/RouteOrigin.java
index 6fdbb27..2f2a6ec 100644
--- a/src/main/java/com/intel/jndn/management/enums/RouteOrigin.java
+++ b/src/main/java/com/intel/jndn/management/enums/RouteOrigin.java
@@ -19,13 +19,14 @@
* @see <a href="https://redmine.named-data.net/projects/nfd/wiki/RibMgmt">RIB Management</a>
*/
public enum RouteOrigin {
+
NONE(-1),
APP(0),
AUTOREG(64),
CLIENT(65),
AUTOCONF(66),
NLSR(128),
- SELFLEARNING(129),
+ PREFIXANN(129),
STATIC(255);
private final int value;
@@ -65,8 +66,8 @@
return "autoconf";
} else if (value == NLSR.toInteger()) {
return "nlsr";
- } else if (value == SELFLEARNING.toInteger()) {
- return "selflearning";
+ } else if (value == PREFIXANN.toInteger()) {
+ return "prefixann";
} else if (value == STATIC.toInteger()) {
return "static";
} else {
@@ -92,8 +93,8 @@
return AUTOCONF;
} else if (value == NLSR.toInteger()) {
return NLSR;
- } else if (value == SELFLEARNING.toInteger()) {
- return SELFLEARNING;
+ } else if (value == PREFIXANN.toInteger()) {
+ return PREFIXANN;
} else if (value == STATIC.toInteger()) {
return STATIC;
} else {
diff --git a/src/main/java/com/intel/jndn/management/enums/Strategies.java b/src/main/java/com/intel/jndn/management/enums/Strategies.java
index b375a7f..fb875bf 100644
--- a/src/main/java/com/intel/jndn/management/enums/Strategies.java
+++ b/src/main/java/com/intel/jndn/management/enums/Strategies.java
@@ -19,13 +19,16 @@
* A reference list of the strategies available in NFD.
*
* @author Andrew Brown <andrew.brown@intel.com>
- * @see <a href="https://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategy">Strategies</a>
+ * @see <a href="https://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategies">Strategies</a>
*/
public final class Strategies {
+ public static final Name ACCESS = new Name("/localhost/nfd/strategy/access");
+ public static final Name ASF = new Name("/localhost/nfd/strategy/asf");
public static final Name BEST_ROUTE = new Name("/localhost/nfd/strategy/best-route");
- public static final Name BROADCAST = new Name("/localhost/nfd/strategy/broadcast");
- public static final Name CLIENT_CONTROL = new Name("/localhost/nfd/strategy/client-control");
+ public static final Name MULTICAST = new Name("/localhost/nfd/strategy/multicast");
public static final Name NCC = new Name("/localhost/nfd/strategy/ncc");
+ public static final Name RANDOM = new Name("/localhost/nfd/strategy/random");
+ public static final Name SELF_LEARNING = new Name("/localhost/nfd/strategy/self-learning");
/**
* Prevent instances of Strategies.
diff --git a/src/test/java/com/intel/jndn/management/NfdcIT.java b/src/test/java/com/intel/jndn/management/NfdcIT.java
index f1deef1..3b0973d 100644
--- a/src/test/java/com/intel/jndn/management/NfdcIT.java
+++ b/src/test/java/com/intel/jndn/management/NfdcIT.java
@@ -173,18 +173,17 @@
Nfdc.unregister(face, new Name("/my/test/route"), "udp4://127.0.0.1:56363");
}
- // TODO: restore after fixed bug in MockFace
-// @Test
-// public void testFailOfRegister() throws Exception {
-// exception.expect(ManagementException.class);
-// Nfdc.register(mockFace, new Name("/my/route/to/app/face"), 333);
-// }
-//
-// @Test
-// public void testFailOfUnregister() throws Exception {
-// exception.expect(ManagementException.class);
-// Nfdc.unregister(mockFace, new Name("/my/route/to/app/face"));
-// }
+ @Test
+ public void testFailOfRegister() throws Exception {
+ exception.expect(ManagementException.class);
+ Nfdc.register(mockFace, new Name("/my/route/to/app/face"), 333);
+ }
+
+ @Test
+ public void testFailOfUnregister() throws Exception {
+ exception.expect(ManagementException.class);
+ Nfdc.unregister(mockFace, new Name("/my/route/to/app/face"));
+ }
@Test
public void testFailOfCreateFace() throws Exception {
@@ -205,7 +204,7 @@
List<StrategyChoice> choices = Nfdc.getStrategyList(face);
int oldSize = choices.size();
- Nfdc.setStrategy(face, prefix, Strategies.CLIENT_CONTROL);
+ Nfdc.setStrategy(face, prefix, Strategies.RANDOM);
Thread.sleep(1000); // strategy takes a while to register
choices = Nfdc.getStrategyList(face);
@@ -252,7 +251,7 @@
}
}
});
- Nfdc.setStrategy(mockFace, new Name("/"), Strategies.BROADCAST);
+ Nfdc.setStrategy(mockFace, new Name("/"), Strategies.MULTICAST);
}
@Test
diff --git a/src/test/java/com/intel/jndn/management/types/ForwarderStatusTest.java b/src/test/java/com/intel/jndn/management/types/ForwarderStatusTest.java
index cc2eafe..6a12d4b 100644
--- a/src/test/java/com/intel/jndn/management/types/ForwarderStatusTest.java
+++ b/src/test/java/com/intel/jndn/management/types/ForwarderStatusTest.java
@@ -13,14 +13,15 @@
*/
package com.intel.jndn.management.types;
-import java.nio.ByteBuffer;
-
import com.intel.jndn.management.TestHelper;
import net.named_data.jndn.encoding.EncodingException;
-import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
+import java.nio.ByteBuffer;
+
+import static org.junit.Assert.assertEquals;
+
/**
* Test encoding/decoding of ForwarderStatus.
*
diff --git a/src/test/java/com/intel/jndn/management/types/StrategyChoiceTest.java b/src/test/java/com/intel/jndn/management/types/StrategyChoiceTest.java
index 1940b41..47667a1 100644
--- a/src/test/java/com/intel/jndn/management/types/StrategyChoiceTest.java
+++ b/src/test/java/com/intel/jndn/management/types/StrategyChoiceTest.java
@@ -11,9 +11,9 @@
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*/
-package com.intel.jndn.management;
+package com.intel.jndn.management.types;
-import com.intel.jndn.management.types.StrategyChoice;
+import com.intel.jndn.management.TestHelper;
import net.named_data.jndn.Name;
import net.named_data.jndn.encoding.EncodingException;
import org.junit.Before;