Added ability to configure a global vlan used for all ARP packets sent from the controller
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index b6a9591..0151212 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -52,6 +52,9 @@
private final ILayer3InfoService layer3;
private final IRestApiService restApi;
+ private short vlan;
+ private static final short NO_VLAN = 0;
+
private final ArpCache arpCache;
private final SetMultimap<InetAddress, ArpRequest> arpRequests;
@@ -117,7 +120,10 @@
HashMultimap.<InetAddress, ArpRequest>create());
}
- public void startUp() {
+ public void startUp(short vlan) {
+ this.vlan = vlan;
+ log.info("vlan set to {}", this.vlan);
+
restApi.addRestletRoutable(new ArpWebRoutable());
Timer arpTimer = new Timer("arp-processing");
@@ -361,6 +367,11 @@
.setEtherType(Ethernet.TYPE_ARP)
.setPayload(arpRequest);
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
sendArpRequestToSwitches(ipAddress, eth.serialize());
}
@@ -492,12 +503,19 @@
.setTargetHardwareAddress(arpRequest.getSenderHardwareAddress())
.setTargetProtocolAddress(arpRequest.getSenderProtocolAddress());
+
+
Ethernet eth = new Ethernet();
eth.setDestinationMACAddress(arpRequest.getSenderHardwareAddress())
.setSourceMACAddress(targetMac.toBytes())
.setEtherType(Ethernet.TYPE_ARP)
.setPayload(arpReply);
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
List<OFAction> actions = new ArrayList<OFAction>();
actions.add(new OFActionOutput(port));