Jian Li | 955c20c | 2016-10-31 01:21:50 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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.lisp.device.impl; |
| 17 | |
| 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.onosproject.core.ApplicationId; |
| 24 | import org.onosproject.core.CoreService; |
| 25 | import org.onosproject.lisp.LispController; |
| 26 | import org.onosproject.net.DeviceId; |
| 27 | import org.onosproject.net.MastershipRole; |
| 28 | import org.onosproject.net.PortNumber; |
| 29 | import org.onosproject.net.device.DeviceProvider; |
| 30 | import org.onosproject.net.provider.AbstractProvider; |
| 31 | import org.onosproject.net.provider.ProviderId; |
| 32 | import org.slf4j.Logger; |
| 33 | import org.slf4j.LoggerFactory; |
| 34 | |
| 35 | /** |
| 36 | * Provider which uses an LISP controller to detect device. |
| 37 | */ |
| 38 | @Component(immediate = true) |
| 39 | public class LispDeviceProvider extends AbstractProvider |
| 40 | implements DeviceProvider { |
| 41 | |
| 42 | private static final Logger log = LoggerFactory.getLogger(LispDeviceProvider.class); |
| 43 | |
| 44 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 45 | protected CoreService coreService; |
| 46 | |
| 47 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 48 | protected LispController controller; |
| 49 | |
| 50 | private static final String APP_NAME = "org.onosproject.lisp"; |
| 51 | private static final String SCHEME_NAME = "lisp"; |
| 52 | private static final String DEVICE_PROVIDER_PACKAGE = "org.onosproject.lisp.provider.device"; |
| 53 | |
| 54 | private ApplicationId appId; |
| 55 | |
| 56 | /** |
| 57 | * Creates a LISP device provider. |
| 58 | */ |
| 59 | public LispDeviceProvider() { |
| 60 | super(new ProviderId(SCHEME_NAME, DEVICE_PROVIDER_PACKAGE)); |
| 61 | } |
| 62 | |
| 63 | @Activate |
| 64 | public void activate() { |
| 65 | appId = coreService.registerApplication(APP_NAME); |
| 66 | log.info("Started"); |
| 67 | } |
| 68 | |
| 69 | @Deactivate |
| 70 | public void deactivate() { |
| 71 | log.info("Stopped"); |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public void triggerProbe(DeviceId deviceId) { |
| 76 | |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { |
| 81 | |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public boolean isReachable(DeviceId deviceId) { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public void changePortState(DeviceId deviceId, PortNumber portNumber, boolean enable) { |
| 91 | |
| 92 | } |
| 93 | } |