blob: 502a3b415d518d9b75115690320e7f117e80020d [file] [log] [blame]
Jian Li6322a362016-10-31 00:57:19 +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.lisp.ctl;
17
18import org.apache.felix.scr.annotations.Component;
19import org.apache.felix.scr.annotations.Reference;
20import org.apache.felix.scr.annotations.ReferenceCardinality;
21import org.apache.felix.scr.annotations.Service;
22import org.apache.felix.scr.annotations.Activate;
23import org.apache.felix.scr.annotations.Deactivate;
24
25import org.onosproject.core.CoreService;
26import org.onosproject.lisp.LispController;
27import org.onosproject.net.device.DeviceService;
28import org.slf4j.Logger;
29import org.slf4j.LoggerFactory;
30
31/**
32 * LISP controller initiation class.
33 */
34@Component(immediate = true)
35@Service
36public class LispControllerImpl implements LispController {
37
38 private static final String APP_ID = "org.onosproject.lisp-base";
39
40 private static final Logger log =
41 LoggerFactory.getLogger(LispControllerImpl.class);
42
43 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
44 protected CoreService coreService;
45
46 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
47 protected DeviceService deviceService;
48
49 private final LispControllerBootstrap bootstrap = new LispControllerBootstrap();
50
51 @Activate
52 public void activate() {
53 coreService.registerApplication(APP_ID);
54 bootstrap.start();
55 log.info("Started");
56 }
57
58 @Deactivate
59 public void deactivate() {
60 bootstrap.stop();
61 log.info("Stopped");
62 }
63}