blob: 4b2b087964faf1dd7a909d4003a0a8aa214999ec [file] [log] [blame]
Jonathan Hart1caaa932013-11-04 15:28:28 -08001package net.onrc.onos.ofcontroller.forwarding;
2
Jonathan Hart17672992013-12-12 16:15:16 -08003import java.net.InetAddress;
Jonathan Harte93aed42013-12-05 18:39:50 -08004import java.util.ArrayList;
5import java.util.Collection;
Jonathan Hartd33a6cf2013-12-10 14:29:08 -08006import java.util.HashMap;
Jonathan Hart1caaa932013-11-04 15:28:28 -08007import java.util.Iterator;
Jonathan Harte93aed42013-12-05 18:39:50 -08008import java.util.List;
9import java.util.Map;
Jonathan Hart5e448782013-12-10 12:36:35 -080010import java.util.concurrent.ConcurrentHashMap;
Jonathan Hart1caaa932013-11-04 15:28:28 -080011
12import net.floodlightcontroller.core.FloodlightContext;
13import net.floodlightcontroller.core.IFloodlightProviderService;
14import net.floodlightcontroller.core.IOFMessageListener;
15import net.floodlightcontroller.core.IOFSwitch;
Jonathan Harte93aed42013-12-05 18:39:50 -080016import net.floodlightcontroller.core.module.FloodlightModuleContext;
17import net.floodlightcontroller.core.module.IFloodlightModule;
18import net.floodlightcontroller.core.module.IFloodlightService;
Jonathan Hart1caaa932013-11-04 15:28:28 -080019import net.floodlightcontroller.packet.Ethernet;
Jonathan Hart17672992013-12-12 16:15:16 -080020import net.floodlightcontroller.packet.IPv4;
Jonathan Hart1caaa932013-11-04 15:28:28 -080021import net.floodlightcontroller.util.MACAddress;
Jonathan Hart17672992013-12-12 16:15:16 -080022import net.onrc.onos.datagrid.IDatagridService;
Jonathan Hart1caaa932013-11-04 15:28:28 -080023import net.onrc.onos.ofcontroller.core.IDeviceStorage;
24import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
25import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
26import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
27import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
Jonathan Hartd857ad62013-12-14 18:08:17 -080028import net.onrc.onos.ofcontroller.devicemanager.IOnosDeviceService;
Jonathan Hart1caaa932013-11-04 15:28:28 -080029import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
Jonathan Hart7e6df362013-12-10 23:33:59 -080030import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
Jonathan Hart17672992013-12-12 16:15:16 -080031import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
Jonathan Hart1caaa932013-11-04 15:28:28 -080032import net.onrc.onos.ofcontroller.topology.TopologyManager;
33import net.onrc.onos.ofcontroller.util.CallerId;
34import net.onrc.onos.ofcontroller.util.DataPath;
35import net.onrc.onos.ofcontroller.util.Dpid;
Jonathan Hart4fb16d82013-11-07 22:41:32 -080036import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
Jonathan Hart1caaa932013-11-04 15:28:28 -080037import net.onrc.onos.ofcontroller.util.FlowId;
38import net.onrc.onos.ofcontroller.util.FlowPath;
39import net.onrc.onos.ofcontroller.util.FlowPathType;
40import net.onrc.onos.ofcontroller.util.FlowPathUserState;
41import net.onrc.onos.ofcontroller.util.Port;
42import net.onrc.onos.ofcontroller.util.SwitchPort;
43
44import org.openflow.protocol.OFMessage;
45import org.openflow.protocol.OFPacketIn;
Jonathan Hart41d1e912013-11-24 16:50:25 -080046import org.openflow.protocol.OFPacketOut;
47import org.openflow.protocol.OFPort;
Jonathan Hart1caaa932013-11-04 15:28:28 -080048import org.openflow.protocol.OFType;
Jonathan Hart41d1e912013-11-24 16:50:25 -080049import org.openflow.protocol.action.OFAction;
50import org.openflow.protocol.action.OFActionOutput;
Jonathan Hart1caaa932013-11-04 15:28:28 -080051import org.openflow.util.HexString;
52import org.slf4j.Logger;
53import org.slf4j.LoggerFactory;
54
Jonathan Hartd857ad62013-12-14 18:08:17 -080055import com.google.common.collect.LinkedListMultimap;
56import com.google.common.collect.ListMultimap;
Jonathan Hart17672992013-12-12 16:15:16 -080057import com.google.common.net.InetAddresses;
Jonathan Hart5e448782013-12-10 12:36:35 -080058
59public class Forwarding implements IOFMessageListener, IFloodlightModule,
60 IForwardingService {
Jonathan Hart1caaa932013-11-04 15:28:28 -080061 private final static Logger log = LoggerFactory.getLogger(Forwarding.class);
62
Jonathan Hart7e6df362013-12-10 23:33:59 -080063 private final int IDLE_TIMEOUT = 5; // seconds
64 private final int HARD_TIMEOUT = 0; // seconds
65
Jonathan Hart1caaa932013-11-04 15:28:28 -080066 private IFloodlightProviderService floodlightProvider;
67 private IFlowService flowService;
Jonathan Hart7e6df362013-12-10 23:33:59 -080068 private IFlowPusherService flowPusher;
Jonathan Hart17672992013-12-12 16:15:16 -080069 private IDatagridService datagrid;
Jonathan Hart1caaa932013-11-04 15:28:28 -080070
71 private IDeviceStorage deviceStorage;
72 private TopologyManager topologyService;
73
Jonathan Hart5e448782013-12-10 12:36:35 -080074 private Map<Path, Long> pendingFlows;
Jonathan Hartd857ad62013-12-14 18:08:17 -080075 private ListMultimap<Long, PacketToPush> waitingPackets;
Jonathan Hart5e448782013-12-10 12:36:35 -080076
Jonathan Hart7e6df362013-12-10 23:33:59 -080077 private final Object lock = new Object();
78
Jonathan Hart5e448782013-12-10 12:36:35 -080079 public class PacketToPush {
80 public final OFPacketOut packet;
81 public final long dpid;
Jonathan Hart1caaa932013-11-04 15:28:28 -080082
Jonathan Hart5e448782013-12-10 12:36:35 -080083 public PacketToPush(OFPacketOut packet, long dpid) {
84 this.packet = packet;
85 this.dpid = dpid;
86 }
87 }
88
89 public final class Path {
90 public final SwitchPort srcPort;
91 public final SwitchPort dstPort;
92
93 public Path(SwitchPort src, SwitchPort dst) {
94 srcPort = new SwitchPort(new Dpid(src.dpid().value()),
95 new Port(src.port().value()));
96 dstPort = new SwitchPort(new Dpid(dst.dpid().value()),
97 new Port(dst.port().value()));
98 }
99
100 @Override
101 public boolean equals(Object other) {
102 if (!(other instanceof Path)) {
103 return false;
104 }
105
106 Path otherPath = (Path) other;
107 return srcPort.equals(otherPath.srcPort) &&
108 dstPort.equals(otherPath.dstPort);
109 }
110
111 @Override
112 public int hashCode() {
113 int hash = 17;
114 hash = 31 * hash + srcPort.hashCode();
115 hash = 31 * hash + dstPort.hashCode();
116 return hash;
117 }
Jonathan Hart1caaa932013-11-04 15:28:28 -0800118 }
119
Jonathan Harte93aed42013-12-05 18:39:50 -0800120 @Override
121 public Collection<Class<? extends IFloodlightService>> getModuleServices() {
Jonathan Hartd33a6cf2013-12-10 14:29:08 -0800122 List<Class<? extends IFloodlightService>> services =
123 new ArrayList<Class<? extends IFloodlightService>>(1);
124 services.add(IForwardingService.class);
125 return services;
Jonathan Harte93aed42013-12-05 18:39:50 -0800126 }
127
128 @Override
129 public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
Jonathan Hartd33a6cf2013-12-10 14:29:08 -0800130 Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
131 new HashMap<Class<? extends IFloodlightService>, IFloodlightService>(1);
132 impls.put(IForwardingService.class, this);
133 return impls;
Jonathan Harte93aed42013-12-05 18:39:50 -0800134 }
135
136 @Override
137 public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
138 List<Class<? extends IFloodlightService>> dependencies =
139 new ArrayList<Class<? extends IFloodlightService>>();
140 dependencies.add(IFloodlightProviderService.class);
141 dependencies.add(IFlowService.class);
Jonathan Hart7e6df362013-12-10 23:33:59 -0800142 dependencies.add(IFlowPusherService.class);
Jonathan Hartd857ad62013-12-14 18:08:17 -0800143 dependencies.add(IOnosDeviceService.class);
Jonathan Harte93aed42013-12-05 18:39:50 -0800144 return dependencies;
145 }
146
147 @Override
148 public void init(FloodlightModuleContext context) {
Jonathan Hart7e6df362013-12-10 23:33:59 -0800149 floodlightProvider =
Jonathan Harte93aed42013-12-05 18:39:50 -0800150 context.getServiceImpl(IFloodlightProviderService.class);
Jonathan Hart7e6df362013-12-10 23:33:59 -0800151 flowService = context.getServiceImpl(IFlowService.class);
152 flowPusher = context.getServiceImpl(IFlowPusherService.class);
Jonathan Hart17672992013-12-12 16:15:16 -0800153 datagrid = context.getServiceImpl(IDatagridService.class);
Jonathan Hart1caaa932013-11-04 15:28:28 -0800154
155 floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
156
Jonathan Hart5e448782013-12-10 12:36:35 -0800157 pendingFlows = new ConcurrentHashMap<Path, Long>();
Jonathan Hart7e6df362013-12-10 23:33:59 -0800158 //waitingPackets = Multimaps.synchronizedSetMultimap(
159 //HashMultimap.<Long, PacketToPush>create());
Jonathan Hartd857ad62013-12-14 18:08:17 -0800160 //waitingPackets = HashMultimap.create();
161 waitingPackets = LinkedListMultimap.create();
Jonathan Hart5e448782013-12-10 12:36:35 -0800162
Jonathan Hart1caaa932013-11-04 15:28:28 -0800163 deviceStorage = new DeviceStorageImpl();
164 deviceStorage.init("");
165 topologyService = new TopologyManager();
166 topologyService.init("");
167 }
168
Jonathan Harte93aed42013-12-05 18:39:50 -0800169 @Override
170 public void startUp(FloodlightModuleContext context) {
Jonathan Hart1caaa932013-11-04 15:28:28 -0800171 // no-op
172 }
173
174 @Override
175 public String getName() {
176 return "onosforwarding";
177 }
178
179 @Override
180 public boolean isCallbackOrderingPrereq(OFType type, String name) {
181 return (type == OFType.PACKET_IN) &&
Jonathan Hartd857ad62013-12-14 18:08:17 -0800182 (name.equals("devicemanager") || name.equals("proxyarpmanager")
183 || name.equals("onosdevicemanager"));
Jonathan Hart1caaa932013-11-04 15:28:28 -0800184 }
185
186 @Override
187 public boolean isCallbackOrderingPostreq(OFType type, String name) {
188 return false;
189 }
190
191 @Override
192 public Command receive(
193 IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
194
195 if (msg.getType() != OFType.PACKET_IN) {
196 return Command.CONTINUE;
197 }
198
199 OFPacketIn pi = (OFPacketIn) msg;
200
201 Ethernet eth = IFloodlightProviderService.bcStore.
202 get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
203
Jonathan Hart17672992013-12-12 16:15:16 -0800204 if (eth.getEtherType() != Ethernet.TYPE_IPv4) {
Jonathan Hart1caaa932013-11-04 15:28:28 -0800205 return Command.CONTINUE;
206 }
207
Jonathan Hart17672992013-12-12 16:15:16 -0800208 if (eth.isBroadcast() || eth.isMulticast()) {
209 handleBroadcast(sw, pi, eth);
210 //return Command.CONTINUE;
211 }
212 else {
213 // Unicast
214 handlePacketIn(sw, pi, eth);
215 }
Jonathan Hart1caaa932013-11-04 15:28:28 -0800216
217 return Command.STOP;
218 }
219
Jonathan Hart17672992013-12-12 16:15:16 -0800220 private void handleBroadcast(IOFSwitch sw, OFPacketIn pi, Ethernet eth) {
221 if (log.isTraceEnabled()) {
222 log.trace("Sending broadcast packet to other ONOS instances");
223 }
224
225 IPv4 ipv4Packet = (IPv4) eth.getPayload();
226
227 // TODO We'll put the destination address here, because the current
228 // architecture needs an address. Addresses are only used for replies
229 // however, which don't apply to non-ARP packets. The ArpMessage class
230 // has become a bit too overloaded and should be refactored to
231 // handle all use cases nicely.
232 InetAddress targetAddress =
233 InetAddresses.fromInteger(ipv4Packet.getDestinationAddress());
234
235 // Piggy-back on the ARP mechanism to broadcast this packet out the
236 // edge. Luckily the ARP module doesn't check that the packet is
237 // actually ARP before broadcasting, so we can trick it into sending
238 // our non-ARP packets.
239 // TODO This should be refactored later to account for the new use case.
Jonathan Hartf9bd98d2013-12-13 11:40:55 -0800240 datagrid.sendArpRequest(ArpMessage.newRequest(targetAddress, eth.serialize(),
Jonathan Hartd857ad62013-12-14 18:08:17 -0800241 -1L, (short)-1, sw.getId(), pi.getInPort()));
Jonathan Hart17672992013-12-12 16:15:16 -0800242 }
243
Jonathan Hart1caaa932013-11-04 15:28:28 -0800244 private void handlePacketIn(IOFSwitch sw, OFPacketIn pi, Ethernet eth) {
Jonathan Hart5e448782013-12-10 12:36:35 -0800245 String destinationMac =
246 HexString.toHexString(eth.getDestinationMACAddress());
Jonathan Hart1caaa932013-11-04 15:28:28 -0800247
248 IDeviceObject deviceObject = deviceStorage.getDeviceByMac(
249 destinationMac);
250
251 if (deviceObject == null) {
252 log.debug("No device entry found for {}", destinationMac);
253 return;
254 }
255
Jonathan Hart5e448782013-12-10 12:36:35 -0800256 Iterator<IPortObject> ports = deviceObject.getAttachedPorts().iterator();
Jonathan Hart1caaa932013-11-04 15:28:28 -0800257 if (!ports.hasNext()) {
258 log.debug("No attachment point found for device {}", destinationMac);
259 return;
260 }
261 IPortObject portObject = ports.next();
262 short destinationPort = portObject.getNumber();
263 ISwitchObject switchObject = portObject.getSwitch();
264 long destinationDpid = HexString.toLong(switchObject.getDPID());
265
Jonathan Hart41d1e912013-11-24 16:50:25 -0800266 // TODO SwitchPort, Dpid and Port should probably be immutable
267 // (also, are Dpid and Port are even necessary?)
Jonathan Hart1caaa932013-11-04 15:28:28 -0800268 SwitchPort srcSwitchPort = new SwitchPort(
269 new Dpid(sw.getId()), new Port(pi.getInPort()));
270 SwitchPort dstSwitchPort = new SwitchPort(
271 new Dpid(destinationDpid), new Port(destinationPort));
Jonathan Hartdc3ad702013-11-14 11:34:59 -0800272
273 MACAddress srcMacAddress = MACAddress.valueOf(eth.getSourceMACAddress());
274 MACAddress dstMacAddress = MACAddress.valueOf(eth.getDestinationMACAddress());
Jonathan Hart1caaa932013-11-04 15:28:28 -0800275
Jonathan Hart5e448782013-12-10 12:36:35 -0800276
Jonathan Hart7e6df362013-12-10 23:33:59 -0800277 FlowPath flowPath, reverseFlowPath;
Jonathan Hart5e448782013-12-10 12:36:35 -0800278
279 Path pathspec = new Path(srcSwitchPort, dstSwitchPort);
280 // TODO check concurrency
Jonathan Hart7e6df362013-12-10 23:33:59 -0800281 synchronized (lock) {
282 Long existingFlowId = pendingFlows.get(pathspec);
Jonathan Hartdc3ad702013-11-14 11:34:59 -0800283
Jonathan Hart7e6df362013-12-10 23:33:59 -0800284 if (existingFlowId != null) {
285 log.debug("Found existing flow {}",
286 HexString.toHexString(existingFlowId));
287
288 OFPacketOut po = constructPacketOut(pi, sw);
289 waitingPackets.put(existingFlowId, new PacketToPush(po, sw.getId()));
290 return;
291 }
292
Jonathan Hart7e6df362013-12-10 23:33:59 -0800293 log.debug("Adding new flow between {} at {} and {} at {}",
294 new Object[]{srcMacAddress, srcSwitchPort, dstMacAddress, dstSwitchPort});
295
296
297 CallerId callerId = new CallerId("Forwarding");
298
299 DataPath datapath = new DataPath();
300 datapath.setSrcPort(srcSwitchPort);
301 datapath.setDstPort(dstSwitchPort);
302
303 flowPath = new FlowPath();
304 flowPath.setInstallerId(callerId);
305
306 flowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
307 flowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
308 flowPath.setFlowEntryMatch(new FlowEntryMatch());
309 flowPath.setIdleTimeout(IDLE_TIMEOUT);
310 flowPath.setHardTimeout(HARD_TIMEOUT);
311 flowPath.flowEntryMatch().enableSrcMac(srcMacAddress);
312 flowPath.flowEntryMatch().enableDstMac(dstMacAddress);
313 flowPath.flowEntryMatch().enableEthernetFrameType(Ethernet.TYPE_IPv4);
314 flowPath.setDataPath(datapath);
315
316
317 DataPath reverseDataPath = new DataPath();
318 // Reverse the ports for the reverse path
319 reverseDataPath.setSrcPort(dstSwitchPort);
320 reverseDataPath.setDstPort(srcSwitchPort);
321
322 // TODO implement copy constructor for FlowPath
323 reverseFlowPath = new FlowPath();
324 reverseFlowPath.setInstallerId(callerId);
325 reverseFlowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
326 reverseFlowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
327 reverseFlowPath.setIdleTimeout(IDLE_TIMEOUT);
328 reverseFlowPath.setHardTimeout(HARD_TIMEOUT);
329 reverseFlowPath.setFlowEntryMatch(new FlowEntryMatch());
330 // Reverse the MAC addresses for the reverse path
331 reverseFlowPath.flowEntryMatch().enableSrcMac(dstMacAddress);
332 reverseFlowPath.flowEntryMatch().enableDstMac(srcMacAddress);
333 reverseFlowPath.flowEntryMatch().enableEthernetFrameType(Ethernet.TYPE_IPv4);
334 reverseFlowPath.setDataPath(reverseDataPath);
335 reverseFlowPath.dataPath().srcPort().dpid().toString();
336
337 // TODO what happens if no path exists? cleanup
338
339 FlowId flowId = new FlowId(flowService.getNextFlowEntryId());
340 FlowId reverseFlowId = new FlowId(flowService.getNextFlowEntryId());
341
342 flowPath.setFlowId(flowId);
343 reverseFlowPath.setFlowId(reverseFlowId);
344
345 OFPacketOut po = constructPacketOut(pi, sw);
346 Path reversePathSpec = new Path(dstSwitchPort, srcSwitchPort);
347
348 // Add to waiting lists
349 pendingFlows.put(pathspec, flowId.value());
350 pendingFlows.put(reversePathSpec, reverseFlowId.value());
351 waitingPackets.put(flowId.value(), new PacketToPush(po, sw.getId()));
352
Jonathan Hart41d1e912013-11-24 16:50:25 -0800353 }
354
Jonathan Hart5e448782013-12-10 12:36:35 -0800355 flowService.addFlow(reverseFlowPath);
356 flowService.addFlow(flowPath);
Jonathan Hart7e6df362013-12-10 23:33:59 -0800357
Jonathan Hart1caaa932013-11-04 15:28:28 -0800358 }
Jonathan Hartdc3ad702013-11-14 11:34:59 -0800359
Jonathan Hart5e448782013-12-10 12:36:35 -0800360 /*
Jonathan Hartdc3ad702013-11-14 11:34:59 -0800361 private boolean flowExists(SwitchPort srcPort, MACAddress srcMac,
362 SwitchPort dstPort, MACAddress dstMac) {
363 for (FlowPath flow : datagridService.getAllFlows()) {
364 FlowEntryMatch match = flow.flowEntryMatch();
365 // TODO implement FlowEntryMatch.equals();
366 // This is painful to do properly without support in the FlowEntryMatch
367 boolean same = true;
368 if (!match.srcMac().equals(srcMac) ||
369 !match.dstMac().equals(dstMac)) {
370 same = false;
371 }
372 if (!flow.dataPath().srcPort().equals(srcPort) ||
373 !flow.dataPath().dstPort().equals(dstPort)) {
374 same = false;
375 }
376
377 if (same) {
378 log.debug("found flow entry that's the same {}-{}:::{}-{}",
379 new Object[] {srcPort, srcMac, dstPort, dstMac});
380 return true;
381 }
382 }
383
384 return false;
385 }
Jonathan Hart5e448782013-12-10 12:36:35 -0800386 */
Jonathan Hart1caaa932013-11-04 15:28:28 -0800387
Jonathan Hart7e6df362013-12-10 23:33:59 -0800388 private OFPacketOut constructPacketOut(OFPacketIn pi, IOFSwitch sw) {
Jonathan Hart41d1e912013-11-24 16:50:25 -0800389 OFPacketOut po = new OFPacketOut();
390 po.setInPort(OFPort.OFPP_NONE)
391 .setInPort(pi.getInPort())
Jonathan Hart5e448782013-12-10 12:36:35 -0800392 .setActions(new ArrayList<OFAction>())
393 .setLengthU(OFPacketOut.MINIMUM_LENGTH);
Jonathan Hart41d1e912013-11-24 16:50:25 -0800394
395 if (sw.getBuffers() == 0) {
396 po.setBufferId(OFPacketOut.BUFFER_ID_NONE)
397 .setPacketData(pi.getPacketData())
398 .setLengthU(po.getLengthU() + po.getPacketData().length);
399 }
400 else {
401 po.setBufferId(pi.getBufferId());
402 }
403
Jonathan Hart5e448782013-12-10 12:36:35 -0800404 return po;
405 }
Pavlin Radoslavov7208e9a2013-12-11 14:31:07 -0800406
Jonathan Hart5e448782013-12-10 12:36:35 -0800407 @Override
Pavlin Radoslavov7208e9a2013-12-11 14:31:07 -0800408 public void flowsInstalled(Collection<FlowPath> installedFlowPaths) {
409 for (FlowPath flowPath : installedFlowPaths) {
410 flowInstalled(flowPath);
411 }
412 }
413
414 private void flowInstalled(FlowPath installedFlowPath) {
Jonathan Hart5e448782013-12-10 12:36:35 -0800415 // TODO check concurrency
416 // will need to sync and access both collections at once.
417 long flowId = installedFlowPath.flowId().value();
Jonathan Hart5e448782013-12-10 12:36:35 -0800418
Jonathan Hart7e6df362013-12-10 23:33:59 -0800419 Collection<PacketToPush> packets;
420 synchronized (lock) {
421 packets = waitingPackets.removeAll(flowId);
422
423 //remove pending flows entry
424 Path pathToRemove = new Path(installedFlowPath.dataPath().srcPort(),
425 installedFlowPath.dataPath().dstPort());
426 pendingFlows.remove(pathToRemove);
427
428 }
Jonathan Hart5e448782013-12-10 12:36:35 -0800429
430 for (PacketToPush packet : packets) {
431 IOFSwitch sw = floodlightProvider.getSwitches().get(packet.dpid);
432
433 OFPacketOut po = packet.packet;
434 short outPort =
435 installedFlowPath.flowEntries().get(0).outPort().value();
436 po.getActions().add(new OFActionOutput(outPort));
437 po.setActionsLength((short)
438 (po.getActionsLength() + OFActionOutput.MINIMUM_LENGTH));
439 po.setLengthU(po.getLengthU() + OFActionOutput.MINIMUM_LENGTH);
440
Jonathan Hart7e6df362013-12-10 23:33:59 -0800441 flowPusher.add(sw, po);
Jonathan Hart41d1e912013-11-24 16:50:25 -0800442 }
443 }
Jonathan Hart1caaa932013-11-04 15:28:28 -0800444}