cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
cheng fan | 48e832c | 2015-05-29 01:54:47 +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 | */ |
| 16 | package org.onosproject.provider.pcep.topology.impl; |
| 17 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 18 | import org.apache.felix.scr.annotations.Activate; |
| 19 | import org.apache.felix.scr.annotations.Component; |
| 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Reference; |
| 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 23 | import org.onlab.packet.ChassisId; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 24 | import org.onosproject.net.ConnectPoint; |
| 25 | import org.onosproject.net.DefaultAnnotations; |
| 26 | import org.onosproject.net.Device; |
| 27 | import org.onosproject.net.DeviceId; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 28 | import org.onosproject.net.Link.Type; |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 29 | import org.onosproject.net.SparseAnnotations; |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 30 | import org.onosproject.net.config.ConfigFactory; |
| 31 | import org.onosproject.net.config.NetworkConfigRegistry; |
| 32 | import org.onosproject.net.config.NetworkConfigService; |
| 33 | import org.onosproject.net.config.basics.SubjectFactories; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 34 | import org.onosproject.net.MastershipRole; |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 35 | import org.onosproject.net.Port; |
Saurav Das | a2d3750 | 2016-03-25 17:50:40 -0700 | [diff] [blame] | 36 | import org.onosproject.net.PortNumber; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 37 | import org.onosproject.net.device.DefaultDeviceDescription; |
| 38 | import org.onosproject.net.device.DefaultPortDescription; |
| 39 | import org.onosproject.net.device.DeviceDescription; |
| 40 | import org.onosproject.net.device.DeviceProvider; |
| 41 | import org.onosproject.net.device.DeviceProviderRegistry; |
| 42 | import org.onosproject.net.device.DeviceProviderService; |
| 43 | import org.onosproject.net.device.DeviceService; |
| 44 | import org.onosproject.net.device.PortDescription; |
| 45 | import org.onosproject.net.link.DefaultLinkDescription; |
| 46 | import org.onosproject.net.link.LinkDescription; |
| 47 | import org.onosproject.net.link.LinkProvider; |
| 48 | import org.onosproject.net.link.LinkProviderRegistry; |
| 49 | import org.onosproject.net.link.LinkProviderService; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 50 | import org.onosproject.net.provider.AbstractProvider; |
| 51 | import org.onosproject.net.provider.ProviderId; |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 52 | import org.onosproject.pcep.api.DeviceCapability; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 53 | import org.onosproject.pcep.api.PcepController; |
| 54 | import org.onosproject.pcep.api.PcepDpid; |
| 55 | import org.onosproject.pcep.api.PcepLink; |
| 56 | import org.onosproject.pcep.api.PcepLinkListener; |
| 57 | import org.onosproject.pcep.api.PcepOperator.OperationType; |
| 58 | import org.onosproject.pcep.api.PcepSwitch; |
| 59 | import org.onosproject.pcep.api.PcepSwitchListener; |
harikrushna-Huawei | 6ecfc77 | 2017-04-10 18:22:00 +0530 | [diff] [blame^] | 60 | import org.onosproject.pcep.server.PccId; |
| 61 | import org.onosproject.pcep.server.PcepClient; |
| 62 | import org.onosproject.pcep.server.PcepClientController; |
| 63 | import org.onosproject.pcep.server.PcepNodeListener; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 64 | import org.slf4j.Logger; |
| 65 | import org.slf4j.LoggerFactory; |
| 66 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 67 | import java.util.ArrayList; |
| 68 | import java.util.HashMap; |
| 69 | import java.util.List; |
| 70 | |
| 71 | import static com.google.common.base.Preconditions.checkNotNull; |
| 72 | import static org.onosproject.net.DeviceId.deviceId; |
| 73 | import static org.onosproject.pcep.api.PcepDpid.uri; |
| 74 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 75 | /** |
| 76 | * Provider which uses an PCEP controller to detect network infrastructure |
| 77 | * topology. |
| 78 | */ |
| 79 | @Component(immediate = true) |
| 80 | public class PcepTopologyProvider extends AbstractProvider |
| 81 | implements LinkProvider, DeviceProvider { |
| 82 | |
Priyanka B | 9bee080 | 2016-04-27 22:06:02 +0530 | [diff] [blame] | 83 | /** |
| 84 | * Creates instance of PCEP topology provider. |
| 85 | */ |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 86 | public PcepTopologyProvider() { |
Priyanka B | cdf9b10 | 2016-06-07 20:01:38 +0530 | [diff] [blame] | 87 | //In BGP-PCEP app, since both BGP and PCEP topology provider have same scheme |
| 88 | //so BGP will be primary and PCEP topology provider will be ancillary. |
| 89 | super(new ProviderId("l3", "org.onosproject.provider.pcep", true)); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | private static final Logger log = LoggerFactory |
| 93 | .getLogger(PcepTopologyProvider.class); |
| 94 | |
| 95 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 96 | protected LinkProviderRegistry linkProviderRegistry; |
| 97 | |
| 98 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 99 | protected DeviceProviderRegistry deviceProviderRegistry; |
| 100 | |
| 101 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 102 | protected PcepController controller; |
| 103 | |
| 104 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 105 | protected DeviceService deviceService; |
| 106 | |
| 107 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 108 | protected PcepClientController pcepClientController; |
| 109 | |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 110 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 111 | protected NetworkConfigRegistry netConfigRegistry; |
| 112 | |
| 113 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 114 | protected NetworkConfigService netConfigService; |
| 115 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 116 | private DeviceProviderService deviceProviderService; |
| 117 | private LinkProviderService linkProviderService; |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 118 | |
| 119 | private HashMap<Long, List<PortDescription>> portMap = new HashMap<>(); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 120 | private InternalLinkProvider listener = new InternalLinkProvider(); |
| 121 | |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 122 | private final ConfigFactory<DeviceId, DeviceCapability> configFactory = |
| 123 | new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY, |
Avantika-Huawei | 3524d85 | 2016-06-04 20:44:13 +0530 | [diff] [blame] | 124 | DeviceCapability.class, "deviceCapability", false) { |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 125 | @Override |
| 126 | public DeviceCapability createConfig() { |
| 127 | return new DeviceCapability(); |
| 128 | } |
| 129 | }; |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 130 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 131 | @Activate |
| 132 | public void activate() { |
| 133 | linkProviderService = linkProviderRegistry.register(this); |
| 134 | deviceProviderService = deviceProviderRegistry.register(this); |
| 135 | controller.addListener(listener); |
| 136 | controller.addLinkListener(listener); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 137 | pcepClientController.addNodeListener(listener); |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 138 | netConfigRegistry.registerConfigFactory(configFactory); |
Priyanka B | cdf9b10 | 2016-06-07 20:01:38 +0530 | [diff] [blame] | 139 | log.info("Started"); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | @Deactivate |
| 143 | public void deactivate() { |
| 144 | linkProviderRegistry.unregister(this); |
| 145 | linkProviderService = null; |
| 146 | controller.removeListener(listener); |
| 147 | controller.removeLinkListener(listener); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 148 | pcepClientController.removeNodeListener(listener); |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 149 | netConfigRegistry.unregisterConfigFactory(configFactory); |
Priyanka B | cdf9b10 | 2016-06-07 20:01:38 +0530 | [diff] [blame] | 150 | log.info("Stopped"); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 151 | } |
| 152 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 153 | private List<PortDescription> buildPortDescriptions(PcepDpid dpid, |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 154 | Port port) { |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 155 | |
| 156 | List<PortDescription> portList; |
| 157 | |
| 158 | if (portMap.containsKey(dpid.value())) { |
| 159 | portList = portMap.get(dpid.value()); |
| 160 | } else { |
| 161 | portList = new ArrayList<>(); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 162 | } |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 163 | if (port != null) { |
| 164 | SparseAnnotations annotations = DefaultAnnotations.builder() |
| 165 | .putAll(port.annotations()).build(); |
| 166 | portList.add(new DefaultPortDescription(port.number(), port.isEnabled(), |
| 167 | port.type(), port.portSpeed(), |
| 168 | annotations)); |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | portMap.put(dpid.value(), portList); |
| 172 | return portList; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 173 | } |
| 174 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 175 | /** |
chengfan | 3e61879 | 2015-06-28 21:42:01 +0800 | [diff] [blame] | 176 | * Build a link description from a pcep link. |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 177 | * |
chengfan | 3e61879 | 2015-06-28 21:42:01 +0800 | [diff] [blame] | 178 | * @param pceLink pcep link |
| 179 | * @return LinkDescription onos link description |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 180 | */ |
| 181 | private LinkDescription buildLinkDescription(PcepLink pceLink) { |
| 182 | LinkDescription ld; |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 183 | checkNotNull(pceLink); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 184 | DeviceId srcDeviceID = deviceId(uri(pceLink.linkSrcDeviceID())); |
| 185 | DeviceId dstDeviceID = deviceId(uri(pceLink.linkDstDeviceId())); |
| 186 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 187 | deviceProviderService |
| 188 | .updatePorts(srcDeviceID, |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 189 | buildPortDescriptions(pceLink.linkSrcDeviceID(), |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 190 | pceLink.linkSrcPort())); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 191 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 192 | deviceProviderService |
| 193 | .updatePorts(dstDeviceID, |
| 194 | buildPortDescriptions(pceLink.linkDstDeviceId(), |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 195 | pceLink.linkDstPort())); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 196 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 197 | ConnectPoint src = new ConnectPoint(srcDeviceID, pceLink.linkSrcPort().number()); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 198 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 199 | ConnectPoint dst = new ConnectPoint(dstDeviceID, pceLink.linkDstPort().number()); |
| 200 | |
| 201 | DefaultAnnotations extendedAttributes = DefaultAnnotations |
| 202 | .builder() |
| 203 | .set("subType", String.valueOf(pceLink.linkSubType())) |
| 204 | .set("workState", pceLink.linkState()) |
| 205 | .set("distance", String.valueOf(pceLink.linkDistance())) |
| 206 | .set("capType", pceLink.linkCapacityType().toLowerCase()) |
| 207 | .set("avail_" + pceLink.linkCapacityType().toLowerCase(), |
| 208 | String.valueOf(pceLink.linkAvailValue())) |
| 209 | .set("max_" + pceLink.linkCapacityType().toLowerCase(), |
| 210 | String.valueOf(pceLink.linkMaxValue())).build(); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 211 | // construct the link |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 212 | ld = new DefaultLinkDescription(src, dst, Type.OPTICAL, extendedAttributes); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 213 | return ld; |
| 214 | } |
| 215 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 216 | private class InternalLinkProvider |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 217 | implements PcepSwitchListener, PcepLinkListener, PcepNodeListener { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 218 | |
| 219 | @Override |
| 220 | public void switchAdded(PcepDpid dpid) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 221 | if (deviceProviderService == null) { |
| 222 | return; |
| 223 | } |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 224 | DeviceId deviceId = deviceId(uri(dpid)); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 225 | PcepSwitch sw = controller.getSwitch(dpid); |
| 226 | checkNotNull(sw, "device should not null."); |
| 227 | // The default device type is switch. |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 228 | ChassisId cId = new ChassisId(dpid.value()); |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 229 | Device.Type deviceType; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 230 | |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 231 | switch (sw.getDeviceType()) { |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 232 | case ROADM: |
| 233 | deviceType = Device.Type.ROADM; |
| 234 | break; |
| 235 | case OTN: |
| 236 | deviceType = Device.Type.SWITCH; |
| 237 | break; |
| 238 | case ROUTER: |
| 239 | deviceType = Device.Type.ROUTER; |
| 240 | break; |
| 241 | default: |
| 242 | deviceType = Device.Type.OTHER; |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 243 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 244 | |
| 245 | DeviceDescription description = new DefaultDeviceDescription( |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 246 | deviceId.uri(), |
| 247 | deviceType, |
| 248 | sw.manufacturerDescription(), |
| 249 | sw.hardwareDescription(), |
| 250 | sw.softwareDescription(), |
| 251 | sw.serialNumber(), |
| 252 | cId); |
| 253 | deviceProviderService.deviceConnected(deviceId, description); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 254 | |
| 255 | } |
| 256 | |
| 257 | @Override |
| 258 | public void switchRemoved(PcepDpid dpid) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 259 | if (deviceProviderService == null || linkProviderService == null) { |
| 260 | return; |
| 261 | } |
| 262 | deviceProviderService.deviceDisconnected(deviceId(uri(dpid))); |
| 263 | |
| 264 | linkProviderService.linksVanished(DeviceId.deviceId(uri(dpid))); |
| 265 | } |
| 266 | |
| 267 | @Override |
| 268 | public void switchChanged(PcepDpid dpid) { |
| 269 | // TODO Auto-generated method stub |
| 270 | |
| 271 | } |
| 272 | |
| 273 | @Override |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 274 | public void handlePceplink(PcepLink link) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 275 | |
| 276 | OperationType operType = link.getOperationType(); |
| 277 | LinkDescription ld = buildLinkDescription(link); |
| 278 | if (ld == null) { |
| 279 | log.error("Invalid link info."); |
| 280 | return; |
| 281 | } |
| 282 | switch (operType) { |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 283 | case ADD: |
| 284 | case UPDATE: |
| 285 | linkProviderService.linkDetected(ld); |
| 286 | break; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 287 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 288 | case DELETE: |
| 289 | linkProviderService.linkVanished(ld); |
| 290 | break; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 291 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 292 | default: |
| 293 | break; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 294 | |
| 295 | } |
| 296 | } |
| 297 | |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 298 | @Override |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 299 | public void addDevicePcepConfig(PcepClient pc) { |
| 300 | if (netConfigRegistry == null) { |
| 301 | log.error("Cannot add PCEP device capability as network config service is not available."); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 302 | return; |
| 303 | } |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 304 | DeviceId pccDeviceId = DeviceId.deviceId(String.valueOf(pc.getPccId().ipAddress())); |
| 305 | DeviceCapability deviceCap = netConfigService.addConfig(pccDeviceId, DeviceCapability.class); |
| 306 | deviceCap.setLabelStackCap(pc.capability().labelStackCapability()) |
| 307 | .setLocalLabelCap(pc.capability().pceccCapability()) |
| 308 | .setSrCap(pc.capability().srCapability()) |
| 309 | .apply(); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | @Override |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 313 | public void deleteDevicePcepConfig(PccId pccId) { |
| 314 | if (netConfigRegistry == null) { |
| 315 | log.error("Cannot remove PCEP device capability as network config service is not available."); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 316 | return; |
| 317 | } |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 318 | DeviceId pccDeviceId = DeviceId.deviceId(String.valueOf(pccId.ipAddress())); |
| 319 | netConfigService.removeConfig(pccDeviceId, DeviceCapability.class); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 320 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | @Override |
| 324 | public void triggerProbe(DeviceId deviceId) { |
| 325 | // TODO Auto-generated method stub |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | @Override |
| 329 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | @Override |
| 333 | public boolean isReachable(DeviceId deviceId) { |
| 334 | // TODO Auto-generated method stub |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 335 | return true; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 336 | } |
Saurav Das | a2d3750 | 2016-03-25 17:50:40 -0700 | [diff] [blame] | 337 | |
| 338 | @Override |
| 339 | public void changePortState(DeviceId deviceId, PortNumber portNumber, |
| 340 | boolean enable) { |
| 341 | // TODO Auto-generated method stub |
| 342 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 343 | } |