Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -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.incubator.net.virtual.impl; |
| 17 | |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 18 | import com.google.common.collect.Maps; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 19 | import org.apache.felix.scr.annotations.Activate; |
| 20 | import org.apache.felix.scr.annotations.Component; |
| 21 | import org.apache.felix.scr.annotations.Deactivate; |
| 22 | import org.apache.felix.scr.annotations.Reference; |
| 23 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 24 | import org.apache.felix.scr.annotations.Service; |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 25 | import org.onlab.osgi.DefaultServiceDirectory; |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 26 | import org.onlab.osgi.ServiceDirectory; |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 27 | import org.onlab.packet.IpAddress; |
| 28 | import org.onlab.packet.MacAddress; |
| 29 | import org.onlab.packet.VlanId; |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 30 | import org.onosproject.core.ApplicationId; |
| 31 | import org.onosproject.core.CoreService; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 32 | import org.onosproject.incubator.net.tunnel.TunnelId; |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 33 | import org.onosproject.incubator.net.virtual.DefaultVirtualLink; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 34 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 35 | import org.onosproject.incubator.net.virtual.TenantId; |
| 36 | import org.onosproject.incubator.net.virtual.VirtualDevice; |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 37 | import org.onosproject.incubator.net.virtual.VirtualHost; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 38 | import org.onosproject.incubator.net.virtual.VirtualLink; |
| 39 | import org.onosproject.incubator.net.virtual.VirtualNetwork; |
| 40 | import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService; |
| 41 | import org.onosproject.incubator.net.virtual.VirtualNetworkEvent; |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 42 | import org.onosproject.incubator.net.virtual.VirtualNetworkIntent; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 43 | import org.onosproject.incubator.net.virtual.VirtualNetworkListener; |
| 44 | import org.onosproject.incubator.net.virtual.VirtualNetworkService; |
| 45 | import org.onosproject.incubator.net.virtual.VirtualNetworkStore; |
| 46 | import org.onosproject.incubator.net.virtual.VirtualNetworkStoreDelegate; |
| 47 | import org.onosproject.incubator.net.virtual.VirtualPort; |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 48 | import org.onosproject.incubator.net.virtual.VnetService; |
Claudine Chiu | 465a260 | 2017-03-17 18:33:36 -0400 | [diff] [blame^] | 49 | import org.onosproject.incubator.net.virtual.event.VirtualEvent; |
| 50 | import org.onosproject.incubator.net.virtual.event.VirtualListenerRegistryManager; |
yoonseon | 6b972c3 | 2016-12-06 16:45:03 -0800 | [diff] [blame] | 51 | import org.onosproject.incubator.net.virtual.provider.VirtualNetworkProvider; |
| 52 | import org.onosproject.incubator.net.virtual.provider.VirtualNetworkProviderRegistry; |
| 53 | import org.onosproject.incubator.net.virtual.provider.VirtualNetworkProviderService; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 54 | import org.onosproject.net.ConnectPoint; |
| 55 | import org.onosproject.net.DeviceId; |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 56 | import org.onosproject.net.HostId; |
| 57 | import org.onosproject.net.HostLocation; |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 58 | import org.onosproject.net.Link; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 59 | import org.onosproject.net.PortNumber; |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 60 | import org.onosproject.net.device.DeviceService; |
Claudine Chiu | 70222ad | 2016-11-17 22:29:20 -0500 | [diff] [blame] | 61 | import org.onosproject.net.flow.FlowRuleService; |
yoonseon | 86bebed | 2017-02-03 15:23:57 -0800 | [diff] [blame] | 62 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
Claudine Chiu | 465a260 | 2017-03-17 18:33:36 -0400 | [diff] [blame^] | 63 | import org.onosproject.net.group.GroupService; |
Claudine Chiu | 30a8a2a | 2016-07-14 17:09:04 -0400 | [diff] [blame] | 64 | import org.onosproject.net.host.HostService; |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 65 | import org.onosproject.net.intent.IntentEvent; |
| 66 | import org.onosproject.net.intent.IntentListener; |
| 67 | import org.onosproject.net.intent.IntentService; |
| 68 | import org.onosproject.net.intent.IntentState; |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 69 | import org.onosproject.net.link.LinkService; |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 70 | import org.onosproject.net.packet.PacketService; |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 71 | import org.onosproject.net.provider.AbstractListenerProviderRegistry; |
| 72 | import org.onosproject.net.provider.AbstractProviderService; |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 73 | import org.onosproject.net.topology.PathService; |
Brian Stanke | 8e9f8d1 | 2016-06-08 14:48:33 -0400 | [diff] [blame] | 74 | import org.onosproject.net.topology.TopologyService; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 75 | import org.slf4j.Logger; |
| 76 | import org.slf4j.LoggerFactory; |
| 77 | |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 78 | import java.util.Map; |
Claudine Chiu | e7f6b91 | 2017-02-24 14:13:30 -0500 | [diff] [blame] | 79 | import java.util.Objects; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 80 | import java.util.Set; |
| 81 | |
| 82 | import static com.google.common.base.Preconditions.checkNotNull; |
| 83 | |
| 84 | /** |
| 85 | * Implementation of the virtual network service. |
| 86 | */ |
| 87 | @Component(immediate = true) |
| 88 | @Service |
| 89 | public class VirtualNetworkManager |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 90 | extends AbstractListenerProviderRegistry<VirtualNetworkEvent, |
| 91 | VirtualNetworkListener, VirtualNetworkProvider, VirtualNetworkProviderService> |
| 92 | implements VirtualNetworkService, VirtualNetworkAdminService, |
| 93 | VirtualNetworkProviderRegistry { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 94 | |
| 95 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 96 | |
| 97 | private static final String TENANT_NULL = "Tenant ID cannot be null"; |
| 98 | private static final String NETWORK_NULL = "Network ID cannot be null"; |
| 99 | private static final String DEVICE_NULL = "Device ID cannot be null"; |
| 100 | private static final String LINK_POINT_NULL = "Link end-point cannot be null"; |
| 101 | |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 102 | private static final String VIRTUAL_NETWORK_APP_ID_STRING = |
| 103 | "org.onosproject.virtual-network"; |
| 104 | |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 105 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 106 | protected VirtualNetworkStore store; |
| 107 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 108 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 109 | protected IntentService intentService; |
| 110 | |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 112 | protected CoreService coreService; |
| 113 | |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 114 | private final InternalVirtualIntentListener intentListener = |
| 115 | new InternalVirtualIntentListener(); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 116 | |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 117 | private VirtualNetworkStoreDelegate delegate = this::post; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 118 | |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 119 | private ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 120 | private ApplicationId appId; |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 121 | |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 122 | // TODO: figure out how to coordinate "implementation" of a virtual network in a cluster |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 123 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 124 | /** |
| 125 | * Only used for Junit test methods outside of this package. |
| 126 | * |
| 127 | * @param store virtual network store |
| 128 | */ |
| 129 | public void setStore(VirtualNetworkStore store) { |
| 130 | this.store = store; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Only used for Junit test methods outside of this package. |
| 135 | * |
| 136 | * @param intentService intent service |
| 137 | */ |
| 138 | |
| 139 | public void setIntentService(IntentService intentService) { |
| 140 | this.intentService = intentService; |
| 141 | } |
| 142 | |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 143 | @Activate |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 144 | public void activate() { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 145 | store.setDelegate(delegate); |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 146 | eventDispatcher.addSink(VirtualNetworkEvent.class, listenerRegistry); |
Claudine Chiu | 465a260 | 2017-03-17 18:33:36 -0400 | [diff] [blame^] | 147 | eventDispatcher.addSink(VirtualEvent.class, |
| 148 | VirtualListenerRegistryManager.getInstance()); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 149 | intentService.addListener(intentListener); |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 150 | appId = coreService.registerApplication(VIRTUAL_NETWORK_APP_ID_STRING); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 151 | log.info("Started"); |
| 152 | } |
| 153 | |
| 154 | @Deactivate |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 155 | public void deactivate() { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 156 | store.unsetDelegate(delegate); |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 157 | eventDispatcher.removeSink(VirtualNetworkEvent.class); |
Claudine Chiu | 465a260 | 2017-03-17 18:33:36 -0400 | [diff] [blame^] | 158 | eventDispatcher.removeSink(VirtualEvent.class); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 159 | intentService.removeListener(intentListener); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 160 | log.info("Stopped"); |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public void registerTenantId(TenantId tenantId) { |
| 165 | checkNotNull(tenantId, TENANT_NULL); |
| 166 | store.addTenantId(tenantId); |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public void unregisterTenantId(TenantId tenantId) { |
| 171 | checkNotNull(tenantId, TENANT_NULL); |
| 172 | store.removeTenantId(tenantId); |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | public Set<TenantId> getTenantIds() { |
| 177 | return store.getTenantIds(); |
| 178 | } |
| 179 | |
| 180 | @Override |
| 181 | public VirtualNetwork createVirtualNetwork(TenantId tenantId) { |
| 182 | checkNotNull(tenantId, TENANT_NULL); |
| 183 | return store.addNetwork(tenantId); |
| 184 | } |
| 185 | |
| 186 | @Override |
| 187 | public void removeVirtualNetwork(NetworkId networkId) { |
| 188 | checkNotNull(networkId, NETWORK_NULL); |
| 189 | store.removeNetwork(networkId); |
| 190 | } |
| 191 | |
| 192 | @Override |
| 193 | public VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId) { |
| 194 | checkNotNull(networkId, NETWORK_NULL); |
| 195 | checkNotNull(deviceId, DEVICE_NULL); |
| 196 | return store.addDevice(networkId, deviceId); |
| 197 | } |
| 198 | |
| 199 | @Override |
| 200 | public void removeVirtualDevice(NetworkId networkId, DeviceId deviceId) { |
| 201 | checkNotNull(networkId, NETWORK_NULL); |
| 202 | checkNotNull(deviceId, DEVICE_NULL); |
| 203 | store.removeDevice(networkId, deviceId); |
| 204 | } |
| 205 | |
| 206 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 207 | public VirtualHost createVirtualHost(NetworkId networkId, HostId hostId, |
| 208 | MacAddress mac, VlanId vlan, |
| 209 | HostLocation location, Set<IpAddress> ips) { |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 210 | checkNotNull(networkId, NETWORK_NULL); |
| 211 | checkNotNull(hostId, DEVICE_NULL); |
| 212 | return store.addHost(networkId, hostId, mac, vlan, location, ips); |
| 213 | } |
| 214 | |
| 215 | @Override |
| 216 | public void removeVirtualHost(NetworkId networkId, HostId hostId) { |
| 217 | checkNotNull(networkId, NETWORK_NULL); |
| 218 | checkNotNull(hostId, DEVICE_NULL); |
| 219 | store.removeHost(networkId, hostId); |
| 220 | } |
| 221 | |
| 222 | @Override |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 223 | public VirtualLink createVirtualLink(NetworkId networkId, |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 224 | ConnectPoint src, ConnectPoint dst) { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 225 | checkNotNull(networkId, NETWORK_NULL); |
| 226 | checkNotNull(src, LINK_POINT_NULL); |
| 227 | checkNotNull(dst, LINK_POINT_NULL); |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 228 | ConnectPoint physicalSrc = mapVirtualToPhysicalPort(networkId, src); |
| 229 | checkNotNull(physicalSrc, LINK_POINT_NULL); |
| 230 | ConnectPoint physicalDst = mapVirtualToPhysicalPort(networkId, dst); |
| 231 | checkNotNull(physicalDst, LINK_POINT_NULL); |
| 232 | |
| 233 | VirtualNetworkProvider provider = getProvider(DefaultVirtualLink.PID); |
| 234 | Link.State state = Link.State.INACTIVE; |
| 235 | if (provider != null) { |
| 236 | boolean traversable = provider.isTraversable(physicalSrc, physicalDst); |
| 237 | state = traversable ? Link.State.ACTIVE : Link.State.INACTIVE; |
| 238 | } |
| 239 | return store.addLink(networkId, src, dst, state, null); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Maps the virtual connect point to a physical connect point. |
| 244 | * |
| 245 | * @param networkId network identifier |
| 246 | * @param virtualCp virtual connect point |
| 247 | * @return physical connect point |
| 248 | */ |
| 249 | private ConnectPoint mapVirtualToPhysicalPort(NetworkId networkId, |
| 250 | ConnectPoint virtualCp) { |
| 251 | Set<VirtualPort> ports = store.getPorts(networkId, virtualCp.deviceId()); |
| 252 | for (VirtualPort port : ports) { |
| 253 | if (port.number().equals(virtualCp.port())) { |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame] | 254 | return new ConnectPoint(port.realizedBy().deviceId(), |
| 255 | port.realizedBy().port()); |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 256 | } |
| 257 | } |
| 258 | return null; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 259 | } |
| 260 | |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 261 | /** |
| 262 | * Maps the physical connect point to a virtual connect point. |
| 263 | * |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 264 | * @param networkId network identifier |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 265 | * @param physicalCp physical connect point |
| 266 | * @return virtual connect point |
| 267 | */ |
| 268 | private ConnectPoint mapPhysicalToVirtualToPort(NetworkId networkId, |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 269 | ConnectPoint physicalCp) { |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 270 | Set<VirtualPort> ports = store.getPorts(networkId, null); |
| 271 | for (VirtualPort port : ports) { |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame] | 272 | if (port.realizedBy().deviceId().equals(physicalCp.elementId()) && |
| 273 | port.realizedBy().port().equals(physicalCp.port())) { |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 274 | return new ConnectPoint(port.element().id(), port.number()); |
| 275 | } |
| 276 | } |
| 277 | return null; |
| 278 | } |
| 279 | |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 280 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 281 | public void removeVirtualLink(NetworkId networkId, ConnectPoint src, |
| 282 | ConnectPoint dst) { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 283 | checkNotNull(networkId, NETWORK_NULL); |
| 284 | checkNotNull(src, LINK_POINT_NULL); |
| 285 | checkNotNull(dst, LINK_POINT_NULL); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 286 | store.removeLink(networkId, src, dst); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | @Override |
| 290 | public VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId, |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame] | 291 | PortNumber portNumber, ConnectPoint realizedBy) { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 292 | checkNotNull(networkId, NETWORK_NULL); |
| 293 | checkNotNull(deviceId, DEVICE_NULL); |
| 294 | checkNotNull(portNumber, "Port description cannot be null"); |
| 295 | return store.addPort(networkId, deviceId, portNumber, realizedBy); |
| 296 | } |
| 297 | |
| 298 | @Override |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame] | 299 | public void bindVirtualPort(NetworkId networkId, DeviceId deviceId, |
| 300 | PortNumber portNumber, ConnectPoint realizedBy) { |
| 301 | checkNotNull(networkId, NETWORK_NULL); |
| 302 | checkNotNull(deviceId, DEVICE_NULL); |
| 303 | checkNotNull(portNumber, "Port description cannot be null"); |
| 304 | checkNotNull(realizedBy, "Physical port description cannot be null"); |
| 305 | |
| 306 | store.bindPort(networkId, deviceId, portNumber, realizedBy); |
| 307 | } |
| 308 | |
| 309 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 310 | public void removeVirtualPort(NetworkId networkId, DeviceId deviceId, |
| 311 | PortNumber portNumber) { |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 312 | checkNotNull(networkId, NETWORK_NULL); |
| 313 | checkNotNull(deviceId, DEVICE_NULL); |
| 314 | checkNotNull(portNumber, "Port number cannot be null"); |
| 315 | store.removePort(networkId, deviceId, portNumber); |
| 316 | } |
| 317 | |
| 318 | @Override |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 319 | public ServiceDirectory getServiceDirectory() { |
| 320 | return serviceDirectory; |
| 321 | } |
| 322 | |
| 323 | @Override |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 324 | public Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId) { |
| 325 | checkNotNull(tenantId, TENANT_NULL); |
| 326 | return store.getNetworks(tenantId); |
| 327 | } |
| 328 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 329 | /** |
| 330 | * Returns the virtual network matching the network identifier. |
| 331 | * |
| 332 | * @param networkId network identifier |
| 333 | * @return virtual network |
| 334 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 335 | private VirtualNetwork getVirtualNetwork(NetworkId networkId) { |
| 336 | checkNotNull(networkId, NETWORK_NULL); |
| 337 | return store.getNetwork(networkId); |
| 338 | } |
| 339 | |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 340 | @Override |
| 341 | public Set<VirtualDevice> getVirtualDevices(NetworkId networkId) { |
| 342 | checkNotNull(networkId, NETWORK_NULL); |
| 343 | return store.getDevices(networkId); |
| 344 | } |
| 345 | |
| 346 | @Override |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 347 | public Set<VirtualHost> getVirtualHosts(NetworkId networkId) { |
| 348 | checkNotNull(networkId, NETWORK_NULL); |
| 349 | return store.getHosts(networkId); |
| 350 | } |
| 351 | |
| 352 | @Override |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 353 | public Set<VirtualLink> getVirtualLinks(NetworkId networkId) { |
| 354 | checkNotNull(networkId, NETWORK_NULL); |
| 355 | return store.getLinks(networkId); |
| 356 | } |
| 357 | |
| 358 | @Override |
| 359 | public Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId) { |
| 360 | checkNotNull(networkId, NETWORK_NULL); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 361 | return store.getPorts(networkId, deviceId); |
| 362 | } |
| 363 | |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 364 | private final Map<ServiceKey, VnetService> networkServices = Maps.newConcurrentMap(); |
| 365 | |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 366 | @Override |
| 367 | public <T> T get(NetworkId networkId, Class<T> serviceClass) { |
| 368 | checkNotNull(networkId, NETWORK_NULL); |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 369 | ServiceKey serviceKey = networkServiceKey(networkId, serviceClass); |
| 370 | VnetService service = lookup(serviceKey); |
| 371 | if (service == null) { |
| 372 | service = create(serviceKey); |
| 373 | } |
| 374 | return (T) service; |
| 375 | } |
| 376 | |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 377 | @Override |
| 378 | public ApplicationId getVirtualNetworkApplicationId(NetworkId networkId) { |
| 379 | return appId; |
| 380 | } |
| 381 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 382 | /** |
| 383 | * Returns the Vnet service matching the service key. |
| 384 | * |
| 385 | * @param serviceKey service key |
| 386 | * @return vnet service |
| 387 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 388 | private VnetService lookup(ServiceKey serviceKey) { |
| 389 | return networkServices.get(serviceKey); |
| 390 | } |
| 391 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 392 | /** |
| 393 | * Creates a new service key using the specified network identifier and service class. |
| 394 | * |
| 395 | * @param networkId network identifier |
| 396 | * @param serviceClass service class |
| 397 | * @param <T> type of service |
| 398 | * @return service key |
| 399 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 400 | private <T> ServiceKey networkServiceKey(NetworkId networkId, Class<T> serviceClass) { |
| 401 | return new ServiceKey(networkId, serviceClass); |
| 402 | } |
| 403 | |
| 404 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 405 | /** |
| 406 | * Create a new vnet service instance. |
| 407 | * |
| 408 | * @param serviceKey service key |
| 409 | * @return vnet service |
| 410 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 411 | private VnetService create(ServiceKey serviceKey) { |
| 412 | VirtualNetwork network = getVirtualNetwork(serviceKey.networkId()); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 413 | checkNotNull(network, NETWORK_NULL); |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 414 | |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 415 | VnetService service; |
| 416 | if (serviceKey.serviceClass.equals(DeviceService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 417 | service = new VirtualNetworkDeviceManager(this, network.id()); |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 418 | } else if (serviceKey.serviceClass.equals(LinkService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 419 | service = new VirtualNetworkLinkManager(this, network.id()); |
Brian Stanke | 8e9f8d1 | 2016-06-08 14:48:33 -0400 | [diff] [blame] | 420 | } else if (serviceKey.serviceClass.equals(TopologyService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 421 | service = new VirtualNetworkTopologyManager(this, network.id()); |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 422 | } else if (serviceKey.serviceClass.equals(IntentService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 423 | service = new VirtualNetworkIntentManager(this, network.id()); |
Claudine Chiu | 30a8a2a | 2016-07-14 17:09:04 -0400 | [diff] [blame] | 424 | } else if (serviceKey.serviceClass.equals(HostService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 425 | service = new VirtualNetworkHostManager(this, network.id()); |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 426 | } else if (serviceKey.serviceClass.equals(PathService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 427 | service = new VirtualNetworkPathManager(this, network.id()); |
Claudine Chiu | 70222ad | 2016-11-17 22:29:20 -0500 | [diff] [blame] | 428 | } else if (serviceKey.serviceClass.equals(FlowRuleService.class)) { |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 429 | service = new VirtualNetworkFlowRuleManager(this, network.id()); |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 430 | } else if (serviceKey.serviceClass.equals(PacketService.class)) { |
| 431 | service = new VirtualNetworkPacketManager(this, network.id()); |
yoonseon | dc3210d | 2017-01-25 16:03:10 -0800 | [diff] [blame] | 432 | } else if (serviceKey.serviceClass.equals(GroupService.class)) { |
| 433 | service = new VirtualNetworkGroupManager(this, network.id()); |
yoonseon | 86bebed | 2017-02-03 15:23:57 -0800 | [diff] [blame] | 434 | } else if (serviceKey.serviceClass.equals(FlowObjectiveService.class)) { |
| 435 | service = new VirtualNetworkFlowObjectiveManager(this, network.id()); |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 436 | } else { |
| 437 | return null; |
| 438 | } |
| 439 | networkServices.put(serviceKey, service); |
| 440 | return service; |
| 441 | } |
| 442 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 443 | /** |
| 444 | * Service key class. |
| 445 | */ |
Claudine Chiu | 9a18f49 | 2017-02-27 15:57:06 -0500 | [diff] [blame] | 446 | private static class ServiceKey { |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 447 | final NetworkId networkId; |
| 448 | final Class serviceClass; |
| 449 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 450 | /** |
| 451 | * Constructor for service key. |
| 452 | * |
| 453 | * @param networkId network identifier |
| 454 | * @param serviceClass service class |
| 455 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 456 | public ServiceKey(NetworkId networkId, Class serviceClass) { |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 457 | |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 458 | checkNotNull(networkId, NETWORK_NULL); |
| 459 | this.networkId = networkId; |
| 460 | this.serviceClass = serviceClass; |
| 461 | } |
| 462 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 463 | /** |
| 464 | * Returns the network identifier. |
| 465 | * |
| 466 | * @return network identifier |
| 467 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 468 | public NetworkId networkId() { |
| 469 | return networkId; |
| 470 | } |
| 471 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 472 | /** |
| 473 | * Returns the service class. |
| 474 | * |
| 475 | * @return service class |
| 476 | */ |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 477 | public Class serviceClass() { |
| 478 | return serviceClass; |
| 479 | } |
Claudine Chiu | e7f6b91 | 2017-02-24 14:13:30 -0500 | [diff] [blame] | 480 | |
| 481 | @Override |
| 482 | public int hashCode() { |
| 483 | return Objects.hash(networkId, serviceClass); |
| 484 | } |
| 485 | |
| 486 | @Override |
| 487 | public boolean equals(Object obj) { |
| 488 | if (this == obj) { |
| 489 | return true; |
| 490 | } |
| 491 | if (obj instanceof ServiceKey) { |
| 492 | ServiceKey that = (ServiceKey) obj; |
| 493 | return Objects.equals(this.networkId, that.networkId) && |
| 494 | Objects.equals(this.serviceClass, that.serviceClass); |
| 495 | } |
| 496 | return false; |
| 497 | } |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 498 | } |
| 499 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 500 | /** |
| 501 | * Internal intent event listener. |
| 502 | */ |
| 503 | private class InternalVirtualIntentListener implements IntentListener { |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 504 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 505 | @Override |
| 506 | public void event(IntentEvent event) { |
| 507 | |
| 508 | // Ignore intent events that are not relevant. |
| 509 | if (!isRelevant(event)) { |
| 510 | return; |
| 511 | } |
| 512 | |
| 513 | VirtualNetworkIntent intent = (VirtualNetworkIntent) event.subject(); |
| 514 | |
| 515 | switch (event.type()) { |
| 516 | case INSTALL_REQ: |
| 517 | store.addOrUpdateIntent(intent, IntentState.INSTALL_REQ); |
| 518 | break; |
| 519 | case INSTALLED: |
| 520 | store.addOrUpdateIntent(intent, IntentState.INSTALLED); |
| 521 | break; |
| 522 | case WITHDRAW_REQ: |
| 523 | store.addOrUpdateIntent(intent, IntentState.WITHDRAW_REQ); |
| 524 | break; |
| 525 | case WITHDRAWN: |
| 526 | store.addOrUpdateIntent(intent, IntentState.WITHDRAWN); |
| 527 | break; |
| 528 | case FAILED: |
| 529 | store.addOrUpdateIntent(intent, IntentState.FAILED); |
| 530 | break; |
| 531 | case CORRUPT: |
| 532 | store.addOrUpdateIntent(intent, IntentState.CORRUPT); |
| 533 | break; |
| 534 | case PURGED: |
| 535 | store.removeIntent(intent.key()); |
| 536 | default: |
| 537 | break; |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | @Override |
| 542 | public boolean isRelevant(IntentEvent event) { |
| 543 | if (event.subject() instanceof VirtualNetworkIntent) { |
| 544 | return true; |
| 545 | } |
| 546 | return false; |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 551 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 552 | protected VirtualNetworkProviderService |
| 553 | createProviderService(VirtualNetworkProvider provider) { |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 554 | return new InternalVirtualNetworkProviderService(provider); |
| 555 | } |
| 556 | |
yoonseon | 6b972c3 | 2016-12-06 16:45:03 -0800 | [diff] [blame] | 557 | |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 558 | /** |
| 559 | * Service issued to registered virtual network providers so that they |
| 560 | * can interact with the core. |
| 561 | */ |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 562 | private class InternalVirtualNetworkProviderService |
| 563 | extends AbstractProviderService<VirtualNetworkProvider> |
| 564 | implements VirtualNetworkProviderService { |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 565 | /** |
| 566 | * Constructor. |
| 567 | * @param provider virtual network provider |
| 568 | */ |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 569 | InternalVirtualNetworkProviderService(VirtualNetworkProvider provider) { |
| 570 | super(provider); |
| 571 | } |
Brian Stanke | 4d57988 | 2016-04-22 13:28:46 -0400 | [diff] [blame] | 572 | |
| 573 | @Override |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 574 | public void topologyChanged(Set<Set<ConnectPoint>> clusters) { |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 575 | Set<TenantId> tenantIds = getTenantIds(); |
| 576 | tenantIds.forEach(tenantId -> { |
| 577 | Set<VirtualNetwork> virtualNetworks = getVirtualNetworks(tenantId); |
| 578 | |
| 579 | virtualNetworks.forEach(virtualNetwork -> { |
| 580 | Set<VirtualLink> virtualLinks = getVirtualLinks(virtualNetwork.id()); |
| 581 | |
| 582 | virtualLinks.forEach(virtualLink -> { |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 583 | if (isVirtualLinkInCluster(virtualNetwork.id(), |
| 584 | virtualLink, clusters)) { |
| 585 | store.updateLink(virtualLink, virtualLink.tunnelId(), |
| 586 | Link.State.ACTIVE); |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 587 | } else { |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 588 | store.updateLink(virtualLink, virtualLink.tunnelId(), |
| 589 | Link.State.INACTIVE); |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 590 | } |
| 591 | }); |
| 592 | }); |
| 593 | }); |
| 594 | } |
| 595 | |
| 596 | /** |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 597 | * Determines if the virtual link (both source and destination connect point) |
| 598 | * is in a cluster. |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 599 | * |
| 600 | * @param networkId virtual network identifier |
| 601 | * @param virtualLink virtual link |
| 602 | * @param clusters topology clusters |
| 603 | * @return true if the virtual link is in a cluster. |
| 604 | */ |
| 605 | private boolean isVirtualLinkInCluster(NetworkId networkId, VirtualLink virtualLink, |
| 606 | Set<Set<ConnectPoint>> clusters) { |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 607 | ConnectPoint srcPhysicalCp = |
| 608 | mapVirtualToPhysicalPort(networkId, virtualLink.src()); |
| 609 | ConnectPoint dstPhysicalCp = |
| 610 | mapVirtualToPhysicalPort(networkId, virtualLink.dst()); |
Brian Stanke | fb61df4 | 2016-07-25 11:47:51 -0400 | [diff] [blame] | 611 | |
| 612 | final boolean[] foundSrc = {false}; |
| 613 | final boolean[] foundDst = {false}; |
| 614 | clusters.forEach(connectPoints -> { |
| 615 | connectPoints.forEach(connectPoint -> { |
| 616 | if (connectPoint.equals(srcPhysicalCp)) { |
| 617 | foundSrc[0] = true; |
| 618 | } else if (connectPoint.equals(dstPhysicalCp)) { |
| 619 | foundDst[0] = true; |
| 620 | } |
| 621 | }); |
| 622 | if (foundSrc[0] && foundDst[0]) { |
| 623 | return; |
| 624 | } |
| 625 | }); |
| 626 | return foundSrc[0] && foundDst[0]; |
| 627 | } |
| 628 | |
| 629 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 630 | public void tunnelUp(NetworkId networkId, ConnectPoint src, |
| 631 | ConnectPoint dst, TunnelId tunnelId) { |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 632 | ConnectPoint srcVirtualCp = mapPhysicalToVirtualToPort(networkId, src); |
| 633 | ConnectPoint dstVirtualCp = mapPhysicalToVirtualToPort(networkId, dst); |
| 634 | if ((srcVirtualCp == null) || (dstVirtualCp == null)) { |
| 635 | log.error("Src or dst virtual connection point was not found."); |
| 636 | } |
| 637 | |
| 638 | VirtualLink virtualLink = store.getLink(networkId, srcVirtualCp, dstVirtualCp); |
| 639 | if (virtualLink != null) { |
| 640 | store.updateLink(virtualLink, tunnelId, Link.State.ACTIVE); |
| 641 | } |
Brian Stanke | 4d57988 | 2016-04-22 13:28:46 -0400 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 645 | public void tunnelDown(NetworkId networkId, ConnectPoint src, |
| 646 | ConnectPoint dst, TunnelId tunnelId) { |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 647 | ConnectPoint srcVirtualCp = mapPhysicalToVirtualToPort(networkId, src); |
| 648 | ConnectPoint dstVirtualCp = mapPhysicalToVirtualToPort(networkId, dst); |
| 649 | if ((srcVirtualCp == null) || (dstVirtualCp == null)) { |
| 650 | log.error("Src or dst virtual connection point was not found."); |
| 651 | } |
Brian Stanke | 4d57988 | 2016-04-22 13:28:46 -0400 | [diff] [blame] | 652 | |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 653 | VirtualLink virtualLink = store.getLink(networkId, srcVirtualCp, dstVirtualCp); |
| 654 | if (virtualLink != null) { |
| 655 | store.updateLink(virtualLink, tunnelId, Link.State.INACTIVE); |
| 656 | } |
Brian Stanke | 4d57988 | 2016-04-22 13:28:46 -0400 | [diff] [blame] | 657 | } |
Thomas Vachuska | 3d62fd7 | 2015-09-25 14:58:13 -0700 | [diff] [blame] | 658 | } |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 659 | } |