Created basic network graph objects, and implementation for the southbound API against the Ramcloud datastore
Change-Id: I2172dacb171f27ba2099ee5a52835030d2004689
Created basic objects and southbound API to build the network graph
Change-Id: I061efdf10e5e8549f7192844d10781dc28ee62d4
Added basic northbound get switch method on network graph
Change-Id: I4f2e4d4a4df00979abc927ef0772997dcdebc4e2
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java
new file mode 100644
index 0000000..0619087
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java
@@ -0,0 +1,37 @@
+package net.onrc.onos.ofcontroller.networkgraph;
+
+import org.openflow.protocol.OFPhysicalPort;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+public class FloodlightToOnosMappers {
+
+ public static Switch map(NetworkGraph graph, IOFSwitch sw) {
+ SwitchImpl onosSwitch = new SwitchImpl(graph);
+ onosSwitch.setDpid(sw.getId());
+
+ for (OFPhysicalPort port : sw.getPorts()) {
+ onosSwitch.addPort(map(graph, port));
+ }
+
+ return onosSwitch;
+ }
+
+ public static Port map(NetworkGraph graph, OFPhysicalPort port) {
+ PortImpl onosPort = new PortImpl(graph);
+ onosPort.setPortNumber(port.getPortNumber());
+ return onosPort;
+ }
+
+ public static Link map(NetworkGraph graph, net.floodlightcontroller.routing.Link link) {
+ LinkImpl onosLink = new LinkImpl(graph);
+
+ onosLink.setSrcSwitch(link.getSrc());
+ onosLink.setSrcPort(link.getSrcPort());
+ onosLink.setDstSwitch(link.getDst());
+ onosLink.setDstPort(link.getDstPort());
+
+ return onosLink;
+
+ }
+}