Cleaned up old code out of SDNIP and the proxy ARP module, and improved ProxyArpManager logging
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 4a0aa27..5bbaa6c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -307,8 +307,6 @@
 		log.debug("Config file set to {}", configFilename);
 		
 		readGatewaysConfiguration(configFilename);
-		
-		//proxyArp.setL3Mode(interfacePtrie, interfaces.values(), bgpdMacAddress);
 	}
 	
 	@Override
@@ -465,7 +463,6 @@
 				Path path = pushedPaths.get(dstIpAddress);
 				if (path == null) {
 					path = new Path(egressInterface, dstIpAddress);
-					//setUpDataPath(path, MACAddress.valueOf(nextHopMacAddress));
 					calculateAndPushPath(path, MACAddress.valueOf(nextHopMacAddress));
 					pushedPaths.put(dstIpAddress, path);
 				}
@@ -493,14 +490,7 @@
 		}
 		
 		//Add a flow to rewrite mac for this prefix to all other border switches
-		//for (Interface srcInterface : interfaces.values()) {
 		for (Interface srcInterface : srcInterfaces.values()) {
-			//if (srcInterface == egressInterface) {
-				//Don't push a flow for the switch where this peer is attached
-				//continue;
-			//}
-			
-			
 			DataPath shortestPath; 
 			if (topoRouteTopology == null) {
 				shortestPath = topoRouteService.getShortestPath(
@@ -608,7 +598,6 @@
 		
 		if (!bgpPeers.containsKey(ribEntry.getNextHop())) {
 			log.debug("Getting path for route with non-peer nexthop");
-			//Path path = prefixToPath.get(prefix);
 			Path path = prefixToPath.remove(prefix);
 			
 			if (path != null) {
@@ -616,7 +605,6 @@
 				//flows yet because we were waiting to resolve ARP
 			
 				path.decrementUsers();
-				log.debug("users {}, permanent {}", path.getUsers(), path.isPermanent());
 				if (path.getUsers() <= 0 && !path.isPermanent()) {
 					deletePath(path);
 					pushedPaths.remove(path.getDstIpAddress());
@@ -625,28 +613,37 @@
 		}
 	}
 	
-	private void deletePrefixFlows(Prefix prefix) {	
+	private void deletePrefixFlows(Prefix prefix) {
+		log.debug("Deleting flows for prefix {}", prefix);
+		
 		Collection<PushedFlowMod> pushedFlowMods 
 				= pushedFlows.removeAll(prefix);
 		
 		for (PushedFlowMod pfm : pushedFlowMods) {
-			log.debug("Pushing a DELETE flow mod to {}, matches prefix {} with mac-rewrite {}",
-					new Object[] {HexString.toHexString(pfm.getDpid()),
-					pfm.getFlowMod().getMatch().getNetworkDestination() + 
-					pfm.getFlowMod().getMatch().getNetworkDestinationMaskLen(),
-					HexString.toHexString(((OFActionDataLayerDestination)pfm.getFlowMod().getActions().get(0))
-							.getDataLayerAddress())});
+			if (log.isTraceEnabled()) {
+				log.trace("Pushing a DELETE flow mod to {}, matches prefix {} with mac-rewrite {}",
+						new Object[] {HexString.toHexString(pfm.getDpid()),
+						pfm.getFlowMod().getMatch().getNetworkDestination() + 
+						pfm.getFlowMod().getMatch().getNetworkDestinationMaskLen(),
+						HexString.toHexString(((OFActionDataLayerDestination)pfm.getFlowMod().getActions().get(0))
+								.getDataLayerAddress())});
+			}
 			
 			sendDeleteFlowMod(pfm.getFlowMod(), pfm.getDpid());
 		}
 	}
 	
 	private void deletePath(Path path) {
+		log.debug("Deleting flows for path to {}", 
+				path.getDstIpAddress().getHostAddress());
+		
 		for (PushedFlowMod pfm : path.getFlowMods()) {
-			log.debug("Pushing a DELETE flow mod to {}, dst MAC {}",
-					new Object[] {HexString.toHexString(pfm.getDpid()),
-					HexString.toHexString(pfm.getFlowMod().getMatch().getDataLayerDestination())
-			});
+			if (log.isTraceEnabled()) {
+				log.trace("Pushing a DELETE flow mod to {}, dst MAC {}",
+						new Object[] {HexString.toHexString(pfm.getDpid()),
+						HexString.toHexString(pfm.getFlowMod().getMatch().getDataLayerDestination())
+				});
+			}
 			
 			sendDeleteFlowMod(pfm.getFlowMod(), pfm.getDpid());
 		}
@@ -708,17 +705,10 @@
 			}
 			
 			//If we know the MAC, lets go ahead and push the paths to this peer
-			//setUpDataPath(path, MACAddress.valueOf(mac));
 			calculateAndPushPath(path, MACAddress.valueOf(mac));
 		}
 	}
 	
-	/*
-	private void setUpDataPath(Path path, MACAddress dstMacAddress) {
-		calculateAndPushPath(path, dstMacAddress);
-	}
-	*/
-	
 	private void calculateAndPushPath(Path path, MACAddress dstMacAddress) {
 		Interface dstInterface = path.getDstInterface();
 		
@@ -734,20 +724,18 @@
 			
 			DataPath shortestPath;
 			if (topoRouteTopology == null) {
-				log.debug("Using database topo");
 				shortestPath = topoRouteService.getShortestPath(
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 			}
 			else {
-				log.debug("Using prepared topo");
 				shortestPath = topoRouteService.getTopoShortestPath(topoRouteTopology, 
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 			}
 			
 			if (shortestPath == null){
-				log.debug("Shortest path between {} and {} not found",
+				log.warn("Shortest path between {} and {} not found",
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
-				return; // just quit here?
+				return;
 			}
 			
 			pushedFlows.addAll(installPath(shortestPath.flowEntries(), dstMacAddress));
@@ -997,7 +985,6 @@
 					}
 				}
 				else {
-					//setUpDataPath(path, MACAddress.valueOf(macAddress));
 					calculateAndPushPath(path, MACAddress.valueOf(macAddress));
 					pushedPaths.put(path.getDstIpAddress(), path);
 				}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java
index f058843..8403f71 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java
@@ -15,20 +15,6 @@
 
 	protected static Logger log = LoggerFactory.getLogger(BgpRouteResource.class);
 
-	private String addrToString(byte [] addr) {
-		String str = "";
-
-		for (int i = 0; i < 4; i++) {
-			int val = (addr[i] & 0xff);
-			str += val;
-			if (i != 3)
-				str += ".";
-		}
-
-		return str;
-	}
-
-	//@SuppressWarnings("unused")
 	@Get
 	public String get(String fmJson) {
 		String dest = (String) getRequestAttributes().get("dest");
@@ -38,45 +24,23 @@
 
 		if (dest != null) {
 			//TODO Needs to be changed to use the new RestClient.get().
-			
-			
-			//Prefix p;
-			//try {
-			//	p = new Prefix(dest, 32);
-			//} catch (UnknownHostException e) {
-			//if (p == null) {
-			//	return "[GET]: dest address format is wrong";
-			//}
 
 			// the dest here refers to router-id
 			//bgpdRestIp includes port number, such as 1.1.1.1:8080
 			String BGPdRestIp = bgpRoute.getBGPdRestIp();
 			String url="http://"+BGPdRestIp+"/wm/bgp/"+dest;
 
-			RestClient.get(url);
+			//Doesn't actually do anything with the response
+			RestClient.get(url); 
 			
 			output="Get rib from bgpd finished!\n";
 			return output;
 		} 
 		else {
-			//Ptree ptree = bgpRoute.getPtree();
 			IPatriciaTrie<RibEntry> ptree = bgpRoute.getPtree();
 			output += "{\n  \"rib\": [\n";
 			boolean printed = false;
 			
-			/*
-			for (PtreeNode node = ptree.begin(); node!= null; node = ptree.next(node)) {
-				if (node.rib == null) {
-					continue;
-				}
-				if (printed == true) {
-					output += ",\n";
-				}
-				output += "    {\"prefix\": \"" + addrToString(node.key) + "/" + node.keyBits +"\", ";
-				output += "\"nexthop\": \"" + addrToString(node.rib.nextHop.getAddress()) +"\"}";
-				printed = true;
-			}*/
-			
 			synchronized(ptree) {
 				Iterator<IPatriciaTrie.Entry<RibEntry>> it = ptree.iterator();
 				while (it.hasNext()) {
@@ -88,42 +52,22 @@
 					
 					output += "    {\"prefix\": \"" + entry.getPrefix() +"\", ";
 					output += "\"nexthop\": \"" + entry.getValue().getNextHop().getHostAddress() +"\"}";
-					//output += ",\n";
 					
 					printed = true;
 				}
 			}
 			
-			//output += "{\"router_id\": \"" + addrToString(node.rib.routerId.getAddress()) +"\"}\n";
 			output += "\n  ]\n}\n";
 		}
 		
 		return output;
 	}
 
-	//unused?
-	/*
-	public static ByteBuffer toByteBuffer(String value) throws UnsupportedEncodingException {
-		return ByteBuffer.wrap(value.getBytes("UTF-8"));
-	}
-	*/
-
-	//unused?
-	/*
-	public static String toString(ByteBuffer buffer) throws UnsupportedEncodingException {
-		byte[] bytes = new byte[buffer.remaining()];
-		buffer.get(bytes);
-		return new String(bytes, "UTF-8");
-	}
-	*/
-
 	@Post
 	public String store(String fmJson) {
 		IBgpRouteService bgpRoute = (IBgpRouteService) getContext().getAttributes().
 				get(IBgpRouteService.class.getCanonicalName());
 
-		//Ptree ptree = bgpRoute.getPtree();
-
 		String routerId = (String) getRequestAttributes().get("routerid");
 		String prefix = (String) getRequestAttributes().get("prefix");
 		String mask = (String) getRequestAttributes().get("mask");
@@ -151,18 +95,6 @@
 
 			bgpRoute.newRibUpdate(new RibUpdate(Operation.UPDATE, p, rib));
 			
-			/*
-			PtreeNode node = ptree.acquire(p.getAddress(), p.getPrefixLength());
-			
-			if (node.rib != null) {
-				node.rib = null;
-				ptree.delReference(node);
-			}
-			node.rib = rib;
-
-			bgpRoute.prefixAdded(node);
-			*/
-			
 			reply = "[POST: " + prefix + "/" + mask + ":" + nexthop + "]";
 			log.info(reply);
 		}
@@ -185,8 +117,6 @@
 		IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
 				get(IBgpRouteService.class.getCanonicalName());
 
-		//Ptree ptree = bgpRoute.getPtree();
-
 		String routerId = (String) getRequestAttributes().get("routerid");
 		String prefix = (String) getRequestAttributes().get("prefix");
 		String mask = (String) getRequestAttributes().get("mask");
@@ -214,29 +144,6 @@
 			
 			bgpRoute.newRibUpdate(new RibUpdate(Operation.DELETE, p, r));
 			
-			/*
-			PtreeNode node = ptree.lookup(p.getAddress(), p.getPrefixLength());
-			
-			//Remove the flows from the switches before the rib is lost
-			//Theory: we could get a delete for a prefix not in the Ptree.
-			//This would result in a null node being returned. We could get a delete for
-			//a node that's not actually there, but is a aggregate node. This would result
-			//in a non-null node with a null rib. Only a non-null node with a non-null
-			//rib is an actual prefix in the Ptree.
-			if (node != null && node.rib != null){
-				bgpRoute.prefixDeleted(node);
-			}
-
-			
-
-			if (node != null && node.rib != null) {
-				if (r.equals(node.rib)) {
-					node.rib = null;
-					ptree.delReference(node);					
-				}
-			}
-			*/
-			
 			reply =reply + "[DELE: " + prefix + "/" + mask + ":" + nextHop + "]";
 		}
 		else {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java
index 0f14dd6..00ddd68 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java
@@ -10,7 +10,6 @@
  *
  */
 public interface ILayer3InfoService {
-	//public Collection<Interface> getInterfaces();
 	public boolean isInterfaceAddress(InetAddress address);
 	public boolean inConnectedNetwork(InetAddress address);
 	public boolean fromExternalNetwork(long inDpid, short inPort);
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 8eb64a2..a242464 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -42,7 +42,7 @@
 
 //TODO REST API to inspect ARP table
 public class ProxyArpManager implements IProxyArpService, IOFMessageListener {
-	private static Logger log = LoggerFactory.getLogger(ProxyArpManager.class);
+	private final static Logger log = LoggerFactory.getLogger(ProxyArpManager.class);
 	
 	private final long ARP_ENTRY_TIMEOUT = 600000; //ms (== 10 mins)
 	
@@ -56,16 +56,8 @@
 
 	private SetMultimap<InetAddress, ArpRequest> arpRequests;
 	
-	//public enum Mode {L2_MODE, L3_MODE}
-	
-	//private Mode mode;
-	//private IPatriciaTrie<Interface> interfacePtrie = null;
-	//private Collection<Interface> interfaces = null;
-	//private MACAddress routerMacAddress = null;
-	//private SwitchPort bgpdAttachmentPoint = null;
-	
 	private class ArpRequest {
-		private IArpRequester requester;
+		private final IArpRequester requester;
 		private boolean retry;
 		private long requestTime;
 		
@@ -91,8 +83,6 @@
 		}
 		
 		public void dispatchReply(InetAddress ipAddress, byte[] replyMacAddress) {
-			log.debug("Dispatching reply for {} to {}", ipAddress.getHostAddress(), 
-					requester);
 			requester.arpResponse(ipAddress, replyMacAddress);
 		}
 	}
@@ -107,21 +97,8 @@
 
 		arpRequests = Multimaps.synchronizedSetMultimap(
 				HashMultimap.<InetAddress, ArpRequest>create());
-		
-		//mode = Mode.L2_MODE;
 	}
 	
-	/*
-	public void setL3Mode(IPatriciaTrie<Interface> interfacePtrie, 
-			Collection<Interface> interfaces, MACAddress routerMacAddress) {
-		this.interfacePtrie = interfacePtrie;
-		this.interfaces = interfaces;
-		this.routerMacAddress = routerMacAddress;
-
-		mode = Mode.L3_MODE;
-	}
-	*/
-	
 	public void startUp() {
 		Timer arpTimer = new Timer();
 		arpTimer.scheduleAtFixedRate(new TimerTask() {
@@ -234,48 +211,26 @@
 		}
 
 		InetAddress target;
-		//InetAddress source;
 		try {
 			 target = InetAddress.getByAddress(arp.getTargetProtocolAddress());
-			 //source = InetAddress.getByAddress(arp.getSenderProtocolAddress());
 		} catch (UnknownHostException e) {
 			log.debug("Invalid address in ARP request", e);
 			return;
 		}
-		
-		//if (mode == Mode.L3_MODE) {
-			
-			//if (originatedOutsideNetwork(source)) {
-			//if (originatedOutsideNetwork(sw.getId(), pi.getInPort())) {
-			if (layer3.fromExternalNetwork(sw.getId(), pi.getInPort())) {
-				//If the request came from outside our network, we only care if
-				//it was a request for one of our interfaces.
-				//if (isInterfaceAddress(target)) {
-				if (layer3.isInterfaceAddress(target)) {
-					log.trace("ARP request for our interface. Sending reply {} => {}",
-							target.getHostAddress(), layer3.getRouterMacAddress().toString());
-					sendArpReply(arp, sw.getId(), pi.getInPort(), layer3.getRouterMacAddress().toBytes());
-				}
-				return;
+
+		if (layer3.fromExternalNetwork(sw.getId(), pi.getInPort())) {
+			//If the request came from outside our network, we only care if
+			//it was a request for one of our interfaces.
+			if (layer3.isInterfaceAddress(target)) {
+				log.trace("ARP request for our interface. Sending reply {} => {}",
+						target.getHostAddress(), layer3.getRouterMacAddress());
+				
+				sendArpReply(arp, sw.getId(), pi.getInPort(), 
+						layer3.getRouterMacAddress().toBytes());
 			}
 			
-			/*
-			Interface intf = interfacePtrie.match(new Prefix(target.getAddress(), 32));
-			//if (intf != null && target.equals(intf.getIpAddress())) {
-			if (intf != null) {
-				if (target.equals(intf.getIpAddress())) {
-					//ARP request for one of our interfaces, we can reply straight away
-					sendArpReply(arp, sw.getId(), pi.getInPort(), routerMacAddress.toBytes());
-				}
-				// If we didn't enter the above if block, then we found a matching
-				// interface for the target IP but the request wasn't for us.
-				// This is someone else ARPing for a different host in the subnet.
-				// We shouldn't do anything in this case - if we let processing continue
-				// we'll end up erroneously re-broadcasting an ARP for someone else.
-				return;
-			}
-			*/
-		//}
+			return;
+		}
 		
 		byte[] mac = lookupArpTable(arp.getTargetProtocolAddress());
 		
@@ -287,7 +242,6 @@
 					new HostArpRequester(this, arp, sw.getId(), pi.getInPort()), false));
 						
 			//Flood the request out edge ports
-			//broadcastArpRequestOutEdge(pi.getPacketData(), sw.getId(), pi.getInPort());
 			sendArpRequestToSwitches(target, pi.getPacketData(), sw.getId(), pi.getInPort());
 		}
 		else {
@@ -318,7 +272,7 @@
 		try {
 			addr = InetAddress.getByAddress(arp.getSenderProtocolAddress());
 		} catch (UnknownHostException e) {
-			log.debug("Invalid address in ARP request", e);
+			log.debug("Invalid address in ARP reply", e);
 			return;
 		}
 		
@@ -331,7 +285,6 @@
 			while (it.hasNext()) {
 				ArpRequest request = it.next();
 				it.remove();
-				//request.dispatchReply(addr, arp.getSenderHardwareAddress());
 				requestsToSend.add(request);
 			}
 		}
@@ -347,21 +300,22 @@
 		try {
 			addr = InetAddress.getByAddress(ipAddress);
 		} catch (UnknownHostException e) {
-			log.warn("Unable to create InetAddress", e);
+			log.debug("Unable to create InetAddress", e);
 			return null;
 		}
 		
 		ArpTableEntry arpEntry = arpTable.get(addr);
 		
 		if (arpEntry == null){
-			//log.debug("MAC for {} unknown", bytesToStringAddr(ipAddress));
 			return null;
 		}
 		
 		if (System.currentTimeMillis() - arpEntry.getTimeLastSeen() 
 				> ARP_ENTRY_TIMEOUT){
 			//Entry has timed out so we'll remove it and return null
-			log.debug("Timing out old ARP entry for {}", inetAddressToString(ipAddress));
+			log.trace("Removing expired ARP entry for {}", 
+					inetAddressToString(ipAddress));
+			
 			arpTable.remove(addr);
 			return null;
 		}
@@ -374,7 +328,7 @@
 		try {
 			addr = InetAddress.getByAddress(arp.getSenderProtocolAddress());
 		} catch (UnknownHostException e) {
-			log.warn("Unable to create InetAddress", e);
+			log.debug("Unable to create InetAddress", e);
 			return;
 		}
 		
@@ -410,69 +364,42 @@
 			.setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
 			.setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
 			.setOpCode(ARP.OP_REQUEST)
-			//.setSenderHardwareAddress(bgpdMac)
-			//.setSenderHardwareAddress(routerMacAddress.toBytes())
-			//.setSenderProtocolAddress(zeroIpv4)
 			.setTargetHardwareAddress(zeroMac)
 			.setTargetProtocolAddress(ipAddress.getAddress());
 
 		MACAddress routerMacAddress = layer3.getRouterMacAddress();
-		byte[] senderMacAddress = null;
+		//TODO hack for now as it's unclear what the MAC address should be
+		byte[] senderMacAddress = genericNonZeroMac;
 		if (routerMacAddress != null) {
 			senderMacAddress = routerMacAddress.toBytes();
 		}
-		else {
-			//TODO hack for now as it's unclear what the MAC address should be
-			senderMacAddress = genericNonZeroMac;
-		}
 		arpRequest.setSenderHardwareAddress(senderMacAddress);
 		
 		byte[] senderIPAddress = zeroIpv4;
-		//if (mode == Mode.L3_MODE) {
-			//Interface intf = interfacePtrie.match(new Prefix(ipAddress.getAddress(), 32));
 		Interface intf = layer3.getOutgoingInterface(ipAddress);
 		if (intf != null) {
 			senderIPAddress = intf.getIpAddress().getAddress();
 		}
-		//}
 		
 		arpRequest.setSenderProtocolAddress(senderIPAddress);
 		
 		Ethernet eth = new Ethernet();
-		//eth.setSourceMACAddress(routerMacAddress.toBytes())
 		eth.setSourceMACAddress(senderMacAddress)
 			.setDestinationMACAddress(broadcastMac)
 			.setEtherType(Ethernet.TYPE_ARP)
 			.setPayload(arpRequest);
 		
-		//broadcastArpRequestOutEdge(eth.serialize(), 0, OFPort.OFPP_NONE.getValue());
 		sendArpRequestToSwitches(ipAddress, eth.serialize());
 	}
 	
 	private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest) {
-		sendArpRequestToSwitches(dstAddress, arpRequest, 0, OFPort.OFPP_NONE.getValue());
+		sendArpRequestToSwitches(dstAddress, arpRequest, 
+				0, OFPort.OFPP_NONE.getValue());
 	}
+	
 	private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest,
 			long inSwitch, short inPort) {
-		/*
-		if (mode == Mode.L2_MODE) {
-			//log.debug("mode is l2");
-			broadcastArpRequestOutEdge(arpRequest, inSwitch, inPort);
-		}
-		else if (mode == Mode.L3_MODE) {
-			//log.debug("mode is l3");
-			//TODO the case where it should be broadcast out all non-interface
-			//edge ports
-			Interface intf = interfacePtrie.match(new Prefix(dstAddress.getAddress(), 32));
-			if (intf != null) {
-				sendArpRequestOutPort(arpRequest, intf.getDpid(), intf.getPort());
-			}
-			else {
-				log.debug("No interface found to send ARP request for {}", 
-						dstAddress.getHostAddress());
-			}
-		}
-		*/
+
 		if (layer3.hasLayer3Configuration()) {
 			Interface intf = layer3.getOutgoingInterface(dstAddress);
 			if (intf != null) {
@@ -520,7 +447,6 @@
 				}
 				
 				actions.add(new OFActionOutput(portNum));
-				//log.debug("Broadcasting out {}/{}", HexString.toHexString(sw.getId()), portNum);
 			}
 			
 			po.setActions(actions);
@@ -542,7 +468,10 @@
 	}
 	
 	private void sendArpRequestOutPort(byte[] arpRequest, long dpid, short port) {
-		log.debug("Sending ARP request out {}/{}", HexString.toHexString(dpid), port);
+		if (log.isTraceEnabled()) {
+			log.trace("Sending ARP request out {}/{}", 
+					HexString.toHexString(dpid), port);
+		}
 		
 		OFPacketOut po = new OFPacketOut();
 		po.setInPort(OFPort.OFPP_NONE)
@@ -560,7 +489,7 @@
 		IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
 		
 		if (sw == null) {
-			log.debug("Switch not found when sending ARP request");
+			log.warn("Switch not found when sending ARP request");
 			return;
 		}
 		
@@ -576,7 +505,7 @@
 		try {
 			return InetAddress.getByAddress(bytes).getHostAddress();
 		} catch (UnknownHostException e) {
-			log.warn("Invalid IP address", e);
+			log.debug("Invalid IP address", e);
 			return "";
 		}
 	}
@@ -586,10 +515,12 @@
 	 */
 	
 	public void sendArpReply(ARP arpRequest, long dpid, short port, byte[] targetMac) {
-		log.trace("Sending reply {} => {} to {}", new Object[] {
-				inetAddressToString(arpRequest.getTargetProtocolAddress()),
-				HexString.toHexString(targetMac),
-				inetAddressToString(arpRequest.getSenderProtocolAddress())});
+		if (log.isTraceEnabled()) {
+			log.trace("Sending reply {} => {} to {}", new Object[] {
+					inetAddressToString(arpRequest.getTargetProtocolAddress()),
+					HexString.toHexString(targetMac),
+					inetAddressToString(arpRequest.getSenderProtocolAddress())});
+		}
 		
 		ARP arpReply = new ARP();
 		arpReply.setHardwareType(ARP.HW_TYPE_ETHERNET)
@@ -626,17 +557,16 @@
 		IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
 		
 		if (sw == null) {
-			log.error("Switch {} not found when sending ARP reply", 
+			log.warn("Switch {} not found when sending ARP reply", 
 					HexString.toHexString(dpid));
 			return;
 		}
 		
 		try {
-			log.debug("Sending ARP reply to {}/{}", HexString.toHexString(sw.getId()), port);
 			sw.write(msgList, null);
 			sw.flush();
 		} catch (IOException e) {
-			log.warn("Failure writing packet out to switch", e);
+			log.error("Failure writing packet out to switch", e);
 		}
 	}
 
@@ -651,56 +581,8 @@
 		arpRequests.put(ipAddress, new ArpRequest(requester, retry));
 		
 		//Sanity check to make sure we don't send a request for our own address
-		//if (!isInterfaceAddress(ipAddress)) {
 		if (!layer3.isInterfaceAddress(ipAddress)) {
 			sendArpRequestForAddress(ipAddress);
 		}
 	}
-	
-	/*
-	 * TODO These methods might be more suited to some kind of L3 information service
-	 * that ProxyArpManager could query, rather than having the information 
-	 * embedded in ProxyArpManager. There may be many modules that need L3 information.
-	 */
-	/*
-	private boolean originatedOutsideNetwork(InetAddress source) {
-		Interface intf = interfacePtrie.match(new Prefix(source.getAddress(), 32));
-		if (intf != null) {
-			if (intf.getIpAddress().equals(source)) {
-				// This request must have been originated by us (the controller)
-				return false;
-			}
-			else {
-				// Source was in one of our interface subnets, but wasn't us.
-				// It must be external.
-				return true;
-			}
-		}
-		else {
-			// Source is not in one of our interface subnets. It's probably a host
-			// in our network as we should only receive ARPs broadcast by external
-			// hosts if they're in the same subnet.
-			return false;
-		}
-	}
-	
-	private boolean originatedOutsideNetwork(long inDpid, short inPort) {
-		for (Interface intf : interfaces) {
-			if (intf.getDpid() == inDpid && intf.getPort() == inPort) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	private boolean isInterfaceAddress(InetAddress address) {
-		Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
-		return (intf != null && intf.getIpAddress().equals(address));
-	}
-	
-	private boolean inInterfaceSubnet(InetAddress address) {
-		Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
-		return (intf != null && !intf.getIpAddress().equals(address));
-	}
-	*/
 }