Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Foundation |
| 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 | */ |
| 16 | package org.opencord.olt.impl; |
| 17 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 18 | import org.onlab.packet.EthType; |
| 19 | import org.onlab.packet.IPv4; |
| 20 | import org.onlab.packet.IPv6; |
| 21 | import org.onlab.packet.MacAddress; |
| 22 | import org.onlab.packet.TpPort; |
| 23 | import org.onlab.packet.VlanId; |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 24 | import org.onlab.util.KryoNamespace; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 25 | import org.onlab.util.Tools; |
| 26 | import org.onosproject.cfg.ComponentConfigService; |
| 27 | import org.onosproject.core.ApplicationId; |
| 28 | import org.onosproject.core.CoreService; |
| 29 | import org.onosproject.mastership.MastershipService; |
| 30 | import org.onosproject.net.AnnotationKeys; |
Matteo Scandolo | 3a037a3 | 2020-04-01 12:17:50 -0700 | [diff] [blame] | 31 | import org.onosproject.net.ConnectPoint; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 32 | import org.onosproject.net.DeviceId; |
| 33 | import org.onosproject.net.Port; |
| 34 | import org.onosproject.net.PortNumber; |
| 35 | import org.onosproject.net.device.DeviceService; |
| 36 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 37 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 38 | import org.onosproject.net.flow.TrafficSelector; |
| 39 | import org.onosproject.net.flow.TrafficTreatment; |
| 40 | import org.onosproject.net.flow.criteria.Criteria; |
| 41 | import org.onosproject.net.flowobjective.DefaultFilteringObjective; |
| 42 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 43 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 44 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 45 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 46 | import org.onosproject.net.flowobjective.Objective; |
| 47 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 48 | import org.onosproject.net.flowobjective.ObjectiveError; |
| 49 | import org.onosproject.net.meter.MeterId; |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 50 | import org.onosproject.store.serializers.KryoNamespaces; |
| 51 | import org.onosproject.store.service.Serializer; |
| 52 | import org.onosproject.store.service.StorageService; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 53 | import org.opencord.olt.internalapi.AccessDeviceFlowService; |
| 54 | import org.opencord.olt.internalapi.AccessDeviceMeterService; |
| 55 | import org.opencord.sadis.BandwidthProfileInformation; |
| 56 | import org.opencord.sadis.BaseInformationService; |
| 57 | import org.opencord.sadis.SadisService; |
| 58 | import org.opencord.sadis.SubscriberAndDeviceInformation; |
| 59 | import org.opencord.sadis.UniTagInformation; |
| 60 | import org.osgi.service.component.ComponentContext; |
| 61 | import org.osgi.service.component.annotations.Activate; |
| 62 | import org.osgi.service.component.annotations.Component; |
| 63 | import org.osgi.service.component.annotations.Deactivate; |
| 64 | import org.osgi.service.component.annotations.Modified; |
| 65 | import org.osgi.service.component.annotations.Reference; |
| 66 | import org.osgi.service.component.annotations.ReferenceCardinality; |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 67 | import org.osgi.service.component.annotations.ReferencePolicy; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 68 | import org.slf4j.Logger; |
| 69 | |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 70 | import java.util.Dictionary; |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 71 | import java.util.Optional; |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 72 | import java.util.Map; |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 73 | import java.util.Properties; |
| 74 | import java.util.concurrent.BlockingQueue; |
| 75 | import java.util.concurrent.CompletableFuture; |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 76 | import java.util.concurrent.LinkedBlockingQueue; |
| 77 | |
| 78 | import static com.google.common.base.Strings.isNullOrEmpty; |
| 79 | import static org.onlab.util.Tools.get; |
| 80 | import static org.opencord.olt.impl.OsgiPropertyConstants.*; |
| 81 | import static org.slf4j.LoggerFactory.getLogger; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Provisions flow rules on access devices. |
| 85 | */ |
| 86 | @Component(immediate = true, property = { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 87 | ENABLE_DHCP_ON_NNI + ":Boolean=" + ENABLE_DHCP_ON_NNI_DEFAULT, |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 88 | ENABLE_DHCP_V4 + ":Boolean=" + ENABLE_DHCP_V4_DEFAULT, |
| 89 | ENABLE_DHCP_V6 + ":Boolean=" + ENABLE_DHCP_V6_DEFAULT, |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 90 | ENABLE_IGMP_ON_NNI + ":Boolean=" + ENABLE_IGMP_ON_NNI_DEFAULT, |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 91 | ENABLE_EAPOL + ":Boolean=" + ENABLE_EAPOL_DEFAULT, |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 92 | ENABLE_PPPOE + ":Boolean=" + ENABLE_PPPOE_DEFAULT, |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 93 | DEFAULT_TP_ID + ":Integer=" + DEFAULT_TP_ID_DEFAULT |
| 94 | }) |
| 95 | public class OltFlowService implements AccessDeviceFlowService { |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 96 | private static final String SADIS_NOT_RUNNING = "Sadis is not running."; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 97 | private static final String APP_NAME = "org.opencord.olt"; |
| 98 | private static final int NONE_TP_ID = -1; |
| 99 | private static final int NO_PCP = -1; |
| 100 | private static final Integer MAX_PRIORITY = 10000; |
| 101 | private static final Integer MIN_PRIORITY = 1000; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 102 | private static final String INSTALLED = "installed"; |
| 103 | private static final String REMOVED = "removed"; |
| 104 | private static final String INSTALLATION = "installation"; |
| 105 | private static final String REMOVAL = "removal"; |
| 106 | private static final String V4 = "V4"; |
| 107 | private static final String V6 = "V6"; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 108 | |
| 109 | private final Logger log = getLogger(getClass()); |
| 110 | |
| 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 112 | protected FlowObjectiveService flowObjectiveService; |
| 113 | |
| 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 115 | protected CoreService coreService; |
| 116 | |
| 117 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 118 | protected MastershipService mastershipService; |
| 119 | |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 120 | @Reference(cardinality = ReferenceCardinality.OPTIONAL, |
| 121 | bind = "bindSadisService", |
| 122 | unbind = "unbindSadisService", |
| 123 | policy = ReferencePolicy.DYNAMIC) |
| 124 | protected volatile SadisService sadisService; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 125 | |
| 126 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 127 | protected DeviceService deviceService; |
| 128 | |
| 129 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 130 | protected AccessDeviceMeterService oltMeterService; |
| 131 | |
| 132 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 133 | protected ComponentConfigService componentConfigService; |
| 134 | |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 135 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 136 | protected StorageService storageService; |
| 137 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 138 | /** |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 139 | * Create DHCP trap flow on NNI port(s). |
| 140 | */ |
| 141 | protected boolean enableDhcpOnNni = ENABLE_DHCP_ON_NNI_DEFAULT; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 142 | |
| 143 | /** |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 144 | * Enable flows for DHCP v4 if dhcp is required in sadis config. |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 145 | **/ |
| 146 | protected boolean enableDhcpV4 = ENABLE_DHCP_V4_DEFAULT; |
| 147 | |
| 148 | /** |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 149 | * Enable flows for DHCP v6 if dhcp is required in sadis config. |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 150 | **/ |
| 151 | protected boolean enableDhcpV6 = ENABLE_DHCP_V6_DEFAULT; |
| 152 | |
| 153 | /** |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 154 | * Create IGMP trap flow on NNI port(s). |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 155 | **/ |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 156 | protected boolean enableIgmpOnNni = ENABLE_IGMP_ON_NNI_DEFAULT; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 157 | |
| 158 | /** |
| 159 | * Send EAPOL authentication trap flows before subscriber provisioning. |
| 160 | **/ |
| 161 | protected boolean enableEapol = ENABLE_EAPOL_DEFAULT; |
| 162 | |
| 163 | /** |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 164 | * Send PPPoED authentication trap flows before subscriber provisioning. |
| 165 | **/ |
| 166 | protected boolean enablePppoe = ENABLE_PPPOE_DEFAULT; |
| 167 | |
| 168 | /** |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 169 | * Default technology profile id that is used for authentication trap flows. |
| 170 | **/ |
| 171 | protected int defaultTechProfileId = DEFAULT_TP_ID_DEFAULT; |
| 172 | |
| 173 | protected ApplicationId appId; |
| 174 | protected BaseInformationService<BandwidthProfileInformation> bpService; |
| 175 | protected BaseInformationService<SubscriberAndDeviceInformation> subsService; |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 176 | protected Map<DeviceId, BlockingQueue<SubscriberFlowInfo>> pendingEapolForDevice; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 177 | |
| 178 | @Activate |
| 179 | public void activate(ComponentContext context) { |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 180 | if (sadisService != null) { |
| 181 | bpService = sadisService.getBandwidthProfileService(); |
| 182 | subsService = sadisService.getSubscriberInfoService(); |
| 183 | } else { |
| 184 | log.warn(SADIS_NOT_RUNNING); |
| 185 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 186 | componentConfigService.registerProperties(getClass()); |
| 187 | appId = coreService.getAppId(APP_NAME); |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 188 | KryoNamespace serializer = KryoNamespace.newBuilder() |
| 189 | .register(KryoNamespaces.API) |
| 190 | .register(UniTagInformation.class) |
| 191 | .register(SubscriberFlowInfo.class) |
| 192 | .register(LinkedBlockingQueue.class) |
| 193 | .build(); |
| 194 | pendingEapolForDevice = storageService.<DeviceId, BlockingQueue<SubscriberFlowInfo>>consistentMapBuilder() |
| 195 | .withName("volt-pending-eapol") |
| 196 | .withSerializer(Serializer.using(serializer)) |
| 197 | .withApplicationId(appId) |
| 198 | .build().asJavaMap(); |
Andrea Campanella | fee8642 | 2020-06-04 16:01:27 +0200 | [diff] [blame] | 199 | log.info("started"); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | |
| 203 | @Deactivate |
| 204 | public void deactivate(ComponentContext context) { |
| 205 | componentConfigService.unregisterProperties(getClass(), false); |
Andrea Campanella | fee8642 | 2020-06-04 16:01:27 +0200 | [diff] [blame] | 206 | log.info("stopped"); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | @Modified |
| 210 | public void modified(ComponentContext context) { |
| 211 | |
| 212 | Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties(); |
| 213 | |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 214 | Boolean o = Tools.isPropertyEnabled(properties, ENABLE_DHCP_ON_NNI); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 215 | if (o != null) { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 216 | enableDhcpOnNni = o; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 219 | Boolean v4 = Tools.isPropertyEnabled(properties, ENABLE_DHCP_V4); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 220 | if (v4 != null) { |
| 221 | enableDhcpV4 = v4; |
| 222 | } |
| 223 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 224 | Boolean v6 = Tools.isPropertyEnabled(properties, ENABLE_DHCP_V6); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 225 | if (v6 != null) { |
| 226 | enableDhcpV6 = v6; |
| 227 | } |
| 228 | |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 229 | Boolean p = Tools.isPropertyEnabled(properties, ENABLE_IGMP_ON_NNI); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 230 | if (p != null) { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 231 | enableIgmpOnNni = p; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 232 | } |
| 233 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 234 | Boolean eap = Tools.isPropertyEnabled(properties, ENABLE_EAPOL); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 235 | if (eap != null) { |
| 236 | enableEapol = eap; |
| 237 | } |
| 238 | |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 239 | Boolean pppoe = Tools.isPropertyEnabled(properties, ENABLE_PPPOE); |
| 240 | if (pppoe != null) { |
| 241 | enablePppoe = pppoe; |
| 242 | } |
| 243 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 244 | String tpId = get(properties, DEFAULT_TP_ID); |
| 245 | defaultTechProfileId = isNullOrEmpty(tpId) ? DEFAULT_TP_ID_DEFAULT : Integer.parseInt(tpId.trim()); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 246 | |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 247 | log.info("modified. Values = enableDhcpOnNni: {}, enableDhcpV4: {}, " + |
| 248 | "enableDhcpV6:{}, enableIgmpOnNni:{}, " + |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 249 | "enableEapol{}, enablePppoe{}, defaultTechProfileId: {}", |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 250 | enableDhcpOnNni, enableDhcpV4, enableDhcpV6, |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 251 | enableIgmpOnNni, enableEapol, enablePppoe, |
| 252 | defaultTechProfileId); |
Andrea Campanella | fee8642 | 2020-06-04 16:01:27 +0200 | [diff] [blame] | 253 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 256 | protected void bindSadisService(SadisService service) { |
| 257 | sadisService = service; |
| 258 | bpService = sadisService.getBandwidthProfileService(); |
| 259 | subsService = sadisService.getSubscriberInfoService(); |
| 260 | log.info("Sadis-service binds to onos."); |
| 261 | } |
| 262 | |
| 263 | protected void unbindSadisService(SadisService service) { |
| 264 | sadisService = null; |
| 265 | bpService = null; |
| 266 | subsService = null; |
| 267 | log.info("Sadis-service unbinds from onos."); |
| 268 | } |
| 269 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 270 | @Override |
| 271 | public void processDhcpFilteringObjectives(DeviceId devId, PortNumber port, |
| 272 | MeterId upstreamMeterId, |
| 273 | UniTagInformation tagInformation, |
| 274 | boolean install, |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 275 | boolean upstream, |
| 276 | Optional<CompletableFuture<ObjectiveError>> dhcpFuture) { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 277 | if (upstream) { |
| 278 | // for UNI ports |
| 279 | if (tagInformation != null && !tagInformation.getIsDhcpRequired()) { |
| 280 | log.debug("Dhcp provisioning is disabled for UNI port {} on " |
| 281 | + "device {} for service {}", port, devId, |
| 282 | tagInformation.getServiceName()); |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 283 | dhcpFuture.ifPresent(f -> f.complete(null)); |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 284 | return; |
| 285 | } |
| 286 | } else { |
| 287 | // for NNI ports |
| 288 | if (!enableDhcpOnNni) { |
| 289 | log.debug("Dhcp provisioning is disabled for NNI port {} on " |
| 290 | + "device {}", port, devId); |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 291 | dhcpFuture.ifPresent(f -> f.complete(null)); |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 292 | return; |
| 293 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 294 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 295 | int techProfileId = tagInformation != null ? tagInformation.getTechnologyProfileId() : NONE_TP_ID; |
| 296 | VlanId cTag = tagInformation != null ? tagInformation.getPonCTag() : VlanId.NONE; |
| 297 | VlanId unitagMatch = tagInformation != null ? tagInformation.getUniTagMatch() : VlanId.ANY; |
Andrea Campanella | 3a96ce8 | 2021-02-09 12:32:42 +0100 | [diff] [blame] | 298 | Byte vlanPcp = tagInformation != null && tagInformation.getUsPonCTagPriority() != NO_PCP |
| 299 | ? (byte) tagInformation.getUsPonCTagPriority() : null; |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 300 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 301 | |
| 302 | if (enableDhcpV4) { |
| 303 | int udpSrc = (upstream) ? 68 : 67; |
| 304 | int udpDst = (upstream) ? 67 : 68; |
| 305 | |
| 306 | EthType ethType = EthType.EtherType.IPV4.ethType(); |
| 307 | byte protocol = IPv4.PROTOCOL_UDP; |
| 308 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 309 | addDhcpFilteringObjectives(devId, port, udpSrc, udpDst, ethType, |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 310 | upstreamMeterId, techProfileId, protocol, cTag, unitagMatch, |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 311 | vlanPcp, upstream, install, dhcpFuture); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | if (enableDhcpV6) { |
| 315 | int udpSrc = (upstream) ? 547 : 546; |
| 316 | int udpDst = (upstream) ? 546 : 547; |
| 317 | |
| 318 | EthType ethType = EthType.EtherType.IPV6.ethType(); |
| 319 | byte protocol = IPv6.PROTOCOL_UDP; |
| 320 | |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 321 | addDhcpFilteringObjectives(devId, port, udpSrc, udpDst, ethType, |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 322 | upstreamMeterId, techProfileId, protocol, cTag, unitagMatch, |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 323 | vlanPcp, upstream, install, dhcpFuture); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 324 | } |
| 325 | } |
| 326 | |
| 327 | private void addDhcpFilteringObjectives(DeviceId devId, PortNumber port, int udpSrc, int udpDst, |
| 328 | EthType ethType, MeterId upstreamMeterId, int techProfileId, byte protocol, |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 329 | VlanId cTag, VlanId unitagMatch, |
| 330 | Byte vlanPcp, boolean upstream, |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 331 | boolean install, Optional<CompletableFuture<ObjectiveError>> dhcpFuture) { |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 332 | |
| 333 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); |
| 334 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); |
| 335 | |
| 336 | if (upstreamMeterId != null) { |
| 337 | treatmentBuilder.meter(upstreamMeterId); |
| 338 | } |
| 339 | |
| 340 | if (techProfileId != NONE_TP_ID) { |
| 341 | treatmentBuilder.writeMetadata(createTechProfValueForWm(unitagMatch, techProfileId), 0); |
| 342 | } |
| 343 | |
| 344 | FilteringObjective.Builder dhcpUpstreamBuilder = (install ? builder.permit() : builder.deny()) |
| 345 | .withKey(Criteria.matchInPort(port)) |
| 346 | .addCondition(Criteria.matchEthType(ethType)) |
| 347 | .addCondition(Criteria.matchIPProtocol(protocol)) |
| 348 | .addCondition(Criteria.matchUdpSrc(TpPort.tpPort(udpSrc))) |
| 349 | .addCondition(Criteria.matchUdpDst(TpPort.tpPort(udpDst))) |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 350 | .fromApp(appId) |
| 351 | .withPriority(MAX_PRIORITY); |
| 352 | |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 353 | //VLAN changes and PCP matching need to happen only in the upstream directions |
| 354 | if (upstream) { |
| 355 | treatmentBuilder.setVlanId(cTag); |
| 356 | if (!VlanId.vlanId(VlanId.NO_VID).equals(unitagMatch)) { |
| 357 | dhcpUpstreamBuilder.addCondition(Criteria.matchVlanId(unitagMatch)); |
| 358 | } |
| 359 | if (vlanPcp != null) { |
| 360 | treatmentBuilder.setVlanPcp(vlanPcp); |
| 361 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 362 | } |
| 363 | |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 364 | dhcpUpstreamBuilder.withMeta(treatmentBuilder |
| 365 | .setOutput(PortNumber.CONTROLLER).build()); |
| 366 | |
| 367 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 368 | FilteringObjective dhcpUpstream = dhcpUpstreamBuilder.add(new ObjectiveContext() { |
| 369 | @Override |
| 370 | public void onSuccess(Objective objective) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 371 | log.info("DHCP {} filter for dev/port {}/{} {}.", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 372 | (ethType.equals(EthType.EtherType.IPV4.ethType())) ? V4 : V6, |
| 373 | devId, port, (install) ? INSTALLED : REMOVED); |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 374 | dhcpFuture.ifPresent(f -> f.complete(null)); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | @Override |
| 378 | public void onError(Objective objective, ObjectiveError error) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 379 | log.error("DHCP {} filter for dev/port {}/{} failed {} because {}", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 380 | (ethType.equals(EthType.EtherType.IPV4.ethType())) ? V4 : V6, |
| 381 | devId, port, (install) ? INSTALLATION : REMOVAL, |
| 382 | error); |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 383 | dhcpFuture.ifPresent(f -> f.complete(error)); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 384 | } |
| 385 | }); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 386 | flowObjectiveService.filter(devId, dhcpUpstream); |
| 387 | |
| 388 | } |
| 389 | |
| 390 | @Override |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 391 | public void processPPPoEDFilteringObjectives(DeviceId devId, PortNumber portNumber, |
| 392 | MeterId upstreamMeterId, |
| 393 | UniTagInformation tagInformation, |
| 394 | boolean install, |
| 395 | boolean upstream) { |
| 396 | if (!enablePppoe) { |
| 397 | log.debug("PPPoED filtering is disabled. Ignoring request."); |
| 398 | return; |
| 399 | } |
| 400 | |
| 401 | int techProfileId = NONE_TP_ID; |
| 402 | VlanId cTag = VlanId.NONE; |
| 403 | VlanId unitagMatch = VlanId.ANY; |
| 404 | Byte vlanPcp = null; |
| 405 | |
| 406 | if (tagInformation != null) { |
| 407 | techProfileId = tagInformation.getTechnologyProfileId(); |
| 408 | cTag = tagInformation.getPonCTag(); |
| 409 | unitagMatch = tagInformation.getUniTagMatch(); |
| 410 | if (tagInformation.getUsPonCTagPriority() != NO_PCP) { |
| 411 | vlanPcp = (byte) tagInformation.getUsPonCTagPriority(); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); |
| 416 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); |
| 417 | CompletableFuture<Object> meterFuture = new CompletableFuture<>(); |
| 418 | |
| 419 | if (upstreamMeterId != null) { |
| 420 | treatmentBuilder.meter(upstreamMeterId); |
| 421 | } |
| 422 | |
| 423 | if (techProfileId != NONE_TP_ID) { |
| 424 | treatmentBuilder.writeMetadata(createTechProfValueForWm(cTag, techProfileId), 0); |
| 425 | } |
| 426 | |
| 427 | DefaultFilteringObjective.Builder pppoedBuilder = (install ? builder.permit() : builder.deny()) |
| 428 | .withKey(Criteria.matchInPort(portNumber)) |
| 429 | .addCondition(Criteria.matchEthType(EthType.EtherType.PPPoED.ethType())) |
| 430 | .fromApp(appId) |
| 431 | .withPriority(10000); |
| 432 | |
| 433 | if (upstream) { |
| 434 | treatmentBuilder.setVlanId(cTag); |
| 435 | if (!VlanId.vlanId(VlanId.NO_VID).equals(unitagMatch)) { |
| 436 | pppoedBuilder.addCondition(Criteria.matchVlanId(unitagMatch)); |
| 437 | } |
| 438 | if (vlanPcp != null) { |
| 439 | treatmentBuilder.setVlanPcp(vlanPcp); |
| 440 | } |
| 441 | } |
| 442 | pppoedBuilder = pppoedBuilder.withMeta(treatmentBuilder.setOutput(PortNumber.CONTROLLER).build()); |
| 443 | |
| 444 | FilteringObjective pppoed = pppoedBuilder |
| 445 | .add(new ObjectiveContext() { |
| 446 | @Override |
| 447 | public void onSuccess(Objective objective) { |
| 448 | log.info("PPPoED filter for {} on {} {}.", |
| 449 | devId, portNumber, (install) ? INSTALLED : REMOVED); |
| 450 | } |
| 451 | |
| 452 | @Override |
| 453 | public void onError(Objective objective, ObjectiveError error) { |
| 454 | log.info("PPPoED filter for {} on {} failed {} because {}", |
| 455 | devId, portNumber, (install) ? INSTALLATION : REMOVAL, error); |
| 456 | } |
| 457 | }); |
| 458 | flowObjectiveService.filter(devId, pppoed); |
| 459 | } |
| 460 | |
| 461 | @Override |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 462 | public void processIgmpFilteringObjectives(DeviceId devId, PortNumber port, |
| 463 | MeterId upstreamMeterId, |
| 464 | UniTagInformation tagInformation, |
| 465 | boolean install, |
| 466 | boolean upstream) { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 467 | if (upstream) { |
| 468 | // for UNI ports |
| 469 | if (tagInformation != null && !tagInformation.getIsIgmpRequired()) { |
| 470 | log.debug("Igmp provisioning is disabled for UNI port {} on " |
| 471 | + "device {} for service {}", port, devId, |
| 472 | tagInformation.getServiceName()); |
| 473 | return; |
| 474 | } |
| 475 | } else { |
| 476 | // for NNI ports |
| 477 | if (!enableIgmpOnNni) { |
| 478 | log.debug("Igmp provisioning is disabled for NNI port {} on device {}", |
| 479 | port, devId); |
| 480 | return; |
| 481 | } |
Matteo Scandolo | 34556e5 | 2020-05-08 12:34:13 -0700 | [diff] [blame] | 482 | } |
| 483 | |
Andrea Campanella | fee8642 | 2020-06-04 16:01:27 +0200 | [diff] [blame] | 484 | log.debug("{} IGMP flows on {}:{}", (install) ? |
| 485 | "Installing" : "Removing", devId, port); |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 486 | DefaultFilteringObjective.Builder filterBuilder = DefaultFilteringObjective.builder(); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 487 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); |
| 488 | if (upstream) { |
| 489 | |
| 490 | if (tagInformation.getTechnologyProfileId() != NONE_TP_ID) { |
| 491 | treatmentBuilder.writeMetadata(createTechProfValueForWm(null, |
| 492 | tagInformation.getTechnologyProfileId()), 0); |
| 493 | } |
| 494 | |
| 495 | |
| 496 | if (upstreamMeterId != null) { |
| 497 | treatmentBuilder.meter(upstreamMeterId); |
| 498 | } |
| 499 | |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 500 | if (!VlanId.vlanId(VlanId.NO_VID).equals(tagInformation.getUniTagMatch())) { |
| 501 | filterBuilder.addCondition(Criteria.matchVlanId(tagInformation.getUniTagMatch())); |
| 502 | } |
| 503 | |
| 504 | if (!VlanId.vlanId(VlanId.NO_VID).equals(tagInformation.getPonCTag())) { |
| 505 | treatmentBuilder.setVlanId(tagInformation.getPonCTag()); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | if (tagInformation.getUsPonCTagPriority() != NO_PCP) { |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 509 | treatmentBuilder.setVlanPcp((byte) tagInformation.getUsPonCTagPriority()); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 510 | } |
| 511 | } |
| 512 | |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 513 | filterBuilder = install ? filterBuilder.permit() : filterBuilder.deny(); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 514 | |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 515 | FilteringObjective igmp = filterBuilder |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 516 | .withKey(Criteria.matchInPort(port)) |
| 517 | .addCondition(Criteria.matchEthType(EthType.EtherType.IPV4.ethType())) |
| 518 | .addCondition(Criteria.matchIPProtocol(IPv4.PROTOCOL_IGMP)) |
| 519 | .withMeta(treatmentBuilder |
| 520 | .setOutput(PortNumber.CONTROLLER).build()) |
| 521 | .fromApp(appId) |
| 522 | .withPriority(MAX_PRIORITY) |
| 523 | .add(new ObjectiveContext() { |
| 524 | @Override |
| 525 | public void onSuccess(Objective objective) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 526 | log.info("Igmp filter for dev/port {}/{} {}.", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 527 | devId, port, (install) ? INSTALLED : REMOVED); |
| 528 | } |
| 529 | |
| 530 | @Override |
| 531 | public void onError(Objective objective, ObjectiveError error) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 532 | log.error("Igmp filter for dev/port {}/{} failed {} because {}.", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 533 | devId, port, (install) ? INSTALLATION : REMOVAL, |
| 534 | error); |
| 535 | } |
| 536 | }); |
| 537 | |
| 538 | flowObjectiveService.filter(devId, igmp); |
| 539 | } |
| 540 | |
| 541 | @Override |
| 542 | public void processEapolFilteringObjectives(DeviceId devId, PortNumber portNumber, String bpId, |
| 543 | CompletableFuture<ObjectiveError> filterFuture, |
| 544 | VlanId vlanId, boolean install) { |
| 545 | |
| 546 | if (!enableEapol) { |
| 547 | log.debug("Eapol filtering is disabled. Completing filteringFuture immediately for the device {}", devId); |
| 548 | if (filterFuture != null) { |
| 549 | filterFuture.complete(null); |
| 550 | } |
| 551 | return; |
| 552 | } |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 553 | log.info("Processing EAPOL with Bandwidth profile {} on {}/{}", bpId, |
| 554 | devId, portNumber); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 555 | BandwidthProfileInformation bpInfo = getBandwidthProfileInformation(bpId); |
| 556 | if (bpInfo == null) { |
| 557 | log.warn("Bandwidth profile {} is not found. Authentication flow" |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 558 | + " will not be installed on {}/{}", bpId, devId, portNumber); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 559 | if (filterFuture != null) { |
| 560 | filterFuture.complete(ObjectiveError.BADPARAMS); |
| 561 | } |
| 562 | return; |
| 563 | } |
| 564 | |
Matteo Scandolo | 3a037a3 | 2020-04-01 12:17:50 -0700 | [diff] [blame] | 565 | ConnectPoint cp = new ConnectPoint(devId, portNumber); |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 566 | DefaultFilteringObjective.Builder filterBuilder = DefaultFilteringObjective.builder(); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 567 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); |
| 568 | CompletableFuture<Object> meterFuture = new CompletableFuture<>(); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 569 | // check if meter exists and create it only for an install |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 570 | final MeterId meterId = oltMeterService.getMeterIdFromBpMapping(devId, bpInfo.id()); |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 571 | log.info("Meter id {} for Bandwidth profile {} associated to EAPOL on {}", meterId, bpInfo.id(), devId); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 572 | if (meterId == null) { |
| 573 | if (install) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 574 | log.debug("Need to install meter for EAPOL with bwp {} on dev/port {}", bpInfo.id(), cp.toString()); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 575 | SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(), |
| 576 | new UniTagInformation.Builder() |
| 577 | .setPonCTag(vlanId).build(), |
| 578 | null, null, |
| 579 | null, bpInfo.id()); |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 580 | pendingEapolForDevice.compute(devId, (id, queue) -> { |
| 581 | if (queue == null) { |
| 582 | queue = new LinkedBlockingQueue<>(); |
| 583 | } |
| 584 | queue.add(fi); |
| 585 | return queue; |
| 586 | }); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 587 | |
Andrea Campanella | d1e2664 | 2020-10-23 12:08:32 +0200 | [diff] [blame] | 588 | //If false the meter is already being installed, skipping installation |
| 589 | if (!oltMeterService.checkAndAddPendingMeter(devId, bpInfo)) { |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 590 | return; |
| 591 | } |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 592 | MeterId innerMeterId = oltMeterService.createMeter(devId, bpInfo, |
| 593 | meterFuture); |
| 594 | fi.setUpMeterId(innerMeterId); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 595 | } else { |
| 596 | // this case should not happen as the request to remove an eapol |
| 597 | // flow should mean that the flow points to a meter that exists. |
| 598 | // Nevertheless we can still delete the flow as we only need the |
| 599 | // correct 'match' to do so. |
| 600 | log.warn("Unknown meter id for bp {}, still proceeding with " |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 601 | + "delete of eapol flow for {}", bpInfo.id(), cp.toString()); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 602 | SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(), |
| 603 | new UniTagInformation.Builder() |
| 604 | .setPonCTag(vlanId).build(), |
| 605 | null, meterId, |
| 606 | null, bpInfo.id()); |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 607 | handleEapol(filterFuture, install, cp, filterBuilder, treatmentBuilder, fi, meterId); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 608 | } |
| 609 | } else { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 610 | log.debug("Meter {} was previously created for bp {} on {}", meterId, bpInfo.id(), cp.toString()); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 611 | SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(), |
| 612 | new UniTagInformation.Builder() |
| 613 | .setPonCTag(vlanId).build(), |
| 614 | null, meterId, |
| 615 | null, bpInfo.id()); |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 616 | handleEapol(filterFuture, install, cp, filterBuilder, treatmentBuilder, fi, meterId); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 617 | //No need for the future, meter is present. |
| 618 | return; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 619 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 620 | meterFuture.thenAcceptAsync(result -> { |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 621 | //for each pending eapol flow we check if the meter is there. |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 622 | BlockingQueue<SubscriberFlowInfo> queue = pendingEapolForDevice.get(devId); |
| 623 | if (queue != null) { |
| 624 | while (true) { |
| 625 | SubscriberFlowInfo fi = queue.remove(); |
| 626 | if (fi == null) { |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 627 | pendingEapolForDevice.replace(devId, queue); |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 628 | break; |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 629 | } |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 630 | //TODO this might return the reference and not the actual object |
| 631 | // so it can be actually swapped underneath us. |
| 632 | log.debug("handing pending eapol on {}/{} for {}", fi.getDevId(), fi.getUniPort(), fi); |
| 633 | if (result == null) { |
| 634 | MeterId mId = oltMeterService |
| 635 | .getMeterIdFromBpMapping(devId, fi.getUpBpInfo()); |
| 636 | if (mId != null) { |
| 637 | log.debug("Meter installation completed for subscriber on {}, handling EAPOL trap flow", |
| 638 | cp.toString()); |
| 639 | handleEapol(filterFuture, install, cp, filterBuilder, treatmentBuilder, fi, mId); |
| 640 | } |
| 641 | } else { |
| 642 | log.warn("Meter installation error while sending EAPOL trap flow to {}. " + |
| 643 | "Result {} and MeterId {}", cp.toString(), result, meterId); |
| 644 | } |
| 645 | oltMeterService.removeFromPendingMeters(devId, bpInfo); |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 646 | } |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 647 | } else { |
| 648 | log.info("No pending EAPOLs on {}", devId); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 649 | } |
| 650 | }); |
| 651 | } |
| 652 | |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 653 | private void handleEapol(CompletableFuture<ObjectiveError> filterFuture, |
| 654 | boolean install, ConnectPoint cp, |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 655 | DefaultFilteringObjective.Builder filterBuilder, |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 656 | TrafficTreatment.Builder treatmentBuilder, |
| 657 | SubscriberFlowInfo fi, MeterId mId) { |
| 658 | log.info("Meter {} for {} on {}/{} exists. {} EAPOL trap flow", |
| 659 | mId, fi.getUpBpInfo(), fi.getDevId(), fi.getUniPort(), |
| 660 | (install) ? "Installing" : "Removing"); |
| 661 | int techProfileId = getDefaultTechProfileId(fi.getDevId(), fi.getUniPort()); |
| 662 | // can happen in case of removal |
| 663 | if (mId != null) { |
| 664 | treatmentBuilder.meter(mId); |
| 665 | } |
| 666 | //Authentication trap flow uses only tech profile id as write metadata value |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 667 | FilteringObjective eapol = (install ? filterBuilder.permit() : filterBuilder.deny()) |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 668 | .withKey(Criteria.matchInPort(fi.getUniPort())) |
| 669 | .addCondition(Criteria.matchEthType(EthType.EtherType.EAPOL.ethType())) |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 670 | .withMeta(treatmentBuilder |
| 671 | .writeMetadata(createTechProfValueForWm( |
| 672 | fi.getTagInfo().getPonCTag(), |
| 673 | techProfileId), 0) |
Andrea Campanella | 0e34f56 | 2020-06-11 10:47:10 +0200 | [diff] [blame] | 674 | .setOutput(PortNumber.CONTROLLER) |
| 675 | .pushVlan() |
| 676 | .setVlanId(fi.getTagInfo().getPonCTag()) |
| 677 | .build()) |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 678 | .fromApp(appId) |
| 679 | .withPriority(MAX_PRIORITY) |
| 680 | .add(new ObjectiveContext() { |
| 681 | @Override |
| 682 | public void onSuccess(Objective objective) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 683 | log.info("Eapol filter {} for {} on {}/{} with meter {}.", |
Andrea Campanella | 600d2e2 | 2020-06-22 11:00:31 +0200 | [diff] [blame] | 684 | objective.id(), fi.getDevId(), fi.getUniPort(), |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 685 | (install) ? INSTALLED : REMOVED, mId); |
| 686 | if (filterFuture != null) { |
| 687 | filterFuture.complete(null); |
| 688 | } |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | @Override |
| 692 | public void onError(Objective objective, ObjectiveError error) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 693 | log.error("Eapol filter {} for {}/{} with meter {} " + |
Andrea Campanella | 600d2e2 | 2020-06-22 11:00:31 +0200 | [diff] [blame] | 694 | "failed {} because {}", objective.id(), |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 695 | fi.getDevId(), fi.getUniPort(), mId, |
| 696 | (install) ? INSTALLATION : REMOVAL, |
| 697 | error); |
| 698 | if (filterFuture != null) { |
| 699 | filterFuture.complete(error); |
| 700 | } |
Andrea Campanella | 3ce4d28 | 2020-06-09 13:46:58 +0200 | [diff] [blame] | 701 | } |
| 702 | }); |
| 703 | flowObjectiveService.filter(fi.getDevId(), eapol); |
| 704 | } |
| 705 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 706 | /** |
| 707 | * Installs trap filtering objectives for particular traffic types on an |
| 708 | * NNI port. |
| 709 | * |
| 710 | * @param devId device ID |
| 711 | * @param port port number |
| 712 | * @param install true to install, false to remove |
| 713 | */ |
| 714 | @Override |
| 715 | public void processNniFilteringObjectives(DeviceId devId, PortNumber port, boolean install) { |
Saurav Das | f62cea8 | 2020-08-26 17:43:04 -0700 | [diff] [blame] | 716 | log.info("{} flows for NNI port {} on device {}", |
| 717 | install ? "Adding" : "Removing", port, devId); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 718 | processLldpFilteringObjective(devId, port, install); |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 719 | processDhcpFilteringObjectives(devId, port, null, null, install, false, Optional.empty()); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 720 | processIgmpFilteringObjectives(devId, port, null, null, install, false); |
Gustavo Silva | 5c492dd | 2021-02-12 10:21:11 -0300 | [diff] [blame] | 721 | processPPPoEDFilteringObjectives(devId, port, null, null, install, false); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | |
| 725 | @Override |
| 726 | public void processLldpFilteringObjective(DeviceId devId, PortNumber port, boolean install) { |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 727 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); |
| 728 | |
| 729 | FilteringObjective lldp = (install ? builder.permit() : builder.deny()) |
| 730 | .withKey(Criteria.matchInPort(port)) |
| 731 | .addCondition(Criteria.matchEthType(EthType.EtherType.LLDP.ethType())) |
| 732 | .withMeta(DefaultTrafficTreatment.builder() |
| 733 | .setOutput(PortNumber.CONTROLLER).build()) |
| 734 | .fromApp(appId) |
| 735 | .withPriority(MAX_PRIORITY) |
| 736 | .add(new ObjectiveContext() { |
| 737 | @Override |
| 738 | public void onSuccess(Objective objective) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 739 | log.info("LLDP filter for dev/port {}/{} {}.", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 740 | devId, port, (install) ? INSTALLED : REMOVED); |
| 741 | } |
| 742 | |
| 743 | @Override |
| 744 | public void onError(Objective objective, ObjectiveError error) { |
Matteo Scandolo | 19b56f6 | 2020-10-29 13:29:21 -0700 | [diff] [blame] | 745 | log.error("LLDP filter for dev/port {}/{} failed {} because {}", |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 746 | devId, port, (install) ? INSTALLATION : REMOVAL, |
| 747 | error); |
| 748 | } |
| 749 | }); |
| 750 | |
| 751 | flowObjectiveService.filter(devId, lldp); |
| 752 | } |
| 753 | |
| 754 | @Override |
| 755 | public ForwardingObjective.Builder createTransparentBuilder(PortNumber uplinkPort, |
| 756 | PortNumber subscriberPort, |
| 757 | MeterId meterId, |
| 758 | UniTagInformation tagInfo, |
| 759 | boolean upstream) { |
| 760 | |
| 761 | TrafficSelector selector = DefaultTrafficSelector.builder() |
| 762 | .matchVlanId(tagInfo.getPonSTag()) |
| 763 | .matchInPort(upstream ? subscriberPort : uplinkPort) |
| 764 | .matchInnerVlanId(tagInfo.getPonCTag()) |
| 765 | .build(); |
| 766 | |
| 767 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
| 768 | if (meterId != null) { |
| 769 | tBuilder.meter(meterId); |
| 770 | } |
| 771 | |
| 772 | TrafficTreatment treatment = tBuilder |
| 773 | .setOutput(upstream ? uplinkPort : subscriberPort) |
| 774 | .writeMetadata(createMetadata(upstream ? tagInfo.getPonSTag() : tagInfo.getPonCTag(), |
| 775 | tagInfo.getTechnologyProfileId(), upstream ? uplinkPort : subscriberPort), 0) |
| 776 | .build(); |
| 777 | |
| 778 | return createForwardingObjectiveBuilder(selector, treatment, MIN_PRIORITY); |
| 779 | } |
| 780 | |
| 781 | @Override |
| 782 | public ForwardingObjective.Builder createUpBuilder(PortNumber uplinkPort, |
| 783 | PortNumber subscriberPort, |
| 784 | MeterId upstreamMeterId, |
| 785 | UniTagInformation uniTagInformation) { |
| 786 | |
| 787 | TrafficSelector selector = DefaultTrafficSelector.builder() |
| 788 | .matchInPort(subscriberPort) |
| 789 | .matchVlanId(uniTagInformation.getUniTagMatch()) |
| 790 | .build(); |
| 791 | |
Andrea Campanella | 327c572 | 2020-01-30 11:34:13 +0100 | [diff] [blame] | 792 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); |
| 793 | //if the subscriberVlan (cTag) is different than ANY it needs to set. |
| 794 | if (uniTagInformation.getPonCTag().toShort() != VlanId.ANY_VALUE) { |
| 795 | treatmentBuilder.pushVlan() |
| 796 | .setVlanId(uniTagInformation.getPonCTag()); |
| 797 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 798 | |
| 799 | if (uniTagInformation.getUsPonCTagPriority() != NO_PCP) { |
| 800 | treatmentBuilder.setVlanPcp((byte) uniTagInformation.getUsPonCTagPriority()); |
| 801 | } |
| 802 | |
| 803 | treatmentBuilder.pushVlan() |
| 804 | .setVlanId(uniTagInformation.getPonSTag()); |
| 805 | |
| 806 | if (uniTagInformation.getUsPonSTagPriority() != NO_PCP) { |
| 807 | treatmentBuilder.setVlanPcp((byte) uniTagInformation.getUsPonSTagPriority()); |
| 808 | } |
| 809 | |
| 810 | treatmentBuilder.setOutput(uplinkPort) |
| 811 | .writeMetadata(createMetadata(uniTagInformation.getPonCTag(), |
| 812 | uniTagInformation.getTechnologyProfileId(), uplinkPort), 0L); |
| 813 | |
| 814 | if (upstreamMeterId != null) { |
| 815 | treatmentBuilder.meter(upstreamMeterId); |
| 816 | } |
| 817 | |
| 818 | return createForwardingObjectiveBuilder(selector, treatmentBuilder.build(), MIN_PRIORITY); |
| 819 | } |
| 820 | |
| 821 | @Override |
| 822 | public ForwardingObjective.Builder createDownBuilder(PortNumber uplinkPort, |
| 823 | PortNumber subscriberPort, |
| 824 | MeterId downstreamMeterId, |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 825 | UniTagInformation tagInformation, |
| 826 | Optional<MacAddress> macAddress) { |
Andrea Campanella | 327c572 | 2020-01-30 11:34:13 +0100 | [diff] [blame] | 827 | |
| 828 | //subscriberVlan can be any valid Vlan here including ANY to make sure the packet is tagged |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 829 | TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder() |
| 830 | .matchVlanId(tagInformation.getPonSTag()) |
| 831 | .matchInPort(uplinkPort) |
Andrea Campanella | 090e4a0 | 2020-02-05 13:53:55 +0100 | [diff] [blame] | 832 | .matchInnerVlanId(tagInformation.getPonCTag()); |
| 833 | |
| 834 | |
| 835 | if (tagInformation.getPonCTag().toShort() != VlanId.ANY_VALUE) { |
| 836 | selectorBuilder.matchMetadata(tagInformation.getPonCTag().toShort()); |
| 837 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 838 | |
| 839 | if (tagInformation.getDsPonSTagPriority() != NO_PCP) { |
| 840 | selectorBuilder.matchVlanPcp((byte) tagInformation.getDsPonSTagPriority()); |
| 841 | } |
| 842 | |
Tunahan Sezen | a07fe96 | 2021-02-24 08:24:24 +0000 | [diff] [blame] | 843 | macAddress.ifPresent(selectorBuilder::matchEthDst); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 844 | |
| 845 | TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder() |
| 846 | .popVlan() |
Andrea Campanella | 327c572 | 2020-01-30 11:34:13 +0100 | [diff] [blame] | 847 | .setOutput(subscriberPort); |
| 848 | |
Andrea Campanella | 327c572 | 2020-01-30 11:34:13 +0100 | [diff] [blame] | 849 | treatmentBuilder.writeMetadata(createMetadata(tagInformation.getPonCTag(), |
| 850 | tagInformation.getTechnologyProfileId(), |
| 851 | subscriberPort), 0); |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 852 | |
Andrea Campanella | 981e86c | 2021-03-12 11:35:33 +0100 | [diff] [blame] | 853 | // Upstream pbit is used to remark inner vlan pbit. |
| 854 | // Upstream is used to avoid trusting the BNG to send the packet with correct pbit. |
| 855 | // this is done because ds mode 0 is used because ds mode 3 or 6 that allow for |
| 856 | // all pbit acceptance are not widely supported by vendors even though present in |
| 857 | // the OMCI spec. |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 858 | if (tagInformation.getUsPonCTagPriority() != NO_PCP) { |
| 859 | treatmentBuilder.setVlanPcp((byte) tagInformation.getUsPonCTagPriority()); |
| 860 | } |
| 861 | |
Andrea Campanella | 9a77929 | 2020-02-03 19:19:09 +0100 | [diff] [blame] | 862 | if (!VlanId.NONE.equals(tagInformation.getUniTagMatch()) && |
| 863 | tagInformation.getPonCTag().toShort() != VlanId.ANY_VALUE) { |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 864 | treatmentBuilder.setVlanId(tagInformation.getUniTagMatch()); |
| 865 | } |
| 866 | |
| 867 | if (downstreamMeterId != null) { |
| 868 | treatmentBuilder.meter(downstreamMeterId); |
| 869 | } |
| 870 | |
| 871 | return createForwardingObjectiveBuilder(selectorBuilder.build(), treatmentBuilder.build(), MIN_PRIORITY); |
| 872 | } |
| 873 | |
Andrea Campanella | 600d2e2 | 2020-06-22 11:00:31 +0200 | [diff] [blame] | 874 | @Override |
| 875 | public void clearDeviceState(DeviceId deviceId) { |
Andrea Campanella | 7a1d7e7 | 2020-11-05 10:40:10 +0100 | [diff] [blame] | 876 | pendingEapolForDevice.remove(deviceId); |
Andrea Campanella | 600d2e2 | 2020-06-22 11:00:31 +0200 | [diff] [blame] | 877 | } |
| 878 | |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 879 | private DefaultForwardingObjective.Builder createForwardingObjectiveBuilder(TrafficSelector selector, |
| 880 | TrafficTreatment treatment, |
| 881 | Integer priority) { |
| 882 | return DefaultForwardingObjective.builder() |
| 883 | .withFlag(ForwardingObjective.Flag.VERSATILE) |
| 884 | .withPriority(priority) |
| 885 | .makePermanent() |
| 886 | .withSelector(selector) |
| 887 | .fromApp(appId) |
| 888 | .withTreatment(treatment); |
| 889 | } |
| 890 | |
| 891 | /** |
| 892 | * Returns the write metadata value including tech profile reference and innerVlan. |
| 893 | * For param cVlan, null can be sent |
| 894 | * |
| 895 | * @param cVlan c (customer) tag of one subscriber |
| 896 | * @param techProfileId tech profile id of one subscriber |
| 897 | * @return the write metadata value including tech profile reference and innerVlan |
| 898 | */ |
| 899 | private Long createTechProfValueForWm(VlanId cVlan, int techProfileId) { |
| 900 | if (cVlan == null || VlanId.NONE.equals(cVlan)) { |
| 901 | return (long) techProfileId << 32; |
| 902 | } |
| 903 | return ((long) (cVlan.id()) << 48 | (long) techProfileId << 32); |
| 904 | } |
| 905 | |
| 906 | private BandwidthProfileInformation getBandwidthProfileInformation(String bandwidthProfile) { |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 907 | if (bpService == null) { |
| 908 | log.warn(SADIS_NOT_RUNNING); |
| 909 | return null; |
| 910 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 911 | if (bandwidthProfile == null) { |
| 912 | return null; |
| 913 | } |
| 914 | return bpService.get(bandwidthProfile); |
| 915 | } |
| 916 | |
| 917 | /** |
| 918 | * It will be used to support AT&T use case (for EAPOL flows). |
| 919 | * If multiple services are found in uniServiceList, returns default tech profile id |
| 920 | * If one service is found, returns the found one |
| 921 | * |
| 922 | * @param devId |
| 923 | * @param portNumber |
| 924 | * @return the default technology profile id |
| 925 | */ |
| 926 | private int getDefaultTechProfileId(DeviceId devId, PortNumber portNumber) { |
Ilayda Ozdemir | 90a9362 | 2021-02-25 09:40:58 +0000 | [diff] [blame] | 927 | if (subsService == null) { |
| 928 | log.warn(SADIS_NOT_RUNNING); |
| 929 | return defaultTechProfileId; |
| 930 | } |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 931 | Port port = deviceService.getPort(devId, portNumber); |
| 932 | if (port != null) { |
| 933 | SubscriberAndDeviceInformation info = subsService.get(port.annotations().value(AnnotationKeys.PORT_NAME)); |
| 934 | if (info != null && info.uniTagList().size() == 1) { |
| 935 | return info.uniTagList().get(0).getTechnologyProfileId(); |
| 936 | } |
| 937 | } |
| 938 | return defaultTechProfileId; |
| 939 | } |
| 940 | |
| 941 | /** |
| 942 | * Write metadata instruction value (metadata) is 8 bytes. |
| 943 | * <p> |
| 944 | * MS 2 bytes: C Tag |
| 945 | * Next 2 bytes: Technology Profile Id |
| 946 | * Next 4 bytes: Port number (uni or nni) |
| 947 | */ |
| 948 | private Long createMetadata(VlanId innerVlan, int techProfileId, PortNumber egressPort) { |
| 949 | if (techProfileId == NONE_TP_ID) { |
Andrea Campanella | 7c49b79 | 2020-05-11 11:36:53 +0200 | [diff] [blame] | 950 | techProfileId = DEFAULT_TP_ID_DEFAULT; |
Andrea Campanella | cbbb795 | 2019-11-25 06:38:41 +0000 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | return ((long) (innerVlan.id()) << 48 | (long) techProfileId << 32) | egressPort.toLong(); |
| 954 | } |
| 955 | |
| 956 | |
| 957 | } |