Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.provider.of.device.impl; |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 17 | |
Thomas Vachuska | f0397b5 | 2015-05-29 13:50:17 -0700 | [diff] [blame] | 18 | import com.google.common.base.Strings; |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 19 | import com.google.common.collect.Lists; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 20 | import com.google.common.collect.Maps; |
| 21 | import com.google.common.collect.Sets; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 22 | |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 23 | import org.apache.felix.scr.annotations.Activate; |
| 24 | import org.apache.felix.scr.annotations.Component; |
| 25 | import org.apache.felix.scr.annotations.Deactivate; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 26 | import org.apache.felix.scr.annotations.Modified; |
| 27 | import org.apache.felix.scr.annotations.Property; |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 28 | import org.apache.felix.scr.annotations.Reference; |
| 29 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Thomas Vachuska | f0397b5 | 2015-05-29 13:50:17 -0700 | [diff] [blame] | 30 | import org.onlab.packet.ChassisId; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 31 | import org.onosproject.cfg.ComponentConfigService; |
Thomas Vachuska | b52a014 | 2015-04-21 17:48:15 -0700 | [diff] [blame] | 32 | import org.onosproject.net.AnnotationKeys; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 33 | import org.onosproject.net.DefaultAnnotations; |
| 34 | import org.onosproject.net.Device; |
| 35 | import org.onosproject.net.DeviceId; |
| 36 | import org.onosproject.net.MastershipRole; |
| 37 | import org.onosproject.net.Port; |
| 38 | import org.onosproject.net.PortNumber; |
| 39 | import org.onosproject.net.SparseAnnotations; |
| 40 | import org.onosproject.net.device.DefaultDeviceDescription; |
| 41 | import org.onosproject.net.device.DefaultPortDescription; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 42 | import org.onosproject.net.device.DefaultPortStatistics; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 43 | import org.onosproject.net.device.DeviceDescription; |
| 44 | import org.onosproject.net.device.DeviceProvider; |
| 45 | import org.onosproject.net.device.DeviceProviderRegistry; |
| 46 | import org.onosproject.net.device.DeviceProviderService; |
| 47 | import org.onosproject.net.device.PortDescription; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 48 | import org.onosproject.net.device.PortStatistics; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 49 | import org.onosproject.net.provider.AbstractProvider; |
| 50 | import org.onosproject.net.provider.ProviderId; |
| 51 | import org.onosproject.openflow.controller.Dpid; |
| 52 | import org.onosproject.openflow.controller.OpenFlowController; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 53 | import org.onosproject.openflow.controller.OpenFlowEventListener; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 54 | import org.onosproject.openflow.controller.OpenFlowOpticalSwitch; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 55 | import org.onosproject.openflow.controller.OpenFlowSwitch; |
| 56 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 57 | import org.onosproject.openflow.controller.PortDescPropertyType; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 58 | import org.onosproject.openflow.controller.RoleState; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 59 | import org.osgi.service.component.ComponentContext; |
Ayaka Koshibe | e8708e3 | 2014-10-22 13:40:18 -0700 | [diff] [blame] | 60 | import org.projectfloodlight.openflow.protocol.OFFactory; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 61 | import org.projectfloodlight.openflow.protocol.OFMessage; |
alshabib | 4680bb6 | 2014-09-04 17:15:08 -0700 | [diff] [blame] | 62 | import org.projectfloodlight.openflow.protocol.OFPortConfig; |
alshabib | 25c8eec | 2014-09-04 16:41:31 -0700 | [diff] [blame] | 63 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 64 | import org.projectfloodlight.openflow.protocol.OFPortFeatures; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 65 | import org.projectfloodlight.openflow.protocol.OFPortOptical; |
alshabib | afc514a | 2014-12-01 14:44:05 -0800 | [diff] [blame] | 66 | import org.projectfloodlight.openflow.protocol.OFPortReason; |
alshabib | 4680bb6 | 2014-09-04 17:15:08 -0700 | [diff] [blame] | 67 | import org.projectfloodlight.openflow.protocol.OFPortState; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 68 | import org.projectfloodlight.openflow.protocol.OFPortStatsEntry; |
| 69 | import org.projectfloodlight.openflow.protocol.OFPortStatsReply; |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 70 | import org.projectfloodlight.openflow.protocol.OFPortStatus; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 71 | import org.projectfloodlight.openflow.protocol.OFStatsReply; |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 72 | import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 73 | import org.projectfloodlight.openflow.protocol.OFStatsType; |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 74 | import org.projectfloodlight.openflow.protocol.OFVersion; |
| 75 | import org.projectfloodlight.openflow.types.PortSpeed; |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 76 | import org.slf4j.Logger; |
tom | 5f38b3a | 2014-08-27 23:50:54 -0700 | [diff] [blame] | 77 | |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 78 | import java.util.ArrayList; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 79 | import java.util.Collection; |
| 80 | import java.util.Collections; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 81 | import java.util.Dictionary; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 82 | import java.util.HashMap; |
| 83 | import java.util.HashSet; |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 84 | import java.util.List; |
| 85 | |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 86 | import static com.google.common.base.Strings.isNullOrEmpty; |
| 87 | import static org.onlab.util.Tools.get; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 88 | import static org.onosproject.net.DeviceId.deviceId; |
| 89 | import static org.onosproject.net.Port.Type.COPPER; |
| 90 | import static org.onosproject.net.Port.Type.FIBER; |
| 91 | import static org.onosproject.openflow.controller.Dpid.dpid; |
| 92 | import static org.onosproject.openflow.controller.Dpid.uri; |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 93 | import static org.slf4j.LoggerFactory.getLogger; |
| 94 | |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 95 | /** |
tom | b1260e4 | 2014-08-26 18:39:57 -0700 | [diff] [blame] | 96 | * Provider which uses an OpenFlow controller to detect network |
tom | e06f855 | 2014-08-26 16:58:42 -0700 | [diff] [blame] | 97 | * infrastructure devices. |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 98 | */ |
tom | b1260e4 | 2014-08-26 18:39:57 -0700 | [diff] [blame] | 99 | @Component(immediate = true) |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 100 | public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 101 | |
alshabib | a89cc58 | 2014-09-09 16:43:00 -0700 | [diff] [blame] | 102 | private static final Logger LOG = getLogger(OpenFlowDeviceProvider.class); |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 103 | private static final long MBPS = 1_000 * 1_000; |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 104 | |
| 105 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
tom | 96dfcab | 2014-08-28 09:26:03 -0700 | [diff] [blame] | 106 | protected DeviceProviderRegistry providerRegistry; |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 107 | |
tom | 5f38b3a | 2014-08-27 23:50:54 -0700 | [diff] [blame] | 108 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 109 | protected OpenFlowController controller; |
| 110 | |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 112 | protected ComponentConfigService cfgService; |
| 113 | |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 114 | private DeviceProviderService providerService; |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 115 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 116 | private final InternalDeviceProvider listener = new InternalDeviceProvider(); |
| 117 | |
| 118 | // TODO: We need to make the poll interval configurable. |
Srikanth Vavilapalli | 78baf58 | 2015-06-05 11:40:14 -0700 | [diff] [blame] | 119 | static final int POLL_INTERVAL = 5; |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 120 | @Property(name = "PortStatsPollFrequency", intValue = POLL_INTERVAL, |
| 121 | label = "Frequency (in seconds) for polling switch Port statistics") |
| 122 | private int portStatsPollFrequency = POLL_INTERVAL; |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 123 | |
| 124 | private HashMap<Dpid, PortStatsCollector> collectors = Maps.newHashMap(); |
tom | d40fc7a | 2014-09-04 16:41:10 -0700 | [diff] [blame] | 125 | |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 126 | /** |
| 127 | * Creates an OpenFlow device provider. |
| 128 | */ |
| 129 | public OpenFlowDeviceProvider() { |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 130 | super(new ProviderId("of", "org.onosproject.provider.openflow")); |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 131 | } |
| 132 | |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 133 | @Activate |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 134 | public void activate(ComponentContext context) { |
| 135 | cfgService.registerProperties(getClass()); |
tom | 96dfcab | 2014-08-28 09:26:03 -0700 | [diff] [blame] | 136 | providerService = providerRegistry.register(this); |
tom | d40fc7a | 2014-09-04 16:41:10 -0700 | [diff] [blame] | 137 | controller.addListener(listener); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 138 | controller.addEventListener(listener); |
alshabib | c944fd0 | 2014-09-10 17:55:17 -0700 | [diff] [blame] | 139 | for (OpenFlowSwitch sw : controller.getSwitches()) { |
Yuta HIGUCHI | ac2972a | 2014-11-18 12:58:52 -0800 | [diff] [blame] | 140 | try { |
| 141 | listener.switchAdded(new Dpid(sw.getId())); |
| 142 | } catch (Exception e) { |
| 143 | LOG.warn("Failed initially adding {} : {}", sw.getStringId(), e.getMessage()); |
| 144 | LOG.debug("Error details:", e); |
| 145 | // disconnect to trigger switch-add later |
| 146 | sw.disconnectSwitch(); |
| 147 | } |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 148 | PortStatsCollector psc = new PortStatsCollector(sw, portStatsPollFrequency); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 149 | psc.start(); |
| 150 | collectors.put(new Dpid(sw.getId()), psc); |
alshabib | c944fd0 | 2014-09-10 17:55:17 -0700 | [diff] [blame] | 151 | } |
alshabib | a89cc58 | 2014-09-09 16:43:00 -0700 | [diff] [blame] | 152 | LOG.info("Started"); |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | @Deactivate |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 156 | public void deactivate(ComponentContext context) { |
| 157 | cfgService.unregisterProperties(getClass(), false); |
tom | 96dfcab | 2014-08-28 09:26:03 -0700 | [diff] [blame] | 158 | providerRegistry.unregister(this); |
tom | d40fc7a | 2014-09-04 16:41:10 -0700 | [diff] [blame] | 159 | controller.removeListener(listener); |
Thomas Vachuska | 74bcd92 | 2015-06-02 13:08:57 -0700 | [diff] [blame] | 160 | collectors.values().forEach(PortStatsCollector::stop); |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 161 | providerService = null; |
alshabib | a89cc58 | 2014-09-09 16:43:00 -0700 | [diff] [blame] | 162 | LOG.info("Stopped"); |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 165 | @Modified |
| 166 | public void modified(ComponentContext context) { |
| 167 | Dictionary<?, ?> properties = context.getProperties(); |
| 168 | int newPortStatsPollFrequency; |
| 169 | try { |
| 170 | String s = get(properties, "PortStatsPollFrequency"); |
| 171 | newPortStatsPollFrequency = isNullOrEmpty(s) ? portStatsPollFrequency : Integer.parseInt(s.trim()); |
| 172 | |
| 173 | } catch (NumberFormatException | ClassCastException e) { |
| 174 | newPortStatsPollFrequency = portStatsPollFrequency; |
| 175 | } |
| 176 | |
| 177 | if (newPortStatsPollFrequency != portStatsPollFrequency) { |
| 178 | portStatsPollFrequency = newPortStatsPollFrequency; |
| 179 | collectors.values().forEach(psc -> psc.adjustPollInterval(portStatsPollFrequency)); |
| 180 | } |
| 181 | |
| 182 | LOG.info("Settings: portStatsPollFrequency={}", portStatsPollFrequency); |
| 183 | } |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 184 | |
| 185 | @Override |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 186 | public boolean isReachable(DeviceId deviceId) { |
| 187 | OpenFlowSwitch sw = controller.getSwitch(dpid(deviceId.uri())); |
Yuta HIGUCHI | 69a2735 | 2014-10-31 15:48:37 -0700 | [diff] [blame] | 188 | if (sw == null || !sw.isConnected()) { |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 189 | return false; |
| 190 | } |
| 191 | return true; |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 192 | } |
| 193 | |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 194 | @Override |
Ayaka Koshibe | 78bcbc1 | 2014-11-19 14:28:58 -0800 | [diff] [blame] | 195 | public void triggerProbe(DeviceId deviceId) { |
Madan Jampani | c332876 | 2015-05-31 12:39:27 -0700 | [diff] [blame] | 196 | LOG.debug("Triggering probe on device {}", deviceId); |
Ayaka Koshibe | e8708e3 | 2014-10-22 13:40:18 -0700 | [diff] [blame] | 197 | |
Yuta HIGUCHI | 802d0e8 | 2014-10-31 16:07:37 -0700 | [diff] [blame] | 198 | final Dpid dpid = dpid(deviceId.uri()); |
| 199 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
| 200 | if (sw == null || !sw.isConnected()) { |
Ayaka Koshibe | 78bcbc1 | 2014-11-19 14:28:58 -0800 | [diff] [blame] | 201 | LOG.error("Failed to probe device {} on sw={}", deviceId, sw); |
Yuta HIGUCHI | 802d0e8 | 2014-10-31 16:07:37 -0700 | [diff] [blame] | 202 | providerService.deviceDisconnected(deviceId); |
Thomas Vachuska | 74bcd92 | 2015-06-02 13:08:57 -0700 | [diff] [blame] | 203 | return; |
Yuta HIGUCHI | 802d0e8 | 2014-10-31 16:07:37 -0700 | [diff] [blame] | 204 | } else { |
Ayaka Koshibe | 78bcbc1 | 2014-11-19 14:28:58 -0800 | [diff] [blame] | 205 | LOG.trace("Confirmed device {} connection", deviceId); |
Yuta HIGUCHI | 802d0e8 | 2014-10-31 16:07:37 -0700 | [diff] [blame] | 206 | } |
Ayaka Koshibe | e8708e3 | 2014-10-22 13:40:18 -0700 | [diff] [blame] | 207 | |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 208 | // Prompt an update of port information. We can use any XID for this. |
Ayaka Koshibe | e8708e3 | 2014-10-22 13:40:18 -0700 | [diff] [blame] | 209 | OFFactory fact = sw.factory(); |
| 210 | switch (fact.getVersion()) { |
| 211 | case OF_10: |
| 212 | sw.sendMsg(fact.buildFeaturesRequest().setXid(0).build()); |
| 213 | break; |
| 214 | case OF_13: |
| 215 | sw.sendMsg(fact.buildPortDescStatsRequest().setXid(0).build()); |
| 216 | break; |
| 217 | default: |
| 218 | LOG.warn("Unhandled protocol version"); |
| 219 | } |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | @Override |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 223 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 224 | switch (newRole) { |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 225 | case MASTER: |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 226 | controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 227 | break; |
| 228 | case STANDBY: |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 229 | controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 230 | break; |
| 231 | case NONE: |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 232 | controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 233 | break; |
| 234 | default: |
| 235 | LOG.error("Unknown Mastership state : {}", newRole); |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 236 | |
| 237 | } |
Madan Jampani | c332876 | 2015-05-31 12:39:27 -0700 | [diff] [blame] | 238 | LOG.debug("Accepting mastership role change for device {}", deviceId); |
tom | ab21e7c | 2014-08-26 15:23:08 -0700 | [diff] [blame] | 239 | } |
| 240 | |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 241 | private void pushPortMetrics(Dpid dpid, List<OFPortStatsEntry> portStatsEntries) { |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 242 | DeviceId deviceId = DeviceId.deviceId(dpid.uri(dpid)); |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 243 | Collection<PortStatistics> stats = buildPortStatistics(deviceId, portStatsEntries); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 244 | providerService.updatePortStatistics(deviceId, stats); |
| 245 | } |
| 246 | |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 247 | private Collection<PortStatistics> buildPortStatistics(DeviceId deviceId, |
| 248 | List<OFPortStatsEntry> entries) { |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 249 | HashSet<PortStatistics> stats = Sets.newHashSet(); |
| 250 | |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 251 | for (OFPortStatsEntry entry : entries) { |
Thomas Vachuska | f0397b5 | 2015-05-29 13:50:17 -0700 | [diff] [blame] | 252 | try { |
Thomas Vachuska | 4e6025e | 2015-06-03 11:25:21 -0700 | [diff] [blame] | 253 | if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) { |
Thomas Vachuska | f0397b5 | 2015-05-29 13:50:17 -0700 | [diff] [blame] | 254 | continue; |
| 255 | } |
| 256 | DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); |
| 257 | DefaultPortStatistics stat = builder.setDeviceId(deviceId) |
| 258 | .setPort(entry.getPortNo().getPortNumber()) |
| 259 | .setPacketsReceived(entry.getRxPackets().getValue()) |
| 260 | .setPacketsSent(entry.getTxPackets().getValue()) |
| 261 | .setBytesReceived(entry.getRxBytes().getValue()) |
| 262 | .setBytesSent(entry.getTxBytes().getValue()) |
| 263 | .setPacketsRxDropped(entry.getRxDropped().getValue()) |
| 264 | .setPacketsTxDropped(entry.getTxDropped().getValue()) |
| 265 | .setPacketsRxErrors(entry.getRxErrors().getValue()) |
| 266 | .setPacketsTxErrors(entry.getTxErrors().getValue()) |
| 267 | .setDurationSec(entry.getVersion() == OFVersion.OF_10 ? 0 : entry.getDurationSec()) |
| 268 | .setDurationNano(entry.getVersion() == OFVersion.OF_10 ? 0 : entry.getDurationNsec()) |
| 269 | .build(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 270 | |
Thomas Vachuska | f0397b5 | 2015-05-29 13:50:17 -0700 | [diff] [blame] | 271 | stats.add(stat); |
| 272 | } catch (Exception e) { |
| 273 | LOG.warn("Unable to process port stats", e); |
| 274 | } |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | return Collections.unmodifiableSet(stats); |
| 278 | |
| 279 | } |
| 280 | |
| 281 | private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener { |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 282 | |
Srikanth Vavilapalli | 78baf58 | 2015-06-05 11:40:14 -0700 | [diff] [blame] | 283 | private HashMap<Dpid, List<OFPortStatsEntry>> portStatsReplies = new HashMap<>(); |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 284 | |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 285 | @Override |
tom | d1900f3 | 2014-09-03 14:08:16 -0700 | [diff] [blame] | 286 | public void switchAdded(Dpid dpid) { |
alshabib | 6f5460b | 2014-09-03 14:46:17 -0700 | [diff] [blame] | 287 | if (providerService == null) { |
| 288 | return; |
| 289 | } |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 290 | DeviceId did = deviceId(uri(dpid)); |
alshabib | 6f5460b | 2014-09-03 14:46:17 -0700 | [diff] [blame] | 291 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
| 292 | |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 293 | Device.Type deviceType = sw.isOptical() ? Device.Type.ROADM : |
| 294 | Device.Type.SWITCH; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 295 | ChassisId cId = new ChassisId(dpid.value()); |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 296 | |
Thomas Vachuska | 82041f5 | 2014-11-30 22:14:02 -0800 | [diff] [blame] | 297 | SparseAnnotations annotations = DefaultAnnotations.builder() |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 298 | .set("protocol", sw.factory().getVersion().toString()) |
| 299 | .set("channelId", sw.channelId()) |
| 300 | .build(); |
| 301 | |
tom | d1900f3 | 2014-09-03 14:08:16 -0700 | [diff] [blame] | 302 | DeviceDescription description = |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 303 | new DefaultDeviceDescription(did.uri(), deviceType, |
Ray Milkey | d3edd03 | 2015-01-16 11:38:58 -0800 | [diff] [blame] | 304 | sw.manufacturerDescription(), |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 305 | sw.hardwareDescription(), |
| 306 | sw.softwareDescription(), |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 307 | sw.serialNumber(), |
Thomas Vachuska | 82041f5 | 2014-11-30 22:14:02 -0800 | [diff] [blame] | 308 | cId, annotations); |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 309 | providerService.deviceConnected(did, description); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 310 | providerService.updatePorts(did, buildPortDescriptions(sw)); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 311 | |
Thomas Vachuska | fc52fec | 2015-05-18 19:13:56 -0700 | [diff] [blame] | 312 | PortStatsCollector psc = |
Dusan Pajin | bab8a5e | 2015-07-24 17:37:19 +0200 | [diff] [blame^] | 313 | new PortStatsCollector(controller.getSwitch(dpid), portStatsPollFrequency); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 314 | psc.start(); |
| 315 | collectors.put(dpid, psc); |
alshabib | 25c8eec | 2014-09-04 16:41:31 -0700 | [diff] [blame] | 316 | } |
| 317 | |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 318 | @Override |
| 319 | public void switchRemoved(Dpid dpid) { |
alshabib | 6f5460b | 2014-09-03 14:46:17 -0700 | [diff] [blame] | 320 | if (providerService == null) { |
| 321 | return; |
| 322 | } |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 323 | providerService.deviceDisconnected(deviceId(uri(dpid))); |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 324 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 325 | PortStatsCollector collector = collectors.remove(dpid); |
| 326 | if (collector != null) { |
| 327 | collector.stop(); |
| 328 | } |
| 329 | } |
Ayaka Koshibe | 38594c2 | 2014-10-22 13:36:12 -0700 | [diff] [blame] | 330 | |
| 331 | @Override |
| 332 | public void switchChanged(Dpid dpid) { |
| 333 | if (providerService == null) { |
| 334 | return; |
| 335 | } |
| 336 | DeviceId did = deviceId(uri(dpid)); |
| 337 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 338 | providerService.updatePorts(did, buildPortDescriptions(sw)); |
Ayaka Koshibe | 38594c2 | 2014-10-22 13:36:12 -0700 | [diff] [blame] | 339 | } |
| 340 | |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 341 | @Override |
| 342 | public void portChanged(Dpid dpid, OFPortStatus status) { |
alshabib | afc514a | 2014-12-01 14:44:05 -0800 | [diff] [blame] | 343 | PortDescription portDescription = buildPortDescription(status); |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 344 | providerService.portStatusChanged(deviceId(uri(dpid)), portDescription); |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 345 | } |
| 346 | |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 347 | @Override |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 348 | public void receivedRoleReply(Dpid dpid, RoleState requested, RoleState response) { |
| 349 | MastershipRole request = roleOf(requested); |
| 350 | MastershipRole reply = roleOf(response); |
| 351 | |
| 352 | providerService.receivedRoleReply(deviceId(uri(dpid)), request, reply); |
| 353 | } |
| 354 | |
| 355 | /** |
| 356 | * Translates a RoleState to the corresponding MastershipRole. |
| 357 | * |
Thomas Vachuska | fc52fec | 2015-05-18 19:13:56 -0700 | [diff] [blame] | 358 | * @param response role state |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 359 | * @return a MastershipRole |
| 360 | */ |
| 361 | private MastershipRole roleOf(RoleState response) { |
| 362 | switch (response) { |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 363 | case MASTER: |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 364 | return MastershipRole.MASTER; |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 365 | case EQUAL: |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 366 | return MastershipRole.STANDBY; |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 367 | case SLAVE: |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 368 | return MastershipRole.NONE; |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 369 | default: |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 370 | LOG.warn("unknown role {}", response); |
| 371 | return null; |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 372 | } |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 373 | } |
| 374 | |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 375 | /** |
| 376 | * Builds a list of port descriptions for a given list of ports. |
tom | ff7eb7c | 2014-09-08 12:49:03 -0700 | [diff] [blame] | 377 | * |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 378 | * @return list of portdescriptions |
| 379 | */ |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 380 | private List<PortDescription> buildPortDescriptions(OpenFlowSwitch sw) { |
| 381 | final List<PortDescription> portDescs = new ArrayList<>(sw.getPorts().size()); |
| 382 | sw.getPorts().forEach(port -> portDescs.add(buildPortDescription(port))); |
| 383 | if (sw.isOptical()) { |
| 384 | OpenFlowOpticalSwitch opsw = (OpenFlowOpticalSwitch) sw; |
| 385 | opsw.getPortTypes().forEach(type -> { |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 386 | opsw.getPortsOf(type).forEach( |
| 387 | op -> { |
| 388 | portDescs.add(buildPortDescription(type, (OFPortOptical) op)); |
| 389 | } |
| 390 | ); |
| 391 | }); |
alshabib | 4680bb6 | 2014-09-04 17:15:08 -0700 | [diff] [blame] | 392 | } |
| 393 | return portDescs; |
| 394 | } |
| 395 | |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 396 | /** |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 397 | * Creates an annotation for the port name if one is available. |
| 398 | * |
| 399 | * @param port description of the port |
| 400 | * @return annotation containing the port name if one is found, |
| 401 | * null otherwise |
| 402 | */ |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 403 | private SparseAnnotations makePortNameAnnotation(String port) { |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 404 | SparseAnnotations annotations = null; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 405 | String portName = Strings.emptyToNull(port); |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 406 | if (portName != null) { |
| 407 | annotations = DefaultAnnotations.builder() |
Thomas Vachuska | b52a014 | 2015-04-21 17:48:15 -0700 | [diff] [blame] | 408 | .set(AnnotationKeys.PORT_NAME, portName).build(); |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 409 | } |
| 410 | return annotations; |
| 411 | } |
| 412 | |
| 413 | /** |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 414 | * Build a portDescription from a given Ethernet port description. |
tom | ff7eb7c | 2014-09-08 12:49:03 -0700 | [diff] [blame] | 415 | * |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 416 | * @param port the port to build from. |
| 417 | * @return portDescription for the port. |
| 418 | */ |
| 419 | private PortDescription buildPortDescription(OFPortDesc port) { |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 420 | PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); |
| 421 | boolean enabled = |
| 422 | !port.getState().contains(OFPortState.LINK_DOWN) && |
| 423 | !port.getConfig().contains(OFPortConfig.PORT_DOWN); |
| 424 | Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 425 | SparseAnnotations annotations = makePortNameAnnotation(port.getName()); |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 426 | return new DefaultPortDescription(portNo, enabled, type, |
| 427 | portSpeed(port), annotations); |
alshabib | a14f364 | 2014-09-05 09:31:31 -0700 | [diff] [blame] | 428 | } |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 429 | |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 430 | /** |
| 431 | * Build a portDescription from a given a port description describing some |
| 432 | * Optical port. |
| 433 | * |
| 434 | * @param port description property type. |
| 435 | * @param port the port to build from. |
| 436 | * @return portDescription for the port. |
| 437 | */ |
| 438 | private PortDescription buildPortDescription(PortDescPropertyType ptype, OFPortOptical port) { |
| 439 | // Minimally functional fixture. This needs to be fixed as we add better support. |
| 440 | PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); |
Ayaka Koshibe | 74b5527 | 2015-05-28 15:16:04 -0700 | [diff] [blame] | 441 | |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 442 | boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) |
| 443 | && !port.getConfig().contains(OFPortConfig.PORT_DOWN); |
| 444 | SparseAnnotations annotations = makePortNameAnnotation(port.getName()); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 445 | |
| 446 | if (port.getVersion() == OFVersion.OF_13 |
| 447 | && ptype == PortDescPropertyType.OPTICAL_TRANSPORT) { |
| 448 | // At this point, not much is carried in the optical port message. |
Ayaka Koshibe | ae54173 | 2015-05-19 13:37:27 -0700 | [diff] [blame] | 449 | LOG.debug("Optical transport port message {}", port.toString()); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 450 | } else { |
| 451 | // removable once 1.4+ support complete. |
Ayaka Koshibe | ae54173 | 2015-05-19 13:37:27 -0700 | [diff] [blame] | 452 | LOG.debug("Unsupported optical port properties"); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 453 | } |
Ayaka Koshibe | 74b5527 | 2015-05-28 15:16:04 -0700 | [diff] [blame] | 454 | return new DefaultPortDescription(portNo, enabled, FIBER, 0, annotations); |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 455 | } |
| 456 | |
alshabib | afc514a | 2014-12-01 14:44:05 -0800 | [diff] [blame] | 457 | private PortDescription buildPortDescription(OFPortStatus status) { |
| 458 | OFPortDesc port = status.getDesc(); |
| 459 | if (status.getReason() != OFPortReason.DELETE) { |
| 460 | return buildPortDescription(port); |
| 461 | } else { |
| 462 | PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); |
| 463 | Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER; |
Ayaka Koshibe | 5460d62 | 2015-05-14 12:19:19 -0700 | [diff] [blame] | 464 | SparseAnnotations annotations = makePortNameAnnotation(port.getName()); |
Ray Milkey | e0fade7 | 2015-01-15 13:29:47 -0800 | [diff] [blame] | 465 | return new DefaultPortDescription(portNo, false, type, |
| 466 | portSpeed(port), annotations); |
alshabib | afc514a | 2014-12-01 14:44:05 -0800 | [diff] [blame] | 467 | } |
| 468 | } |
| 469 | |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 470 | private long portSpeed(OFPortDesc port) { |
| 471 | if (port.getVersion() == OFVersion.OF_13) { |
| 472 | return port.getCurrSpeed() / MBPS; |
| 473 | } |
| 474 | |
| 475 | PortSpeed portSpeed = PortSpeed.SPEED_NONE; |
| 476 | for (OFPortFeatures feat : port.getCurr()) { |
| 477 | portSpeed = PortSpeed.max(portSpeed, feat.getPortSpeed()); |
| 478 | } |
Thomas Vachuska | 98eda53 | 2014-10-29 17:31:02 -0700 | [diff] [blame] | 479 | return portSpeed.getSpeedBps() / MBPS; |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 480 | } |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 481 | |
| 482 | @Override |
| 483 | public void handleMessage(Dpid dpid, OFMessage msg) { |
| 484 | switch (msg.getType()) { |
| 485 | case STATS_REPLY: |
| 486 | if (((OFStatsReply) msg).getStatsType() == OFStatsType.PORT) { |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 487 | OFPortStatsReply portStatsReply = (OFPortStatsReply) msg; |
Srikanth Vavilapalli | 78baf58 | 2015-06-05 11:40:14 -0700 | [diff] [blame] | 488 | List<OFPortStatsEntry> portStatsReplyList = portStatsReplies.get(dpid); |
| 489 | if (portStatsReplyList == null) { |
| 490 | portStatsReplyList = Lists.newArrayList(); |
| 491 | } |
| 492 | portStatsReplyList.addAll(portStatsReply.getEntries()); |
| 493 | portStatsReplies.put(dpid, portStatsReplyList); |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 494 | if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) { |
Srikanth Vavilapalli | 78baf58 | 2015-06-05 11:40:14 -0700 | [diff] [blame] | 495 | pushPortMetrics(dpid, portStatsReplies.get(dpid)); |
| 496 | portStatsReplies.get(dpid).clear(); |
Thomas Vachuska | 893bf4b | 2015-05-29 18:13:18 -0700 | [diff] [blame] | 497 | } |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 498 | } |
| 499 | break; |
| 500 | default: |
| 501 | break; |
| 502 | } |
| 503 | } |
alshabib | f1216ed | 2014-09-03 11:53:54 -0700 | [diff] [blame] | 504 | } |
| 505 | |
tom | b5a46e6 | 2014-08-26 14:20:00 -0700 | [diff] [blame] | 506 | } |