blob: 0183959f5368648d5db5e4b2c4d5ae644b3d476c [file] [log] [blame]
Jian Li955c20c2016-10-31 01:21:50 +09001/*
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 */
16package org.onosproject.provider.lisp.device.impl;
17
18import org.apache.felix.scr.annotations.Activate;
19import org.apache.felix.scr.annotations.Component;
20import org.apache.felix.scr.annotations.Deactivate;
21import org.apache.felix.scr.annotations.Reference;
22import org.apache.felix.scr.annotations.ReferenceCardinality;
23import org.onosproject.core.ApplicationId;
24import org.onosproject.core.CoreService;
Jian Li5e505c62016-12-05 02:44:24 +090025import org.onosproject.lisp.ctl.LispController;
Jian Li955c20c2016-10-31 01:21:50 +090026import org.onosproject.net.DeviceId;
27import org.onosproject.net.MastershipRole;
28import org.onosproject.net.PortNumber;
29import org.onosproject.net.device.DeviceProvider;
30import org.onosproject.net.provider.AbstractProvider;
31import org.onosproject.net.provider.ProviderId;
32import org.slf4j.Logger;
33import org.slf4j.LoggerFactory;
34
35/**
36 * Provider which uses an LISP controller to detect device.
37 */
38@Component(immediate = true)
39public 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}