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 | a2c7c20 | 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(); |
Yuta HIGUCHI | 53e4796 | 2018-03-01 23:50:48 -0800 | [diff] [blame] | 166 | portList.add(DefaultPortDescription.builder() |
| 167 | .withPortNumber(port.number()) |
| 168 | .isEnabled(port.isEnabled()) |
| 169 | .type(port.type()) |
| 170 | .portSpeed(port.portSpeed()) |
| 171 | .annotations(annotations) |
| 172 | .build()); |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | portMap.put(dpid.value(), portList); |
| 176 | return portList; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 177 | } |
| 178 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 179 | /** |
chengfan | 3e61879 | 2015-06-28 21:42:01 +0800 | [diff] [blame] | 180 | * Build a link description from a pcep link. |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 181 | * |
chengfan | 3e61879 | 2015-06-28 21:42:01 +0800 | [diff] [blame] | 182 | * @param pceLink pcep link |
| 183 | * @return LinkDescription onos link description |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 184 | */ |
| 185 | private LinkDescription buildLinkDescription(PcepLink pceLink) { |
| 186 | LinkDescription ld; |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 187 | checkNotNull(pceLink); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 188 | DeviceId srcDeviceID = deviceId(uri(pceLink.linkSrcDeviceID())); |
| 189 | DeviceId dstDeviceID = deviceId(uri(pceLink.linkDstDeviceId())); |
| 190 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 191 | deviceProviderService |
| 192 | .updatePorts(srcDeviceID, |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 193 | buildPortDescriptions(pceLink.linkSrcDeviceID(), |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 194 | pceLink.linkSrcPort())); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 195 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 196 | deviceProviderService |
| 197 | .updatePorts(dstDeviceID, |
| 198 | buildPortDescriptions(pceLink.linkDstDeviceId(), |
Andrea Campanella | 5d73df7 | 2017-05-09 14:26:00 -0700 | [diff] [blame] | 199 | pceLink.linkDstPort())); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 200 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 201 | ConnectPoint src = new ConnectPoint(srcDeviceID, pceLink.linkSrcPort().number()); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 202 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 203 | ConnectPoint dst = new ConnectPoint(dstDeviceID, pceLink.linkDstPort().number()); |
| 204 | |
| 205 | DefaultAnnotations extendedAttributes = DefaultAnnotations |
| 206 | .builder() |
| 207 | .set("subType", String.valueOf(pceLink.linkSubType())) |
| 208 | .set("workState", pceLink.linkState()) |
| 209 | .set("distance", String.valueOf(pceLink.linkDistance())) |
| 210 | .set("capType", pceLink.linkCapacityType().toLowerCase()) |
| 211 | .set("avail_" + pceLink.linkCapacityType().toLowerCase(), |
| 212 | String.valueOf(pceLink.linkAvailValue())) |
| 213 | .set("max_" + pceLink.linkCapacityType().toLowerCase(), |
| 214 | String.valueOf(pceLink.linkMaxValue())).build(); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 215 | // construct the link |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 216 | ld = new DefaultLinkDescription(src, dst, Type.OPTICAL, extendedAttributes); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 217 | return ld; |
| 218 | } |
| 219 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 220 | private class InternalLinkProvider |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 221 | implements PcepSwitchListener, PcepLinkListener, PcepNodeListener { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 222 | |
| 223 | @Override |
| 224 | public void switchAdded(PcepDpid dpid) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 225 | if (deviceProviderService == null) { |
| 226 | return; |
| 227 | } |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 228 | DeviceId deviceId = deviceId(uri(dpid)); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 229 | PcepSwitch sw = controller.getSwitch(dpid); |
| 230 | checkNotNull(sw, "device should not null."); |
| 231 | // The default device type is switch. |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 232 | ChassisId cId = new ChassisId(dpid.value()); |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 233 | Device.Type deviceType; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 234 | |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 235 | switch (sw.getDeviceType()) { |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 236 | case ROADM: |
| 237 | deviceType = Device.Type.ROADM; |
| 238 | break; |
| 239 | case OTN: |
| 240 | deviceType = Device.Type.SWITCH; |
| 241 | break; |
| 242 | case ROUTER: |
| 243 | deviceType = Device.Type.ROUTER; |
| 244 | break; |
| 245 | default: |
| 246 | deviceType = Device.Type.OTHER; |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 247 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 248 | |
| 249 | DeviceDescription description = new DefaultDeviceDescription( |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 250 | deviceId.uri(), |
| 251 | deviceType, |
| 252 | sw.manufacturerDescription(), |
| 253 | sw.hardwareDescription(), |
| 254 | sw.softwareDescription(), |
| 255 | sw.serialNumber(), |
| 256 | cId); |
| 257 | deviceProviderService.deviceConnected(deviceId, description); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 258 | |
| 259 | } |
| 260 | |
| 261 | @Override |
| 262 | public void switchRemoved(PcepDpid dpid) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 263 | if (deviceProviderService == null || linkProviderService == null) { |
| 264 | return; |
| 265 | } |
| 266 | deviceProviderService.deviceDisconnected(deviceId(uri(dpid))); |
| 267 | |
| 268 | linkProviderService.linksVanished(DeviceId.deviceId(uri(dpid))); |
| 269 | } |
| 270 | |
| 271 | @Override |
| 272 | public void switchChanged(PcepDpid dpid) { |
| 273 | // TODO Auto-generated method stub |
| 274 | |
| 275 | } |
| 276 | |
| 277 | @Override |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 278 | public void handlePceplink(PcepLink link) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 279 | |
| 280 | OperationType operType = link.getOperationType(); |
| 281 | LinkDescription ld = buildLinkDescription(link); |
| 282 | if (ld == null) { |
| 283 | log.error("Invalid link info."); |
| 284 | return; |
| 285 | } |
| 286 | switch (operType) { |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 287 | case ADD: |
| 288 | case UPDATE: |
| 289 | linkProviderService.linkDetected(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 | case DELETE: |
| 293 | linkProviderService.linkVanished(ld); |
| 294 | break; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 295 | |
chengfan | 359abf7 | 2015-07-02 23:33:16 +0800 | [diff] [blame] | 296 | default: |
| 297 | break; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 298 | |
| 299 | } |
| 300 | } |
| 301 | |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 302 | @Override |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 303 | public void addDevicePcepConfig(PcepClient pc) { |
| 304 | if (netConfigRegistry == null) { |
| 305 | 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] | 306 | return; |
| 307 | } |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 308 | DeviceId pccDeviceId = DeviceId.deviceId(String.valueOf(pc.getPccId().ipAddress())); |
| 309 | DeviceCapability deviceCap = netConfigService.addConfig(pccDeviceId, DeviceCapability.class); |
| 310 | deviceCap.setLabelStackCap(pc.capability().labelStackCapability()) |
| 311 | .setLocalLabelCap(pc.capability().pceccCapability()) |
| 312 | .setSrCap(pc.capability().srCapability()) |
| 313 | .apply(); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | @Override |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 317 | public void deleteDevicePcepConfig(PccId pccId) { |
| 318 | if (netConfigRegistry == null) { |
| 319 | 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] | 320 | return; |
| 321 | } |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 322 | DeviceId pccDeviceId = DeviceId.deviceId(String.valueOf(pccId.ipAddress())); |
| 323 | netConfigService.removeConfig(pccDeviceId, DeviceCapability.class); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 324 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | @Override |
| 328 | public void triggerProbe(DeviceId deviceId) { |
| 329 | // TODO Auto-generated method stub |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | @Override |
| 333 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | @Override |
| 337 | public boolean isReachable(DeviceId deviceId) { |
| 338 | // TODO Auto-generated method stub |
cheng fan | 7716ec9 | 2015-05-31 01:53:19 +0800 | [diff] [blame] | 339 | return true; |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 340 | } |
Saurav Das | a2d3750 | 2016-03-25 17:50:40 -0700 | [diff] [blame] | 341 | |
| 342 | @Override |
| 343 | public void changePortState(DeviceId deviceId, PortNumber portNumber, |
| 344 | boolean enable) { |
| 345 | // TODO Auto-generated method stub |
| 346 | } |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 347 | } |