HIGUCHI Yuta | 60a1014 | 2013-06-14 15:50:10 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowmanager; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.Collection; |
| 5 | import java.util.HashMap; |
Masayoshi Kobayashi | c9da09e | 2013-03-26 20:52:02 +0000 | [diff] [blame] | 6 | import java.util.LinkedList; |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 7 | import java.util.List; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 8 | import java.util.Map; |
Pavlin Radoslavov | 0b22d0e | 2013-04-02 01:12:46 +0000 | [diff] [blame] | 9 | import java.util.Random; |
Pavlin Radoslavov | 5321980 | 2013-12-06 11:02:04 -0800 | [diff] [blame] | 10 | import java.util.SortedMap; |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 11 | import java.util.concurrent.BlockingQueue; |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 12 | import java.util.concurrent.LinkedBlockingQueue; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 13 | |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 14 | import net.floodlightcontroller.core.IFloodlightProviderService; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 15 | import net.floodlightcontroller.core.IOFSwitch; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 16 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 17 | import net.floodlightcontroller.core.module.FloodlightModuleException; |
| 18 | import net.floodlightcontroller.core.module.IFloodlightModule; |
| 19 | import net.floodlightcontroller.core.module.IFloodlightService; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 20 | import net.floodlightcontroller.restserver.IRestApiService; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 21 | import net.floodlightcontroller.util.OFMessageDamper; |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 22 | import net.onrc.onos.graph.DBOperation; |
| 23 | import net.onrc.onos.graph.GraphDBManager; |
Pavlin Radoslavov | 0537827 | 2013-10-19 23:23:05 -0700 | [diff] [blame] | 24 | import net.onrc.onos.datagrid.IDatagridService; |
HIGUCHI Yuta | 2051490 | 2013-06-12 11:24:16 -0700 | [diff] [blame] | 25 | import net.onrc.onos.ofcontroller.core.INetMapStorage; |
Pavlin Radoslavov | e9a3ef9 | 2013-10-18 18:46:45 -0700 | [diff] [blame] | 26 | import net.onrc.onos.ofcontroller.floodlightlistener.INetworkGraphService; |
HIGUCHI Yuta | 60a1014 | 2013-06-14 15:50:10 -0700 | [diff] [blame] | 27 | import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable; |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 28 | import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService; |
Pavlin Radoslavov | c086266 | 2013-12-10 15:31:49 -0800 | [diff] [blame] | 29 | import net.onrc.onos.ofcontroller.forwarding.IForwardingService; |
Pavlin Radoslavov | 15954d4 | 2013-10-19 15:29:04 -0700 | [diff] [blame] | 30 | import net.onrc.onos.ofcontroller.topology.Topology; |
Pavlin Radoslavov | 63e4260 | 2013-12-12 12:54:05 -0800 | [diff] [blame] | 31 | import net.onrc.onos.ofcontroller.util.Dpid; |
| 32 | import net.onrc.onos.ofcontroller.util.FlowEntry; |
| 33 | import net.onrc.onos.ofcontroller.util.FlowEntrySwitchState; |
| 34 | import net.onrc.onos.ofcontroller.util.FlowEntryUserState; |
| 35 | import net.onrc.onos.ofcontroller.util.FlowEntryId; |
| 36 | import net.onrc.onos.ofcontroller.util.FlowId; |
| 37 | import net.onrc.onos.ofcontroller.util.FlowPath; |
| 38 | import net.onrc.onos.ofcontroller.util.FlowPathUserState; |
| 39 | import net.onrc.onos.ofcontroller.util.Pair; |
Pavlin Radoslavov | da8d723 | 2013-12-12 12:48:14 -0800 | [diff] [blame] | 40 | import net.onrc.onos.ofcontroller.util.serializers.KryoFactory; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 41 | |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 42 | import com.thinkaurelius.titan.core.TitanException; |
| 43 | |
Pavlin Radoslavov | da8d723 | 2013-12-12 12:48:14 -0800 | [diff] [blame] | 44 | import com.esotericsoftware.kryo2.Kryo; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 45 | |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 46 | import org.slf4j.Logger; |
| 47 | import org.slf4j.LoggerFactory; |
| 48 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 49 | /** |
HIGUCHI Yuta | eb567aa | 2013-10-08 19:27:35 -0700 | [diff] [blame] | 50 | * Flow Manager class for handling the network flows. |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 51 | */ |
Pavlin Radoslavov | 5adf152 | 2013-04-04 17:43:41 -0700 | [diff] [blame] | 52 | public class FlowManager implements IFloodlightModule, IFlowService, INetMapStorage { |
Naoki Shiota | 1a37ca1 | 2013-11-18 10:55:23 -0800 | [diff] [blame] | 53 | // flag to use FlowPusher instead of FlowSwitchOperation/MessageDamper |
| 54 | private final static boolean enableFlowPusher = false; |
yoshitomo | b292c62 | 2013-11-23 14:35:58 -0800 | [diff] [blame] | 55 | protected DBOperation dbHandlerApi; |
| 56 | protected DBOperation dbHandlerInner; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 57 | |
Jonathan Hart | 50a9498 | 2013-04-10 14:49:51 -0700 | [diff] [blame] | 58 | protected volatile IFloodlightProviderService floodlightProvider; |
Pavlin Radoslavov | 0537827 | 2013-10-19 23:23:05 -0700 | [diff] [blame] | 59 | protected volatile IDatagridService datagridService; |
| 60 | protected IRestApiService restApi; |
Pavlin Radoslavov | 571cff9 | 2013-03-20 02:01:32 -0700 | [diff] [blame] | 61 | protected FloodlightModuleContext context; |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 62 | protected FlowEventHandler flowEventHandler; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 63 | |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 64 | protected IFlowPusherService pusher; |
Pavlin Radoslavov | 7208e9a | 2013-12-11 14:31:07 -0800 | [diff] [blame] | 65 | protected IForwardingService forwardingService; |
Pavlin Radoslavov | da8d723 | 2013-12-12 12:48:14 -0800 | [diff] [blame] | 66 | |
| 67 | private KryoFactory kryoFactory = new KryoFactory(); |
| 68 | |
Pavlin Radoslavov | 0b22d0e | 2013-04-02 01:12:46 +0000 | [diff] [blame] | 69 | // Flow Entry ID generation state |
| 70 | private static Random randomGenerator = new Random(); |
| 71 | private static int nextFlowEntryIdPrefix = 0; |
| 72 | private static int nextFlowEntryIdSuffix = 0; |
Pavlin Radoslavov | 01391c9 | 2013-03-14 17:13:21 -0700 | [diff] [blame] | 73 | |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 74 | /** The logger. */ |
Yuta HIGUCHI | 6ac8d18 | 2013-10-22 15:24:56 -0700 | [diff] [blame] | 75 | private final static Logger log = LoggerFactory.getLogger(FlowManager.class); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 76 | |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 77 | // The queue to write Flow Entries to the database |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 78 | private BlockingQueue<FlowPath> flowPathsToDatabaseQueue = |
| 79 | new LinkedBlockingQueue<FlowPath>(); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 80 | FlowDatabaseWriter flowDatabaseWriter; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 81 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 82 | /** |
| 83 | * Initialize the Flow Manager. |
| 84 | * |
| 85 | * @param conf the Graph Database configuration string. |
| 86 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 87 | @Override |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 88 | public void init(final String dbStore, final String conf) { |
yoshi | b1f4070 | 2014-01-22 13:07:52 -0800 | [diff] [blame] | 89 | dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloud.conf"); |
| 90 | dbHandlerInner = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloud.conf"); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 91 | } |
| 92 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 93 | /** |
| 94 | * Shutdown the Flow Manager operation. |
| 95 | */ |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 96 | @Override |
Yuta HIGUCHI | 67a7a3e | 2014-01-03 14:51:34 -0800 | [diff] [blame] | 97 | protected void finalize() { |
Toshio Koide | 9fe1cb2 | 2013-06-13 13:51:11 -0700 | [diff] [blame] | 98 | close(); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 99 | } |
| 100 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 101 | /** |
| 102 | * Shutdown the Flow Manager operation. |
| 103 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 104 | @Override |
| 105 | public void close() { |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 106 | datagridService.deregisterFlowEventHandlerService(flowEventHandler); |
Pavlin Radoslavov | bc96ae1 | 2013-11-05 08:44:02 -0800 | [diff] [blame] | 107 | dbHandlerApi.close(); |
| 108 | dbHandlerInner.close(); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 109 | } |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 110 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 111 | /** |
| 112 | * Get the collection of offered module services. |
| 113 | * |
| 114 | * @return the collection of offered module services. |
| 115 | */ |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 116 | @Override |
| 117 | public Collection<Class<? extends IFloodlightService>> getModuleServices() { |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 118 | Collection<Class<? extends IFloodlightService>> l = |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 119 | new ArrayList<Class<? extends IFloodlightService>>(); |
| 120 | l.add(IFlowService.class); |
| 121 | return l; |
| 122 | } |
| 123 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 124 | /** |
| 125 | * Get the collection of implemented services. |
| 126 | * |
| 127 | * @return the collection of implemented services. |
| 128 | */ |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 129 | @Override |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 130 | public Map<Class<? extends IFloodlightService>, IFloodlightService> |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 131 | getServiceImpls() { |
| 132 | Map<Class<? extends IFloodlightService>, |
Pavlin Radoslavov | e9a3ef9 | 2013-10-18 18:46:45 -0700 | [diff] [blame] | 133 | IFloodlightService> m = |
| 134 | new HashMap<Class<? extends IFloodlightService>, |
| 135 | IFloodlightService>(); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 136 | m.put(IFlowService.class, this); |
| 137 | return m; |
| 138 | } |
| 139 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 140 | /** |
| 141 | * Get the collection of modules this module depends on. |
| 142 | * |
| 143 | * @return the collection of modules this module depends on. |
| 144 | */ |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 145 | @Override |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 146 | public Collection<Class<? extends IFloodlightService>> |
Pavlin Radoslavov | 50e532e | 2013-10-20 02:07:51 -0700 | [diff] [blame] | 147 | getModuleDependencies() { |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 148 | Collection<Class<? extends IFloodlightService>> l = |
| 149 | new ArrayList<Class<? extends IFloodlightService>>(); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 150 | l.add(IFloodlightProviderService.class); |
Pavlin Radoslavov | e9a3ef9 | 2013-10-18 18:46:45 -0700 | [diff] [blame] | 151 | l.add(INetworkGraphService.class); |
Pavlin Radoslavov | 0537827 | 2013-10-19 23:23:05 -0700 | [diff] [blame] | 152 | l.add(IDatagridService.class); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 153 | l.add(IRestApiService.class); |
Pavlin Radoslavov | c086266 | 2013-12-10 15:31:49 -0800 | [diff] [blame] | 154 | l.add(IFlowPusherService.class); |
Pavlin Radoslavov | 63c2d05 | 2013-12-18 18:17:55 -0800 | [diff] [blame] | 155 | // |
| 156 | // TODO: Comment-out the dependency on the IForwardingService, |
| 157 | // because it is an optional module. Apparently, adding the dependency |
| 158 | // here automatically enables the module. |
| 159 | // |
| 160 | // l.add(IForwardingService.class); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 161 | return l; |
| 162 | } |
| 163 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 164 | /** |
| 165 | * Initialize the module. |
| 166 | * |
| 167 | * @param context the module context to use for the initialization. |
| 168 | */ |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 169 | @Override |
| 170 | public void init(FloodlightModuleContext context) |
| 171 | throws FloodlightModuleException { |
Pavlin Radoslavov | 571cff9 | 2013-03-20 02:01:32 -0700 | [diff] [blame] | 172 | this.context = context; |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 173 | floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); |
Pavlin Radoslavov | 0537827 | 2013-10-19 23:23:05 -0700 | [diff] [blame] | 174 | datagridService = context.getServiceImpl(IDatagridService.class); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 175 | restApi = context.getServiceImpl(IRestApiService.class); |
Pavlin Radoslavov | 939ca6b | 2013-12-03 12:35:37 -0800 | [diff] [blame] | 176 | pusher = context.getServiceImpl(IFlowPusherService.class); |
Pavlin Radoslavov | 7208e9a | 2013-12-11 14:31:07 -0800 | [diff] [blame] | 177 | forwardingService = context.getServiceImpl(IForwardingService.class); |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 178 | |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 179 | this.init("",""); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 180 | } |
| 181 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 182 | /** |
| 183 | * Get the next Flow Entry ID to use. |
| 184 | * |
| 185 | * @return the next Flow Entry ID to use. |
| 186 | */ |
Naoki Shiota | 4e77de9 | 2013-11-18 17:29:54 -0800 | [diff] [blame] | 187 | @Override |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 188 | public synchronized long getNextFlowEntryId() { |
Pavlin Radoslavov | 0b22d0e | 2013-04-02 01:12:46 +0000 | [diff] [blame] | 189 | // |
| 190 | // Generate the next Flow Entry ID. |
| 191 | // NOTE: For now, the higher 32 bits are random, and |
| 192 | // the lower 32 bits are sequential. |
| 193 | // In the future, we need a better allocation mechanism. |
| 194 | // |
| 195 | if ((nextFlowEntryIdSuffix & 0xffffffffL) == 0xffffffffL) { |
| 196 | nextFlowEntryIdPrefix = randomGenerator.nextInt(); |
| 197 | nextFlowEntryIdSuffix = 0; |
| 198 | } else { |
| 199 | nextFlowEntryIdSuffix++; |
| 200 | } |
| 201 | long result = (long)nextFlowEntryIdPrefix << 32; |
| 202 | result = result | (0xffffffffL & nextFlowEntryIdSuffix); |
| 203 | return result; |
| 204 | } |
| 205 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 206 | /** |
| 207 | * Startup module operation. |
| 208 | * |
| 209 | * @param context the module context to use for the startup. |
| 210 | */ |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 211 | @Override |
| 212 | public void startUp(FloodlightModuleContext context) { |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 213 | restApi.addRestletRoutable(new FlowWebRoutable()); |
Pavlin Radoslavov | 50e532e | 2013-10-20 02:07:51 -0700 | [diff] [blame] | 214 | |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 215 | // Initialize the Flow Entry ID generator |
| 216 | nextFlowEntryIdPrefix = randomGenerator.nextInt(); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 217 | |
| 218 | // |
| 219 | // The thread to write to the database |
| 220 | // |
| 221 | flowDatabaseWriter = new FlowDatabaseWriter(this, |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 222 | flowPathsToDatabaseQueue); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 223 | flowDatabaseWriter.start(); |
| 224 | |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 225 | // |
Pavlin Radoslavov | c9da532 | 2013-11-22 11:59:46 -0800 | [diff] [blame] | 226 | // The Flow Event Handler thread: |
| 227 | // - create |
| 228 | // - register with the Datagrid Service |
| 229 | // - startup |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 230 | // |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 231 | flowEventHandler = new FlowEventHandler(this, datagridService); |
| 232 | datagridService.registerFlowEventHandlerService(flowEventHandler); |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 233 | flowEventHandler.start(); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Add a flow. |
| 238 | * |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 239 | * @param flowPath the Flow Path to install. |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 240 | * @return the Flow ID on success, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 241 | */ |
| 242 | @Override |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 243 | public FlowId addFlow(FlowPath flowPath) { |
| 244 | |
| 245 | // Allocate the Flow ID if necessary |
Pavlin Radoslavov | 892dd18 | 2013-12-05 23:33:15 -0800 | [diff] [blame] | 246 | if (! flowPath.isValidFlowId()) { |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 247 | long id = getNextFlowEntryId(); |
| 248 | flowPath.setFlowId(new FlowId(id)); |
| 249 | } |
| 250 | |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 251 | // |
Pavlin Radoslavov | 1c24f22 | 2013-10-30 13:56:46 -0700 | [diff] [blame] | 252 | // NOTE: We need to explicitly initialize some of the state, |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 253 | // in case the application didn't do it. |
| 254 | // |
| 255 | for (FlowEntry flowEntry : flowPath.flowEntries()) { |
Pavlin Radoslavov | 07d22b4 | 2013-12-15 16:33:33 -0800 | [diff] [blame] | 256 | // The Flow Entry switch state |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 257 | if (flowEntry.flowEntrySwitchState() == |
| 258 | FlowEntrySwitchState.FE_SWITCH_UNKNOWN) { |
| 259 | flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 260 | } |
Pavlin Radoslavov | 07d22b4 | 2013-12-15 16:33:33 -0800 | [diff] [blame] | 261 | // The Flow Entry ID |
| 262 | if (! flowEntry.isValidFlowEntryId()) { |
| 263 | long id = getNextFlowEntryId(); |
| 264 | flowEntry.setFlowEntryId(new FlowEntryId(id)); |
| 265 | } |
| 266 | // The Flow ID |
Pavlin Radoslavov | 1c24f22 | 2013-10-30 13:56:46 -0700 | [diff] [blame] | 267 | if (! flowEntry.isValidFlowId()) |
| 268 | flowEntry.setFlowId(new FlowId(flowPath.flowId().value())); |
Pavlin Radoslavov | 89c8f43 | 2013-03-15 18:50:46 -0700 | [diff] [blame] | 269 | } |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 270 | |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 271 | if (FlowDatabaseOperation.addFlow(dbHandlerApi, flowPath)) { |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 272 | datagridService.notificationSendFlowAdded(flowPath); |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 273 | return flowPath.flowId(); |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 274 | } |
Pavlin Radoslavov | 051abb4 | 2013-12-05 17:24:50 -0800 | [diff] [blame] | 275 | return null; |
Pavlin Radoslavov | 9425f70 | 2013-04-04 19:55:07 -0700 | [diff] [blame] | 276 | } |
| 277 | |
| 278 | /** |
Pavlin Radoslavov | baea924 | 2013-05-08 00:20:09 +0000 | [diff] [blame] | 279 | * Delete all previously added flows. |
| 280 | * |
| 281 | * @return true on success, otherwise false. |
| 282 | */ |
| 283 | @Override |
| 284 | public boolean deleteAllFlows() { |
Pavlin Radoslavov | bc96ae1 | 2013-11-05 08:44:02 -0800 | [diff] [blame] | 285 | if (FlowDatabaseOperation.deleteAllFlows(dbHandlerApi)) { |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 286 | datagridService.notificationSendAllFlowsRemoved(); |
| 287 | return true; |
Pavlin Radoslavov | baea924 | 2013-05-08 00:20:09 +0000 | [diff] [blame] | 288 | } |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 289 | return false; |
Pavlin Radoslavov | baea924 | 2013-05-08 00:20:09 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | /** |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 293 | * Delete a previously added flow. |
| 294 | * |
| 295 | * @param flowId the Flow ID of the flow to delete. |
| 296 | * @return true on success, otherwise false. |
| 297 | */ |
| 298 | @Override |
| 299 | public boolean deleteFlow(FlowId flowId) { |
Pavlin Radoslavov | bc96ae1 | 2013-11-05 08:44:02 -0800 | [diff] [blame] | 300 | if (FlowDatabaseOperation.deleteFlow(dbHandlerApi, flowId)) { |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 301 | datagridService.notificationSendFlowRemoved(flowId); |
| 302 | return true; |
Pavlin Radoslavov | 571cff9 | 2013-03-20 02:01:32 -0700 | [diff] [blame] | 303 | } |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 304 | return false; |
Pavlin Radoslavov | 916832f | 2013-03-14 17:48:41 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | /** |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 308 | * Get a previously added flow. |
| 309 | * |
| 310 | * @param flowId the Flow ID of the flow to get. |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 311 | * @return the Flow Path if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 312 | */ |
| 313 | @Override |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 314 | public FlowPath getFlow(FlowId flowId) { |
Pavlin Radoslavov | bc96ae1 | 2013-11-05 08:44:02 -0800 | [diff] [blame] | 315 | return FlowDatabaseOperation.getFlow(dbHandlerApi, flowId); |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 316 | } |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 317 | |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 318 | /** |
| 319 | * Get all installed flows by all installers. |
| 320 | * |
| 321 | * @return the Flow Paths if found, otherwise null. |
| 322 | */ |
| 323 | @Override |
| 324 | public ArrayList<FlowPath> getAllFlows() { |
Pavlin Radoslavov | bc96ae1 | 2013-11-05 08:44:02 -0800 | [diff] [blame] | 325 | return FlowDatabaseOperation.getAllFlows(dbHandlerApi); |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | /** |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 329 | * Get summary of all installed flows by all installers in a given range. |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 330 | * |
admin | 944ef4f | 2013-10-08 17:48:37 -0700 | [diff] [blame] | 331 | * @param flowId the Flow ID of the first flow in the flow range to get. |
HIGUCHI Yuta | eb567aa | 2013-10-08 19:27:35 -0700 | [diff] [blame] | 332 | * @param maxFlows the maximum number of flows to be returned. |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 333 | * @return the Flow Paths if found, otherwise null. |
| 334 | */ |
| 335 | @Override |
Pavlin Radoslavov | 4ef6ba2 | 2013-11-22 19:32:58 -0800 | [diff] [blame] | 336 | public ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, |
| 337 | int maxFlows) { |
Pavlin Radoslavov | 5321980 | 2013-12-06 11:02:04 -0800 | [diff] [blame] | 338 | ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>(); |
| 339 | SortedMap<Long, FlowPath> sortedFlowPaths = |
| 340 | flowEventHandler.getAllFlowPathsCopy(); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 341 | |
Pavlin Radoslavov | 5321980 | 2013-12-06 11:02:04 -0800 | [diff] [blame] | 342 | // |
Pavlin Radoslavov | e79c19a | 2013-12-06 09:28:15 -0800 | [diff] [blame] | 343 | // Truncate each Flow Path and Flow Entry |
Pavlin Radoslavov | 5321980 | 2013-12-06 11:02:04 -0800 | [diff] [blame] | 344 | // |
| 345 | for (FlowPath flowPath : sortedFlowPaths.values()) { |
| 346 | // |
| 347 | // TODO: Add only the Flow Paths that have been successfully |
| 348 | // installed. |
| 349 | // |
Pavlin Radoslavov | e79c19a | 2013-12-06 09:28:15 -0800 | [diff] [blame] | 350 | flowPath.setFlowEntryMatch(null); |
| 351 | flowPath.setFlowEntryActions(null); |
| 352 | for (FlowEntry flowEntry : flowPath.flowEntries()) { |
| 353 | flowEntry.setFlowEntryMatch(null); |
| 354 | flowEntry.setFlowEntryActions(null); |
| 355 | } |
Pavlin Radoslavov | 5321980 | 2013-12-06 11:02:04 -0800 | [diff] [blame] | 356 | flowPaths.add(flowPath); |
Pavlin Radoslavov | e79c19a | 2013-12-06 09:28:15 -0800 | [diff] [blame] | 357 | } |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 358 | |
Pavlin Radoslavov | e79c19a | 2013-12-06 09:28:15 -0800 | [diff] [blame] | 359 | return flowPaths; |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | /** |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 363 | * Get the collection of my switches. |
Pavlin Radoslavov | 20d35a2 | 2013-04-05 10:16:15 -0700 | [diff] [blame] | 364 | * |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 365 | * @return the collection of my switches. |
Pavlin Radoslavov | 20d35a2 | 2013-04-05 10:16:15 -0700 | [diff] [blame] | 366 | */ |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 367 | public Map<Long, IOFSwitch> getMySwitches() { |
| 368 | return floodlightProvider.getSwitches(); |
Pavlin Radoslavov | 20d35a2 | 2013-04-05 10:16:15 -0700 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | /** |
Pavlin Radoslavov | ed0f4a8 | 2013-11-04 16:38:36 -0800 | [diff] [blame] | 372 | * Get the network topology. |
Pavlin Radoslavov | dbaaf2e | 2013-03-29 04:25:55 -0700 | [diff] [blame] | 373 | * |
Pavlin Radoslavov | ed0f4a8 | 2013-11-04 16:38:36 -0800 | [diff] [blame] | 374 | * @return the network topology. |
Pavlin Radoslavov | dbaaf2e | 2013-03-29 04:25:55 -0700 | [diff] [blame] | 375 | */ |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 376 | @Override |
Pavlin Radoslavov | ed0f4a8 | 2013-11-04 16:38:36 -0800 | [diff] [blame] | 377 | public Topology getTopology() { |
| 378 | return flowEventHandler.getTopology(); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | /** |
Pavlin Radoslavov | 4df85ae | 2013-11-26 14:48:32 -0800 | [diff] [blame] | 382 | * Inform the Flow Manager that a Flow Entry on switch expired. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 383 | * |
Pavlin Radoslavov | 3bd5ccf | 2013-11-26 15:10:21 -0800 | [diff] [blame] | 384 | * @param sw the switch the Flow Entry expired on. |
Pavlin Radoslavov | 4df85ae | 2013-11-26 14:48:32 -0800 | [diff] [blame] | 385 | * @param flowEntryId the Flow Entry ID of the expired Flow Entry. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 386 | */ |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 387 | @Override |
Pavlin Radoslavov | c5718e7 | 2013-12-10 15:47:10 -0800 | [diff] [blame] | 388 | public void flowEntryOnSwitchExpired(IOFSwitch sw, |
| 389 | FlowEntryId flowEntryId) { |
| 390 | // Find the Flow Entry |
| 391 | FlowEntry flowEntry = datagridService.getFlowEntry(flowEntryId); |
yoshi | a97632b | 2013-12-17 15:46:08 -0800 | [diff] [blame] | 392 | if (flowEntry == null) |
Pavlin Radoslavov | c5718e7 | 2013-12-10 15:47:10 -0800 | [diff] [blame] | 393 | return; // Flow Entry not found |
| 394 | |
| 395 | // Find the Flow Path |
| 396 | FlowPath flowPath = datagridService.getFlow(flowEntry.flowId()); |
| 397 | if (flowPath == null) |
| 398 | return; // Flow Path not found |
| 399 | |
| 400 | // |
| 401 | // Remove the Flow if the Flow Entry expired on the first switch |
| 402 | // |
| 403 | Dpid srcDpid = flowPath.dataPath().srcPort().dpid(); |
| 404 | if (srcDpid.value() != sw.getId()) |
| 405 | return; |
| 406 | deleteFlow(flowPath.flowId()); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | /** |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 410 | * Inform the Flow Manager that a collection of Flow Entries have been |
| 411 | * pushed to a switch. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 412 | * |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 413 | * @param entries the collection of <IOFSwitch, FlowEntry> pairs |
| 414 | * that have been pushed. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 415 | */ |
Yuta HIGUCHI | 3ab1fd0 | 2013-12-17 11:01:02 -0800 | [diff] [blame] | 416 | @Override |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 417 | public void flowEntriesPushedToSwitch( |
| 418 | Collection<Pair<IOFSwitch, FlowEntry>> entries) { |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 419 | |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 420 | // |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 421 | // Process all entries |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 422 | // |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 423 | // TODO: For now we have to create an explicit FlowEntry copy so |
| 424 | // we don't modify the original FlowEntry. |
| 425 | // This should go away after we start using the OpenFlow Barrier |
| 426 | // mechnanism in the FlowPusher. |
| 427 | // |
| 428 | Kryo kryo = kryoFactory.newKryo(); |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 429 | for (Pair<IOFSwitch, FlowEntry> entry : entries) { |
Pavlin Radoslavov | 4535bc1 | 2013-12-05 10:43:49 -0800 | [diff] [blame] | 430 | FlowEntry flowEntry = entry.second; |
Pavlin Radoslavov | 6311717 | 2013-11-07 02:18:37 -0800 | [diff] [blame] | 431 | |
| 432 | // |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 433 | // Mark the Flow Entry that it has been pushed to the switch |
Pavlin Radoslavov | 6311717 | 2013-11-07 02:18:37 -0800 | [diff] [blame] | 434 | // |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 435 | FlowEntry copyFlowEntry = kryo.copy(flowEntry); |
| 436 | copyFlowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_UPDATED); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 437 | |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 438 | // |
| 439 | // Write the Flow Entry to the Datagrid |
| 440 | // |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 441 | switch (copyFlowEntry.flowEntryUserState()) { |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 442 | case FE_USER_ADD: |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 443 | datagridService.notificationSendFlowEntryAdded(copyFlowEntry); |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 444 | break; |
| 445 | case FE_USER_MODIFY: |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 446 | datagridService.notificationSendFlowEntryUpdated(copyFlowEntry); |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 447 | break; |
| 448 | case FE_USER_DELETE: |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 449 | datagridService.notificationSendFlowEntryRemoved(copyFlowEntry.flowEntryId()); |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 450 | break; |
Pavlin Radoslavov | 4839f6d | 2013-12-11 12:49:45 -0800 | [diff] [blame] | 451 | case FE_USER_UNKNOWN: |
| 452 | assert(false); |
| 453 | break; |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 454 | } |
| 455 | } |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 456 | kryoFactory.deleteKryo(kryo); |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 457 | } |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 458 | |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 459 | /** |
Pavlin Radoslavov | 7208e9a | 2013-12-11 14:31:07 -0800 | [diff] [blame] | 460 | * Generate a notification that a collection of Flow Paths has been |
| 461 | * installed in the network. |
| 462 | * |
| 463 | * @param flowPaths the collection of installed Flow Paths. |
| 464 | */ |
| 465 | void notificationFlowPathsInstalled(Collection<FlowPath> flowPaths) { |
Pavlin Radoslavov | 63c2d05 | 2013-12-18 18:17:55 -0800 | [diff] [blame] | 466 | // |
| 467 | // TODO: Add an explicit check for null pointer, because |
| 468 | // the IForwardingService is optional. Remove the "if" statement |
| 469 | // after hte Forwarding Module becomes mandatory. |
| 470 | // |
| 471 | if (forwardingService != null) |
| 472 | forwardingService.flowsInstalled(flowPaths); |
Pavlin Radoslavov | 7208e9a | 2013-12-11 14:31:07 -0800 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | /** |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 476 | * Push modified Flow-related state as appropriate. |
| 477 | * |
| 478 | * @param modifiedFlowPaths the collection of modified Flow Paths. |
| 479 | * @param modifiedFlowEntries the collection of modified Flow Entries. |
| 480 | */ |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 481 | void pushModifiedFlowState(Collection<FlowPath> modifiedFlowPaths, |
| 482 | Collection<FlowEntry> modifiedFlowEntries) { |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 483 | // |
| 484 | // Push the modified Flow state: |
| 485 | // - Flow Entries to switches and the datagrid |
| 486 | // - Flow Paths to the database |
| 487 | // |
| 488 | pushModifiedFlowEntriesToSwitches(modifiedFlowEntries); |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 489 | pushModifiedFlowPathsToDatabase(modifiedFlowPaths); |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 490 | cleanupDeletedFlowEntriesFromDatagrid(modifiedFlowEntries); |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 491 | } |
| 492 | |
| 493 | /** |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 494 | * Push modified Flow Entries to switches. |
| 495 | * |
| 496 | * NOTE: Only the Flow Entries to switches controlled by this instance |
| 497 | * are pushed. |
| 498 | * |
| 499 | * @param modifiedFlowEntries the collection of modified Flow Entries. |
| 500 | */ |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 501 | private void pushModifiedFlowEntriesToSwitches( |
Pavlin Radoslavov | afc4aa9 | 2013-12-04 12:44:23 -0800 | [diff] [blame] | 502 | Collection<FlowEntry> modifiedFlowEntries) { |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 503 | if (modifiedFlowEntries.isEmpty()) |
| 504 | return; |
| 505 | |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 506 | List<Pair<IOFSwitch, FlowEntry>> entries = |
| 507 | new LinkedList<Pair<IOFSwitch, FlowEntry>>(); |
| 508 | |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 509 | Map<Long, IOFSwitch> mySwitches = getMySwitches(); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 510 | |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 511 | // |
| 512 | // Create a collection of my Flow Entries to push |
| 513 | // |
Pavlin Radoslavov | afc4aa9 | 2013-12-04 12:44:23 -0800 | [diff] [blame] | 514 | for (FlowEntry flowEntry : modifiedFlowEntries) { |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 515 | IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value()); |
| 516 | if (mySwitch == null) |
| 517 | continue; |
| 518 | |
Pavlin Radoslavov | d1b728c | 2013-12-18 21:39:58 -0800 | [diff] [blame] | 519 | if (flowEntry.flowEntrySwitchState() == |
| 520 | FlowEntrySwitchState.FE_SWITCH_UPDATED) { |
| 521 | // |
| 522 | // Don't push again Flow Entries that were already already |
| 523 | // installed into the switches. |
| 524 | // |
| 525 | continue; |
| 526 | } |
| 527 | |
Pavlin Radoslavov | aca49d1 | 2013-12-04 19:49:17 -0800 | [diff] [blame] | 528 | // |
| 529 | // Assign Flow Entry IDs if missing. |
| 530 | // |
| 531 | // NOTE: This is an additional safeguard, in case the |
| 532 | // mySwitches set has changed (after the Flow Entry IDs |
| 533 | // assignments by the caller). |
| 534 | // |
| 535 | if (! flowEntry.isValidFlowEntryId()) { |
| 536 | long id = getNextFlowEntryId(); |
| 537 | flowEntry.setFlowEntryId(new FlowEntryId(id)); |
| 538 | } |
| 539 | |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 540 | log.debug("Pushing Flow Entry To Switch: {}", flowEntry); |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 541 | entries.add(new Pair<IOFSwitch, FlowEntry>(mySwitch, flowEntry)); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 542 | } |
Pavlin Radoslavov | ab3f886 | 2013-12-04 18:35:53 -0800 | [diff] [blame] | 543 | |
| 544 | pusher.pushFlowEntries(entries); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 545 | } |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 546 | |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 547 | /** |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 548 | * Cleanup deleted Flow Entries from the datagrid. |
| 549 | * |
| 550 | * NOTE: We cleanup only the Flow Entries that are not for our switches. |
| 551 | * This is needed to handle the case a switch going down: |
| 552 | * It has no Master controller instance, hence no controller instance |
| 553 | * will cleanup its flow entries. |
| 554 | * This is sub-optimal: we need to elect a controller instance to handle |
| 555 | * the cleanup of such orphaned flow entries. |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 556 | * |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 557 | * @param modifiedFlowEntries the collection of modified Flow Entries. |
| 558 | */ |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 559 | private void cleanupDeletedFlowEntriesFromDatagrid( |
Pavlin Radoslavov | afc4aa9 | 2013-12-04 12:44:23 -0800 | [diff] [blame] | 560 | Collection<FlowEntry> modifiedFlowEntries) { |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 561 | if (modifiedFlowEntries.isEmpty()) |
| 562 | return; |
| 563 | |
| 564 | Map<Long, IOFSwitch> mySwitches = getMySwitches(); |
| 565 | |
Pavlin Radoslavov | afc4aa9 | 2013-12-04 12:44:23 -0800 | [diff] [blame] | 566 | for (FlowEntry flowEntry : modifiedFlowEntries) { |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 567 | // |
| 568 | // Process only Flow Entries that should be deleted and have |
| 569 | // a valid Flow Entry ID. |
| 570 | // |
Pavlin Radoslavov | 426a853 | 2013-12-02 17:32:21 -0800 | [diff] [blame] | 571 | if (! flowEntry.isValidFlowEntryId()) |
| 572 | continue; |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 573 | if (flowEntry.flowEntryUserState() != |
| 574 | FlowEntryUserState.FE_USER_DELETE) { |
| 575 | continue; |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 576 | } |
| 577 | |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 578 | // |
| 579 | // NOTE: The deletion of Flow Entries for my switches is handled |
| 580 | // elsewhere. |
| 581 | // |
| 582 | IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value()); |
| 583 | if (mySwitch != null) |
| 584 | continue; |
| 585 | |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 586 | log.debug("Pushing cleanup of Flow Entry To Datagrid: {}", flowEntry); |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 587 | |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 588 | // |
| 589 | // Write the Flow Entry to the Datagrid |
| 590 | // |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame] | 591 | datagridService.notificationSendFlowEntryRemoved(flowEntry.flowEntryId()); |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 592 | } |
| 593 | } |
| 594 | |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 595 | /** |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 596 | * Class to implement writing to the database in a separate thread. |
| 597 | */ |
| 598 | class FlowDatabaseWriter extends Thread { |
| 599 | private FlowManager flowManager; |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 600 | private BlockingQueue<FlowPath> blockingQueue; |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 601 | |
| 602 | /** |
| 603 | * Constructor. |
| 604 | * |
| 605 | * @param flowManager the Flow Manager to use. |
| 606 | * @param blockingQueue the blocking queue to use. |
| 607 | */ |
| 608 | FlowDatabaseWriter(FlowManager flowManager, |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 609 | BlockingQueue<FlowPath> blockingQueue) { |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 610 | this.flowManager = flowManager; |
| 611 | this.blockingQueue = blockingQueue; |
| 612 | } |
| 613 | |
| 614 | /** |
| 615 | * Run the thread. |
| 616 | */ |
| 617 | @Override |
| 618 | public void run() { |
| 619 | // |
| 620 | // The main loop |
| 621 | // |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 622 | Collection<FlowPath> collection = new LinkedList<FlowPath>(); |
Yuta HIGUCHI | 61509a4 | 2013-12-17 10:41:04 -0800 | [diff] [blame] | 623 | this.setName("FlowDatabaseWriter " + this.getId() ); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 624 | try { |
| 625 | while (true) { |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 626 | FlowPath flowPath = blockingQueue.take(); |
| 627 | collection.add(flowPath); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 628 | blockingQueue.drainTo(collection); |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 629 | flowManager.writeModifiedFlowPathsToDatabase(collection); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 630 | collection.clear(); |
| 631 | } |
| 632 | } catch (Exception exception) { |
| 633 | log.debug("Exception writing to the Database: ", exception); |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | /** |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 639 | * Push Flow Paths to the Network MAP. |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 640 | * |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 641 | * NOTE: The complete Flow Paths are pushed only on the instance |
| 642 | * responsible for the first switch. This is to avoid database errors |
| 643 | * when multiple instances are writing Flow Entries for the same Flow Path. |
Pavlin Radoslavov | 6311717 | 2013-11-07 02:18:37 -0800 | [diff] [blame] | 644 | * |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 645 | * @param modifiedFlowPaths the collection of Flow Paths to push. |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 646 | */ |
Pavlin Radoslavov | a0c1636 | 2013-12-04 13:18:08 -0800 | [diff] [blame] | 647 | private void pushModifiedFlowPathsToDatabase( |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 648 | Collection<FlowPath> modifiedFlowPaths) { |
Pavlin Radoslavov | da8d723 | 2013-12-12 12:48:14 -0800 | [diff] [blame] | 649 | List<FlowPath> copiedFlowPaths = new LinkedList<FlowPath>(); |
| 650 | |
| 651 | // |
| 652 | // Create a copy of the Flow Paths to push, because the pushing |
| 653 | // itself will happen on a separate thread. |
| 654 | // |
| 655 | Kryo kryo = kryoFactory.newKryo(); |
| 656 | for (FlowPath flowPath : modifiedFlowPaths) { |
| 657 | FlowPath copyFlowPath = kryo.copy(flowPath); |
| 658 | copiedFlowPaths.add(copyFlowPath); |
| 659 | } |
| 660 | kryoFactory.deleteKryo(kryo); |
| 661 | |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 662 | // |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 663 | // We only add the Flow Paths to the Database Queue. |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 664 | // The FlowDatabaseWriter thread is responsible for the actual writing. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 665 | // |
Pavlin Radoslavov | da8d723 | 2013-12-12 12:48:14 -0800 | [diff] [blame] | 666 | flowPathsToDatabaseQueue.addAll(copiedFlowPaths); |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 667 | } |
| 668 | |
| 669 | /** |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 670 | * Write Flow Paths to the Network MAP. |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 671 | * |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 672 | * NOTE: The complete Flow Paths are pushed only on the instance |
| 673 | * responsible for the first switch. This is to avoid database errors |
| 674 | * when multiple instances are writing Flow Entries for the same Flow Path. |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 675 | * |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 676 | * @param modifiedFlowPaths the collection of Flow Paths to write. |
Pavlin Radoslavov | 584bd11 | 2013-11-21 20:59:33 -0800 | [diff] [blame] | 677 | */ |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 678 | private void writeModifiedFlowPathsToDatabase( |
| 679 | Collection<FlowPath> modifiedFlowPaths) { |
| 680 | if (modifiedFlowPaths.isEmpty()) |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 681 | return; |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 682 | |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 683 | Map<Long, IOFSwitch> mySwitches = getMySwitches(); |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 684 | |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 685 | for (FlowPath flowPath : modifiedFlowPaths) { |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 686 | // |
Pavlin Radoslavov | 6311717 | 2013-11-07 02:18:37 -0800 | [diff] [blame] | 687 | // Push the changes only on the instance responsible for the |
| 688 | // first switch. |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 689 | // |
Pavlin Radoslavov | 6311717 | 2013-11-07 02:18:37 -0800 | [diff] [blame] | 690 | Dpid srcDpid = flowPath.dataPath().srcPort().dpid(); |
| 691 | IOFSwitch mySrcSwitch = mySwitches.get(srcDpid.value()); |
| 692 | if (mySrcSwitch == null) |
| 693 | continue; |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 694 | |
| 695 | // |
Pavlin Radoslavov | ef54505 | 2013-12-05 15:17:25 -0800 | [diff] [blame] | 696 | // Delete the Flow Path from the Network Map |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 697 | // |
Pavlin Radoslavov | ef54505 | 2013-12-05 15:17:25 -0800 | [diff] [blame] | 698 | if (flowPath.flowPathUserState() == |
| 699 | FlowPathUserState.FP_USER_DELETE) { |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 700 | log.debug("Deleting Flow Path From Database: {}", flowPath); |
Pavlin Radoslavov | ef54505 | 2013-12-05 15:17:25 -0800 | [diff] [blame] | 701 | |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 702 | boolean retry = false; |
| 703 | do { |
| 704 | retry = false; |
| 705 | try { |
| 706 | if (! FlowDatabaseOperation.deleteFlow( |
| 707 | dbHandlerInner, |
| 708 | flowPath.flowId())) { |
| 709 | log.error("Cannot delete Flow Path {} from Network Map", |
| 710 | flowPath.flowId()); |
| 711 | retry = true; |
| 712 | } |
| 713 | } catch (TitanException te) { |
| 714 | log.error("Titan Exception deleting Flow Path from Network MAP: {}", te); |
| 715 | retry = true; |
| 716 | } catch (Exception e) { |
| 717 | log.error("Exception deleting Flow Path from Network MAP: {}", e); |
Yuta HIGUCHI | 67a7a3e | 2014-01-03 14:51:34 -0800 | [diff] [blame] | 718 | } |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 719 | } while (retry); |
| 720 | |
Pavlin Radoslavov | ef54505 | 2013-12-05 15:17:25 -0800 | [diff] [blame] | 721 | continue; |
| 722 | } |
| 723 | |
| 724 | // |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 725 | // Test whether all Flow Entries are valid |
Pavlin Radoslavov | 9f33edb | 2013-11-06 18:24:37 -0800 | [diff] [blame] | 726 | // |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 727 | boolean allValid = true; |
| 728 | for (FlowEntry flowEntry : flowPath.flowEntries()) { |
| 729 | if (flowEntry.flowEntryUserState() == |
| 730 | FlowEntryUserState.FE_USER_DELETE) { |
| 731 | continue; |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 732 | } |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 733 | if (! flowEntry.isValidFlowEntryId()) { |
| 734 | allValid = false; |
| 735 | break; |
| 736 | } |
Pavlin Radoslavov | 237fde7 | 2013-12-17 22:21:06 -0800 | [diff] [blame] | 737 | if (flowEntry.flowEntrySwitchState() != |
| 738 | FlowEntrySwitchState.FE_SWITCH_UPDATED) { |
| 739 | allValid = false; |
| 740 | break; |
| 741 | } |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 742 | } |
| 743 | if (! allValid) |
| 744 | continue; |
| 745 | |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 746 | log.debug("Pushing Flow Path To Database: {}", flowPath); |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 747 | |
| 748 | // |
| 749 | // Write the Flow Path to the Network Map |
| 750 | // |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 751 | boolean retry = false; |
| 752 | do { |
| 753 | retry = false; |
| 754 | try { |
Masayoshi Kobayashi | 178ead1 | 2013-12-19 20:50:19 -0800 | [diff] [blame] | 755 | long startTime = System.nanoTime(); |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 756 | if (! FlowDatabaseOperation.addFlow(dbHandlerInner, flowPath)) { |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 757 | log.error("Cannot write to Network Map Flow Path {}", flowPath.flowId()); |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 758 | retry = true; |
| 759 | } |
Masayoshi Kobayashi | 178ead1 | 2013-12-19 20:50:19 -0800 | [diff] [blame] | 760 | // FIXME Flag to turn ON logging |
| 761 | //long endTime = System.nanoTime(); |
| 762 | //log.error("Performance %% Flow path total time {} : {}", endTime - startTime, flowPath.toString()); |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 763 | } catch (TitanException te) { |
| 764 | log.error("Titan Exception writing Flow Path to Network MAP: ", te); |
| 765 | retry = true; |
Masayoshi Kobayashi | 178ead1 | 2013-12-19 20:50:19 -0800 | [diff] [blame] | 766 | // FIXME Flag to turn ON logging |
| 767 | //long endTime = System.nanoTime(); |
| 768 | //log.error("Performance %% Flow path total time {} : {}", endTime - startTime, flowPath.toString()); |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 769 | } catch (Exception e) { |
| 770 | log.error("Exception writing Flow Path to Network MAP: ", e); |
Masayoshi Kobayashi | 178ead1 | 2013-12-19 20:50:19 -0800 | [diff] [blame] | 771 | // FIXME Flag to turn ON logging |
| 772 | //long endTime = System.nanoTime(); |
| 773 | //log.error("Performance %% Flow path total time {} : {}", endTime - startTime, flowPath.toString()); |
Pavlin Radoslavov | 2fca8d1 | 2013-12-04 09:39:06 -0800 | [diff] [blame] | 774 | } |
Pavlin Radoslavov | 262e683 | 2013-12-18 14:37:35 -0800 | [diff] [blame] | 775 | } while (retry); |
Pavlin Radoslavov | ebc8b19 | 2013-10-29 15:35:35 -0700 | [diff] [blame] | 776 | } |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 777 | } |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 778 | } |