Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
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 | |
| 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | import static org.slf4j.LoggerFactory.getLogger; |
| 20 | |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 21 | import java.net.URI; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 22 | import java.util.ArrayList; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 23 | import java.util.Collections; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 24 | import java.util.HashSet; |
| 25 | import java.util.List; |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 26 | import java.util.Map; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 27 | import java.util.Set; |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 28 | import java.util.concurrent.ConcurrentHashMap; |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 29 | import java.util.stream.Collectors; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 30 | |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 31 | import org.onlab.packet.Ip4Prefix; |
| 32 | import org.onlab.packet.IpPrefix; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 33 | import org.onlab.packet.MacAddress; |
sangho | 32a5932 | 2015-02-17 12:07:41 -0800 | [diff] [blame] | 34 | import org.onlab.packet.MplsLabel; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 35 | import org.onlab.packet.VlanId; |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 36 | import org.onlab.util.KryoNamespace; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 37 | import org.onosproject.core.ApplicationId; |
| 38 | import org.onosproject.net.DeviceId; |
| 39 | import org.onosproject.net.Link; |
| 40 | import org.onosproject.net.PortNumber; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 41 | import org.onosproject.net.flow.DefaultTrafficSelector; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 42 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 43 | import org.onosproject.net.flow.TrafficSelector; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 44 | import org.onosproject.net.flow.TrafficTreatment; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 45 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 46 | import org.onosproject.net.flowobjective.DefaultObjectiveContext; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 47 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 48 | import org.onosproject.net.flowobjective.NextObjective; |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 49 | import org.onosproject.net.flowobjective.ObjectiveContext; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 50 | import org.onosproject.net.link.LinkService; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 51 | import org.onosproject.segmentrouting.SegmentRoutingManager; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 52 | import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; |
| 53 | import org.onosproject.segmentrouting.config.DeviceProperties; |
Charles Chan | d299036 | 2016-04-18 13:44:03 -0700 | [diff] [blame] | 54 | import org.onosproject.segmentrouting.storekey.NeighborSetNextObjectiveStoreKey; |
| 55 | import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey; |
| 56 | import org.onosproject.segmentrouting.storekey.SubnetNextObjectiveStoreKey; |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 57 | import org.onosproject.store.service.EventuallyConsistentMap; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 58 | import org.slf4j.Logger; |
| 59 | |
| 60 | /** |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 61 | * Default ECMP group handler creation module. This component creates a set of |
| 62 | * ECMP groups for every neighbor that this device is connected to based on |
| 63 | * whether the current device is an edge device or a transit device. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 64 | */ |
| 65 | public class DefaultGroupHandler { |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 66 | protected static final Logger log = getLogger(DefaultGroupHandler.class); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 67 | |
| 68 | protected final DeviceId deviceId; |
| 69 | protected final ApplicationId appId; |
| 70 | protected final DeviceProperties deviceConfig; |
| 71 | protected final List<Integer> allSegmentIds; |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 72 | protected int ipv4NodeSegmentId = -1; |
| 73 | protected int ipv6NodeSegmentId = -1; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 74 | protected boolean isEdgeRouter = false; |
| 75 | protected MacAddress nodeMacAddr = null; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 76 | protected LinkService linkService; |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 77 | protected FlowObjectiveService flowObjectiveService; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 78 | // local store for neighbor-device-ids and the set of ports on this device |
| 79 | // that connect to the same neighbor |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 80 | protected ConcurrentHashMap<DeviceId, Set<PortNumber>> devicePortMap = |
| 81 | new ConcurrentHashMap<>(); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 82 | // local store for ports on this device connected to neighbor-device-id |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 83 | protected ConcurrentHashMap<PortNumber, DeviceId> portDeviceMap = |
| 84 | new ConcurrentHashMap<>(); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 85 | // distributed store for (device+neighborset) mapped to next-id |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 86 | protected EventuallyConsistentMap<NeighborSetNextObjectiveStoreKey, Integer> |
| 87 | nsNextObjStore = null; |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 88 | // distributed store for (device+subnet-ip-prefix) mapped to next-id |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 89 | protected EventuallyConsistentMap<SubnetNextObjectiveStoreKey, Integer> |
| 90 | subnetNextObjStore = null; |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 91 | // distributed store for (device+port+treatment) mapped to next-id |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 92 | protected EventuallyConsistentMap<PortNextObjectiveStoreKey, Integer> |
| 93 | portNextObjStore = null; |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 94 | private SegmentRoutingManager srManager; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 95 | |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 96 | protected KryoNamespace.Builder kryo = new KryoNamespace.Builder() |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 97 | .register(URI.class).register(HashSet.class) |
| 98 | .register(DeviceId.class).register(PortNumber.class) |
| 99 | .register(NeighborSet.class).register(PolicyGroupIdentifier.class) |
| 100 | .register(PolicyGroupParams.class) |
| 101 | .register(GroupBucketIdentifier.class) |
| 102 | .register(GroupBucketIdentifier.BucketOutputType.class); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 103 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 104 | protected DefaultGroupHandler(DeviceId deviceId, ApplicationId appId, |
| 105 | DeviceProperties config, |
| 106 | LinkService linkService, |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 107 | FlowObjectiveService flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 108 | SegmentRoutingManager srManager) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 109 | this.deviceId = checkNotNull(deviceId); |
| 110 | this.appId = checkNotNull(appId); |
| 111 | this.deviceConfig = checkNotNull(config); |
| 112 | this.linkService = checkNotNull(linkService); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 113 | this.allSegmentIds = checkNotNull(config.getAllDeviceSegmentIds()); |
| 114 | try { |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 115 | this.ipv4NodeSegmentId = config.getIPv4SegmentId(deviceId); |
| 116 | this.ipv6NodeSegmentId = config.getIPv6SegmentId(deviceId); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 117 | this.isEdgeRouter = config.isEdgeDevice(deviceId); |
| 118 | this.nodeMacAddr = checkNotNull(config.getDeviceMac(deviceId)); |
| 119 | } catch (DeviceConfigNotFoundException e) { |
| 120 | log.warn(e.getMessage() |
| 121 | + " Skipping value assignment in DefaultGroupHandler"); |
| 122 | } |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 123 | this.flowObjectiveService = flowObjService; |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 124 | this.nsNextObjStore = srManager.nsNextObjStore; |
| 125 | this.subnetNextObjStore = srManager.subnetNextObjStore; |
| 126 | this.portNextObjStore = srManager.portNextObjStore; |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 127 | this.srManager = srManager; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 128 | |
| 129 | populateNeighborMaps(); |
| 130 | } |
| 131 | |
| 132 | /** |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 133 | * Creates a group handler object based on the type of device. If device is |
| 134 | * of edge type it returns edge group handler, else it returns transit group |
| 135 | * handler. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 136 | * |
| 137 | * @param deviceId device identifier |
| 138 | * @param appId application identifier |
| 139 | * @param config interface to retrieve the device properties |
| 140 | * @param linkService link service object |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 141 | * @param flowObjService flow objective service object |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 142 | * @param srManager segment routing manager |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 143 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 144 | * @return default group handler type |
| 145 | */ |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 146 | public static DefaultGroupHandler createGroupHandler( |
| 147 | DeviceId deviceId, |
| 148 | ApplicationId appId, |
| 149 | DeviceProperties config, |
| 150 | LinkService linkService, |
| 151 | FlowObjectiveService flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 152 | SegmentRoutingManager srManager) |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 153 | throws DeviceConfigNotFoundException { |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 154 | // handle possible exception in the caller |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 155 | if (config.isEdgeDevice(deviceId)) { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 156 | return new DefaultEdgeGroupHandler(deviceId, appId, config, |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 157 | linkService, |
| 158 | flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 159 | srManager |
| 160 | ); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 161 | } else { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 162 | return new DefaultTransitGroupHandler(deviceId, appId, config, |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 163 | linkService, |
| 164 | flowObjService, |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 165 | srManager); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
| 169 | /** |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 170 | * Creates the auto created groups for this device based on the current |
| 171 | * snapshot of the topology. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 172 | */ |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 173 | // Empty implementations to be overridden by derived classes |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 174 | public void createGroups() { |
| 175 | } |
| 176 | |
| 177 | /** |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 178 | * Performs group creation or update procedures when a new link is |
| 179 | * discovered on this device. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 180 | * |
| 181 | * @param newLink new neighbor link |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 182 | * @param isMaster true if local instance is the master |
| 183 | * |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 184 | */ |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 185 | public void linkUp(Link newLink, boolean isMaster) { |
sangho | b35a619 | 2015-04-01 13:05:26 -0700 | [diff] [blame] | 186 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 187 | if (newLink.type() != Link.Type.DIRECT) { |
| 188 | log.warn("linkUp: unknown link type"); |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | if (!newLink.src().deviceId().equals(deviceId)) { |
| 193 | log.warn("linkUp: deviceId{} doesn't match with link src{}", |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 194 | deviceId, newLink.src().deviceId()); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 195 | return; |
| 196 | } |
| 197 | |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 198 | log.info("* LinkUP: Device {} linkUp at local port {} to neighbor {}", deviceId, |
| 199 | newLink.src().port(), newLink.dst().deviceId()); |
Saurav Das | 59232cf | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 200 | // ensure local state is updated even if linkup is aborted later on |
| 201 | addNeighborAtPort(newLink.dst().deviceId(), |
| 202 | newLink.src().port()); |
| 203 | |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 204 | MacAddress dstMac; |
| 205 | try { |
| 206 | dstMac = deviceConfig.getDeviceMac(newLink.dst().deviceId()); |
| 207 | } catch (DeviceConfigNotFoundException e) { |
| 208 | log.warn(e.getMessage() + " Aborting linkUp."); |
| 209 | return; |
| 210 | } |
| 211 | |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 212 | /*if (devicePortMap.get(newLink.dst().deviceId()) == null) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 213 | // New Neighbor |
| 214 | newNeighbor(newLink); |
| 215 | } else { |
| 216 | // Old Neighbor |
| 217 | newPortToExistingNeighbor(newLink); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 218 | }*/ |
| 219 | Set<NeighborSet> nsSet = nsNextObjStore.keySet() |
| 220 | .stream() |
| 221 | .filter((nsStoreEntry) -> (nsStoreEntry.deviceId().equals(deviceId))) |
| 222 | .map((nsStoreEntry) -> (nsStoreEntry.neighborSet())) |
| 223 | .filter((ns) -> (ns.getDeviceIds() |
| 224 | .contains(newLink.dst().deviceId()))) |
| 225 | .collect(Collectors.toSet()); |
| 226 | log.trace("linkUp: nsNextObjStore contents for device {}:", |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 227 | deviceId, |
| 228 | nsSet); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 229 | for (NeighborSet ns : nsSet) { |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 230 | Integer nextId = nsNextObjStore. |
| 231 | get(new NeighborSetNextObjectiveStoreKey(deviceId, ns)); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 232 | if (nextId != null && isMaster) { |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 233 | // Create the new bucket to be updated |
| 234 | TrafficTreatment.Builder tBuilder = |
| 235 | DefaultTrafficTreatment.builder(); |
| 236 | tBuilder.setOutput(newLink.src().port()) |
| 237 | .setEthDst(dstMac) |
| 238 | .setEthSrc(nodeMacAddr); |
| 239 | if (ns.getEdgeLabel() != NeighborSet.NO_EDGE_LABEL) { |
| 240 | tBuilder.pushMpls() |
| 241 | .copyTtlOut() |
| 242 | .setMpls(MplsLabel.mplsLabel(ns.getEdgeLabel())); |
| 243 | } |
| 244 | // setup metadata to pass to nextObjective - indicate the vlan on egress |
| 245 | // if needed by the switch pipeline. Since hashed next-hops are always to |
| 246 | // other neighboring routers, there is no subnet assigned on those ports. |
| 247 | TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder(); |
| 248 | metabuilder.matchVlanId( |
| 249 | VlanId.vlanId(SegmentRoutingManager.ASSIGNED_VLAN_NO_SUBNET)); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 250 | |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 251 | NextObjective.Builder nextObjBuilder = DefaultNextObjective.builder() |
| 252 | .withId(nextId) |
| 253 | .withType(NextObjective.Type.HASHED) |
| 254 | .addTreatment(tBuilder.build()) |
| 255 | .withMeta(metabuilder.build()) |
| 256 | .fromApp(appId); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 257 | log.info("**linkUp in device {}: Adding Bucket " |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 258 | + "with Port {} to next object id {}", |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 259 | deviceId, |
| 260 | newLink.src().port(), |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 261 | nextId); |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 262 | |
| 263 | ObjectiveContext context = new DefaultObjectiveContext( |
Saurav Das | 1ce0a7b | 2016-10-21 14:06:29 -0700 | [diff] [blame] | 264 | (objective) -> log.debug("LinkUp addedTo NextObj {} on {}", |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 265 | nextId, deviceId), |
| 266 | (objective, error) -> |
Saurav Das | 1ce0a7b | 2016-10-21 14:06:29 -0700 | [diff] [blame] | 267 | log.warn("LinkUp failed to addTo NextObj {} on {}: {}", |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 268 | nextId, deviceId, error)); |
| 269 | NextObjective nextObjective = nextObjBuilder.addToExisting(context); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 270 | flowObjectiveService.next(deviceId, nextObjective); |
| 271 | } else if (isMaster) { |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 272 | log.warn("linkUp in device {}, but global store has no record " |
| 273 | + "for neighbor-set {}", deviceId, ns); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 274 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 279 | * Performs hash group recovery procedures when a switch-to-switch |
| 280 | * port goes down on this device. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 281 | * |
| 282 | * @param port port number that has gone down |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 283 | * @param isMaster true if local instance is the master |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 284 | */ |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 285 | public void portDown(PortNumber port, boolean isMaster) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 286 | if (portDeviceMap.get(port) == null) { |
| 287 | log.warn("portDown: unknown port"); |
| 288 | return; |
| 289 | } |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 290 | |
| 291 | MacAddress dstMac; |
| 292 | try { |
| 293 | dstMac = deviceConfig.getDeviceMac(portDeviceMap.get(port)); |
| 294 | } catch (DeviceConfigNotFoundException e) { |
| 295 | log.warn(e.getMessage() + " Aborting portDown."); |
| 296 | return; |
| 297 | } |
| 298 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 299 | log.debug("Device {} portDown {} to neighbor {}", deviceId, port, |
| 300 | portDeviceMap.get(port)); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 301 | /*Set<NeighborSet> nsSet = computeImpactedNeighborsetForPortEvent(portDeviceMap |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 302 | .get(port), |
| 303 | devicePortMap |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 304 | .keySet());*/ |
| 305 | Set<NeighborSet> nsSet = nsNextObjStore.keySet() |
| 306 | .stream() |
| 307 | .filter((nsStoreEntry) -> (nsStoreEntry.deviceId().equals(deviceId))) |
| 308 | .map((nsStoreEntry) -> (nsStoreEntry.neighborSet())) |
| 309 | .filter((ns) -> (ns.getDeviceIds() |
| 310 | .contains(portDeviceMap.get(port)))) |
| 311 | .collect(Collectors.toSet()); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 312 | log.debug("portDown: nsNextObjStore contents for device {}:{}", |
| 313 | deviceId, nsSet); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 314 | for (NeighborSet ns : nsSet) { |
Saurav Das | 80980c7 | 2016-03-23 11:22:49 -0700 | [diff] [blame] | 315 | NeighborSetNextObjectiveStoreKey nsStoreKey = |
| 316 | new NeighborSetNextObjectiveStoreKey(deviceId, ns); |
| 317 | Integer nextId = nsNextObjStore.get(nsStoreKey); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 318 | if (nextId != null && isMaster) { |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 319 | log.info("**portDown in device {}: Removing Bucket " |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 320 | + "with Port {} to next object id {}", |
| 321 | deviceId, |
| 322 | port, |
| 323 | nextId); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 324 | // Create the bucket to be removed |
| 325 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment |
| 326 | .builder(); |
| 327 | tBuilder.setOutput(port) |
| 328 | .setEthDst(dstMac) |
| 329 | .setEthSrc(nodeMacAddr); |
| 330 | if (ns.getEdgeLabel() != NeighborSet.NO_EDGE_LABEL) { |
| 331 | tBuilder.pushMpls() |
| 332 | .copyTtlOut() |
| 333 | .setMpls(MplsLabel.mplsLabel(ns.getEdgeLabel())); |
| 334 | } |
| 335 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 336 | .builder() |
| 337 | .withType(NextObjective.Type.HASHED) //same as original |
| 338 | .withId(nextId) |
| 339 | .fromApp(appId) |
| 340 | .addTreatment(tBuilder.build()); |
Saurav Das | 1ce0a7b | 2016-10-21 14:06:29 -0700 | [diff] [blame] | 341 | ObjectiveContext context = new DefaultObjectiveContext( |
| 342 | (objective) -> log.debug("portDown removedFrom NextObj {} on {}", |
| 343 | nextId, deviceId), |
| 344 | (objective, error) -> |
| 345 | log.warn("portDown failed to removeFrom NextObj {} on {}: {}", |
| 346 | nextId, deviceId, error)); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 347 | NextObjective nextObjective = nextObjBuilder. |
Saurav Das | 1ce0a7b | 2016-10-21 14:06:29 -0700 | [diff] [blame] | 348 | removeFromExisting(context); |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 349 | |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 350 | flowObjectiveService.next(deviceId, nextObjective); |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 351 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | devicePortMap.get(portDeviceMap.get(port)).remove(port); |
| 355 | portDeviceMap.remove(port); |
| 356 | } |
| 357 | |
| 358 | /** |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 359 | * Adds or removes a port that has been configured with a subnet to a broadcast group |
| 360 | * for bridging. Note that this does not create the broadcast group itself. |
| 361 | * |
| 362 | * @param port the port on this device that needs to be added/removed to a bcast group |
| 363 | * @param subnet the subnet corresponding to the broadcast group |
| 364 | * @param portUp true if port is enabled, false if disabled |
| 365 | * @param isMaster true if local instance is the master |
| 366 | */ |
| 367 | public void processEdgePort(PortNumber port, Ip4Prefix subnet, |
| 368 | boolean portUp, boolean isMaster) { |
| 369 | if (!isMaster) { |
| 370 | return; |
| 371 | } |
| 372 | //get the next id for the subnet and edit it. |
| 373 | Integer nextId = getSubnetNextObjectiveId(subnet); |
| 374 | if (nextId == -1) { |
| 375 | if (portUp) { |
| 376 | log.debug("**Creating flooding group for first port enabled in" |
| 377 | + " subnet {} on dev {} port {}", subnet, deviceId, port); |
| 378 | createBcastGroupFromSubnet(subnet, Collections.singletonList(port)); |
| 379 | } else { |
| 380 | log.warn("Could not find flooding group for subnet {} on dev:{} when" |
| 381 | + " removing port:{}", subnet, deviceId, port); |
| 382 | } |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | log.info("**port{} in device {}: {} Bucket with Port {} to" |
| 387 | + " next-id {}", (portUp) ? "UP" : "DOWN", deviceId, |
| 388 | (portUp) ? "Adding" : "Removing", |
| 389 | port, nextId); |
| 390 | // Create the bucket to be added or removed |
| 391 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
| 392 | tBuilder.popVlan(); |
| 393 | tBuilder.setOutput(port); |
| 394 | |
| 395 | VlanId assignedVlanId = |
| 396 | srManager.getSubnetAssignedVlanId(this.deviceId, subnet); |
| 397 | TrafficSelector metadata = |
| 398 | DefaultTrafficSelector.builder().matchVlanId(assignedVlanId).build(); |
| 399 | |
| 400 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 401 | .builder().withId(nextId) |
| 402 | .withType(NextObjective.Type.BROADCAST).fromApp(appId) |
| 403 | .addTreatment(tBuilder.build()) |
| 404 | .withMeta(metadata); |
| 405 | |
| 406 | ObjectiveContext context = new DefaultObjectiveContext( |
| 407 | (objective) -> log.debug("port {} successfully {} NextObj {} on {}", |
| 408 | port, (portUp) ? "addedTo" : "removedFrom", |
| 409 | nextId, deviceId), |
| 410 | (objective, error) -> |
| 411 | log.warn("port {} failed to {} NextObj {} on {}: {}", |
| 412 | port, (portUp) ? "addTo" : "removeFrom", |
| 413 | nextId, deviceId, error)); |
| 414 | |
| 415 | NextObjective nextObj = (portUp) ? nextObjBuilder.addToExisting(context) |
| 416 | : nextObjBuilder.removeFromExisting(context); |
| 417 | log.debug("edgePort processed: Submited next objective {} in device {}", |
| 418 | nextId, deviceId); |
| 419 | flowObjectiveService.next(deviceId, nextObj); |
| 420 | } |
| 421 | |
| 422 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 423 | * Returns the next objective of type hashed associated with the neighborset. |
| 424 | * If there is no next objective for this neighborset, this method |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 425 | * would create a next objective and return. Optionally metadata can be |
| 426 | * passed in for the creation of the next objective. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 427 | * |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 428 | * @param ns neighborset |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 429 | * @param meta metadata passed into the creation of a Next Objective |
| 430 | * @return int if found or -1 if there are errors in the creation of the |
| 431 | * neighbor set. |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 432 | */ |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 433 | public int getNextObjectiveId(NeighborSet ns, TrafficSelector meta) { |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 434 | Integer nextId = nsNextObjStore. |
| 435 | get(new NeighborSetNextObjectiveStoreKey(deviceId, ns)); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 436 | if (nextId == null) { |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 437 | log.trace("getNextObjectiveId in device{}: Next objective id " |
| 438 | + "not found for {} and creating", deviceId, ns); |
| 439 | log.trace("getNextObjectiveId: nsNextObjStore contents for device {}: {}", |
| 440 | deviceId, |
| 441 | nsNextObjStore.entrySet() |
| 442 | .stream() |
| 443 | .filter((nsStoreEntry) -> |
| 444 | (nsStoreEntry.getKey().deviceId().equals(deviceId))) |
| 445 | .collect(Collectors.toList())); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 446 | createGroupsFromNeighborsets(Collections.singleton(ns), meta); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 447 | nextId = nsNextObjStore. |
| 448 | get(new NeighborSetNextObjectiveStoreKey(deviceId, ns)); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 449 | if (nextId == null) { |
| 450 | log.warn("getNextObjectiveId: unable to create next objective"); |
| 451 | return -1; |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 452 | } else { |
| 453 | log.debug("getNextObjectiveId in device{}: Next objective id {} " |
Sho SHIMIZU | af97343 | 2015-09-11 14:24:50 -0700 | [diff] [blame] | 454 | + "created for {}", deviceId, nextId, ns); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 455 | } |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 456 | } else { |
| 457 | log.trace("getNextObjectiveId in device{}: Next objective id {} " |
Sho SHIMIZU | af97343 | 2015-09-11 14:24:50 -0700 | [diff] [blame] | 458 | + "found for {}", deviceId, nextId, ns); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 459 | } |
Sho SHIMIZU | af97343 | 2015-09-11 14:24:50 -0700 | [diff] [blame] | 460 | return nextId; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 461 | } |
| 462 | |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 463 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 464 | * Returns the next objective of type broadcast associated with the subnet, |
| 465 | * or -1 if no such objective exists. Note that this method does NOT create |
| 466 | * 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] | 467 | * created at startup from network configuration. Typically this is used |
| 468 | * for L2 flooding within the subnet configured on the switch. |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 469 | * |
| 470 | * @param prefix subnet information |
| 471 | * @return int if found or -1 |
| 472 | */ |
| 473 | public int getSubnetNextObjectiveId(IpPrefix prefix) { |
| 474 | Integer nextId = subnetNextObjStore. |
| 475 | get(new SubnetNextObjectiveStoreKey(deviceId, prefix)); |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 476 | |
| 477 | return (nextId != null) ? nextId : -1; |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 481 | * Returns the next objective of type simple associated with the port on the |
| 482 | * device, given the treatment. Different treatments to the same port result |
| 483 | * in different next objectives. If no such objective exists, this method |
| 484 | * creates one and returns the id. Optionally metadata can be passed in for |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 485 | * the creation of the objective. Typically this is used for L2 and L3 forwarding |
| 486 | * to compute nodes and containers/VMs on the compute nodes directly attached |
| 487 | * to the switch. |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 488 | * |
| 489 | * @param portNum the port number for the simple next objective |
| 490 | * @param treatment the actions to apply on the packets (should include outport) |
| 491 | * @param meta optional metadata passed into the creation of the next objective |
| 492 | * @return int if found or created, -1 if there are errors during the |
| 493 | * creation of the next objective. |
| 494 | */ |
| 495 | public int getPortNextObjectiveId(PortNumber portNum, TrafficTreatment treatment, |
| 496 | TrafficSelector meta) { |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 497 | Integer nextId = portNextObjStore |
| 498 | .get(new PortNextObjectiveStoreKey(deviceId, portNum, treatment)); |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 499 | if (nextId == null) { |
| 500 | log.trace("getPortNextObjectiveId in device{}: Next objective id " |
| 501 | + "not found for {} and {} creating", deviceId, portNum); |
| 502 | createGroupFromPort(portNum, treatment, meta); |
| 503 | nextId = portNextObjStore.get( |
| 504 | new PortNextObjectiveStoreKey(deviceId, portNum, treatment)); |
| 505 | if (nextId == null) { |
| 506 | log.warn("getPortNextObjectiveId: unable to create next obj" |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 507 | + "for dev:{} port:{}", deviceId, portNum); |
| 508 | return -1; |
| 509 | } |
| 510 | } |
| 511 | return nextId; |
| 512 | } |
| 513 | |
| 514 | /** |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 515 | * Checks if the next objective ID (group) for the neighbor set exists or not. |
| 516 | * |
| 517 | * @param ns neighbor set to check |
| 518 | * @return true if it exists, false otherwise |
| 519 | */ |
| 520 | public boolean hasNextObjectiveId(NeighborSet ns) { |
| 521 | Integer nextId = nsNextObjStore. |
| 522 | get(new NeighborSetNextObjectiveStoreKey(deviceId, ns)); |
| 523 | if (nextId == null) { |
| 524 | return false; |
| 525 | } |
| 526 | |
| 527 | return true; |
| 528 | } |
| 529 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 530 | // Empty implementation |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 531 | protected void newNeighbor(Link newLink) { |
| 532 | } |
| 533 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 534 | // Empty implementation |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 535 | protected void newPortToExistingNeighbor(Link newLink) { |
| 536 | } |
| 537 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 538 | // Empty implementation |
| 539 | protected Set<NeighborSet> |
| 540 | computeImpactedNeighborsetForPortEvent(DeviceId impactedNeighbor, |
| 541 | Set<DeviceId> updatedNeighbors) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 542 | return null; |
| 543 | } |
| 544 | |
| 545 | private void populateNeighborMaps() { |
| 546 | Set<Link> outgoingLinks = linkService.getDeviceEgressLinks(deviceId); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 547 | for (Link link : outgoingLinks) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 548 | if (link.type() != Link.Type.DIRECT) { |
| 549 | continue; |
| 550 | } |
| 551 | addNeighborAtPort(link.dst().deviceId(), link.src().port()); |
| 552 | } |
| 553 | } |
| 554 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 555 | protected void addNeighborAtPort(DeviceId neighborId, |
| 556 | PortNumber portToNeighbor) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 557 | // Update DeviceToPort database |
| 558 | log.debug("Device {} addNeighborAtPort: neighbor {} at port {}", |
| 559 | deviceId, neighborId, portToNeighbor); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 560 | Set<PortNumber> ports = Collections |
| 561 | .newSetFromMap(new ConcurrentHashMap<PortNumber, Boolean>()); |
| 562 | ports.add(portToNeighbor); |
| 563 | Set<PortNumber> portnums = devicePortMap.putIfAbsent(neighborId, ports); |
| 564 | if (portnums != null) { |
| 565 | portnums.add(portToNeighbor); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | // Update portToDevice database |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 569 | DeviceId prev = portDeviceMap.putIfAbsent(portToNeighbor, neighborId); |
| 570 | if (prev != null) { |
| 571 | log.warn("Device: {} port: {} has neighbor: {}. NOT updating " |
| 572 | + "to neighbor: {}", deviceId, portToNeighbor, prev, neighborId); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 573 | } |
| 574 | } |
| 575 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 576 | protected Set<Set<DeviceId>> getPowerSetOfNeighbors(Set<DeviceId> neighbors) { |
Sho SHIMIZU | 6cfc02d | 2015-09-11 11:19:11 -0700 | [diff] [blame] | 577 | List<DeviceId> list = new ArrayList<>(neighbors); |
| 578 | Set<Set<DeviceId>> sets = new HashSet<>(); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 579 | // get the number of elements in the neighbors |
| 580 | int elements = list.size(); |
| 581 | // the number of members of a power set is 2^n |
| 582 | // including the empty set |
| 583 | int powerElements = (1 << elements); |
| 584 | |
| 585 | // run a binary counter for the number of power elements |
| 586 | // NOTE: Exclude empty set |
| 587 | for (long i = 1; i < powerElements; i++) { |
Sho SHIMIZU | 6cfc02d | 2015-09-11 11:19:11 -0700 | [diff] [blame] | 588 | Set<DeviceId> neighborSubSet = new HashSet<>(); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 589 | for (int j = 0; j < elements; j++) { |
| 590 | if ((i >> j) % 2 == 1) { |
| 591 | neighborSubSet.add(list.get(j)); |
| 592 | } |
| 593 | } |
| 594 | sets.add(neighborSubSet); |
| 595 | } |
| 596 | return sets; |
| 597 | } |
| 598 | |
| 599 | private boolean isSegmentIdSameAsNodeSegmentId(DeviceId deviceId, int sId) { |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 600 | int segmentId; |
| 601 | try { |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 602 | /* |
| 603 | * IPv6 sid is not inserted. this part of the code is not used for now. |
| 604 | */ |
| 605 | segmentId = deviceConfig.getIPv4SegmentId(deviceId); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 606 | } catch (DeviceConfigNotFoundException e) { |
| 607 | log.warn(e.getMessage() + " Aborting isSegmentIdSameAsNodeSegmentId."); |
| 608 | return false; |
| 609 | } |
| 610 | |
| 611 | return segmentId == sId; |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 612 | } |
| 613 | |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 614 | protected List<Integer> getSegmentIdsTobePairedWithNeighborSet(Set<DeviceId> neighbors) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 615 | |
Sho SHIMIZU | 6cfc02d | 2015-09-11 11:19:11 -0700 | [diff] [blame] | 616 | List<Integer> nsSegmentIds = new ArrayList<>(); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 617 | |
sangho | b35a619 | 2015-04-01 13:05:26 -0700 | [diff] [blame] | 618 | // Always pair up with no edge label |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 619 | // If (neighbors.size() == 1) { |
sangho | b35a619 | 2015-04-01 13:05:26 -0700 | [diff] [blame] | 620 | nsSegmentIds.add(-1); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 621 | // } |
sangho | b35a619 | 2015-04-01 13:05:26 -0700 | [diff] [blame] | 622 | |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 623 | // Filter out SegmentIds matching with the |
| 624 | // nodes in the combo |
| 625 | for (Integer sId : allSegmentIds) { |
Pier Ventre | e0ae7a3 | 2016-11-23 09:57:42 -0800 | [diff] [blame] | 626 | if (sId.equals(this.ipv4NodeSegmentId)) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 627 | continue; |
| 628 | } |
| 629 | boolean filterOut = false; |
| 630 | // Check if the edge label being set is of |
| 631 | // any node in the Neighbor set |
| 632 | for (DeviceId deviceId : neighbors) { |
| 633 | if (isSegmentIdSameAsNodeSegmentId(deviceId, sId)) { |
| 634 | filterOut = true; |
| 635 | break; |
| 636 | } |
| 637 | } |
| 638 | if (!filterOut) { |
| 639 | nsSegmentIds.add(sId); |
| 640 | } |
| 641 | } |
| 642 | return nsSegmentIds; |
| 643 | } |
| 644 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 645 | /** |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 646 | * Creates hash groups from a set of NeighborSet given. |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 647 | * |
| 648 | * @param nsSet a set of NeighborSet |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 649 | * @param meta metadata passed into the creation of a Next Objective |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 650 | */ |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 651 | public void createGroupsFromNeighborsets(Set<NeighborSet> nsSet, |
| 652 | TrafficSelector meta) { |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 653 | for (NeighborSet ns : nsSet) { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 654 | int nextId = flowObjectiveService.allocateNextId(); |
| 655 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 656 | .builder().withId(nextId) |
| 657 | .withType(NextObjective.Type.HASHED).fromApp(appId); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 658 | for (DeviceId neighborId : ns.getDeviceIds()) { |
| 659 | if (devicePortMap.get(neighborId) == null) { |
| 660 | log.warn("Neighbor {} is not in the port map yet for dev:{}", |
| 661 | neighborId, deviceId); |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 662 | return; |
Jon Hall | cbd1b39 | 2017-01-18 20:15:44 -0800 | [diff] [blame] | 663 | } else if (devicePortMap.get(neighborId).isEmpty()) { |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 664 | log.warn("There are no ports for " |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 665 | + "the Device {} in the port map yet", neighborId); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 666 | return; |
sangho | 834e4b0 | 2015-05-01 09:38:25 -0700 | [diff] [blame] | 667 | } |
| 668 | |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 669 | MacAddress neighborMac; |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 670 | try { |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 671 | neighborMac = deviceConfig.getDeviceMac(neighborId); |
Charles Chan | 0b4e618 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 672 | } catch (DeviceConfigNotFoundException e) { |
| 673 | log.warn(e.getMessage() + " Aborting createGroupsFromNeighborsets."); |
| 674 | return; |
| 675 | } |
| 676 | |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 677 | for (PortNumber sp : devicePortMap.get(neighborId)) { |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 678 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment |
| 679 | .builder(); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 680 | tBuilder.setEthDst(neighborMac) |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 681 | .setEthSrc(nodeMacAddr); |
| 682 | if (ns.getEdgeLabel() != NeighborSet.NO_EDGE_LABEL) { |
Charles Chan | 68aa62d | 2015-11-09 16:37:23 -0800 | [diff] [blame] | 683 | tBuilder.pushMpls() |
| 684 | .copyTtlOut() |
| 685 | .setMpls(MplsLabel.mplsLabel(ns.getEdgeLabel())); |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 686 | } |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 687 | tBuilder.setOutput(sp); |
Srikanth Vavilapalli | f5b234a | 2015-04-21 13:04:13 -0700 | [diff] [blame] | 688 | nextObjBuilder.addTreatment(tBuilder.build()); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 689 | } |
| 690 | } |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 691 | if (meta != null) { |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 692 | nextObjBuilder.withMeta(meta); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 693 | } |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 694 | |
| 695 | ObjectiveContext context = new DefaultObjectiveContext( |
| 696 | (objective) -> log.debug("createGroupsFromNeighborsets installed NextObj {} on {}", |
| 697 | nextId, deviceId), |
| 698 | (objective, error) -> |
| 699 | log.warn("createGroupsFromNeighborsets failed to install NextObj {} on {}: {}", |
| 700 | nextId, deviceId, error)); |
| 701 | NextObjective nextObj = nextObjBuilder.add(context); |
| 702 | log.debug("**createGroupsFromNeighborsets: Submited " |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 703 | + "next objective {} in device {}", |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 704 | nextId, deviceId); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 705 | flowObjectiveService.next(deviceId, nextObj); |
Srikanth Vavilapalli | 2318191 | 2015-05-04 09:48:09 -0700 | [diff] [blame] | 706 | nsNextObjStore.put(new NeighborSetNextObjectiveStoreKey(deviceId, ns), |
| 707 | nextId); |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 708 | } |
| 709 | } |
Srikanth Vavilapalli | 717361f | 2015-03-16 12:06:04 -0700 | [diff] [blame] | 710 | |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 711 | /** |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 712 | * Creates broadcast groups for all ports in the same subnet for |
| 713 | * all configured subnets. |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 714 | */ |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 715 | public void createGroupsFromSubnetConfig() { |
Pier Ventre | 10bd8d1 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 716 | Map<IpPrefix, List<PortNumber>> subnetPortMap; |
Saurav Das | 7a1ffca | 2016-03-28 19:00:18 -0700 | [diff] [blame] | 717 | try { |
| 718 | subnetPortMap = this.deviceConfig.getSubnetPortsMap(this.deviceId); |
| 719 | } catch (DeviceConfigNotFoundException e) { |
| 720 | log.warn(e.getMessage() |
| 721 | + " Not creating broadcast groups for device: " + deviceId); |
| 722 | return; |
| 723 | } |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 724 | // Construct a broadcast group for each subnet |
Pier Ventre | 10bd8d1 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 725 | subnetPortMap.forEach((subnet, ports) -> { |
| 726 | if (subnet.isIp4()) { |
| 727 | createBcastGroupFromSubnet(subnet.getIp4Prefix(), ports); |
| 728 | } |
| 729 | }); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 730 | } |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 731 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 732 | /** |
| 733 | * Creates a single broadcast group from a given subnet and list of ports. |
| 734 | * |
| 735 | * @param subnet a configured subnet |
| 736 | * @param ports list of ports in the subnet |
| 737 | */ |
| 738 | public void createBcastGroupFromSubnet(Ip4Prefix subnet, List<PortNumber> ports) { |
| 739 | SubnetNextObjectiveStoreKey key = |
| 740 | new SubnetNextObjectiveStoreKey(deviceId, subnet); |
Charles Chan | 9f676b6 | 2015-10-29 14:58:10 -0700 | [diff] [blame] | 741 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 742 | if (subnetNextObjStore.containsKey(key)) { |
| 743 | log.debug("Broadcast group for device {} and subnet {} exists", |
| 744 | deviceId, subnet); |
| 745 | return; |
| 746 | } |
Charles Chan | 188ebf5 | 2015-12-23 00:15:11 -0800 | [diff] [blame] | 747 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 748 | VlanId assignedVlanId = |
| 749 | srManager.getSubnetAssignedVlanId(this.deviceId, subnet); |
| 750 | TrafficSelector metadata = |
| 751 | DefaultTrafficSelector.builder().matchVlanId(assignedVlanId).build(); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 752 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 753 | int nextId = flowObjectiveService.allocateNextId(); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 754 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 755 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 756 | .builder().withId(nextId) |
| 757 | .withType(NextObjective.Type.BROADCAST).fromApp(appId) |
| 758 | .withMeta(metadata); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 759 | |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 760 | ports.forEach(port -> { |
| 761 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
| 762 | tBuilder.popVlan(); |
| 763 | tBuilder.setOutput(port); |
| 764 | nextObjBuilder.addTreatment(tBuilder.build()); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 765 | }); |
Saurav Das | 1a129a0 | 2016-11-18 15:21:57 -0800 | [diff] [blame] | 766 | |
| 767 | NextObjective nextObj = nextObjBuilder.add(); |
| 768 | flowObjectiveService.next(deviceId, nextObj); |
| 769 | log.debug("createBcastGroupFromSubnet: Submited next objective {} in device {}", |
| 770 | nextId, deviceId); |
| 771 | |
| 772 | subnetNextObjStore.put(key, nextId); |
Charles Chan | c42e84e | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 773 | } |
| 774 | |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 775 | /** |
Saurav Das | 4ce4596 | 2015-11-24 23:21:05 -0800 | [diff] [blame] | 776 | * Create simple next objective for a single port. The treatments can include |
| 777 | * all outgoing actions that need to happen on the packet. |
| 778 | * |
| 779 | * @param portNum the outgoing port on the device |
| 780 | * @param treatment the actions to apply on the packets (should include outport) |
| 781 | * @param meta optional data to pass to the driver |
| 782 | */ |
| 783 | public void createGroupFromPort(PortNumber portNum, TrafficTreatment treatment, |
| 784 | TrafficSelector meta) { |
| 785 | int nextId = flowObjectiveService.allocateNextId(); |
| 786 | PortNextObjectiveStoreKey key = new PortNextObjectiveStoreKey( |
| 787 | deviceId, portNum, treatment); |
| 788 | |
| 789 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 790 | .builder().withId(nextId) |
| 791 | .withType(NextObjective.Type.SIMPLE) |
| 792 | .addTreatment(treatment) |
| 793 | .fromApp(appId) |
| 794 | .withMeta(meta); |
| 795 | |
| 796 | NextObjective nextObj = nextObjBuilder.add(); |
| 797 | flowObjectiveService.next(deviceId, nextObj); |
| 798 | log.debug("createGroupFromPort: Submited next objective {} in device {} " |
| 799 | + "for port {}", nextId, deviceId, portNum); |
| 800 | |
| 801 | portNextObjStore.put(key, nextId); |
| 802 | } |
| 803 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 804 | /** |
| 805 | * Removes groups for the next objective ID given. |
| 806 | * |
| 807 | * @param objectiveId next objective ID to remove |
| 808 | * @return true if succeeds, false otherwise |
| 809 | */ |
| 810 | public boolean removeGroup(int objectiveId) { |
| 811 | |
| 812 | if (nsNextObjStore.containsValue(objectiveId)) { |
| 813 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 814 | .builder().withId(objectiveId) |
| 815 | .withType(NextObjective.Type.HASHED).fromApp(appId); |
Charles Chan | 216e3c8 | 2016-04-23 14:48:16 -0700 | [diff] [blame] | 816 | ObjectiveContext context = new DefaultObjectiveContext( |
| 817 | (objective) -> log.debug("RemoveGroup removes NextObj {} on {}", |
| 818 | objectiveId, deviceId), |
| 819 | (objective, error) -> |
| 820 | log.warn("RemoveGroup failed to remove NextObj {} on {}: {}", |
| 821 | objectiveId, deviceId, error)); |
| 822 | NextObjective nextObjective = nextObjBuilder.remove(context); |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 823 | log.info("**removeGroup: Submited " |
| 824 | + "next objective {} in device {}", |
| 825 | objectiveId, deviceId); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 826 | flowObjectiveService.next(deviceId, nextObjective); |
| 827 | |
| 828 | for (Map.Entry<NeighborSetNextObjectiveStoreKey, Integer> entry: nsNextObjStore.entrySet()) { |
| 829 | if (entry.getValue().equals(objectiveId)) { |
| 830 | nsNextObjStore.remove(entry.getKey()); |
| 831 | break; |
| 832 | } |
| 833 | } |
sangho | 0b2b6d1 | 2015-05-20 22:16:38 -0700 | [diff] [blame] | 834 | return true; |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | return false; |
| 838 | } |
Srikanth Vavilapalli | f3a8bc0 | 2015-05-22 13:47:31 -0700 | [diff] [blame] | 839 | |
Charles Chan | e849c19 | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 840 | /** |
| 841 | * Removes all groups from all next objective stores. |
| 842 | */ |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 843 | public void removeAllGroups() { |
| 844 | for (Map.Entry<NeighborSetNextObjectiveStoreKey, Integer> entry: |
| 845 | nsNextObjStore.entrySet()) { |
| 846 | removeGroup(entry.getValue()); |
| 847 | } |
| 848 | for (Map.Entry<PortNextObjectiveStoreKey, Integer> entry: |
| 849 | portNextObjStore.entrySet()) { |
| 850 | removeGroup(entry.getValue()); |
| 851 | } |
| 852 | for (Map.Entry<SubnetNextObjectiveStoreKey, Integer> entry: |
| 853 | subnetNextObjStore.entrySet()) { |
| 854 | removeGroup(entry.getValue()); |
| 855 | } |
| 856 | // should probably clean local stores port-neighbor |
| 857 | } |
Srikanth Vavilapalli | ed12ae5 | 2015-02-09 14:43:19 -0800 | [diff] [blame] | 858 | } |