Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [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 | */ |
| 16 | package org.onosproject.dhcprelay; |
| 17 | |
| 18 | import java.nio.ByteBuffer; |
| 19 | import java.util.Collection; |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 20 | import java.util.Collections; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 21 | import java.util.Dictionary; |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 22 | import java.util.List; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 23 | import java.util.Objects; |
| 24 | import java.util.Optional; |
| 25 | import java.util.Set; |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 26 | import java.util.concurrent.atomic.AtomicInteger; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 27 | import java.util.stream.Stream; |
| 28 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 29 | import org.apache.felix.scr.annotations.Activate; |
| 30 | import org.apache.felix.scr.annotations.Component; |
| 31 | import org.apache.felix.scr.annotations.Deactivate; |
| 32 | import org.apache.felix.scr.annotations.Modified; |
| 33 | import org.apache.felix.scr.annotations.Property; |
| 34 | import org.apache.felix.scr.annotations.Reference; |
| 35 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 36 | import org.apache.felix.scr.annotations.Service; |
| 37 | import org.onlab.packet.ARP; |
| 38 | import org.onlab.packet.DHCP; |
| 39 | import org.onlab.packet.DHCP6; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 40 | import org.onlab.packet.Ethernet; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 41 | import org.onlab.packet.IPacket; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 42 | import org.onlab.packet.IPv4; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 43 | import org.onlab.packet.IPv6; |
| 44 | import org.onlab.packet.Ip4Address; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 45 | import org.onlab.packet.MacAddress; |
| 46 | import org.onlab.packet.TpPort; |
| 47 | import org.onlab.packet.UDP; |
| 48 | import org.onlab.packet.VlanId; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 49 | import org.onlab.util.Tools; |
| 50 | import org.onosproject.cfg.ComponentConfigService; |
| 51 | import org.onosproject.core.ApplicationId; |
| 52 | import org.onosproject.core.CoreService; |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 53 | import org.onosproject.dhcprelay.api.DhcpHandler; |
| 54 | import org.onosproject.dhcprelay.api.DhcpRelayService; |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 55 | import org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 56 | import org.onosproject.dhcprelay.config.DhcpServerConfig; |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 57 | import org.onosproject.dhcprelay.config.IgnoreDhcpConfig; |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 58 | import org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 59 | import org.onosproject.dhcprelay.store.DhcpRecord; |
| 60 | import org.onosproject.dhcprelay.store.DhcpRelayStore; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 61 | import org.onosproject.net.ConnectPoint; |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 62 | import org.onosproject.net.Device; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 63 | import org.onosproject.net.DeviceId; |
| 64 | import org.onosproject.net.Host; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 65 | import org.onosproject.net.HostId; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 66 | import org.onosproject.net.config.Config; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 67 | import org.onosproject.net.config.ConfigFactory; |
| 68 | import org.onosproject.net.config.NetworkConfigEvent; |
| 69 | import org.onosproject.net.config.NetworkConfigListener; |
| 70 | import org.onosproject.net.config.NetworkConfigRegistry; |
| 71 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 72 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 73 | import org.onosproject.net.flow.TrafficSelector; |
| 74 | import org.onosproject.net.flow.TrafficTreatment; |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 75 | import org.onosproject.net.behaviour.Pipeliner; |
| 76 | import org.onosproject.net.device.DeviceEvent; |
| 77 | import org.onosproject.net.device.DeviceListener; |
| 78 | import org.onosproject.net.device.DeviceService; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 79 | import org.onosproject.net.flow.criteria.Criterion; |
| 80 | import org.onosproject.net.flow.criteria.UdpPortCriterion; |
| 81 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 82 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 83 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 84 | import org.onosproject.net.flowobjective.Objective; |
| 85 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 86 | import org.onosproject.net.flowobjective.ObjectiveError; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 87 | import org.onosproject.net.host.HostService; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 88 | import org.onosproject.net.intf.Interface; |
| 89 | import org.onosproject.net.intf.InterfaceService; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 90 | import org.onosproject.net.packet.DefaultOutboundPacket; |
| 91 | import org.onosproject.net.packet.OutboundPacket; |
| 92 | import org.onosproject.net.packet.PacketContext; |
| 93 | import org.onosproject.net.packet.PacketPriority; |
| 94 | import org.onosproject.net.packet.PacketProcessor; |
| 95 | import org.onosproject.net.packet.PacketService; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 96 | import org.osgi.service.component.ComponentContext; |
| 97 | import org.slf4j.Logger; |
| 98 | import org.slf4j.LoggerFactory; |
| 99 | |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 100 | import com.google.common.collect.HashMultimap; |
| 101 | import com.google.common.collect.ImmutableList; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 102 | import com.google.common.collect.ImmutableSet; |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 103 | import com.google.common.collect.Multimap; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 104 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 105 | import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY; |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 106 | import static org.onosproject.net.flowobjective.Objective.Operation.ADD; |
| 107 | import static org.onosproject.net.flowobjective.Objective.Operation.REMOVE; |
| 108 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 109 | /** |
| 110 | * DHCP Relay Agent Application Component. |
| 111 | */ |
| 112 | @Component(immediate = true) |
| 113 | @Service |
| 114 | public class DhcpRelayManager implements DhcpRelayService { |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 115 | public static final String DHCP_RELAY_APP = "org.onosproject.dhcprelay"; |
Yi Tseng | 325af8c | 2017-09-01 16:02:56 -0700 | [diff] [blame] | 116 | public static final String ROUTE_STORE_IMPL = |
| 117 | "org.onosproject.routeservice.store.RouteStoreImpl"; |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 118 | private static final TrafficSelector DHCP_SERVER_SELECTOR = DefaultTrafficSelector.builder() |
| 119 | .matchEthType(Ethernet.TYPE_IPV4) |
| 120 | .matchIPProtocol(IPv4.PROTOCOL_UDP) |
| 121 | .matchUdpDst(TpPort.tpPort(UDP.DHCP_SERVER_PORT)) |
| 122 | .build(); |
| 123 | private static final TrafficSelector DHCP_CLIENT_SELECTOR = DefaultTrafficSelector.builder() |
| 124 | .matchEthType(Ethernet.TYPE_IPV4) |
| 125 | .matchIPProtocol(IPv4.PROTOCOL_UDP) |
| 126 | .matchUdpDst(TpPort.tpPort(UDP.DHCP_CLIENT_PORT)) |
| 127 | .build(); |
| 128 | private static final TrafficSelector DHCP6_SERVER_SELECTOR = DefaultTrafficSelector.builder() |
| 129 | .matchEthType(Ethernet.TYPE_IPV6) |
| 130 | .matchIPProtocol(IPv4.PROTOCOL_UDP) |
| 131 | .matchUdpDst(TpPort.tpPort(UDP.DHCP_V6_SERVER_PORT)) |
| 132 | .build(); |
| 133 | private static final TrafficSelector DHCP6_CLIENT_SELECTOR = DefaultTrafficSelector.builder() |
| 134 | .matchEthType(Ethernet.TYPE_IPV6) |
| 135 | .matchIPProtocol(IPv4.PROTOCOL_UDP) |
| 136 | .matchUdpDst(TpPort.tpPort(UDP.DHCP_V6_CLIENT_PORT)) |
| 137 | .build(); |
| 138 | static final List<TrafficSelector> DHCP_SELECTORS = ImmutableList.of( |
| 139 | DHCP_SERVER_SELECTOR, |
| 140 | DHCP_CLIENT_SELECTOR, |
| 141 | DHCP6_SERVER_SELECTOR, |
| 142 | DHCP6_CLIENT_SELECTOR |
| 143 | ); |
| 144 | private static final TrafficSelector ARP_SELECTOR = DefaultTrafficSelector.builder() |
| 145 | .matchEthType(Ethernet.TYPE_ARP) |
| 146 | .build(); |
| 147 | private static final int IGNORE_CONTROL_PRIORITY = PacketPriority.CONTROL.priorityValue() + 1000; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 148 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 149 | private final InternalConfigListener cfgListener = new InternalConfigListener(); |
| 150 | |
| 151 | private final Set<ConfigFactory> factories = ImmutableSet.of( |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 152 | new ConfigFactory<ApplicationId, DefaultDhcpRelayConfig>(APP_SUBJECT_FACTORY, |
| 153 | DefaultDhcpRelayConfig.class, |
| 154 | DefaultDhcpRelayConfig.KEY, |
| 155 | true) { |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 156 | @Override |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 157 | public DefaultDhcpRelayConfig createConfig() { |
| 158 | return new DefaultDhcpRelayConfig(); |
| 159 | } |
| 160 | }, |
| 161 | new ConfigFactory<ApplicationId, IndirectDhcpRelayConfig>(APP_SUBJECT_FACTORY, |
| 162 | IndirectDhcpRelayConfig.class, |
| 163 | IndirectDhcpRelayConfig.KEY, |
| 164 | true) { |
| 165 | @Override |
| 166 | public IndirectDhcpRelayConfig createConfig() { |
| 167 | return new IndirectDhcpRelayConfig(); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 168 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 169 | }, |
| 170 | new ConfigFactory<ApplicationId, IgnoreDhcpConfig>(APP_SUBJECT_FACTORY, |
| 171 | IgnoreDhcpConfig.class, |
| 172 | IgnoreDhcpConfig.KEY, |
| 173 | true) { |
| 174 | @Override |
| 175 | public IgnoreDhcpConfig createConfig() { |
| 176 | return new IgnoreDhcpConfig(); |
| 177 | } |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 178 | } |
| 179 | ); |
| 180 | |
| 181 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 182 | protected NetworkConfigRegistry cfgService; |
| 183 | |
| 184 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 185 | protected CoreService coreService; |
| 186 | |
| 187 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 188 | protected PacketService packetService; |
| 189 | |
| 190 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 191 | protected HostService hostService; |
| 192 | |
| 193 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 194 | protected InterfaceService interfaceService; |
| 195 | |
| 196 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 197 | protected DhcpRelayStore dhcpRelayStore; |
| 198 | |
| 199 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 200 | protected ComponentConfigService compCfgService; |
| 201 | |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 202 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 203 | protected FlowObjectiveService flowObjectiveService; |
| 204 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 205 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 206 | protected DeviceService deviceService; |
| 207 | |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 208 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 209 | target = "(version=4)") |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 210 | protected DhcpHandler v4Handler; |
| 211 | |
| 212 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 213 | target = "(version=6)") |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 214 | protected DhcpHandler v6Handler; |
| 215 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 216 | @Property(name = "arpEnabled", boolValue = true, |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 217 | label = "Enable Address resolution protocol") |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 218 | protected boolean arpEnabled = true; |
| 219 | |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 220 | protected Multimap<DeviceId, VlanId> ignoredVlans = HashMultimap.create(); |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 221 | protected DeviceListener deviceListener = new InternalDeviceListener(); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 222 | private DhcpRelayPacketProcessor dhcpRelayPacketProcessor = new DhcpRelayPacketProcessor(); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 223 | private ApplicationId appId; |
| 224 | |
| 225 | @Activate |
| 226 | protected void activate(ComponentContext context) { |
| 227 | //start the dhcp relay agent |
| 228 | appId = coreService.registerApplication(DHCP_RELAY_APP); |
| 229 | |
| 230 | cfgService.addListener(cfgListener); |
| 231 | factories.forEach(cfgService::registerConfigFactory); |
| 232 | //update the dhcp server configuration. |
| 233 | updateConfig(); |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 234 | |
| 235 | //add the packet processor |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 236 | packetService.addProcessor(dhcpRelayPacketProcessor, PacketProcessor.director(0)); |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 237 | |
| 238 | // listen host event for dhcp server or the gateway |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 239 | requestDhcpPackets(); |
| 240 | modified(context); |
| 241 | |
Yi Tseng | 325af8c | 2017-09-01 16:02:56 -0700 | [diff] [blame] | 242 | // Enable distribute route store |
| 243 | compCfgService.preSetProperty(ROUTE_STORE_IMPL, |
| 244 | "distributed", Boolean.TRUE.toString()); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 245 | compCfgService.registerProperties(getClass()); |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 246 | |
| 247 | deviceService.addListener(deviceListener); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 248 | log.info("DHCP-RELAY Started"); |
| 249 | } |
| 250 | |
| 251 | @Deactivate |
| 252 | protected void deactivate() { |
| 253 | cfgService.removeListener(cfgListener); |
| 254 | factories.forEach(cfgService::unregisterConfigFactory); |
| 255 | packetService.removeProcessor(dhcpRelayPacketProcessor); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 256 | cancelDhcpPackets(); |
| 257 | cancelArpPackets(); |
Yi Tseng | dfa8ee2 | 2017-08-07 12:45:01 -0700 | [diff] [blame] | 258 | compCfgService.unregisterProperties(getClass(), false); |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 259 | deviceService.removeListener(deviceListener); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 260 | log.info("DHCP-RELAY Stopped"); |
| 261 | } |
| 262 | |
| 263 | @Modified |
| 264 | protected void modified(ComponentContext context) { |
| 265 | Dictionary<?, ?> properties = context.getProperties(); |
| 266 | Boolean flag; |
| 267 | |
| 268 | flag = Tools.isPropertyEnabled(properties, "arpEnabled"); |
| 269 | if (flag != null) { |
| 270 | arpEnabled = flag; |
| 271 | log.info("Address resolution protocol is {}", |
| 272 | arpEnabled ? "enabled" : "disabled"); |
| 273 | } |
| 274 | |
| 275 | if (arpEnabled) { |
| 276 | requestArpPackets(); |
| 277 | } else { |
| 278 | cancelArpPackets(); |
| 279 | } |
| 280 | } |
| 281 | |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 282 | /** |
| 283 | * Updates DHCP relay app configuration. |
| 284 | */ |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 285 | private void updateConfig() { |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 286 | DefaultDhcpRelayConfig defaultConfig = |
| 287 | cfgService.getConfig(appId, DefaultDhcpRelayConfig.class); |
| 288 | IndirectDhcpRelayConfig indirectConfig = |
| 289 | cfgService.getConfig(appId, IndirectDhcpRelayConfig.class); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 290 | IgnoreDhcpConfig ignoreDhcpConfig = |
| 291 | cfgService.getConfig(appId, IgnoreDhcpConfig.class); |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 292 | |
| 293 | if (defaultConfig != null) { |
| 294 | updateConfig(defaultConfig); |
| 295 | } |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 296 | if (indirectConfig != null) { |
| 297 | updateConfig(indirectConfig); |
| 298 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 299 | if (ignoreDhcpConfig != null) { |
| 300 | updateConfig(ignoreDhcpConfig); |
| 301 | } |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Updates DHCP relay app configuration with given configuration. |
| 306 | * |
| 307 | * @param config the configuration ot update |
| 308 | */ |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 309 | protected void updateConfig(Config config) { |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 310 | if (config instanceof IndirectDhcpRelayConfig) { |
| 311 | IndirectDhcpRelayConfig indirectConfig = (IndirectDhcpRelayConfig) config; |
| 312 | v4Handler.setIndirectDhcpServerConfigs(indirectConfig.dhcpServerConfigs()); |
| 313 | v6Handler.setIndirectDhcpServerConfigs(indirectConfig.dhcpServerConfigs()); |
Yi Tseng | 4fa0583 | 2017-08-17 13:08:31 -0700 | [diff] [blame] | 314 | } else if (config instanceof DefaultDhcpRelayConfig) { |
| 315 | DefaultDhcpRelayConfig defaultConfig = (DefaultDhcpRelayConfig) config; |
| 316 | v4Handler.setDefaultDhcpServerConfigs(defaultConfig.dhcpServerConfigs()); |
| 317 | v6Handler.setDefaultDhcpServerConfigs(defaultConfig.dhcpServerConfigs()); |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 318 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 319 | if (config instanceof IgnoreDhcpConfig) { |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 320 | updateIgnoreVlanRules((IgnoreDhcpConfig) config); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 321 | } |
| 322 | } |
| 323 | |
| 324 | protected void removeConfig(Config config) { |
| 325 | if (config instanceof IndirectDhcpRelayConfig) { |
| 326 | v4Handler.setIndirectDhcpServerConfigs(Collections.emptyList()); |
| 327 | v6Handler.setIndirectDhcpServerConfigs(Collections.emptyList()); |
| 328 | } else if (config instanceof DefaultDhcpRelayConfig) { |
| 329 | v4Handler.setDefaultDhcpServerConfigs(Collections.emptyList()); |
| 330 | v6Handler.setDefaultDhcpServerConfigs(Collections.emptyList()); |
| 331 | } |
| 332 | if (config instanceof IgnoreDhcpConfig) { |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 333 | ignoredVlans.forEach(((deviceId, vlanId) -> { |
| 334 | processIgnoreVlanRule(deviceId, vlanId, REMOVE); |
| 335 | })); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 336 | } |
| 337 | } |
| 338 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 339 | private void updateIgnoreVlanRules(IgnoreDhcpConfig config) { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 340 | config.ignoredVlans().forEach((deviceId, vlanId) -> { |
| 341 | if (ignoredVlans.get(deviceId).contains(vlanId)) { |
| 342 | // don't need to process if it already ignored |
| 343 | return; |
| 344 | } |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 345 | processIgnoreVlanRule(deviceId, vlanId, ADD); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 346 | }); |
| 347 | |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 348 | ignoredVlans.forEach((deviceId, vlanId) -> { |
| 349 | if (!config.ignoredVlans().get(deviceId).contains(vlanId)) { |
| 350 | // not contains in new config, remove it |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 351 | processIgnoreVlanRule(deviceId, vlanId, REMOVE); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 352 | } |
| 353 | }); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 354 | } |
| 355 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 356 | /** |
| 357 | * Process the ignore rules. |
| 358 | * |
| 359 | * @param deviceId the device id |
| 360 | * @param vlanId the vlan to be ignored |
| 361 | * @param op the operation, ADD to install; REMOVE to uninstall rules |
| 362 | */ |
| 363 | private void processIgnoreVlanRule(DeviceId deviceId, VlanId vlanId, Objective.Operation op) { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 364 | TrafficTreatment dropTreatment = DefaultTrafficTreatment.emptyTreatment(); |
| 365 | dropTreatment.clearedDeferred(); |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 366 | AtomicInteger installedCount = new AtomicInteger(DHCP_SELECTORS.size()); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 367 | DHCP_SELECTORS.forEach(trafficSelector -> { |
| 368 | UdpPortCriterion udpDst = (UdpPortCriterion) trafficSelector.getCriterion(Criterion.Type.UDP_DST); |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 369 | int udpDstPort = udpDst.udpPort().toInt(); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 370 | TrafficSelector selector = DefaultTrafficSelector.builder(trafficSelector) |
| 371 | .matchVlanId(vlanId) |
| 372 | .build(); |
| 373 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 374 | ForwardingObjective.Builder builder = DefaultForwardingObjective.builder() |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 375 | .withFlag(ForwardingObjective.Flag.VERSATILE) |
| 376 | .withSelector(selector) |
| 377 | .withPriority(IGNORE_CONTROL_PRIORITY) |
| 378 | .withTreatment(dropTreatment) |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 379 | .fromApp(appId); |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 380 | |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 381 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 382 | ObjectiveContext objectiveContext = new ObjectiveContext() { |
| 383 | @Override |
| 384 | public void onSuccess(Objective objective) { |
| 385 | log.info("Ignore rule {} (Vlan id {}, device {}, UDP dst {})", |
| 386 | op, vlanId, deviceId, udpDstPort); |
| 387 | int countDown = installedCount.decrementAndGet(); |
| 388 | if (countDown != 0) { |
| 389 | return; |
| 390 | } |
| 391 | switch (op) { |
| 392 | case ADD: |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 393 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 394 | ignoredVlans.put(deviceId, vlanId); |
| 395 | break; |
| 396 | case REMOVE: |
| 397 | ignoredVlans.remove(deviceId, vlanId); |
| 398 | break; |
| 399 | default: |
| 400 | log.warn("Unsupported objective operation {}", op); |
| 401 | break; |
| 402 | } |
| 403 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 404 | |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 405 | @Override |
| 406 | public void onError(Objective objective, ObjectiveError error) { |
| 407 | log.warn("Can't {} ignore rule (vlan id {}, udp dst {}, device {}) due to {}", |
| 408 | op, vlanId, udpDstPort, deviceId, error); |
| 409 | } |
| 410 | }; |
| 411 | |
| 412 | ForwardingObjective fwd; |
| 413 | switch (op) { |
| 414 | case ADD: |
| 415 | fwd = builder.add(objectiveContext); |
| 416 | break; |
| 417 | case REMOVE: |
| 418 | fwd = builder.remove(objectiveContext); |
| 419 | break; |
| 420 | default: |
| 421 | log.warn("Unsupported objective operation {}", op); |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | Device device = deviceService.getDevice(deviceId); |
| 426 | if (device == null || !device.is(Pipeliner.class)) { |
| 427 | log.warn("Device {} is not available now, wait until device is available", deviceId); |
| 428 | return; |
| 429 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 430 | flowObjectiveService.apply(deviceId, fwd); |
| 431 | }); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Request DHCP packet in via PacketService. |
| 436 | */ |
| 437 | private void requestDhcpPackets() { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 438 | DHCP_SELECTORS.forEach(trafficSelector -> { |
| 439 | packetService.requestPackets(trafficSelector, PacketPriority.CONTROL, appId); |
| 440 | }); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Cancel requested DHCP packets in via packet service. |
| 445 | */ |
| 446 | private void cancelDhcpPackets() { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 447 | DHCP_SELECTORS.forEach(trafficSelector -> { |
| 448 | packetService.cancelPackets(trafficSelector, PacketPriority.CONTROL, appId); |
| 449 | }); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Request ARP packet in via PacketService. |
| 454 | */ |
| 455 | private void requestArpPackets() { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 456 | packetService.requestPackets(ARP_SELECTOR, PacketPriority.CONTROL, appId); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Cancel requested ARP packets in via packet service. |
| 461 | */ |
| 462 | private void cancelArpPackets() { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 463 | packetService.cancelPackets(ARP_SELECTOR, PacketPriority.CONTROL, appId); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | @Override |
| 467 | public Optional<DhcpRecord> getDhcpRecord(HostId hostId) { |
| 468 | return dhcpRelayStore.getDhcpRecord(hostId); |
| 469 | } |
| 470 | |
| 471 | @Override |
| 472 | public Collection<DhcpRecord> getDhcpRecords() { |
| 473 | return dhcpRelayStore.getDhcpRecords(); |
| 474 | } |
| 475 | |
Yi Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 476 | @Override |
| 477 | public Optional<MacAddress> getDhcpServerMacAddress() { |
Yi Tseng | 4ec727d | 2017-08-31 11:21:00 -0700 | [diff] [blame] | 478 | // TODO: depreated it |
| 479 | DefaultDhcpRelayConfig config = cfgService.getConfig(appId, DefaultDhcpRelayConfig.class); |
| 480 | DhcpServerConfig serverConfig = config.dhcpServerConfigs().get(0); |
| 481 | Ip4Address serverip = serverConfig.getDhcpServerIp4().get(); |
| 482 | return hostService.getHostsByIp(serverip) |
| 483 | .stream() |
| 484 | .map(Host::mac) |
| 485 | .findFirst(); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 486 | } |
| 487 | |
| 488 | /** |
| 489 | * Gets DHCP data from a packet. |
| 490 | * |
| 491 | * @param packet the packet |
| 492 | * @return the DHCP data; empty if it is not a DHCP packet |
| 493 | */ |
| 494 | private Optional<DHCP> findDhcp(Ethernet packet) { |
| 495 | return Stream.of(packet) |
| 496 | .filter(Objects::nonNull) |
| 497 | .map(Ethernet::getPayload) |
| 498 | .filter(p -> p instanceof IPv4) |
| 499 | .map(IPacket::getPayload) |
| 500 | .filter(Objects::nonNull) |
| 501 | .filter(p -> p instanceof UDP) |
| 502 | .map(IPacket::getPayload) |
| 503 | .filter(Objects::nonNull) |
| 504 | .filter(p -> p instanceof DHCP) |
| 505 | .map(p -> (DHCP) p) |
| 506 | .findFirst(); |
| 507 | } |
| 508 | |
| 509 | /** |
| 510 | * Gets DHCPv6 data from a packet. |
| 511 | * |
| 512 | * @param packet the packet |
| 513 | * @return the DHCPv6 data; empty if it is not a DHCPv6 packet |
| 514 | */ |
| 515 | private Optional<DHCP6> findDhcp6(Ethernet packet) { |
| 516 | return Stream.of(packet) |
| 517 | .filter(Objects::nonNull) |
| 518 | .map(Ethernet::getPayload) |
| 519 | .filter(p -> p instanceof IPv6) |
| 520 | .map(IPacket::getPayload) |
| 521 | .filter(Objects::nonNull) |
| 522 | .filter(p -> p instanceof UDP) |
| 523 | .map(IPacket::getPayload) |
| 524 | .filter(Objects::nonNull) |
| 525 | .filter(p -> p instanceof DHCP6) |
| 526 | .map(p -> (DHCP6) p) |
| 527 | .findFirst(); |
| 528 | } |
| 529 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 530 | |
| 531 | private class DhcpRelayPacketProcessor implements PacketProcessor { |
| 532 | |
| 533 | @Override |
| 534 | public void process(PacketContext context) { |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 535 | // process the packet and get the payload |
| 536 | Ethernet packet = context.inPacket().parsed(); |
| 537 | if (packet == null) { |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | findDhcp(packet).ifPresent(dhcpPayload -> { |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 542 | v4Handler.processDhcpPacket(context, dhcpPayload); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 543 | }); |
| 544 | |
| 545 | findDhcp6(packet).ifPresent(dhcp6Payload -> { |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 546 | v6Handler.processDhcpPacket(context, dhcp6Payload); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 547 | }); |
| 548 | |
| 549 | if (packet.getEtherType() == Ethernet.TYPE_ARP && arpEnabled) { |
| 550 | ARP arpPacket = (ARP) packet.getPayload(); |
| 551 | VlanId vlanId = VlanId.vlanId(packet.getVlanID()); |
| 552 | Set<Interface> interfaces = interfaceService. |
| 553 | getInterfacesByPort(context.inPacket().receivedFrom()); |
| 554 | //ignore the packets if dhcp server interface is not configured on onos. |
| 555 | if (interfaces.isEmpty()) { |
| 556 | log.warn("server virtual interface not configured"); |
| 557 | return; |
| 558 | } |
| 559 | if ((arpPacket.getOpCode() != ARP.OP_REQUEST)) { |
| 560 | // handle request only |
| 561 | return; |
| 562 | } |
| 563 | MacAddress interfaceMac = interfaces.stream() |
| 564 | .filter(iface -> iface.vlan().equals(vlanId)) |
| 565 | .map(Interface::mac) |
| 566 | .filter(mac -> !mac.equals(MacAddress.NONE)) |
| 567 | .findFirst() |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 568 | .orElse(MacAddress.ONOS); |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 569 | if (interfaceMac == null) { |
| 570 | // can't find interface mac address |
| 571 | return; |
| 572 | } |
| 573 | processArpPacket(context, packet, interfaceMac); |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | /** |
| 578 | * Processes the ARP Payload and initiates a reply to the client. |
| 579 | * |
| 580 | * @param context the packet context |
| 581 | * @param packet the ethernet payload |
| 582 | * @param replyMac mac address to be replied |
| 583 | */ |
| 584 | private void processArpPacket(PacketContext context, Ethernet packet, MacAddress replyMac) { |
| 585 | ARP arpPacket = (ARP) packet.getPayload(); |
| 586 | ARP arpReply = (ARP) arpPacket.clone(); |
| 587 | arpReply.setOpCode(ARP.OP_REPLY); |
| 588 | |
| 589 | arpReply.setTargetProtocolAddress(arpPacket.getSenderProtocolAddress()); |
| 590 | arpReply.setTargetHardwareAddress(arpPacket.getSenderHardwareAddress()); |
| 591 | arpReply.setSenderProtocolAddress(arpPacket.getTargetProtocolAddress()); |
| 592 | arpReply.setSenderHardwareAddress(replyMac.toBytes()); |
| 593 | |
| 594 | // Ethernet Frame. |
| 595 | Ethernet ethReply = new Ethernet(); |
| 596 | ethReply.setSourceMACAddress(replyMac.toBytes()); |
| 597 | ethReply.setDestinationMACAddress(packet.getSourceMAC()); |
| 598 | ethReply.setEtherType(Ethernet.TYPE_ARP); |
| 599 | ethReply.setVlanID(packet.getVlanID()); |
| 600 | ethReply.setPayload(arpReply); |
| 601 | |
| 602 | ConnectPoint targetPort = context.inPacket().receivedFrom(); |
| 603 | TrafficTreatment t = DefaultTrafficTreatment.builder() |
| 604 | .setOutput(targetPort.port()).build(); |
| 605 | OutboundPacket o = new DefaultOutboundPacket( |
| 606 | targetPort.deviceId(), t, ByteBuffer.wrap(ethReply.serialize())); |
| 607 | if (log.isTraceEnabled()) { |
| 608 | log.trace("Relaying ARP packet {} to {}", packet, targetPort); |
| 609 | } |
| 610 | packetService.emit(o); |
| 611 | } |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | /** |
| 615 | * Listener for network config events. |
| 616 | */ |
| 617 | private class InternalConfigListener implements NetworkConfigListener { |
| 618 | @Override |
| 619 | public void event(NetworkConfigEvent event) { |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 620 | switch (event.type()) { |
| 621 | case CONFIG_UPDATED: |
| 622 | case CONFIG_ADDED: |
| 623 | event.config().ifPresent(config -> { |
| 624 | updateConfig(config); |
| 625 | log.info("{} updated", config.getClass().getSimpleName()); |
| 626 | }); |
| 627 | break; |
| 628 | case CONFIG_REMOVED: |
| 629 | event.prevConfig().ifPresent(config -> { |
| 630 | removeConfig(config); |
| 631 | log.info("{} removed", config.getClass().getSimpleName()); |
| 632 | }); |
| 633 | break; |
| 634 | default: |
| 635 | log.warn("Unsupported event type {}", event.type()); |
| 636 | break; |
Yi Tseng | e72fbb5 | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 637 | } |
Yi Tseng | 5479fb8 | 2017-09-01 17:24:57 -0700 | [diff] [blame] | 638 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 639 | } |
| 640 | } |
Yi Tseng | 76365d8 | 2017-09-12 15:55:17 -0700 | [diff] [blame] | 641 | |
| 642 | private class InternalDeviceListener implements DeviceListener { |
| 643 | |
| 644 | @Override |
| 645 | public void event(DeviceEvent event) { |
| 646 | Device device = event.subject(); |
| 647 | switch (event.type()) { |
| 648 | case DEVICE_ADDED: |
| 649 | deviceAdd(device.id()); |
| 650 | break; |
| 651 | case DEVICE_REMOVED: |
| 652 | ignoredVlans.removeAll(device.id()); |
| 653 | break; |
| 654 | case DEVICE_AVAILABILITY_CHANGED: |
| 655 | deviceAvailabilityChanged(device); |
| 656 | |
| 657 | default: |
| 658 | break; |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | private void deviceAvailabilityChanged(Device device) { |
| 663 | if (deviceService.isAvailable(device.id())) { |
| 664 | deviceAdd(device.id()); |
| 665 | } else { |
| 666 | ignoredVlans.removeAll(device.id()); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | private void deviceAdd(DeviceId deviceId) { |
| 671 | IgnoreDhcpConfig config = cfgService.getConfig(appId, IgnoreDhcpConfig.class); |
| 672 | Collection<VlanId> vlanIds = config.ignoredVlans().get(deviceId); |
| 673 | vlanIds.forEach(vlanId -> { |
| 674 | processIgnoreVlanRule(deviceId, vlanId, ADD); |
| 675 | }); |
| 676 | } |
| 677 | } |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 678 | } |