Implemented PatriciaTrie.match and put an interface PTrie in BgpRoute. Minor bug fixes to Prefix and RibEntry
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 827c8d2..c978d44 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -89,6 +89,7 @@
 	
 	//protected static Ptree ptree;
 	protected IPatriciaTrie<RibEntry> ptree;
+	protected IPatriciaTrie<Interface> interfacePtrie;
 	protected BlockingQueue<RibUpdate> ribUpdates;
 	
 	protected String bgpdRestIp;
@@ -219,6 +220,22 @@
 			log.error("Error reading JSON file", e);
 			System.exit(1);
 		}
+		
+		//Populate the interface Patricia Trie
+		for (Interface intf : interfaces.values()) {
+			Prefix prefix = new Prefix(intf.getIpAddress().getAddress(), intf.getPrefixLength());
+			interfacePtrie.put(prefix, intf);
+		}
+		
+		/*
+		Iterator<IPatriciaTrie.Entry<Interface>> it = interfacePtrie.iterator();
+		while (it.hasNext()) {
+			IPatriciaTrie.Entry<Interface> entry = it.next();
+			Interface intf = entry.getValue();
+			log.debug("Interface at prefix {}, switchport {}/{}",
+					new Object[] {entry.getPrefix(), HexString.toHexString(intf.getDpid()), intf.getPort()});
+		}
+		*/
 	}
 	
 	@Override
@@ -254,6 +271,7 @@
 	    
 	    //ptree = new Ptree(32);
 		ptree = new PatriciaTrie<RibEntry>(32);
+		interfacePtrie = new PatriciaTrie<Interface>(32);
 	    
 	    ribUpdates = new LinkedBlockingQueue<RibUpdate>();