alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | cf85aa8 | 2017-08-03 22:46:01 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
alshabib | 772e158 | 2016-06-01 17:50:05 -0700 | [diff] [blame] | 16 | package org.opencord.cordmcast; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 17 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableSet; |
| 19 | import com.google.common.collect.Sets; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 20 | import org.apache.commons.lang3.tuple.ImmutablePair; |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 21 | import org.osgi.service.component.annotations.Activate; |
| 22 | import org.osgi.service.component.annotations.Component; |
| 23 | import org.osgi.service.component.annotations.Deactivate; |
| 24 | import org.osgi.service.component.annotations.Modified; |
| 25 | import org.osgi.service.component.annotations.Reference; |
| 26 | import org.osgi.service.component.annotations.ReferenceCardinality; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 27 | import org.onlab.packet.Ethernet; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 28 | import org.onlab.packet.IpAddress; |
| 29 | import org.onlab.packet.VlanId; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 30 | import org.onlab.util.KryoNamespace; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 31 | import org.onosproject.cfg.ComponentConfigService; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 32 | import org.onosproject.cluster.ClusterService; |
| 33 | import org.onosproject.cluster.LeadershipService; |
| 34 | import org.onosproject.cluster.NodeId; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 35 | import org.onosproject.core.ApplicationId; |
| 36 | import org.onosproject.core.CoreService; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 37 | import org.onosproject.mastership.MastershipService; |
| 38 | import org.onosproject.mcast.api.McastEvent; |
| 39 | import org.onosproject.mcast.api.McastListener; |
| 40 | import org.onosproject.mcast.api.McastRoute; |
| 41 | import org.onosproject.mcast.api.MulticastRouteService; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 42 | import org.onosproject.net.ConnectPoint; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 43 | import org.onosproject.net.DeviceId; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 44 | import org.onosproject.net.HostId; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 45 | import org.onosproject.net.PortNumber; |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 46 | import org.onosproject.net.config.ConfigFactory; |
| 47 | import org.onosproject.net.config.NetworkConfigEvent; |
| 48 | import org.onosproject.net.config.NetworkConfigListener; |
| 49 | import org.onosproject.net.config.NetworkConfigRegistry; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 50 | import org.onosproject.net.config.basics.McastConfig; |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 51 | import org.onosproject.net.config.basics.SubjectFactories; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 52 | import org.onosproject.net.device.DeviceService; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 53 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 54 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 55 | import org.onosproject.net.flow.FlowRuleService; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 56 | import org.onosproject.net.flow.TrafficSelector; |
| 57 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 58 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 59 | import org.onosproject.net.flowobjective.DefaultObjectiveContext; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 60 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 61 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 62 | import org.onosproject.net.flowobjective.NextObjective; |
| 63 | import org.onosproject.net.flowobjective.Objective; |
| 64 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 65 | import org.onosproject.net.flowobjective.ObjectiveError; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 66 | import org.onosproject.store.serializers.KryoNamespaces; |
| 67 | import org.onosproject.store.service.ConsistentMap; |
| 68 | import org.onosproject.store.service.Serializer; |
| 69 | import org.onosproject.store.service.StorageService; |
| 70 | import org.onosproject.store.service.Versioned; |
Charles Chan | e8ed8ee | 2016-06-13 16:37:01 -0700 | [diff] [blame] | 71 | import org.opencord.cordconfig.CordConfigService; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 72 | import org.opencord.cordconfig.access.AccessDeviceData; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 73 | import org.osgi.service.component.ComponentContext; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 74 | import org.slf4j.Logger; |
| 75 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 76 | import java.util.Dictionary; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 77 | import java.util.Map; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 78 | import java.util.Objects; |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 79 | import java.util.Optional; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 80 | import java.util.Properties; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 81 | import java.util.Set; |
| 82 | import java.util.concurrent.ExecutorService; |
| 83 | import java.util.concurrent.locks.Lock; |
| 84 | import java.util.concurrent.locks.ReentrantLock; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 85 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 86 | import static com.google.common.base.Strings.isNullOrEmpty; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 87 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 88 | import static org.onlab.util.Tools.get; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 89 | import static org.onlab.util.Tools.groupedThreads; |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 90 | import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_VLAN_ENABLED; |
| 91 | import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_PRIORITY; |
| 92 | import static org.opencord.cordmcast.OsgiPropertyConstants.PRIORITY; |
| 93 | import static org.opencord.cordmcast.OsgiPropertyConstants.VLAN_ENABLED; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 94 | import static org.slf4j.LoggerFactory.getLogger; |
| 95 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 96 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 97 | /** |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 98 | * CORD multicast provisioning application. Operates by listening to |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 99 | * events on the multicast rib and provisioning groups to program multicast |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 100 | * flows on the dataplane. |
| 101 | */ |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 102 | @Component(immediate = true, |
| 103 | property = { |
| 104 | VLAN_ENABLED + ":Boolean=" + DEFAULT_VLAN_ENABLED, |
| 105 | PRIORITY + ":Integer=" + DEFAULT_PRIORITY, |
| 106 | }) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 107 | public class CordMcast { |
Charles Chan | f867c4b | 2017-01-20 11:22:25 -0800 | [diff] [blame] | 108 | private static final String APP_NAME = "org.opencord.cordmcast"; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 109 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 110 | private final Logger log = getLogger(getClass()); |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 111 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 112 | private static final int DEFAULT_PRIORITY = 500; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 113 | private static final short DEFAULT_MCAST_VLAN = 4000; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 114 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 115 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 116 | protected MulticastRouteService mcastService; |
| 117 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 118 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 119 | protected FlowObjectiveService flowObjectiveService; |
| 120 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 121 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 122 | protected CoreService coreService; |
| 123 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 124 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 125 | protected ComponentConfigService componentConfigService; |
| 126 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 127 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 128 | protected CordConfigService cordConfigService; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 129 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 130 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 131 | protected NetworkConfigRegistry networkConfig; |
| 132 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 133 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 134 | protected StorageService storageService; |
| 135 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 136 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 137 | protected MastershipService mastershipService; |
| 138 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 139 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 140 | public DeviceService deviceService; |
| 141 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 142 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 143 | private ClusterService clusterService; |
| 144 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 145 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 146 | private LeadershipService leadershipService; |
| 147 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 148 | protected McastListener listener = new InternalMulticastListener(); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 149 | private InternalNetworkConfigListener configListener = |
| 150 | new InternalNetworkConfigListener(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 151 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 152 | private ConsistentMap<NextKey, NextContent> groups; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 153 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 154 | private ApplicationId appId; |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 155 | private ApplicationId coreAppId; |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 156 | private short mcastVlan = DEFAULT_MCAST_VLAN; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 157 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 158 | /** |
| 159 | * Whether to use VLAN for multicast traffic. |
| 160 | **/ |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 161 | private boolean vlanEnabled = DEFAULT_VLAN_ENABLED; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 162 | |
Carmelo Cascone | 995fd68 | 2019-11-14 14:22:39 -0800 | [diff] [blame^] | 163 | /** |
| 164 | * Priority for multicast rules. |
| 165 | **/ |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 166 | private int priority = DEFAULT_PRIORITY; |
| 167 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 168 | private static final Class<McastConfig> CORD_MCAST_CONFIG_CLASS = |
| 169 | McastConfig.class; |
| 170 | |
| 171 | private ConfigFactory<ApplicationId, McastConfig> cordMcastConfigFactory = |
| 172 | new ConfigFactory<ApplicationId, McastConfig>( |
| 173 | SubjectFactories.APP_SUBJECT_FACTORY, CORD_MCAST_CONFIG_CLASS, "multicast") { |
| 174 | @Override |
| 175 | public McastConfig createConfig() { |
| 176 | return new McastConfig(); |
| 177 | } |
| 178 | }; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 179 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 180 | // lock to synchronize local operations |
| 181 | private final Lock mcastLock = new ReentrantLock(); |
| 182 | private void mcastLock() { |
| 183 | mcastLock.lock(); |
| 184 | } |
| 185 | private void mcastUnlock() { |
| 186 | mcastLock.unlock(); |
| 187 | } |
| 188 | private ExecutorService eventExecutor; |
| 189 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 190 | @Activate |
Jonathan Hart | 435ffc4 | 2016-02-19 10:32:05 -0800 | [diff] [blame] | 191 | public void activate(ComponentContext context) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 192 | componentConfigService.registerProperties(getClass()); |
Jonathan Hart | 435ffc4 | 2016-02-19 10:32:05 -0800 | [diff] [blame] | 193 | modified(context); |
| 194 | |
Charles Chan | f867c4b | 2017-01-20 11:22:25 -0800 | [diff] [blame] | 195 | appId = coreService.registerApplication(APP_NAME); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 196 | coreAppId = coreService.registerApplication(CoreService.CORE_APP_NAME); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 197 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 198 | eventExecutor = newSingleThreadScheduledExecutor(groupedThreads("cord/mcast", |
| 199 | "events-mcast-%d", log)); |
| 200 | |
| 201 | KryoNamespace.Builder groupsKryo = new KryoNamespace.Builder() |
| 202 | .register(KryoNamespaces.API) |
| 203 | .register(NextKey.class) |
| 204 | .register(NextContent.class); |
| 205 | groups = storageService |
| 206 | .<NextKey, NextContent>consistentMapBuilder() |
| 207 | .withName("cord-mcast-groups-store") |
| 208 | .withSerializer(Serializer.using(groupsKryo.build("CordMcast-Groups"))) |
| 209 | .build(); |
| 210 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 211 | networkConfig.registerConfigFactory(cordMcastConfigFactory); |
| 212 | networkConfig.addListener(configListener); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 213 | mcastService.addListener(listener); |
| 214 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 215 | mcastService.getRoutes().stream() |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 216 | .map(r -> new ImmutablePair<>(r, mcastService.sinks(r))) |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 217 | .filter(pair -> pair.getRight() != null && !pair.getRight().isEmpty()) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 218 | .forEach(pair -> pair.getRight().forEach(sink -> addSink(pair.getLeft(), |
| 219 | sink))); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 220 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 221 | McastConfig config = networkConfig.getConfig(coreAppId, CORD_MCAST_CONFIG_CLASS); |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 222 | updateConfig(config); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 223 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 224 | log.info("Started"); |
| 225 | } |
| 226 | |
| 227 | @Deactivate |
| 228 | public void deactivate() { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 229 | componentConfigService.unregisterProperties(getClass(), false); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 230 | mcastService.removeListener(listener); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 231 | networkConfig.removeListener(configListener); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 232 | networkConfig.unregisterConfigFactory(cordMcastConfigFactory); |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 233 | eventExecutor.shutdown(); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 234 | clearGroups(); |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 235 | groups.destroy(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 236 | log.info("Stopped"); |
| 237 | } |
| 238 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 239 | public void clearGroups() { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 240 | mcastLock(); |
| 241 | try { |
| 242 | groups.keySet().forEach(groupInfo -> { |
| 243 | if (!isLocalLeader(groupInfo.getDevice())) { |
| 244 | return; |
| 245 | } |
| 246 | NextContent next = groups.get(groupInfo).value(); |
| 247 | |
| 248 | ObjectiveContext context = new DefaultObjectiveContext( |
| 249 | (objective) -> log.debug("Successfully remove {}", |
| 250 | groupInfo.group), |
| 251 | (objective, error) -> log.warn("Failed to remove {}: {}", |
| 252 | groupInfo.group, error)); |
| 253 | // remove the flow rule |
| 254 | flowObjectiveService.forward(groupInfo.getDevice(), fwdObject(next.getNextId(), |
| 255 | groupInfo.group).remove(context)); |
| 256 | // remove all ports from the group |
| 257 | next.getOutPorts().stream().forEach(portNumber -> |
| 258 | flowObjectiveService.next(groupInfo.getDevice(), nextObject(next.getNextId(), |
| 259 | portNumber, NextType.RemoveFromExisting, |
| 260 | groupInfo.group)) |
| 261 | ); |
| 262 | |
| 263 | }); |
| 264 | groups.clear(); |
| 265 | } finally { |
| 266 | mcastUnlock(); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | private VlanId multicastVlan() { |
| 271 | return VlanId.vlanId(mcastVlan); |
| 272 | } |
| 273 | |
| 274 | private VlanId assignedVlan() { |
| 275 | return vlanEnabled ? multicastVlan() : VlanId.NONE; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 276 | } |
| 277 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 278 | @Modified |
| 279 | public void modified(ComponentContext context) { |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 280 | Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties(); |
| 281 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 282 | try { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 283 | String s = get(properties, "vlanEnabled"); |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 284 | vlanEnabled = isNullOrEmpty(s) ? DEFAULT_VLAN_ENABLED : Boolean.parseBoolean(s.trim()); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 285 | |
| 286 | s = get(properties, "priority"); |
| 287 | priority = isNullOrEmpty(s) ? DEFAULT_PRIORITY : Integer.parseInt(s.trim()); |
| 288 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 289 | } catch (Exception e) { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 290 | log.error("Unable to parse configuration parameter.", e); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 291 | vlanEnabled = false; |
| 292 | priority = DEFAULT_PRIORITY; |
| 293 | } |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 294 | } |
| 295 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 296 | private class InternalMulticastListener implements McastListener { |
| 297 | @Override |
| 298 | public void event(McastEvent event) { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 299 | eventExecutor.execute(() -> { |
| 300 | switch (event.type()) { |
| 301 | case ROUTE_ADDED: |
| 302 | case ROUTE_REMOVED: |
| 303 | case SOURCES_ADDED: |
| 304 | break; |
| 305 | case SINKS_ADDED: |
| 306 | addSinks(event); |
| 307 | break; |
| 308 | case SINKS_REMOVED: |
| 309 | removeSinks(event); |
| 310 | break; |
| 311 | default: |
| 312 | log.warn("Unknown mcast event {}", event.type()); |
| 313 | } |
| 314 | }); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Processes previous, and new sinks then finds the sinks to be removed. |
| 320 | * @param prevSinks the previous sinks to be evaluated |
| 321 | * @param newSinks the new sinks to be evaluated |
| 322 | * @returnt the set of the sinks to be removed |
| 323 | */ |
| 324 | private Set<ConnectPoint> getSinksToBeRemoved(Map<HostId, Set<ConnectPoint>> prevSinks, |
| 325 | Map<HostId, Set<ConnectPoint>> newSinks) { |
| 326 | return getSinksToBeProcessed(prevSinks, newSinks); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | /** |
| 331 | * Processes previous, and new sinks then finds the sinks to be added. |
| 332 | * @param newSinks the new sinks to be processed |
| 333 | * @param allPrevSinks all previous sinks |
| 334 | * @return the set of the sinks to be added |
| 335 | */ |
| 336 | private Set<ConnectPoint> getSinksToBeAdded(Map<HostId, Set<ConnectPoint>> newSinks, |
| 337 | Map<HostId, Set<ConnectPoint>> allPrevSinks) { |
| 338 | return getSinksToBeProcessed(newSinks, allPrevSinks); |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Gets single-homed sinks that are in set1 but not in set2. |
| 343 | * @param sinkSet1 the first sink map |
| 344 | * @param sinkSet2 the second sink map |
| 345 | * @return a set containing all the single-homed sinks found in set1 but not in set2 |
| 346 | */ |
| 347 | private Set<ConnectPoint> getSinksToBeProcessed(Map<HostId, Set<ConnectPoint>> sinkSet1, |
| 348 | Map<HostId, Set<ConnectPoint>> sinkSet2) { |
| 349 | final Set<ConnectPoint> sinksToBeProcessed = Sets.newHashSet(); |
| 350 | sinkSet1.forEach(((hostId, connectPoints) -> { |
| 351 | if (HostId.NONE.equals(hostId)) { |
| 352 | //assume all connect points associated with HostId.NONE are single homed sinks |
| 353 | sinksToBeProcessed.addAll(connectPoints); |
| 354 | return; |
| 355 | } |
| 356 | })); |
| 357 | Set<ConnectPoint> singleHomedSinksOfSet2 = sinkSet2.get(HostId.NONE) == null ? |
| 358 | Sets.newHashSet() : |
| 359 | sinkSet2.get(HostId.NONE); |
| 360 | return Sets.difference(sinksToBeProcessed, singleHomedSinksOfSet2); |
| 361 | }; |
| 362 | |
| 363 | |
| 364 | private void removeSinks(McastEvent event) { |
| 365 | mcastLock(); |
| 366 | try { |
| 367 | Set<ConnectPoint> sinksToBeRemoved = getSinksToBeRemoved(event.prevSubject().sinks(), |
| 368 | event.subject().sinks()); |
| 369 | sinksToBeRemoved.forEach(sink -> removeSink(event.subject().route().group(), sink)); |
| 370 | } finally { |
| 371 | mcastUnlock(); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | private void removeSink(IpAddress group, ConnectPoint sink) { |
| 376 | if (!isLocalLeader(sink.deviceId())) { |
| 377 | log.debug("Not the leader of {}. Skip sink_removed event for the sink {} and group {}", |
| 378 | sink.deviceId(), sink, group); |
| 379 | return; |
| 380 | } |
| 381 | |
| 382 | Optional<AccessDeviceData> oltInfo = cordConfigService.getAccessDevice(sink.deviceId()); |
| 383 | |
| 384 | if (!oltInfo.isPresent()) { |
| 385 | log.warn("Unknown OLT device : {}", sink.deviceId()); |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | log.debug("Removing sink {} from the group {}", sink, group); |
| 390 | |
| 391 | NextKey key = new NextKey(sink.deviceId(), group); |
| 392 | groups.computeIfPresent(key, (k, v) -> { |
| 393 | flowObjectiveService.next(sink.deviceId(), nextObject(v.getNextId(), sink.port(), |
| 394 | NextType.RemoveFromExisting, group)); |
| 395 | |
| 396 | Set<PortNumber> outPorts = Sets.newHashSet(v.getOutPorts()); |
| 397 | outPorts.remove(sink.port()); |
| 398 | |
| 399 | if (outPorts.isEmpty()) { |
| 400 | // this is the last sink |
| 401 | ObjectiveContext context = new DefaultObjectiveContext( |
| 402 | (objective) -> log.debug("Successfully remove {} on {}", |
| 403 | group, sink), |
| 404 | (objective, error) -> log.warn("Failed to remove {} on {}: {}", |
| 405 | group, sink, error)); |
| 406 | ForwardingObjective fwdObj = fwdObject(v.getNextId(), group).remove(context); |
| 407 | flowObjectiveService.forward(sink.deviceId(), fwdObj); |
| 408 | } |
| 409 | // remove the whole entity if no out port exists in the port list |
| 410 | return outPorts.isEmpty() ? null : new NextContent(v.getNextId(), |
| 411 | ImmutableSet.copyOf(outPorts)); |
| 412 | }); |
| 413 | } |
| 414 | |
| 415 | private void addSinks(McastEvent event) { |
| 416 | mcastLock(); |
| 417 | try { |
| 418 | Set<ConnectPoint> sinksToBeAdded = getSinksToBeAdded(event.subject().sinks(), |
| 419 | event.prevSubject().sinks()); |
| 420 | sinksToBeAdded.forEach(sink -> addSink(event.subject().route(), sink)); |
| 421 | } finally { |
| 422 | mcastUnlock(); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | private void addSink(McastRoute route, ConnectPoint sink) { |
| 427 | if (!isLocalLeader(sink.deviceId())) { |
| 428 | log.debug("Not the leader of {}. Skip sink_added event for the sink {} and group {}", |
| 429 | sink.deviceId(), sink, route.group()); |
| 430 | return; |
| 431 | } |
| 432 | |
| 433 | Optional<AccessDeviceData> oltInfo = cordConfigService.getAccessDevice(sink.deviceId()); |
| 434 | |
| 435 | if (!oltInfo.isPresent()) { |
| 436 | log.warn("Unknown OLT device : {}", sink.deviceId()); |
| 437 | return; |
| 438 | } |
| 439 | |
| 440 | log.debug("Adding sink {} to the group {}", sink, route.group()); |
| 441 | |
| 442 | NextKey key = new NextKey(sink.deviceId(), route.group()); |
| 443 | NextObjective newNextObj; |
| 444 | |
| 445 | boolean theFirstSinkOfGroup = false; |
| 446 | if (!groups.containsKey(key)) { |
| 447 | // First time someone request this mcast group via this device |
| 448 | Integer nextId = flowObjectiveService.allocateNextId(); |
| 449 | newNextObj = nextObject(nextId, sink.port(), NextType.AddNew, route.group()); |
| 450 | // Store the new port |
| 451 | groups.put(key, new NextContent(nextId, ImmutableSet.of(sink.port()))); |
| 452 | theFirstSinkOfGroup = true; |
| 453 | } else { |
| 454 | // This device already serves some subscribers of this mcast group |
| 455 | Versioned<NextContent> nextObj = groups.get(key); |
| 456 | if (nextObj.value().getOutPorts().contains(sink.port())) { |
| 457 | log.info("Group {} already serves the sink connected to {}", route.group(), sink); |
| 458 | return; |
| 459 | } |
| 460 | newNextObj = nextObject(nextObj.value().getNextId(), sink.port(), |
| 461 | NextType.AddToExisting, route.group()); |
| 462 | // add new port to the group |
| 463 | Set<PortNumber> outPorts = Sets.newHashSet(nextObj.value().getOutPorts()); |
| 464 | outPorts.add(sink.port()); |
| 465 | groups.put(key, new NextContent(newNextObj.id(), ImmutableSet.copyOf(outPorts))); |
| 466 | } |
| 467 | |
| 468 | ObjectiveContext context = new DefaultObjectiveContext( |
| 469 | (objective) -> log.debug("Successfully add {} on {}/{}, vlan {}", |
| 470 | route.group(), sink.deviceId(), sink.port().toLong(), |
| 471 | assignedVlan()), |
| 472 | (objective, error) -> { |
| 473 | log.warn("Failed to add {} on {}/{}, vlan {}: {}", |
| 474 | route.group(), sink.deviceId(), sink.port().toLong(), assignedVlan(), |
| 475 | error); |
| 476 | }); |
| 477 | |
| 478 | flowObjectiveService.next(sink.deviceId(), newNextObj); |
| 479 | |
| 480 | if (theFirstSinkOfGroup) { |
| 481 | // create the necessary flow rule if this is the first sink request for the group |
| 482 | // on this device |
| 483 | flowObjectiveService.forward(sink.deviceId(), fwdObject(newNextObj.id(), |
| 484 | route.group()).add(context)); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | private class InternalNetworkConfigListener implements NetworkConfigListener { |
| 489 | @Override |
| 490 | public void event(NetworkConfigEvent event) { |
| 491 | eventExecutor.execute(() -> { |
| 492 | switch (event.type()) { |
| 493 | |
| 494 | case CONFIG_ADDED: |
| 495 | case CONFIG_UPDATED: |
| 496 | if (event.configClass().equals(CORD_MCAST_CONFIG_CLASS)) { |
| 497 | McastConfig config = networkConfig.getConfig(coreAppId, CORD_MCAST_CONFIG_CLASS); |
| 498 | if (config != null) { |
| 499 | //TODO: Simply remove flows/groups, hosts will response period query |
| 500 | // and re-sent IGMP report, so the flows can be rebuild. |
| 501 | // However, better to remove and re-add mcast flow rules here |
| 502 | if (mcastVlan != config.egressVlan().toShort() && vlanEnabled) { |
| 503 | clearGroups(); |
| 504 | } |
| 505 | updateConfig(config); |
| 506 | } |
| 507 | } |
| 508 | break; |
| 509 | case CONFIG_REGISTERED: |
| 510 | case CONFIG_UNREGISTERED: |
| 511 | case CONFIG_REMOVED: |
| 512 | break; |
| 513 | default: |
| 514 | break; |
| 515 | } |
| 516 | }); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | private void updateConfig(McastConfig config) { |
| 521 | if (config == null) { |
| 522 | return; |
| 523 | } |
| 524 | log.debug("multicast config received: {}", config); |
| 525 | |
| 526 | if (config.egressVlan() != null) { |
| 527 | mcastVlan = config.egressVlan().toShort(); |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | private class NextKey { |
| 532 | private DeviceId device; |
| 533 | private IpAddress group; |
| 534 | |
| 535 | public NextKey(DeviceId deviceId, IpAddress groupAddress) { |
| 536 | device = deviceId; |
| 537 | group = groupAddress; |
| 538 | } |
| 539 | |
| 540 | public DeviceId getDevice() { |
| 541 | return device; |
| 542 | } |
| 543 | |
| 544 | public int hashCode() { |
| 545 | return Objects.hash(this.device, this.group); |
| 546 | } |
| 547 | |
| 548 | public boolean equals(Object obj) { |
| 549 | if (this == obj) { |
| 550 | return true; |
| 551 | } else if (!(obj instanceof NextKey)) { |
| 552 | return false; |
| 553 | } else { |
| 554 | NextKey that = (NextKey) obj; |
| 555 | return this.getClass() == that.getClass() && |
| 556 | Objects.equals(this.device, that.device) && |
| 557 | Objects.equals(this.group, that.group); |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | private class NextContent { |
| 563 | private Integer nextId; |
| 564 | private Set<PortNumber> outPorts; |
| 565 | |
| 566 | public NextContent(Integer nextId, Set<PortNumber> outPorts) { |
| 567 | this.nextId = nextId; |
| 568 | this.outPorts = outPorts; |
| 569 | } |
| 570 | |
| 571 | public Integer getNextId() { |
| 572 | return nextId; |
| 573 | } |
| 574 | |
| 575 | public Set<PortNumber> getOutPorts() { |
| 576 | return ImmutableSet.copyOf(outPorts); |
| 577 | } |
| 578 | |
| 579 | public int hashCode() { |
| 580 | return Objects.hash(this.nextId, this.outPorts); |
| 581 | } |
| 582 | |
| 583 | public boolean equals(Object obj) { |
| 584 | if (this == obj) { |
| 585 | return true; |
| 586 | } else if (!(obj instanceof NextContent)) { |
| 587 | return false; |
| 588 | } else { |
| 589 | NextContent that = (NextContent) obj; |
| 590 | return this.getClass() == that.getClass() && |
| 591 | Objects.equals(this.nextId, that.nextId) && |
| 592 | Objects.equals(this.outPorts, that.outPorts); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 593 | } |
| 594 | } |
| 595 | } |
| 596 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 597 | private enum NextType { AddNew, AddToExisting, Remove, RemoveFromExisting }; |
| 598 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 599 | private NextObjective nextObject(Integer nextId, PortNumber port, |
| 600 | NextType nextType, IpAddress mcastIp) { |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 601 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 602 | // Build the meta selector with the fwd objective info |
| 603 | TrafficSelector.Builder metadata = DefaultTrafficSelector.builder() |
| 604 | .matchIPDst(mcastIp.toIpPrefix()); |
| 605 | |
| 606 | if (vlanEnabled) { |
| 607 | metadata.matchVlanId(multicastVlan()); |
| 608 | } |
| 609 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 610 | DefaultNextObjective.Builder build = DefaultNextObjective.builder() |
| 611 | .fromApp(appId) |
| 612 | .addTreatment(DefaultTrafficTreatment.builder().setOutput(port).build()) |
| 613 | .withType(NextObjective.Type.BROADCAST) |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 614 | .withId(nextId) |
| 615 | .withMeta(metadata.build()); |
| 616 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 617 | ObjectiveContext content = new ObjectiveContext() { |
| 618 | @Override |
| 619 | public void onSuccess(Objective objective) { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 620 | log.debug("Next Objective {} installed", objective.id()); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | @Override |
| 624 | public void onError(Objective objective, ObjectiveError error) { |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 625 | log.debug("Next Objective {} failed, because {}", |
| 626 | objective.id(), |
| 627 | error); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 628 | } |
| 629 | }; |
| 630 | |
| 631 | switch (nextType) { |
| 632 | case AddNew: |
| 633 | return build.add(content); |
| 634 | case AddToExisting: |
| 635 | return build.addToExisting(content); |
| 636 | case Remove: |
| 637 | return build.remove(content); |
| 638 | case RemoveFromExisting: |
| 639 | return build.removeFromExisting(content); |
| 640 | default: |
| 641 | return null; |
| 642 | } |
| 643 | } |
| 644 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 645 | private ForwardingObjective.Builder fwdObject(int nextId, IpAddress mcastIp) { |
| 646 | TrafficSelector.Builder mcast = DefaultTrafficSelector.builder() |
| 647 | .matchEthType(Ethernet.TYPE_IPV4) |
| 648 | .matchIPDst(mcastIp.toIpPrefix()); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 649 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 650 | //build the meta selector |
| 651 | TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder(); |
| 652 | if (vlanEnabled) { |
| 653 | metabuilder.matchVlanId(multicastVlan()); |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 654 | } |
| 655 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 656 | ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder() |
| 657 | .fromApp(appId) |
| 658 | .nextStep(nextId) |
| 659 | .makePermanent() |
| 660 | .withFlag(ForwardingObjective.Flag.SPECIFIC) |
| 661 | .withPriority(priority) |
| 662 | .withSelector(mcast.build()) |
| 663 | .withMeta(metabuilder.build()); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 664 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 665 | return fwdBuilder; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 666 | } |
| 667 | |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 668 | // Custom-built function, when the device is not available we need a fallback mechanism |
| 669 | private boolean isLocalLeader(DeviceId deviceId) { |
| 670 | if (!mastershipService.isLocalMaster(deviceId)) { |
| 671 | // When the device is available we just check the mastership |
| 672 | if (deviceService.isAvailable(deviceId)) { |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 673 | return false; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 674 | } |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 675 | // Fallback with Leadership service - device id is used as topic |
| 676 | NodeId leader = leadershipService.runForLeadership( |
| 677 | deviceId.toString()).leaderNodeId(); |
| 678 | // Verify if this node is the leader |
| 679 | return clusterService.getLocalNode().id().equals(leader); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 680 | } |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 681 | return true; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 682 | } |
Esin Karaman | 39b2485 | 2019-08-28 13:57:30 +0000 | [diff] [blame] | 683 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 684 | } |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 685 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 686 | |