Augments NRM
Changes:
- Adds useArp flag to disable the ARP handling;
- Adds requestInterceptsEnable to enable/disable the packet requests;
Change-Id: Icbd1e3b72fff5081916c66471cf527c6b7be9fab
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/neighbour/impl/NeighbourResolutionManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/neighbour/impl/NeighbourResolutionManager.java
index 4b786f7..09676b1 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/neighbour/impl/NeighbourResolutionManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/neighbour/impl/NeighbourResolutionManager.java
@@ -96,10 +96,18 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ComponentConfigService componentConfigService;
+ @Property(name = "arpEnabled", boolValue = true,
+ label = "Enable Address resolution protocol")
+ protected boolean arpEnabled = true;
+
@Property(name = "ndpEnabled", boolValue = false,
label = "Enable IPv6 neighbour discovery")
protected boolean ndpEnabled = false;
+ @Property(name = "requestInterceptsEnabled", boolValue = true,
+ label = "Enable requesting packet intercepts")
+ private boolean requestInterceptsEnabled = true;
+
private static final String APP_NAME = "org.onosproject.neighbour";
private ApplicationId appId;
@@ -140,15 +148,38 @@
ndpEnabled ? "enabled" : "disabled");
}
+ flag = Tools.isPropertyEnabled(properties, "arpEnabled");
+ if (flag != null) {
+ arpEnabled = flag;
+ log.info("Address resolution protocol is {}",
+ arpEnabled ? "enabled" : "disabled");
+ }
+
+ flag = Tools.isPropertyEnabled(properties, "requestInterceptsEnabled");
+ if (flag == null) {
+ log.info("Request intercepts is not configured, " +
+ "using current value of {}", requestInterceptsEnabled);
+ } else {
+ requestInterceptsEnabled = flag;
+ log.info("Configured. Request intercepts is {}",
+ requestInterceptsEnabled ? "enabled" : "disabled");
+ }
+
synchronized (packetHandlers) {
- if (!packetHandlers.isEmpty()) {
+ if (!packetHandlers.isEmpty() && requestInterceptsEnabled) {
requestPackets();
+ } else {
+ cancelPackets();
}
}
}
private void requestPackets() {
- packetService.requestPackets(buildArpSelector(), CONTROL, appId);
+ if (arpEnabled) {
+ packetService.requestPackets(buildArpSelector(), CONTROL, appId);
+ } else {
+ packetService.cancelPackets(buildArpSelector(), CONTROL, appId);
+ }
if (ndpEnabled) {
packetService.requestPackets(buildNeighborSolicitationSelector(),