Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Srikanth Vavilapalli | 4db76e3 | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 16 | package org.onosproject.segmentrouting.grouphandler; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 17 | |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 18 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableSet; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 20 | import com.google.common.collect.Iterables; |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 21 | import com.google.common.collect.Sets; |
| 22 | |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 23 | import org.apache.commons.lang3.RandomUtils; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 24 | import org.onlab.packet.MacAddress; |
sangho | 32a5932 | 2015-02-17 12:07:41 -0800 | [diff] [blame] | 25 | import org.onlab.packet.MplsLabel; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 26 | import org.onlab.packet.VlanId; |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 27 | import org.onlab.util.KryoNamespace; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 28 | import org.onosproject.core.ApplicationId; |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 29 | import org.onosproject.net.ConnectPoint; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 30 | import org.onosproject.net.DeviceId; |
| 31 | import org.onosproject.net.Link; |
| 32 | import org.onosproject.net.PortNumber; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 33 | import org.onosproject.net.flow.DefaultTrafficSelector; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 34 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 35 | import org.onosproject.net.flow.TrafficSelector; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 36 | import org.onosproject.net.flow.TrafficTreatment; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 37 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 38 | import org.onosproject.net.flowobjective.DefaultObjectiveContext; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 39 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 40 | import org.onosproject.net.flowobjective.NextObjective; |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 41 | import org.onosproject.net.flowobjective.ObjectiveContext; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 42 | import org.onosproject.net.link.LinkService; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 43 | import org.onosproject.segmentrouting.SegmentRoutingManager; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 44 | import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; |
| 45 | import org.onosproject.segmentrouting.config.DeviceProperties; |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 46 | import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; |
Charles Chan | d299036 | 2016-04-18 13:44:03 -0700 | [diff] [blame] | 47 | import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey; |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 48 | import org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey; |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 49 | import org.onosproject.store.service.EventuallyConsistentMap; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 50 | import org.slf4j.Logger; |
| 51 | |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 52 | import java.net.URI; |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 53 | import java.util.Collection; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 54 | import java.util.Collections; |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 55 | import java.util.HashMap; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 56 | import java.util.HashSet; |
| 57 | import java.util.List; |
| 58 | import java.util.Map; |
| 59 | import java.util.Set; |
| 60 | import java.util.concurrent.ConcurrentHashMap; |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 61 | import java.util.concurrent.ScheduledExecutorService; |
| 62 | import java.util.concurrent.TimeUnit; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 63 | import java.util.stream.Collectors; |
| 64 | |
| 65 | import static com.google.common.base.Preconditions.checkNotNull; |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 66 | import static java.util.concurrent.Executors.newScheduledThreadPool; |
| 67 | import static org.onlab.util.Tools.groupedThreads; |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 68 | import static org.onosproject.segmentrouting.SegmentRoutingManager.INTERNAL_VLAN; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 69 | import static org.slf4j.LoggerFactory.getLogger; |
| 70 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 71 | /** |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 72 | * Default ECMP group handler creation module. This component creates a set of |
| 73 | * ECMP groups for every neighbor that this device is connected to based on |
| 74 | * whether the current device is an edge device or a transit device. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 75 | */ |
| 76 | public class DefaultGroupHandler { |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 77 | protected static final Logger log = getLogger(DefaultGroupHandler.class); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 78 | |
| 79 | protected final DeviceId deviceId; |
| 80 | protected final ApplicationId appId; |
| 81 | protected final DeviceProperties deviceConfig; |
| 82 | protected final List<Integer> allSegmentIds; |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 83 | protected int ipv4NodeSegmentId = -1; |
| 84 | protected int ipv6NodeSegmentId = -1; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 85 | protected boolean isEdgeRouter = false; |
| 86 | protected MacAddress nodeMacAddr = null; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 87 | protected LinkService linkService; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 88 | protected FlowObjectiveService flowObjectiveService; |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 89 | /** |
| 90 | * local store for neighbor-device-ids and the set of ports on this device |
| 91 | * that connect to the same neighbor. |
| 92 | */ |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 93 | protected ConcurrentHashMap<DeviceId, Set<PortNumber>> devicePortMap = |
| 94 | new ConcurrentHashMap<>(); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 95 | /** |
| 96 | * local store for ports on this device connected to neighbor-device-id. |
| 97 | */ |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 98 | protected ConcurrentHashMap<PortNumber, DeviceId> portDeviceMap = |
| 99 | new ConcurrentHashMap<>(); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 100 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 101 | // distributed store for (device+destination-set) mapped to next-id and neighbors |
| 102 | protected EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> |
| 103 | dsNextObjStore = null; |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 104 | // distributed store for (device+subnet-ip-prefix) mapped to next-id |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 105 | protected EventuallyConsistentMap<VlanNextObjectiveStoreKey, Integer> |
| 106 | vlanNextObjStore = null; |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 107 | // distributed store for (device+port+treatment) mapped to next-id |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 108 | protected EventuallyConsistentMap<PortNextObjectiveStoreKey, Integer> |
| 109 | portNextObjStore = null; |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 110 | private SegmentRoutingManager srManager; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 111 | |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 112 | private static final long RETRY_INTERVAL_SEC = 30; |
| 113 | private ScheduledExecutorService executorService |
| 114 | = newScheduledThreadPool(1, groupedThreads("retryhashbkts", "retry-%d", log)); |
| 115 | |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 116 | protected KryoNamespace.Builder kryo = new KryoNamespace.Builder() |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 117 | .register(URI.class).register(HashSet.class) |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 118 | .register(DeviceId.class).register(PortNumber.class) |
| 119 | .register(DestinationSet.class).register(PolicyGroupIdentifier.class) |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 120 | .register(PolicyGroupParams.class) |
| 121 | .register(GroupBucketIdentifier.class) |
| 122 | .register(GroupBucketIdentifier.BucketOutputType.class); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 123 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 124 | protected DefaultGroupHandler(DeviceId deviceId, ApplicationId appId, |
| 125 | DeviceProperties config, |
| 126 | LinkService linkService, |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 127 | FlowObjectiveService flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 128 | SegmentRoutingManager srManager) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 129 | this.deviceId = checkNotNull(deviceId); |
| 130 | this.appId = checkNotNull(appId); |
| 131 | this.deviceConfig = checkNotNull(config); |
| 132 | this.linkService = checkNotNull(linkService); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 133 | this.allSegmentIds = checkNotNull(config.getAllDeviceSegmentIds()); |
| 134 | try { |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 135 | this.ipv4NodeSegmentId = config.getIPv4SegmentId(deviceId); |
| 136 | this.ipv6NodeSegmentId = config.getIPv6SegmentId(deviceId); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 137 | this.isEdgeRouter = config.isEdgeDevice(deviceId); |
| 138 | this.nodeMacAddr = checkNotNull(config.getDeviceMac(deviceId)); |
| 139 | } catch (DeviceConfigNotFoundException e) { |
| 140 | log.warn(e.getMessage() |
| 141 | + " Skipping value assignment in DefaultGroupHandler"); |
| 142 | } |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 143 | this.flowObjectiveService = flowObjService; |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 144 | this.dsNextObjStore = srManager.dsNextObjStore(); |
Ray Milkey | e4afdb5 | 2017-04-05 09:42:04 -0700 | [diff] [blame] | 145 | this.vlanNextObjStore = srManager.vlanNextObjStore(); |
| 146 | this.portNextObjStore = srManager.portNextObjStore(); |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 147 | this.srManager = srManager; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 148 | |
| 149 | populateNeighborMaps(); |
| 150 | } |
| 151 | |
| 152 | /** |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 153 | * Creates a group handler object. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 154 | * |
| 155 | * @param deviceId device identifier |
| 156 | * @param appId application identifier |
| 157 | * @param config interface to retrieve the device properties |
| 158 | * @param linkService link service object |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 159 | * @param flowObjService flow objective service object |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 160 | * @param srManager segment routing manager |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 161 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 162 | * @return default group handler type |
| 163 | */ |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 164 | public static DefaultGroupHandler createGroupHandler( |
| 165 | DeviceId deviceId, |
| 166 | ApplicationId appId, |
| 167 | DeviceProperties config, |
| 168 | LinkService linkService, |
| 169 | FlowObjectiveService flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 170 | SegmentRoutingManager srManager) |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 171 | throws DeviceConfigNotFoundException { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 172 | return new DefaultGroupHandler(deviceId, appId, config, |
| 173 | linkService, |
| 174 | flowObjService, |
| 175 | srManager); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | /** |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 179 | * Updates local stores for link-src device/port to neighbor (link-dst). |
| 180 | * |
| 181 | * @param link the infrastructure link |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 182 | */ |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 183 | public void portUpForLink(Link link) { |
| 184 | if (!link.src().deviceId().equals(deviceId)) { |
| 185 | log.warn("linkUp: deviceId{} doesn't match with link src {}", |
| 186 | deviceId, link.src().deviceId()); |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | log.info("* portUpForLink: Device {} linkUp at local port {} to " |
| 191 | + "neighbor {}", deviceId, link.src().port(), link.dst().deviceId()); |
| 192 | // ensure local state is updated even if linkup is aborted later on |
| 193 | addNeighborAtPort(link.dst().deviceId(), |
| 194 | link.src().port()); |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Updates local stores for port that has gone down. |
| 199 | * |
| 200 | * @param port port number that has gone down |
| 201 | */ |
| 202 | public void portDown(PortNumber port) { |
| 203 | if (portDeviceMap.get(port) == null) { |
| 204 | log.warn("portDown: unknown port"); |
| 205 | return; |
| 206 | } |
| 207 | |
| 208 | log.debug("Device {} portDown {} to neighbor {}", deviceId, port, |
| 209 | portDeviceMap.get(port)); |
| 210 | devicePortMap.get(portDeviceMap.get(port)).remove(port); |
| 211 | portDeviceMap.remove(port); |
| 212 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 213 | |
| 214 | /** |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 215 | * Checks all groups in the src-device of link for neighbor sets that include |
| 216 | * the dst-device of link, and edits the hash groups according to link up |
| 217 | * or down. Should only be called by the master instance of the src-switch |
| 218 | * of link. Typically used when there are no route-path changes due to the |
| 219 | * link up or down, as the ECMPspg does not change. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 220 | * |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 221 | * @param link the infrastructure link that has gone down or come up |
| 222 | * @param linkDown true if link has gone down |
| 223 | * @param firstTime true if link has come up for the first time i.e a link |
| 224 | * not seen-before |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 225 | */ |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 226 | public void retryHash(Link link, boolean linkDown, boolean firstTime) { |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 227 | MacAddress dstMac; |
| 228 | try { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 229 | dstMac = deviceConfig.getDeviceMac(link.dst().deviceId()); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 230 | } catch (DeviceConfigNotFoundException e) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 231 | log.warn(e.getMessage() + " Aborting retryHash."); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 232 | return; |
| 233 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 234 | // find all the destinationSets related to link |
| 235 | Set<DestinationSetNextObjectiveStoreKey> dsKeySet = dsNextObjStore.entrySet() |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 236 | .stream() |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 237 | .filter(entry -> entry.getKey().deviceId().equals(deviceId)) |
| 238 | .filter(entry -> entry.getValue().containsNextHop(link.dst().deviceId())) |
| 239 | .map(entry -> entry.getKey()) |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 240 | .collect(Collectors.toSet()); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 241 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 242 | log.debug("retryHash: dsNextObjStore contents for linkSrc {} -> linkDst {}: {}", |
| 243 | deviceId, link.dst().deviceId(), dsKeySet); |
| 244 | |
| 245 | for (DestinationSetNextObjectiveStoreKey dsKey : dsKeySet) { |
| 246 | NextNeighbors nextHops = dsNextObjStore.get(dsKey); |
| 247 | if (nextHops == null) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 248 | log.warn("retryHash in device {}, but global store has no record " |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 249 | + "for dsKey:{}", deviceId, dsKey); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 250 | continue; |
| 251 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 252 | int nextId = nextHops.nextId(); |
| 253 | Set<DeviceId> dstSet = nextHops.getDstForNextHop(link.dst().deviceId()); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 254 | if (!linkDown) { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 255 | dstSet.forEach(dst -> { |
| 256 | int edgeLabel = dsKey.destinationSet().getEdgeLabel(dst); |
| 257 | addToHashedNextObjective(link.src().port(), dstMac, |
| 258 | edgeLabel, nextId, false); |
| 259 | }); |
| 260 | |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 261 | if (firstTime) { |
| 262 | // some links may have come up before the next-objective was created |
| 263 | // we take this opportunity to ensure other ports to same next-hop-dst |
| 264 | // are part of the hash group (see CORD-1180). Duplicate additions |
| 265 | // to the same hash group are avoided by the driver. |
| 266 | for (PortNumber p : devicePortMap.get(link.dst().deviceId())) { |
| 267 | if (p.equals(link.src().port())) { |
| 268 | continue; |
| 269 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 270 | dstSet.forEach(dst -> { |
| 271 | int edgeLabel = dsKey.destinationSet().getEdgeLabel(dst); |
| 272 | addToHashedNextObjective(p, dstMac, edgeLabel, |
| 273 | nextId, false); |
| 274 | }); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | } else { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 278 | dstSet.forEach(dst -> { |
| 279 | int edgeLabel = dsKey.destinationSet().getEdgeLabel(dst); |
| 280 | removeFromHashedNextObjective(link.src().port(), dstMac, |
| 281 | edgeLabel, nextId); |
| 282 | }); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 283 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 284 | } |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 285 | |
| 286 | // It's possible that at the time of linkup, some hash-groups have |
| 287 | // not been created yet by the instance responsible for creating them, or |
| 288 | // due to the eventually-consistent nature of the nsNextObjStore it has |
| 289 | // not synced up with this instance yet. Thus we perform this check again |
| 290 | // after a delay (see CORD-1180). Duplicate additions to the same hash group |
| 291 | // are avoided by the driver. |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 292 | if (!linkDown && firstTime) { |
| 293 | executorService.schedule(new RetryHashBkts(link, dstMac), |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 294 | RETRY_INTERVAL_SEC, TimeUnit.SECONDS); |
| 295 | } |
| 296 | } |
| 297 | |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 298 | /** |
| 299 | * Makes a call to the FlowObjective service to add a single bucket to |
| 300 | * a hashed group. |
| 301 | * |
| 302 | * @param outport port to add to hash group |
| 303 | * @param dstMac destination mac address of next-hop |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 304 | * @param edgeLabel the label to use in the bucket |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 305 | * @param nextId id for next-objective to which the bucket will be added |
| 306 | * @param retry indicates if this method is being called on a retry attempt |
| 307 | * at adding a bucket to the group |
| 308 | */ |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 309 | private void addToHashedNextObjective(PortNumber outport, MacAddress dstMac, |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 310 | int edgeLabel, Integer nextId, boolean retry) { |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 311 | // Create the new bucket to be updated |
| 312 | TrafficTreatment.Builder tBuilder = |
| 313 | DefaultTrafficTreatment.builder(); |
| 314 | tBuilder.setOutput(outport) |
| 315 | .setEthDst(dstMac) |
| 316 | .setEthSrc(nodeMacAddr); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 317 | if (edgeLabel != DestinationSet.NO_EDGE_LABEL) { |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 318 | tBuilder.pushMpls() |
| 319 | .copyTtlOut() |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 320 | .setMpls(MplsLabel.mplsLabel(edgeLabel)); |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 321 | } |
| 322 | // setup metadata to pass to nextObjective - indicate the vlan on egress |
| 323 | // if needed by the switch pipeline. Since hashed next-hops are always to |
| 324 | // other neighboring routers, there is no subnet assigned on those ports. |
| 325 | TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder(); |
| 326 | metabuilder.matchVlanId(INTERNAL_VLAN); |
| 327 | |
| 328 | NextObjective.Builder nextObjBuilder = DefaultNextObjective.builder() |
| 329 | .withId(nextId) |
| 330 | .withType(NextObjective.Type.HASHED) |
| 331 | .addTreatment(tBuilder.build()) |
| 332 | .withMeta(metabuilder.build()) |
| 333 | .fromApp(appId); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 334 | log.debug("{} in device {}: Adding Bucket with port/label {}/{} to nextId {}", |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 335 | (retry) ? "retry-addToHash" : "addToHash", |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 336 | deviceId, outport, edgeLabel, nextId); |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 337 | |
| 338 | ObjectiveContext context = new DefaultObjectiveContext( |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 339 | (objective) -> log.debug("{} addedTo NextObj {} on {}", |
| 340 | (retry) ? "retry-addToHash" : "addToHash", |
| 341 | nextId, deviceId), |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 342 | (objective, error) -> |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 343 | log.warn("{} failed to addTo NextObj {} on {}: {}", |
| 344 | (retry) ? "retry-addToHash" : "addToHash", |
| 345 | nextId, deviceId, error)); |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 346 | NextObjective nextObjective = nextObjBuilder.addToExisting(context); |
| 347 | flowObjectiveService.next(deviceId, nextObjective); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | /** |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 351 | * Makes a call to the FlowObjective service to remove a single bucket from |
| 352 | * a hashed group. |
| 353 | * |
| 354 | * @param port port to remove from hash group |
| 355 | * @param dstMac destination mac address of next-hop |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 356 | * @param edgeLabel the label to use in the bucket |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 357 | * @param nextId id for next-objective from which the bucket will be removed |
| 358 | */ |
| 359 | private void removeFromHashedNextObjective(PortNumber port, MacAddress dstMac, |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 360 | int edgeLabel, Integer nextId) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 361 | // Create the bucket to be removed |
| 362 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment |
| 363 | .builder(); |
| 364 | tBuilder.setOutput(port) |
| 365 | .setEthDst(dstMac) |
| 366 | .setEthSrc(nodeMacAddr); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 367 | if (edgeLabel != DestinationSet.NO_EDGE_LABEL) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 368 | tBuilder.pushMpls() |
| 369 | .copyTtlOut() |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 370 | .setMpls(MplsLabel.mplsLabel(edgeLabel)); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 371 | } |
| 372 | log.info("{} in device {}: Removing Bucket with Port {} to next object id {}", |
| 373 | "removeFromHash", deviceId, port, nextId); |
| 374 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 375 | .builder() |
| 376 | .withType(NextObjective.Type.HASHED) //same as original |
| 377 | .withId(nextId) |
| 378 | .fromApp(appId) |
| 379 | .addTreatment(tBuilder.build()); |
| 380 | ObjectiveContext context = new DefaultObjectiveContext( |
| 381 | (objective) -> log.debug("port {} removedFrom NextObj {} on {}", |
| 382 | port, nextId, deviceId), |
| 383 | (objective, error) -> |
| 384 | log.warn("port {} failed to removeFrom NextObj {} on {}: {}", |
| 385 | port, nextId, deviceId, error)); |
| 386 | NextObjective nextObjective = nextObjBuilder. |
| 387 | removeFromExisting(context); |
| 388 | |
| 389 | flowObjectiveService.next(deviceId, nextObjective); |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * Checks all the hash-groups in the target-switch meant for the destination |
| 394 | * switch, and either adds or removes buckets to make the neighbor-set |
| 395 | * match the given next-hops. Typically called by the master instance of the |
| 396 | * destination switch, which may be different from the master instance of the |
| 397 | * target switch where hash-group changes are made. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 398 | * |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 399 | * @param targetSw the switch in which the hash groups will be edited |
| 400 | * @param nextHops the current next hops for the target switch to reach |
| 401 | * the dest sw |
| 402 | * @param destSw the destination switch |
| 403 | * @param revoke true if hash groups need to remove buckets from the |
| 404 | * the groups to match the current next hops |
| 405 | * @return true if calls are made to edit buckets, or if no edits are required |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 406 | */ |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 407 | public boolean fixHashGroups(DeviceId targetSw, Set<DeviceId> nextHops, |
| 408 | DeviceId destSw, boolean revoke) { |
| 409 | // temporary storage of keys to be updated |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 410 | Map<DestinationSetNextObjectiveStoreKey, Set<DeviceId>> tempStore = |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 411 | new HashMap<>(); |
| 412 | boolean foundNextObjective = false; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 413 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 414 | // retrieve hash-groups meant for destSw, which have destinationSets |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 415 | // with different neighbors than the given next-hops |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 416 | for (DestinationSetNextObjectiveStoreKey dskey : dsNextObjStore.keySet()) { |
| 417 | if (!dskey.deviceId().equals(targetSw) || |
| 418 | !dskey.destinationSet().getDestinationSwitches().contains(destSw)) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 419 | continue; |
| 420 | } |
| 421 | foundNextObjective = true; |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 422 | NextNeighbors nhops = dsNextObjStore.get(dskey); |
| 423 | Set<DeviceId> currNeighbors = nhops.nextHops(destSw); |
| 424 | int edgeLabel = dskey.destinationSet().getEdgeLabel(destSw); |
| 425 | Integer nextId = nhops.nextId(); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 426 | |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 427 | Set<DeviceId> diff; |
| 428 | if (revoke) { |
| 429 | diff = Sets.difference(currNeighbors, nextHops); |
| 430 | log.debug("targetSw:{} -> dstSw:{} in nextId:{} has current next " |
| 431 | + "hops:{} ..removing {}", targetSw, destSw, nextId, |
| 432 | currNeighbors, diff); |
| 433 | } else { |
| 434 | diff = Sets.difference(nextHops, currNeighbors); |
| 435 | log.debug("targetSw:{} -> dstSw:{} in nextId:{} has current next " |
| 436 | + "hops:{} ..adding {}", targetSw, destSw, nextId, |
| 437 | currNeighbors, diff); |
| 438 | } |
| 439 | for (DeviceId neighbor : diff) { |
| 440 | MacAddress dstMac; |
| 441 | try { |
| 442 | dstMac = deviceConfig.getDeviceMac(neighbor); |
| 443 | } catch (DeviceConfigNotFoundException e) { |
| 444 | log.warn(e.getMessage() + " Aborting fixHashGroup for nextId:" |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 445 | + nextId); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 446 | return false; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 447 | } |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 448 | if (devicePortMap.get(neighbor) == null || |
| 449 | devicePortMap.get(neighbor).isEmpty()) { |
| 450 | log.warn("No ports found in dev:{} for neighbor:{} .. cannot " |
| 451 | + "fix hash group for nextId: {}", |
| 452 | deviceId, neighbor, nextId); |
| 453 | return false; |
| 454 | } |
| 455 | if (revoke) { |
| 456 | for (PortNumber port : devicePortMap.get(neighbor)) { |
| 457 | log.info("fixHashGroup in device {}: Removing Bucket " |
| 458 | + "with Port {} to next object id {}", |
| 459 | deviceId, port, nextId); |
| 460 | removeFromHashedNextObjective(port, dstMac, |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 461 | edgeLabel, |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 462 | nextId); |
| 463 | } |
| 464 | // to update neighbor set with changes made |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 465 | tempStore.put(dskey, Sets.difference(currNeighbors, diff)); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 466 | } else { |
| 467 | for (PortNumber port : devicePortMap.get(neighbor)) { |
| 468 | log.info("fixHashGroup in device {}: Adding Bucket " |
| 469 | + "with Port {} to next object id {}", |
| 470 | deviceId, port, nextId); |
| 471 | addToHashedNextObjective(port, dstMac, |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 472 | edgeLabel, |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 473 | nextId, false); |
| 474 | } |
| 475 | // to update neighbor set with changes made |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 476 | tempStore.put(dskey, Sets.union(currNeighbors, diff)); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 477 | } |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 478 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 479 | } |
| 480 | |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 481 | if (!foundNextObjective) { |
| 482 | log.debug("Cannot find any nextObjectives for route targetSw:{} " |
| 483 | + "-> dstSw:{}", targetSw, destSw); |
| 484 | return true; // nothing to do, return true so ECMPspg is updated |
| 485 | } |
| 486 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 487 | // update the dsNextObjectiveStore with new destinationSet to nextId mappings |
| 488 | for (DestinationSetNextObjectiveStoreKey key : tempStore.keySet()) { |
| 489 | NextNeighbors oldHops = dsNextObjStore.get(key); |
| 490 | if (oldHops == null) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 491 | continue; |
| 492 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 493 | Set<DeviceId> newNeighbors = tempStore.get(key); |
| 494 | Set<DeviceId> oldNeighbors = ImmutableSet.copyOf(oldHops.nextHops(destSw)); |
| 495 | oldHops.dstNextHops().put(destSw, newNeighbors); |
| 496 | log.debug("Updating nsNextObjStore: oldHops:{} -> newHops:{} :: nextId:{}", |
| 497 | oldNeighbors, newNeighbors, oldHops.nextId()); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | return true; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 501 | } |
| 502 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 503 | |
| 504 | public boolean updateNextHops(DestinationSet ds, |
| 505 | Map<DeviceId, Set<DeviceId>> newDstNextHops) { |
| 506 | DestinationSetNextObjectiveStoreKey key = |
| 507 | new DestinationSetNextObjectiveStoreKey(deviceId, ds); |
| 508 | NextNeighbors currNext = dsNextObjStore.get(key); |
| 509 | Map<DeviceId, Set<DeviceId>> currDstNextHops = currNext.dstNextHops(); |
| 510 | |
| 511 | // add newDstNextHops to currDstNextHops for each dst |
| 512 | boolean success = true; |
| 513 | for (DeviceId dstSw : ds.getDestinationSwitches()) { |
| 514 | Set<DeviceId> currNhops = currDstNextHops.get(dstSw); |
| 515 | Set<DeviceId> newNhops = newDstNextHops.get(dstSw); |
| 516 | currNhops = (currNhops == null) ? Sets.newHashSet() : currNhops; |
| 517 | newNhops = (newNhops == null) ? Sets.newHashSet() : newNhops; |
| 518 | int edgeLabel = ds.getEdgeLabel(dstSw); |
| 519 | int nextId = currNext.nextId(); |
| 520 | |
| 521 | // new next hops should be added |
| 522 | boolean suc = updateAllPortsToNextHop(Sets.difference(newNhops, currNhops), |
| 523 | edgeLabel, nextId, false); |
| 524 | if (suc) { |
| 525 | currNhops.addAll(newNhops); |
| 526 | currDstNextHops.put(dstSw, currNhops); // this is only a local change |
| 527 | } |
| 528 | success &= suc; |
| 529 | } |
| 530 | |
| 531 | if (success) { |
| 532 | // update global store |
| 533 | dsNextObjStore.put(key, new NextNeighbors(currDstNextHops, |
| 534 | currNext.nextId())); |
| 535 | log.debug("Updated device:{} ds:{} new next-hops: {}", deviceId, ds, |
| 536 | dsNextObjStore.get(key)); |
| 537 | } |
| 538 | return success; |
| 539 | } |
| 540 | |
| 541 | private boolean updateAllPortsToNextHop(Set<DeviceId> diff, int edgeLabel, |
| 542 | int nextId, boolean revoke) { |
| 543 | for (DeviceId neighbor : diff) { |
| 544 | MacAddress dstMac; |
| 545 | try { |
| 546 | dstMac = deviceConfig.getDeviceMac(neighbor); |
| 547 | } catch (DeviceConfigNotFoundException e) { |
| 548 | log.warn(e.getMessage() + " Aborting fixHashGroup for nextId:" |
| 549 | + nextId); |
| 550 | return false; |
| 551 | } |
| 552 | if (devicePortMap.get(neighbor) == null || |
| 553 | devicePortMap.get(neighbor).isEmpty()) { |
| 554 | log.warn("No ports found in dev:{} for neighbor:{} .. cannot " |
| 555 | + "fix hash group for nextId: {}", |
| 556 | deviceId, neighbor, nextId); |
| 557 | return false; |
| 558 | } |
| 559 | if (revoke) { |
| 560 | for (PortNumber port : devicePortMap.get(neighbor)) { |
| 561 | log.debug("fixHashGroup in device {}: Removing Bucket " |
| 562 | + "with Port {} edgeLabel:{} to next object id {}", |
| 563 | deviceId, port, edgeLabel, nextId); |
| 564 | removeFromHashedNextObjective(port, dstMac, |
| 565 | edgeLabel, |
| 566 | nextId); |
| 567 | } |
| 568 | } else { |
| 569 | for (PortNumber port : devicePortMap.get(neighbor)) { |
| 570 | log.debug("fixHashGroup in device {}: Adding Bucket " |
| 571 | + "with Port {} edgeLabel: {} to next object id {}", |
| 572 | deviceId, port, edgeLabel, nextId); |
| 573 | addToHashedNextObjective(port, dstMac, |
| 574 | edgeLabel, |
| 575 | nextId, false); |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | return true; |
| 580 | } |
| 581 | |
| 582 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 583 | /** |
Saurav Das | b0ae6ee | 2017-03-04 16:08:47 -0800 | [diff] [blame] | 584 | * Adds or removes a port that has been configured with a vlan to a broadcast group |
| 585 | * for bridging. Should only be called by the master instance for this device. |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 586 | * |
| 587 | * @param port the port on this device that needs to be added/removed to a bcast group |
Saurav Das | b0ae6ee | 2017-03-04 16:08:47 -0800 | [diff] [blame] | 588 | * @param vlanId the vlan id corresponding to the broadcast domain/group |
| 589 | * @param popVlan indicates if packets should be sent out untagged or not out |
| 590 | * of the port. If true, indicates an access (untagged) or native vlan |
| 591 | * configuration. If false, indicates a trunk (tagged) vlan config. |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 592 | * @param portUp true if port is enabled, false if disabled |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 593 | */ |
Saurav Das | b0ae6ee | 2017-03-04 16:08:47 -0800 | [diff] [blame] | 594 | public void processEdgePort(PortNumber port, VlanId vlanId, |
| 595 | boolean popVlan, boolean portUp) { |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 596 | //get the next id for the subnet and edit it. |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 597 | Integer nextId = getVlanNextObjectiveId(vlanId); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 598 | if (nextId == -1) { |
| 599 | if (portUp) { |
| 600 | log.debug("**Creating flooding group for first port enabled in" |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 601 | + " subnet {} on dev {} port {}", vlanId, deviceId, port); |
| 602 | createBcastGroupFromVlan(vlanId, Collections.singleton(port)); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 603 | } else { |
| 604 | log.warn("Could not find flooding group for subnet {} on dev:{} when" |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 605 | + " removing port:{}", vlanId, deviceId, port); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 606 | } |
| 607 | return; |
| 608 | } |
| 609 | |
| 610 | log.info("**port{} in device {}: {} Bucket with Port {} to" |
| 611 | + " next-id {}", (portUp) ? "UP" : "DOWN", deviceId, |
| 612 | (portUp) ? "Adding" : "Removing", |
| 613 | port, nextId); |
| 614 | // Create the bucket to be added or removed |
| 615 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
Saurav Das | b0ae6ee | 2017-03-04 16:08:47 -0800 | [diff] [blame] | 616 | if (popVlan) { |
| 617 | tBuilder.popVlan(); |
| 618 | } |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 619 | tBuilder.setOutput(port); |
| 620 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 621 | TrafficSelector metadata = |
Saurav Das | b0ae6ee | 2017-03-04 16:08:47 -0800 | [diff] [blame] | 622 | DefaultTrafficSelector.builder().matchVlanId(vlanId).build(); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 623 | |
| 624 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 625 | .builder().withId(nextId) |
| 626 | .withType(NextObjective.Type.BROADCAST).fromApp(appId) |
| 627 | .addTreatment(tBuilder.build()) |
| 628 | .withMeta(metadata); |
| 629 | |
| 630 | ObjectiveContext context = new DefaultObjectiveContext( |
| 631 | (objective) -> log.debug("port {} successfully {} NextObj {} on {}", |
| 632 | port, (portUp) ? "addedTo" : "removedFrom", |
| 633 | nextId, deviceId), |
| 634 | (objective, error) -> |
| 635 | log.warn("port {} failed to {} NextObj {} on {}: {}", |
| 636 | port, (portUp) ? "addTo" : "removeFrom", |
| 637 | nextId, deviceId, error)); |
| 638 | |
| 639 | NextObjective nextObj = (portUp) ? nextObjBuilder.addToExisting(context) |
| 640 | : nextObjBuilder.removeFromExisting(context); |
| 641 | log.debug("edgePort processed: Submited next objective {} in device {}", |
| 642 | nextId, deviceId); |
| 643 | flowObjectiveService.next(deviceId, nextObj); |
| 644 | } |
| 645 | |
| 646 | /** |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 647 | * Returns the next objective of type hashed associated with the destination set. |
| 648 | * In addition, updates the existing next-objective if new route-route paths found |
| 649 | * have resulted in the addition of new next-hops to a particular destination. |
| 650 | * If there is no existing next objective for this destination set, this method |
| 651 | * would create a next objective and return the nextId. Optionally metadata can be |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 652 | * passed in for the creation of the next objective. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 653 | * |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 654 | * @param ds destination set |
| 655 | * @param nextHops a map of per destination next hops |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 656 | * @param meta metadata passed into the creation of a Next Objective |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 657 | * @param isBos if Bos is set |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 658 | * @return int if found or -1 if there are errors in the creation of the |
| 659 | * neighbor set. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 660 | */ |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 661 | public int getNextObjectiveId(DestinationSet ds, |
| 662 | Map<DeviceId, Set<DeviceId>> nextHops, |
| 663 | TrafficSelector meta, boolean isBos) { |
| 664 | NextNeighbors next = dsNextObjStore. |
| 665 | get(new DestinationSetNextObjectiveStoreKey(deviceId, ds)); |
| 666 | if (next == null) { |
| 667 | log.debug("getNextObjectiveId in device{}: Next objective id " |
| 668 | + "not found for {} ... creating", deviceId, ds); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 669 | log.trace("getNextObjectiveId: nsNextObjStore contents for device {}: {}", |
| 670 | deviceId, |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 671 | dsNextObjStore.entrySet() |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 672 | .stream() |
| 673 | .filter((nsStoreEntry) -> |
| 674 | (nsStoreEntry.getKey().deviceId().equals(deviceId))) |
| 675 | .collect(Collectors.toList())); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 676 | |
| 677 | createGroupFromDestinationSet(ds, nextHops, meta, isBos); |
| 678 | next = dsNextObjStore. |
| 679 | get(new DestinationSetNextObjectiveStoreKey(deviceId, ds)); |
| 680 | if (next == null) { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 681 | log.warn("getNextObjectiveId: unable to create next objective"); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 682 | // failure in creating group |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 683 | return -1; |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 684 | } else { |
| 685 | log.debug("getNextObjectiveId in device{}: Next objective id {} " |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 686 | + "created for {}", deviceId, next.nextId(), ds); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 687 | } |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 688 | } else { |
| 689 | log.trace("getNextObjectiveId in device{}: Next objective id {} " |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 690 | + "found for {}", deviceId, next.nextId(), ds); |
| 691 | // should fix hash groups too if next-hops have changed |
| 692 | if (!next.dstNextHops().equals(nextHops)) { |
| 693 | log.debug("Nexthops have changed for dev:{} nextId:{} ..updating", |
| 694 | deviceId, next.nextId()); |
| 695 | if (!updateNextHops(ds, nextHops)) { |
| 696 | // failure in updating group |
| 697 | return -1; |
| 698 | } |
| 699 | } |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 700 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 701 | return next.nextId(); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 702 | } |
| 703 | |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 704 | /** |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 705 | * Returns the next objective of type broadcast associated with the vlan, |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 706 | * or -1 if no such objective exists. Note that this method does NOT create |
| 707 | * the next objective as a side-effect. It is expected that is objective is |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 708 | * created at startup from network configuration. Typically this is used |
| 709 | * for L2 flooding within the subnet configured on the switch. |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 710 | * |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 711 | * @param vlanId vlan id |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 712 | * @return int if found or -1 |
| 713 | */ |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 714 | public int getVlanNextObjectiveId(VlanId vlanId) { |
| 715 | Integer nextId = vlanNextObjStore. |
| 716 | get(new VlanNextObjectiveStoreKey(deviceId, vlanId)); |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 717 | |
| 718 | return (nextId != null) ? nextId : -1; |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 722 | * Returns the next objective of type simple associated with the port on the |
| 723 | * device, given the treatment. Different treatments to the same port result |
| 724 | * in different next objectives. If no such objective exists, this method |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 725 | * creates one (if requested) and returns the id. Optionally metadata can be passed in for |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 726 | * the creation of the objective. Typically this is used for L2 and L3 forwarding |
| 727 | * to compute nodes and containers/VMs on the compute nodes directly attached |
| 728 | * to the switch. |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 729 | * |
| 730 | * @param portNum the port number for the simple next objective |
| 731 | * @param treatment the actions to apply on the packets (should include outport) |
| 732 | * @param meta optional metadata passed into the creation of the next objective |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 733 | * @param createIfMissing true if a next object should be created if not found |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 734 | * @return int if found or created, -1 if there are errors during the |
| 735 | * creation of the next objective. |
| 736 | */ |
| 737 | public int getPortNextObjectiveId(PortNumber portNum, TrafficTreatment treatment, |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 738 | TrafficSelector meta, boolean createIfMissing) { |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 739 | Integer nextId = portNextObjStore |
Saurav Das | 76ae681 | 2017-03-15 15:15:14 -0700 | [diff] [blame] | 740 | .get(new PortNextObjectiveStoreKey(deviceId, portNum, treatment, meta)); |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 741 | if (nextId != null) { |
| 742 | return nextId; |
| 743 | } |
| 744 | log.debug("getPortNextObjectiveId in device {}: Next objective id " |
| 745 | + "not found for port: {} .. {}", deviceId, portNum, |
| 746 | (createIfMissing) ? "creating" : "aborting"); |
| 747 | if (!createIfMissing) { |
| 748 | return -1; |
| 749 | } |
| 750 | // create missing next objective |
| 751 | createGroupFromPort(portNum, treatment, meta); |
| 752 | nextId = portNextObjStore.get(new PortNextObjectiveStoreKey(deviceId, portNum, |
| 753 | treatment, meta)); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 754 | if (nextId == null) { |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 755 | log.warn("getPortNextObjectiveId: unable to create next obj" |
| 756 | + "for dev:{} port:{}", deviceId, portNum); |
| 757 | return -1; |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 758 | } |
| 759 | return nextId; |
| 760 | } |
| 761 | |
| 762 | /** |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 763 | * Checks if the next objective ID (group) for the neighbor set exists or not. |
| 764 | * |
| 765 | * @param ns neighbor set to check |
| 766 | * @return true if it exists, false otherwise |
| 767 | */ |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 768 | public boolean hasNextObjectiveId(DestinationSet ns) { |
| 769 | NextNeighbors nextHops = dsNextObjStore. |
| 770 | get(new DestinationSetNextObjectiveStoreKey(deviceId, ns)); |
| 771 | if (nextHops == null) { |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 772 | return false; |
| 773 | } |
| 774 | |
| 775 | return true; |
| 776 | } |
| 777 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 778 | private void populateNeighborMaps() { |
| 779 | Set<Link> outgoingLinks = linkService.getDeviceEgressLinks(deviceId); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 780 | for (Link link : outgoingLinks) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 781 | if (link.type() != Link.Type.DIRECT) { |
| 782 | continue; |
| 783 | } |
| 784 | addNeighborAtPort(link.dst().deviceId(), link.src().port()); |
| 785 | } |
| 786 | } |
| 787 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 788 | protected void addNeighborAtPort(DeviceId neighborId, |
| 789 | PortNumber portToNeighbor) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 790 | // Update DeviceToPort database |
| 791 | log.debug("Device {} addNeighborAtPort: neighbor {} at port {}", |
| 792 | deviceId, neighborId, portToNeighbor); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 793 | Set<PortNumber> ports = Collections |
| 794 | .newSetFromMap(new ConcurrentHashMap<PortNumber, Boolean>()); |
| 795 | ports.add(portToNeighbor); |
| 796 | Set<PortNumber> portnums = devicePortMap.putIfAbsent(neighborId, ports); |
| 797 | if (portnums != null) { |
| 798 | portnums.add(portToNeighbor); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 799 | } |
| 800 | |
| 801 | // Update portToDevice database |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 802 | DeviceId prev = portDeviceMap.putIfAbsent(portToNeighbor, neighborId); |
| 803 | if (prev != null) { |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 804 | log.debug("Device: {} port: {} already has neighbor: {} ", |
| 805 | deviceId, portToNeighbor, prev, neighborId); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 806 | } |
| 807 | } |
| 808 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 809 | /** |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 810 | * Creates a NextObjective for a hash group in this device from a given |
| 811 | * DestinationSet. |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 812 | * |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 813 | * @param ds the DestinationSet |
| 814 | * @param neighbors a map for each destination and its next-hops |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 815 | * @param meta metadata passed into the creation of a Next Objective |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 816 | * @param isBos if BoS is set |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 817 | */ |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 818 | public void createGroupFromDestinationSet(DestinationSet ds, |
| 819 | Map<DeviceId, Set<DeviceId>> neighbors, |
| 820 | TrafficSelector meta, |
| 821 | boolean isBos) { |
| 822 | int nextId = flowObjectiveService.allocateNextId(); |
| 823 | NextObjective.Type type = NextObjective.Type.HASHED; |
| 824 | if (neighbors == null || neighbors.isEmpty()) { |
| 825 | log.warn("createGroupsFromDestinationSet: needs at least one neighbor" |
| 826 | + "to create group in dev:{} for ds: {} with next-hops {}", |
| 827 | deviceId, ds, neighbors); |
| 828 | return; |
| 829 | } |
| 830 | // If Bos == False and MPLS-ECMP == false, we have |
| 831 | // to use simple group and we will pick a single neighbor for a single dest. |
| 832 | if (!isBos && !srManager.getMplsEcmp()) { |
| 833 | type = NextObjective.Type.SIMPLE; |
| 834 | } |
| 835 | |
| 836 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 837 | .builder() |
| 838 | .withId(nextId) |
| 839 | .withType(type) |
| 840 | .fromApp(appId); |
| 841 | if (meta != null) { |
| 842 | nextObjBuilder.withMeta(meta); |
| 843 | } |
| 844 | |
| 845 | // create treatment buckets for each neighbor for each dst Device |
| 846 | // except in the special case where we only want to pick a single |
| 847 | // neighbor for a simple group |
| 848 | boolean foundSingleNeighbor = false; |
| 849 | boolean treatmentAdded = false; |
| 850 | Map<DeviceId, Set<DeviceId>> dstNextHops = new ConcurrentHashMap<>(); |
| 851 | for (DeviceId dst : ds.getDestinationSwitches()) { |
| 852 | Set<DeviceId> nextHops = neighbors.get(dst); |
| 853 | if (nextHops == null || nextHops.isEmpty()) { |
| 854 | continue; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 855 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 856 | |
| 857 | if (foundSingleNeighbor) { |
| 858 | break; |
| 859 | } |
| 860 | |
| 861 | for (DeviceId neighborId : nextHops) { |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 862 | if (devicePortMap.get(neighborId) == null) { |
| 863 | log.warn("Neighbor {} is not in the port map yet for dev:{}", |
| 864 | neighborId, deviceId); |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 865 | return; |
Jon Hall | cbd1b39 | 2017-01-18 20:15:44 -0800 | [diff] [blame] | 866 | } else if (devicePortMap.get(neighborId).isEmpty()) { |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 867 | log.warn("There are no ports for " |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 868 | + "the Device {} in the port map yet", neighborId); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 869 | return; |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 870 | } |
| 871 | |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 872 | MacAddress neighborMac; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 873 | try { |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 874 | neighborMac = deviceConfig.getDeviceMac(neighborId); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 875 | } catch (DeviceConfigNotFoundException e) { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 876 | log.warn(e.getMessage() + " Aborting createGroupsFromDestinationset."); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 877 | return; |
| 878 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 879 | // For each port to the neighbor, we create a new treatment |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 880 | Set<PortNumber> neighborPorts = devicePortMap.get(neighborId); |
| 881 | // In this case we are using a SIMPLE group. We randomly pick a port |
| 882 | if (!isBos && !srManager.getMplsEcmp()) { |
| 883 | int size = devicePortMap.get(neighborId).size(); |
| 884 | int index = RandomUtils.nextInt(0, size); |
| 885 | neighborPorts = Collections.singleton( |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 886 | Iterables.get(devicePortMap.get(neighborId), |
| 887 | index)); |
| 888 | foundSingleNeighbor = true; |
Pier Ventre | 917127a | 2016-10-31 16:49:19 -0700 | [diff] [blame] | 889 | } |
| 890 | for (PortNumber sp : neighborPorts) { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 891 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment |
| 892 | .builder(); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 893 | tBuilder.setEthDst(neighborMac).setEthSrc(nodeMacAddr); |
| 894 | int edgeLabel = ds.getEdgeLabel(dst); |
| 895 | if (edgeLabel != DestinationSet.NO_EDGE_LABEL) { |
Charles Chan | 68aa62d | 2015-11-09 16:37:23 -0800 | [diff] [blame] | 896 | tBuilder.pushMpls() |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 897 | .copyTtlOut() |
| 898 | .setMpls(MplsLabel.mplsLabel(edgeLabel)); |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 899 | } |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 900 | tBuilder.setOutput(sp); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 901 | nextObjBuilder.addTreatment(tBuilder.build()); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 902 | treatmentAdded = true; |
| 903 | //update store |
| 904 | Set<DeviceId> existingNeighbors = dstNextHops.get(dst); |
| 905 | if (existingNeighbors == null) { |
| 906 | existingNeighbors = new HashSet<>(); |
| 907 | } |
| 908 | existingNeighbors.add(neighborId); |
| 909 | dstNextHops.put(dst, existingNeighbors); |
| 910 | log.debug("creating treatment for port/label {}/{} in next:{}", |
| 911 | sp, edgeLabel, nextId); |
| 912 | } |
| 913 | |
| 914 | if (foundSingleNeighbor) { |
| 915 | break; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 916 | } |
| 917 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 918 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 919 | |
| 920 | if (!treatmentAdded) { |
| 921 | log.warn("Could not createGroup from DestinationSet {} without any" |
| 922 | + "next hops {}", ds, neighbors); |
| 923 | return; |
| 924 | } |
| 925 | ObjectiveContext context = new DefaultObjectiveContext( |
| 926 | (objective) -> |
| 927 | log.debug("createGroupsFromDestinationSet installed " |
| 928 | + "NextObj {} on {}", nextId, deviceId), |
| 929 | (objective, error) -> |
| 930 | log.warn("createGroupsFromDestinationSet failed to install" |
| 931 | + " NextObj {} on {}: {}", nextId, deviceId, error) |
| 932 | ); |
| 933 | NextObjective nextObj = nextObjBuilder.add(context); |
| 934 | log.debug(".. createGroupsFromDestinationSet: Submitted " |
| 935 | + "next objective {} in device {}", nextId, deviceId); |
| 936 | flowObjectiveService.next(deviceId, nextObj); |
| 937 | //update store |
| 938 | dsNextObjStore.put(new DestinationSetNextObjectiveStoreKey(deviceId, ds), |
| 939 | new NextNeighbors(dstNextHops, nextId)); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 940 | } |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 941 | |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 942 | /** |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 943 | * Creates broadcast groups for all ports in the same subnet for |
| 944 | * all configured subnets. |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 945 | */ |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 946 | public void createGroupsFromVlanConfig() { |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 947 | srManager.getVlanPortMap(deviceId).asMap().forEach((vlanId, ports) -> { |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 948 | createBcastGroupFromVlan(vlanId, ports); |
Pier Ventre | 10bd8d1 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 949 | }); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 950 | } |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 951 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 952 | /** |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 953 | * Creates a single broadcast group from a given vlan id and list of ports. |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 954 | * |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 955 | * @param vlanId vlan id |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 956 | * @param ports list of ports in the subnet |
| 957 | */ |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 958 | public void createBcastGroupFromVlan(VlanId vlanId, Collection<PortNumber> ports) { |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 959 | VlanNextObjectiveStoreKey key = new VlanNextObjectiveStoreKey(deviceId, vlanId); |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 960 | |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 961 | if (vlanNextObjStore.containsKey(key)) { |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 962 | log.debug("Broadcast group for device {} and subnet {} exists", |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 963 | deviceId, vlanId); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 964 | return; |
| 965 | } |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 966 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 967 | TrafficSelector metadata = |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 968 | DefaultTrafficSelector.builder().matchVlanId(vlanId).build(); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 969 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 970 | int nextId = flowObjectiveService.allocateNextId(); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 971 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 972 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 973 | .builder().withId(nextId) |
| 974 | .withType(NextObjective.Type.BROADCAST).fromApp(appId) |
| 975 | .withMeta(metadata); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 976 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 977 | ports.forEach(port -> { |
| 978 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 979 | if (toPopVlan(port, vlanId)) { |
| 980 | tBuilder.popVlan(); |
| 981 | } |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 982 | tBuilder.setOutput(port); |
| 983 | nextObjBuilder.addTreatment(tBuilder.build()); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 984 | }); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 985 | |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 986 | ObjectiveContext context = new DefaultObjectiveContext( |
| 987 | (objective) -> |
| 988 | log.debug("createBroadcastGroupFromVlan installed " |
| 989 | + "NextObj {} on {}", nextId, deviceId), |
| 990 | (objective, error) -> |
| 991 | log.warn("createBroadcastGroupFromVlan failed to install" |
| 992 | + " NextObj {} on {}: {}", nextId, deviceId, error) |
| 993 | ); |
| 994 | NextObjective nextObj = nextObjBuilder.add(context); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 995 | flowObjectiveService.next(deviceId, nextObj); |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 996 | log.debug("createBcastGroupFromVlan: Submited next objective {} in device {}", |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 997 | nextId, deviceId); |
| 998 | |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 999 | vlanNextObjStore.put(key, nextId); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 1000 | } |
| 1001 | |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 1002 | /** |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 1003 | * Determine if we should pop given vlan before sending packets to the given port. |
| 1004 | * |
| 1005 | * @param portNumber port number |
| 1006 | * @param vlanId vlan id |
| 1007 | * @return true if the vlan id is not contained in any vlanTagged config |
| 1008 | */ |
| 1009 | private boolean toPopVlan(PortNumber portNumber, VlanId vlanId) { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1010 | return srManager.interfaceService |
| 1011 | .getInterfacesByPort(new ConnectPoint(deviceId, portNumber)) |
Charles Chan | 7ffd81f | 2017-02-08 15:52:08 -0800 | [diff] [blame] | 1012 | .stream().noneMatch(intf -> intf.vlanTagged().contains(vlanId)); |
| 1013 | } |
| 1014 | |
| 1015 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 1016 | * Create simple next objective for a single port. The treatments can include |
| 1017 | * all outgoing actions that need to happen on the packet. |
| 1018 | * |
| 1019 | * @param portNum the outgoing port on the device |
| 1020 | * @param treatment the actions to apply on the packets (should include outport) |
| 1021 | * @param meta optional data to pass to the driver |
| 1022 | */ |
| 1023 | public void createGroupFromPort(PortNumber portNum, TrafficTreatment treatment, |
| 1024 | TrafficSelector meta) { |
| 1025 | int nextId = flowObjectiveService.allocateNextId(); |
| 1026 | PortNextObjectiveStoreKey key = new PortNextObjectiveStoreKey( |
Saurav Das | 76ae681 | 2017-03-15 15:15:14 -0700 | [diff] [blame] | 1027 | deviceId, portNum, treatment, meta); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 1028 | |
| 1029 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 1030 | .builder().withId(nextId) |
| 1031 | .withType(NextObjective.Type.SIMPLE) |
| 1032 | .addTreatment(treatment) |
| 1033 | .fromApp(appId) |
| 1034 | .withMeta(meta); |
| 1035 | |
Saurav Das | 961beb2 | 2017-03-29 19:09:17 -0700 | [diff] [blame] | 1036 | ObjectiveContext context = new DefaultObjectiveContext( |
| 1037 | (objective) -> |
| 1038 | log.debug("createGroupFromPort installed " |
| 1039 | + "NextObj {} on {}", nextId, deviceId), |
| 1040 | (objective, error) -> |
| 1041 | log.warn("createGroupFromPort failed to install" |
| 1042 | + " NextObj {} on {}: {}", nextId, deviceId, error) |
| 1043 | ); |
| 1044 | NextObjective nextObj = nextObjBuilder.add(context); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 1045 | flowObjectiveService.next(deviceId, nextObj); |
| 1046 | log.debug("createGroupFromPort: Submited next objective {} in device {} " |
| 1047 | + "for port {}", nextId, deviceId, portNum); |
| 1048 | |
| 1049 | portNextObjStore.put(key, nextId); |
| 1050 | } |
| 1051 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1052 | /** |
| 1053 | * Removes groups for the next objective ID given. |
| 1054 | * |
| 1055 | * @param objectiveId next objective ID to remove |
| 1056 | * @return true if succeeds, false otherwise |
| 1057 | */ |
| 1058 | public boolean removeGroup(int objectiveId) { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1059 | for (Map.Entry<DestinationSetNextObjectiveStoreKey, NextNeighbors> e : |
| 1060 | dsNextObjStore.entrySet()) { |
| 1061 | if (e.getValue().nextId() != objectiveId) { |
| 1062 | continue; |
| 1063 | } |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1064 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 1065 | .builder().withId(objectiveId) |
| 1066 | .withType(NextObjective.Type.HASHED).fromApp(appId); |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 1067 | ObjectiveContext context = new DefaultObjectiveContext( |
| 1068 | (objective) -> log.debug("RemoveGroup removes NextObj {} on {}", |
| 1069 | objectiveId, deviceId), |
| 1070 | (objective, error) -> |
| 1071 | log.warn("RemoveGroup failed to remove NextObj {} on {}: {}", |
| 1072 | objectiveId, deviceId, error)); |
| 1073 | NextObjective nextObjective = nextObjBuilder.remove(context); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 1074 | log.info("**removeGroup: Submited " |
| 1075 | + "next objective {} in device {}", |
| 1076 | objectiveId, deviceId); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1077 | flowObjectiveService.next(deviceId, nextObjective); |
| 1078 | |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1079 | dsNextObjStore.remove(e.getKey()); |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 1080 | return true; |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1081 | } |
| 1082 | |
| 1083 | return false; |
| 1084 | } |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 1085 | |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 1086 | /** |
| 1087 | * Removes all groups from all next objective stores. |
| 1088 | */ |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1089 | /*public void removeAllGroups() { |
| 1090 | for (Map.Entry<NeighborSetNextObjectiveStoreKey, NextNeighbors> entry: |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 1091 | nsNextObjStore.entrySet()) { |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1092 | removeGroup(entry.getValue().nextId()); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 1093 | } |
| 1094 | for (Map.Entry<PortNextObjectiveStoreKey, Integer> entry: |
| 1095 | portNextObjStore.entrySet()) { |
| 1096 | removeGroup(entry.getValue()); |
| 1097 | } |
Charles Chan | 59cc16d | 2017-02-02 16:20:42 -0800 | [diff] [blame] | 1098 | for (Map.Entry<VlanNextObjectiveStoreKey, Integer> entry: |
| 1099 | vlanNextObjStore.entrySet()) { |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 1100 | removeGroup(entry.getValue()); |
| 1101 | } |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1102 | }*/ //XXX revisit |
| 1103 | |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 1104 | |
| 1105 | /** |
| 1106 | * RetryHashBkts is a one-time retry at populating all the buckets of a |
| 1107 | * hash group based on the given link. Should only be called by the |
| 1108 | * master instance of the src-device of the link. |
| 1109 | */ |
| 1110 | protected final class RetryHashBkts implements Runnable { |
| 1111 | Link link; |
| 1112 | MacAddress dstMac; |
| 1113 | |
| 1114 | private RetryHashBkts(Link link, MacAddress dstMac) { |
| 1115 | this.link = link; |
| 1116 | this.dstMac = dstMac; |
| 1117 | } |
| 1118 | |
| 1119 | @Override |
| 1120 | public void run() { |
Charles Chan | 7f9737b | 2017-06-22 14:27:17 -0700 | [diff] [blame] | 1121 | log.debug("RETRY Hash buckets for linkup: {}", link); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1122 | Set<DestinationSetNextObjectiveStoreKey> dsKeySet = dsNextObjStore.entrySet() |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 1123 | .stream() |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1124 | .filter(entry -> entry.getKey().deviceId().equals(deviceId)) |
| 1125 | .filter(entry -> entry.getValue().containsNextHop(link.dst().deviceId())) |
| 1126 | .map(entry -> entry.getKey()) |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 1127 | .collect(Collectors.toSet()); |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 1128 | |
| 1129 | log.debug("retry-link: dsNextObjStore contents for device {}: {}", |
| 1130 | deviceId, dsKeySet); |
| 1131 | for (DestinationSetNextObjectiveStoreKey dsKey : dsKeySet) { |
| 1132 | NextNeighbors next = dsNextObjStore.get(dsKey); |
| 1133 | if (next != null) { |
| 1134 | Set<DeviceId> dstSet = next.getDstForNextHop(link.dst().deviceId()); |
| 1135 | dstSet.forEach(dst -> { |
| 1136 | int edgeLabel = dsKey.destinationSet().getEdgeLabel(dst); |
| 1137 | addToHashedNextObjective(link.src().port(), dstMac, edgeLabel, |
| 1138 | next.nextId(), true); |
| 1139 | }); |
Saurav Das | 1547b3f | 2017-05-05 17:01:08 -0700 | [diff] [blame] | 1140 | } |
| 1141 | } |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 1146 | } |