Added getFactory() method to IOFSwitch to get a message factory appropriate
for the switch's OpenFlow version.
This prevents users of the switch having to discriminate what factory to use
based on the switch OpenFlow version.
Change-Id: Iac0454856e35f4429649a6f116da34f4c048f25d
diff --git a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
index 63143cd..ca4c4b1 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
@@ -54,7 +54,6 @@
private Topology topology;
private IDatagridService datagrid;
private IFlowPusherService flowPusher;
- private OFFactory factory;
private IEventChannel<Long, PacketOutNotification> packetOutEventChannel;
@@ -221,7 +220,6 @@
.getTopology();
datagrid = context.getServiceImpl(IDatagridService.class);
flowPusher = context.getServiceImpl(IFlowPusherService.class);
- factory = floodlightProvider.getOFMessageFactory_10();
}
@Override
@@ -243,6 +241,8 @@
continue;
}
+ OFFactory factory = sw.getFactory();
+
List<OFAction> actions = new ArrayList<>();
for (Short port : outPorts.get(dpid)) {
actions.add(factory.actions().output(OFPort.of(port), Short.MAX_VALUE));