update NetworkGraph objects
- Use Object type instead of built-in
- Port number to Long
Change-Id: I30847b6cca801e58ca49dd9d1667cfd33a8ffb92
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java
index 9bd8051..8139737 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/FloodlightToOnosMappers.java
@@ -7,32 +7,24 @@
public class FloodlightToOnosMappers {
public static Switch map(NetworkGraph graph, IOFSwitch sw) {
- SwitchImpl onosSwitch = new SwitchImpl(graph);
- onosSwitch.setDpid(sw.getId());
+ SwitchImpl onosSwitch = new SwitchImpl(graph, sw.getId());
for (OFPhysicalPort port : sw.getPorts()) {
- onosSwitch.addPort(map(graph, port));
+ onosSwitch.addPort(map(graph, onosSwitch, port));
}
return onosSwitch;
}
- public static Port map(NetworkGraph graph, OFPhysicalPort port) {
- PortImpl onosPort = new PortImpl(graph);
- onosPort.setPortNumber(port.getPortNumber());
+ public static Port map(NetworkGraph graph, SwitchImpl sw, OFPhysicalPort port) {
+ PortImpl onosPort = new PortImpl(graph, sw, new Long(port.getPortNumber()));
return onosPort;
}
public static Link map(NetworkGraph graph, net.floodlightcontroller.routing.Link link) {
- LinkImpl onosLink = new LinkImpl(graph);
-
- Switch srcSw = graph.getSwitch(link.getSrc());
- onosLink.setSrcSwitch(srcSw);
- onosLink.setSrcPort(srcSw.getPort(link.getSrcPort()));
-
- Switch dstSw = graph.getSwitch(link.getDst());
- onosLink.setDstSwitch(dstSw);
- onosLink.setDstPort(dstSw.getPort(link.getDstPort()));
+ Port srcPort = graph.getSwitch(link.getSrc()).getPort(Long.valueOf(link.getSrcPort()));
+ Port dstPort = graph.getSwitch(link.getDst()).getPort(Long.valueOf(link.getDstPort()));
+ LinkImpl onosLink = new LinkImpl(graph, srcPort, dstPort);
return onosLink;