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 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 19 | import com.fasterxml.jackson.databind.node.ArrayNode; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 20 | import com.fasterxml.jackson.databind.node.ObjectNode; |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 21 | import com.google.common.collect.Lists; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 22 | import com.google.common.collect.Maps; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 23 | import org.apache.commons.lang3.tuple.ImmutablePair; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 24 | import org.apache.felix.scr.annotations.Activate; |
| 25 | import org.apache.felix.scr.annotations.Component; |
| 26 | import org.apache.felix.scr.annotations.Deactivate; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 27 | import org.apache.felix.scr.annotations.Modified; |
| 28 | import org.apache.felix.scr.annotations.Property; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 29 | import org.apache.felix.scr.annotations.Reference; |
| 30 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 31 | import org.glassfish.jersey.client.ClientConfig; |
| 32 | import org.glassfish.jersey.client.ClientProperties; |
| 33 | import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 34 | import org.onlab.packet.Ethernet; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 35 | import org.onlab.packet.IpAddress; |
| 36 | import org.onlab.packet.VlanId; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 37 | import org.onosproject.cfg.ComponentConfigService; |
| 38 | import org.onosproject.codec.CodecService; |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 39 | import org.onosproject.codec.JsonCodec; |
alshabib | 772e158 | 2016-06-01 17:50:05 -0700 | [diff] [blame] | 40 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 41 | import org.onosproject.core.ApplicationId; |
| 42 | import org.onosproject.core.CoreService; |
| 43 | import org.onosproject.net.ConnectPoint; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 44 | import org.onosproject.net.DeviceId; |
| 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; |
| 50 | import org.onosproject.net.config.basics.SubjectFactories; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 51 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 52 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 53 | import org.onosproject.net.flow.FlowRuleService; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 54 | import org.onosproject.net.flow.TrafficSelector; |
| 55 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 56 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
| 57 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 58 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 59 | import org.onosproject.net.flowobjective.NextObjective; |
| 60 | import org.onosproject.net.flowobjective.Objective; |
| 61 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 62 | import org.onosproject.net.flowobjective.ObjectiveError; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 63 | import org.onosproject.net.mcast.McastEvent; |
| 64 | import org.onosproject.net.mcast.McastListener; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 65 | import org.onosproject.net.mcast.McastRoute; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 66 | import org.onosproject.net.mcast.McastRouteInfo; |
| 67 | import org.onosproject.net.mcast.MulticastRouteService; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 68 | import org.onosproject.rest.AbstractWebResource; |
alshabib | 772e158 | 2016-06-01 17:50:05 -0700 | [diff] [blame] | 69 | import org.opencord.cordconfig.access.AccessAgentData; |
| 70 | import org.opencord.cordconfig.access.AccessDeviceData; |
Charles Chan | e8ed8ee | 2016-06-13 16:37:01 -0700 | [diff] [blame] | 71 | import org.opencord.cordconfig.CordConfigService; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 72 | import org.osgi.service.component.ComponentContext; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 73 | import org.slf4j.Logger; |
Jonathan Hart | f4b27c6 | 2018-05-02 17:30:05 -0700 | [diff] [blame^] | 74 | import org.onosproject.net.config.basics.McastConfig; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 75 | |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 76 | import javax.ws.rs.ProcessingException; |
| 77 | import javax.ws.rs.client.Client; |
| 78 | import javax.ws.rs.client.ClientBuilder; |
| 79 | import javax.ws.rs.client.Entity; |
| 80 | import javax.ws.rs.client.Invocation; |
| 81 | import javax.ws.rs.client.WebTarget; |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 82 | import javax.ws.rs.core.MediaType; |
| 83 | import java.io.IOException; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 84 | import java.util.Dictionary; |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 85 | import java.util.List; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 86 | import java.util.Map; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 87 | import java.util.Objects; |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 88 | import java.util.Optional; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 89 | import java.util.Properties; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 90 | import java.util.concurrent.atomic.AtomicBoolean; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 91 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 92 | import static com.google.common.base.Preconditions.checkNotNull; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 93 | import static com.google.common.base.Strings.isNullOrEmpty; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 94 | import static com.google.common.net.MediaType.JSON_UTF_8; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 95 | import static org.onlab.util.Tools.get; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 96 | import static org.slf4j.LoggerFactory.getLogger; |
| 97 | |
| 98 | /** |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 99 | * CORD multicast provisioning application. Operates by listening to |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 100 | * events on the multicast rib and provisioning groups to program multicast |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 101 | * flows on the dataplane. |
| 102 | */ |
| 103 | @Component(immediate = true) |
| 104 | public class CordMcast { |
Charles Chan | f867c4b | 2017-01-20 11:22:25 -0800 | [diff] [blame] | 105 | private static final String APP_NAME = "org.opencord.cordmcast"; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 106 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 107 | private final Logger log = getLogger(getClass()); |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 108 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 109 | private static final int DEFAULT_REST_TIMEOUT_MS = 1000; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 110 | private static final int DEFAULT_PRIORITY = 500; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 111 | private static final short DEFAULT_MCAST_VLAN = 4000; |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 112 | private static final String DEFAULT_SYNC_HOST = ""; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 113 | private static final String DEFAULT_USER = "karaf"; |
| 114 | private static final String DEFAULT_PASSWORD = "karaf"; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 115 | private static final boolean DEFAULT_VLAN_ENABLED = true; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 116 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 117 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 118 | protected MulticastRouteService mcastService; |
| 119 | |
| 120 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 121 | protected FlowObjectiveService flowObjectiveService; |
| 122 | |
| 123 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 124 | protected CoreService coreService; |
| 125 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 126 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 127 | protected CodecService codecService; |
| 128 | |
| 129 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 130 | protected ComponentConfigService componentConfigService; |
| 131 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 132 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 133 | protected CordConfigService cordConfigService; |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 134 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 135 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 136 | protected NetworkConfigRegistry networkConfig; |
| 137 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 138 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 139 | protected FlowRuleService flowRuleService; |
| 140 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 141 | protected McastListener listener = new InternalMulticastListener(); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 142 | private InternalNetworkConfigListener configListener = |
| 143 | new InternalNetworkConfigListener(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 144 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 145 | //TODO: move this to a ec map |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 146 | private Map<NextKey, Integer> groups = Maps.newConcurrentMap(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 147 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 148 | private ApplicationId appId; |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 149 | private ApplicationId coreAppId; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 150 | private int mcastVlan = DEFAULT_MCAST_VLAN; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 151 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 152 | @Property(name = "vlanEnabled", boolValue = DEFAULT_VLAN_ENABLED, |
| 153 | label = "Use vlan for multicast traffic?") |
| 154 | private boolean vlanEnabled = DEFAULT_VLAN_ENABLED; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 155 | |
| 156 | @Property(name = "priority", intValue = DEFAULT_PRIORITY, |
| 157 | label = "Priority for multicast rules") |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 158 | private int priority = DEFAULT_PRIORITY; |
| 159 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 160 | @Property(name = "syncHost", value = DEFAULT_SYNC_HOST, |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 161 | label = "host:port to synchronize routes to") |
ke han | d851dce | 2017-04-28 13:58:02 +0800 | [diff] [blame] | 162 | private String syncHost = null; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 163 | |
| 164 | @Property(name = "username", value = DEFAULT_USER, |
| 165 | label = "Username for REST password authentication") |
| 166 | private String user = DEFAULT_USER; |
| 167 | |
| 168 | @Property(name = "password", value = DEFAULT_PASSWORD, |
| 169 | label = "Password for REST authentication") |
| 170 | private String password = DEFAULT_PASSWORD; |
| 171 | |
| 172 | private String fabricOnosUrl; |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 173 | private static final Class<McastConfig> CORD_MCAST_CONFIG_CLASS = |
| 174 | McastConfig.class; |
| 175 | |
| 176 | private ConfigFactory<ApplicationId, McastConfig> cordMcastConfigFactory = |
| 177 | new ConfigFactory<ApplicationId, McastConfig>( |
| 178 | SubjectFactories.APP_SUBJECT_FACTORY, CORD_MCAST_CONFIG_CLASS, "multicast") { |
| 179 | @Override |
| 180 | public McastConfig createConfig() { |
| 181 | return new McastConfig(); |
| 182 | } |
| 183 | }; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 184 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 185 | @Activate |
Jonathan Hart | 435ffc4 | 2016-02-19 10:32:05 -0800 | [diff] [blame] | 186 | public void activate(ComponentContext context) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 187 | componentConfigService.registerProperties(getClass()); |
Jonathan Hart | 435ffc4 | 2016-02-19 10:32:05 -0800 | [diff] [blame] | 188 | modified(context); |
| 189 | |
Charles Chan | f867c4b | 2017-01-20 11:22:25 -0800 | [diff] [blame] | 190 | appId = coreService.registerApplication(APP_NAME); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 191 | coreAppId = coreService.registerApplication(CoreService.CORE_APP_NAME); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 192 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 193 | clearRemoteRoutes(); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 194 | networkConfig.registerConfigFactory(cordMcastConfigFactory); |
| 195 | networkConfig.addListener(configListener); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 196 | mcastService.addListener(listener); |
| 197 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 198 | mcastService.getRoutes().stream() |
| 199 | .map(r -> new ImmutablePair<>(r, mcastService.fetchSinks(r))) |
| 200 | .filter(pair -> pair.getRight() != null && !pair.getRight().isEmpty()) |
| 201 | .forEach(pair -> pair.getRight().forEach(sink -> provisionGroup(pair.getLeft(), |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 202 | sink))); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 203 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 204 | McastConfig config = networkConfig.getConfig(coreAppId, CORD_MCAST_CONFIG_CLASS); |
| 205 | if (config != null) { |
| 206 | mcastVlan = config.egressVlan().toShort(); |
| 207 | } |
| 208 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 209 | log.info("Started"); |
| 210 | } |
| 211 | |
| 212 | @Deactivate |
| 213 | public void deactivate() { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 214 | componentConfigService.unregisterProperties(getClass(), false); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 215 | mcastService.removeListener(listener); |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 216 | networkConfig.removeListener(configListener); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 217 | networkConfig.unregisterConfigFactory(cordMcastConfigFactory); |
| 218 | clearGroups(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 219 | log.info("Stopped"); |
| 220 | } |
| 221 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 222 | public void clearGroups() { |
| 223 | groups.keySet().forEach(d -> { |
| 224 | flowObjectiveService.next(d.getDevice(), nextObject(groups.get(d), PortNumber.ANY, NextType.Remove)); |
| 225 | }); |
| 226 | flowRuleService.removeFlowRulesById(appId); |
| 227 | groups.clear(); |
| 228 | } |
| 229 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 230 | @Modified |
| 231 | public void modified(ComponentContext context) { |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 232 | Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties(); |
| 233 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 234 | try { |
| 235 | String s = get(properties, "username"); |
| 236 | user = isNullOrEmpty(s) ? DEFAULT_USER : s.trim(); |
| 237 | |
| 238 | s = get(properties, "password"); |
| 239 | password = isNullOrEmpty(s) ? DEFAULT_PASSWORD : s.trim(); |
| 240 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 241 | s = get(properties, "vlanEnabled"); |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 242 | vlanEnabled = isNullOrEmpty(s) ? DEFAULT_VLAN_ENABLED : Boolean.parseBoolean(s.trim()); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 243 | |
| 244 | s = get(properties, "priority"); |
| 245 | priority = isNullOrEmpty(s) ? DEFAULT_PRIORITY : Integer.parseInt(s.trim()); |
| 246 | |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 247 | s = get(properties, "syncHost"); |
ke han | d851dce | 2017-04-28 13:58:02 +0800 | [diff] [blame] | 248 | syncHost = isNullOrEmpty(s) ? null : s.trim(); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 249 | } catch (Exception e) { |
| 250 | user = DEFAULT_USER; |
| 251 | password = DEFAULT_PASSWORD; |
ke han | d851dce | 2017-04-28 13:58:02 +0800 | [diff] [blame] | 252 | syncHost = null; |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 253 | mcastVlan = DEFAULT_MCAST_VLAN; |
| 254 | vlanEnabled = false; |
| 255 | priority = DEFAULT_PRIORITY; |
| 256 | } |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 257 | fabricOnosUrl = createRemoteUrl(syncHost); |
| 258 | } |
| 259 | |
| 260 | private static String createRemoteUrl(String remoteHost) { |
| 261 | return "http://" + remoteHost + "/onos/v1/mcast"; |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 262 | } |
| 263 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 264 | private class InternalMulticastListener implements McastListener { |
| 265 | @Override |
| 266 | public void event(McastEvent event) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 267 | McastRouteInfo info = event.subject(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 268 | switch (event.type()) { |
| 269 | case ROUTE_ADDED: |
| 270 | break; |
| 271 | case ROUTE_REMOVED: |
| 272 | break; |
| 273 | case SOURCE_ADDED: |
| 274 | break; |
| 275 | case SINK_ADDED: |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 276 | if (!info.sink().isPresent()) { |
| 277 | log.warn("No sink given after sink added event: {}", info); |
| 278 | return; |
| 279 | } |
| 280 | provisionGroup(info.route(), info.sink().get()); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 281 | break; |
| 282 | case SINK_REMOVED: |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 283 | unprovisionGroup(event.subject()); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 284 | break; |
| 285 | default: |
| 286 | log.warn("Unknown mcast event {}", event.type()); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 291 | private enum NextType { AddNew, AddToExisting, Remove, RemoveFromExisting }; |
| 292 | |
| 293 | |
| 294 | private NextObjective nextObject(Integer id, PortNumber port, NextType nextType) { |
| 295 | DefaultNextObjective.Builder build = DefaultNextObjective.builder() |
| 296 | .fromApp(appId) |
| 297 | .addTreatment(DefaultTrafficTreatment.builder().setOutput(port).build()) |
| 298 | .withType(NextObjective.Type.BROADCAST) |
| 299 | .withId(id); |
| 300 | ObjectiveContext content = new ObjectiveContext() { |
| 301 | @Override |
| 302 | public void onSuccess(Objective objective) { |
| 303 | //TODO: change to debug |
| 304 | log.info("Next Objective {} installed", objective.id()); |
| 305 | } |
| 306 | |
| 307 | @Override |
| 308 | public void onError(Objective objective, ObjectiveError error) { |
| 309 | //TODO: change to debug |
| 310 | log.info("Next Objective {} failed, because {}", |
| 311 | objective.id(), |
| 312 | error); |
| 313 | } |
| 314 | }; |
| 315 | |
| 316 | switch (nextType) { |
| 317 | case AddNew: |
| 318 | return build.add(content); |
| 319 | case AddToExisting: |
| 320 | return build.addToExisting(content); |
| 321 | case Remove: |
| 322 | return build.remove(content); |
| 323 | case RemoveFromExisting: |
| 324 | return build.removeFromExisting(content); |
| 325 | default: |
| 326 | return null; |
| 327 | } |
| 328 | } |
| 329 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 330 | private void unprovisionGroup(McastRouteInfo info) { |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 331 | |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 332 | if (info.sinks().isEmpty()) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 333 | removeRemoteRoute(info.route()); |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 334 | } |
| 335 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 336 | if (!info.sink().isPresent()) { |
| 337 | log.warn("No sink given after sink removed event: {}", info); |
| 338 | return; |
| 339 | } |
| 340 | ConnectPoint loc = info.sink().get(); |
| 341 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 342 | NextKey key = new NextKey(loc.deviceId(), info.route().group()); |
| 343 | if (groups.get(key) == null) { |
| 344 | log.warn("No groups on device: {}", loc.deviceId()); |
| 345 | return; |
| 346 | } |
| 347 | flowObjectiveService.next(loc.deviceId(), nextObject(groups.get(key), loc.port(), NextType.RemoveFromExisting)); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 348 | } |
| 349 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 350 | private void provisionGroup(McastRoute route, ConnectPoint sink) { |
| 351 | checkNotNull(route, "Route cannot be null"); |
| 352 | checkNotNull(sink, "Sink cannot be null"); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 353 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 354 | Optional<AccessDeviceData> oltInfo = cordConfigService.getAccessDevice(sink.deviceId()); |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 355 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 356 | if (!oltInfo.isPresent()) { |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 357 | log.warn("Unknown OLT device : {}", sink.deviceId()); |
| 358 | return; |
| 359 | } |
| 360 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 361 | final AtomicBoolean sync = new AtomicBoolean(false); |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 362 | NextKey key = new NextKey(sink.deviceId(), route.group()); |
| 363 | Integer nextId = groups.computeIfAbsent(key, (g) -> { |
Zsolt Haraszti | ab43626 | 2016-02-25 09:39:10 -0800 | [diff] [blame] | 364 | Integer id = flowObjectiveService.allocateNextId(); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 365 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 366 | flowObjectiveService.next(sink.deviceId(), nextObject(id, sink.port(), NextType.AddNew)); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 367 | |
| 368 | TrafficSelector.Builder mcast = DefaultTrafficSelector.builder() |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 369 | .matchInPort(oltInfo.get().uplink()) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 370 | .matchEthType(Ethernet.TYPE_IPV4) |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 371 | .matchIPDst(route.group().toIpPrefix()); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 372 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 373 | if (vlanEnabled) { |
| 374 | mcast.matchVlanId(VlanId.vlanId((short) mcastVlan)); |
| 375 | } |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 376 | |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 377 | ForwardingObjective fwd = DefaultForwardingObjective.builder() |
| 378 | .fromApp(appId) |
| 379 | .nextStep(id) |
| 380 | .makePermanent() |
| 381 | .withFlag(ForwardingObjective.Flag.VERSATILE) |
| 382 | .withPriority(priority) |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 383 | .withSelector(mcast.build()) |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 384 | .add(new ObjectiveContext() { |
| 385 | @Override |
| 386 | public void onSuccess(Objective objective) { |
| 387 | //TODO: change to debug |
| 388 | log.info("Forwarding objective installed {}", objective); |
| 389 | } |
| 390 | |
| 391 | @Override |
| 392 | public void onError(Objective objective, ObjectiveError error) { |
| 393 | //TODO: change to debug |
| 394 | log.info("Forwarding objective failed {}", objective); |
| 395 | } |
| 396 | }); |
| 397 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 398 | flowObjectiveService.forward(sink.deviceId(), fwd); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 399 | |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 400 | sync.set(true); |
| 401 | |
alshabib | 09069c9 | 2016-02-21 14:49:51 -0800 | [diff] [blame] | 402 | return id; |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 403 | }); |
| 404 | |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 405 | if (!sync.get()) { |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 406 | flowObjectiveService.next(sink.deviceId(), nextObject(nextId, sink.port(), NextType.AddToExisting)); |
alshabib | fc1cb03 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 407 | } |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 408 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 409 | addRemoteRoute(route, sink); |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 410 | } |
| 411 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 412 | private void addRemoteRoute(McastRoute route, ConnectPoint inPort) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 413 | checkNotNull(route); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 414 | if (syncHost == null) { |
| 415 | log.warn("No host configured for synchronization; route will be dropped"); |
| 416 | return; |
| 417 | } |
| 418 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 419 | Optional<AccessAgentData> accessAgent = cordConfigService.getAccessAgent(inPort.deviceId()); |
| 420 | if (!accessAgent.isPresent()) { |
| 421 | log.warn("No accessAgent config found for in port {}", inPort); |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | if (!accessAgent.get().getOltConnectPoint(inPort).isPresent()) { |
| 426 | log.warn("No OLT configured for in port {}", inPort); |
| 427 | return; |
| 428 | } |
| 429 | |
| 430 | ConnectPoint oltConnectPoint = accessAgent.get().getOltConnectPoint(inPort).get(); |
| 431 | |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 432 | log.debug("Sending route {} to other ONOS {}", route, fabricOnosUrl); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 433 | |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 434 | Invocation.Builder builder = getClientBuilder(fabricOnosUrl); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 435 | |
| 436 | ObjectNode json = codecService.getCodec(McastRoute.class) |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 437 | .encode(route, new AbstractWebResource()); |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 438 | |
| 439 | try { |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 440 | builder.post(Entity.json(json.toString())); |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 441 | |
| 442 | builder = getClientBuilder(fabricOnosUrl + "/sinks/" + route.group() + "/" + route.source()); |
| 443 | ObjectMapper mapper = new ObjectMapper(); |
| 444 | ObjectNode obj = mapper.createObjectNode(); |
| 445 | obj.putArray("sinks").add(oltConnectPoint.deviceId() + "/" + oltConnectPoint.port()); |
| 446 | |
| 447 | builder.post(Entity.json(obj.toString())); |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 448 | } catch (ProcessingException e) { |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 449 | log.warn("Unable to send route to remote controller: {}", e.getMessage()); |
| 450 | } |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 451 | } |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 452 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 453 | private void removeRemoteRoute(McastRoute route) { |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 454 | if (syncHost == null) { |
| 455 | log.warn("No host configured for synchronization; route will be dropped"); |
| 456 | return; |
| 457 | } |
| 458 | |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 459 | log.debug("Removing route {} from other ONOS {}", route, fabricOnosUrl); |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 460 | |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 461 | Invocation.Builder builder = getClientBuilder(fabricOnosUrl) |
| 462 | .property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 463 | |
| 464 | ObjectNode json = codecService.getCodec(McastRoute.class) |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 465 | .encode(route, new AbstractWebResource()); |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 466 | |
| 467 | builder.method("DELETE", Entity.entity(json.asText(), |
| 468 | MediaType.APPLICATION_OCTET_STREAM)); |
Jonathan Hart | 718c045 | 2016-02-18 15:56:22 -0800 | [diff] [blame] | 469 | } |
| 470 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 471 | private void clearRemoteRoutes() { |
| 472 | if (syncHost == null) { |
| 473 | log.warn("No host configured for synchronization"); |
| 474 | return; |
| 475 | } |
| 476 | |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 477 | log.debug("Clearing remote multicast routes from {}", fabricOnosUrl); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 478 | |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 479 | Invocation.Builder builder = getClientBuilder(fabricOnosUrl); |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 480 | List<McastRoute> mcastRoutes = Lists.newArrayList(); |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 481 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 482 | try { |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 483 | String response = builder |
| 484 | .accept(MediaType.APPLICATION_JSON_TYPE) |
| 485 | .get(String.class); |
| 486 | |
| 487 | JsonCodec<McastRoute> routeCodec = codecService.getCodec(McastRoute.class); |
| 488 | ObjectMapper mapper = new ObjectMapper(); |
| 489 | |
| 490 | |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 491 | ObjectNode node = (ObjectNode) mapper.readTree(response); |
| 492 | ArrayNode list = (ArrayNode) node.path("routes"); |
| 493 | |
| 494 | list.forEach(n -> mcastRoutes.add( |
| 495 | routeCodec.decode((ObjectNode) n, new AbstractWebResource()))); |
Jonathan Hart | 0212f64 | 2016-02-20 11:32:43 -0800 | [diff] [blame] | 496 | |
Jonathan Hart | 0c19496 | 2016-05-23 17:08:15 -0700 | [diff] [blame] | 497 | } catch (IOException | ProcessingException e) { |
Jonathan Hart | c3f84eb | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 498 | log.warn("Error clearing remote routes", e); |
| 499 | } |
| 500 | |
| 501 | mcastRoutes.forEach(this::removeRemoteRoute); |
| 502 | } |
| 503 | |
Jian Li | 46472d7 | 2016-03-09 10:52:49 -0800 | [diff] [blame] | 504 | private Invocation.Builder getClientBuilder(String uri) { |
| 505 | ClientConfig config = new ClientConfig(); |
| 506 | Client client = ClientBuilder.newClient(config); |
| 507 | |
| 508 | client.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_REST_TIMEOUT_MS); |
| 509 | client.property(ClientProperties.READ_TIMEOUT, DEFAULT_REST_TIMEOUT_MS); |
| 510 | client.register(HttpAuthenticationFeature.basic(user, password)); |
| 511 | |
| 512 | WebTarget wt = client.target(uri); |
| 513 | return wt.request(JSON_UTF_8.toString()); |
Jonathan Hart | 2827164 | 2016-02-10 16:13:54 -0800 | [diff] [blame] | 514 | } |
| 515 | |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 516 | private class InternalNetworkConfigListener implements NetworkConfigListener { |
| 517 | @Override |
| 518 | public void event(NetworkConfigEvent event) { |
| 519 | switch (event.type()) { |
| 520 | |
| 521 | case CONFIG_ADDED: |
| 522 | case CONFIG_UPDATED: |
| 523 | if (event.configClass().equals(CORD_MCAST_CONFIG_CLASS)) { |
| 524 | McastConfig config = networkConfig.getConfig(coreAppId, CORD_MCAST_CONFIG_CLASS); |
| 525 | if (config != null) { |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 526 | //TODO: Simply remove flows/groups, hosts will response period query |
| 527 | // and re-sent IGMP report, so the flows can be rebuild. |
| 528 | // However, better to remove and re-add mcast flow rules here |
| 529 | if (mcastVlan != config.egressVlan().toShort() && vlanEnabled) { |
| 530 | clearGroups(); |
| 531 | } |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 532 | mcastVlan = config.egressVlan().toShort(); |
| 533 | } |
| 534 | } |
| 535 | break; |
| 536 | case CONFIG_REGISTERED: |
| 537 | case CONFIG_UNREGISTERED: |
| 538 | case CONFIG_REMOVED: |
| 539 | break; |
| 540 | default: |
| 541 | break; |
| 542 | } |
| 543 | } |
| 544 | } |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 545 | |
| 546 | private class NextKey { |
| 547 | private DeviceId device; |
| 548 | private IpAddress group; |
| 549 | public NextKey(DeviceId deviceId, IpAddress groupAddress) { |
| 550 | device = deviceId; |
| 551 | group = groupAddress; |
| 552 | } |
| 553 | |
| 554 | public DeviceId getDevice() { |
| 555 | return device; |
| 556 | } |
| 557 | |
| 558 | public int hashCode() { |
| 559 | return com.google.common.base.Objects.hashCode(new Object[]{this.device, this.group}); |
| 560 | } |
| 561 | |
| 562 | public boolean equals(Object obj) { |
| 563 | if (this == obj) { |
| 564 | return true; |
| 565 | } else if (!(obj instanceof NextKey)) { |
| 566 | return false; |
| 567 | } else { |
| 568 | NextKey that = (NextKey) obj; |
| 569 | return this.getClass() == that.getClass() && |
| 570 | Objects.equals(this.device, that.device) && |
| 571 | Objects.equals(this.group, that.group); |
| 572 | } |
| 573 | } |
| 574 | } |
alshabib | 3b1eadc | 2016-02-01 17:57:00 -0800 | [diff] [blame] | 575 | } |
ke han | f1709e8 | 2016-08-12 10:48:17 +0800 | [diff] [blame] | 576 | |
ke han | 9590c81 | 2017-02-28 15:02:26 +0800 | [diff] [blame] | 577 | |