blob: 8f5e1493caae99a2ee62f89ca5a0d03ff505c5a7 [file] [log] [blame]
Kalyankumar Asangi6dd598c2016-04-27 18:56:21 +05301/*
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
17package org.onosproject.provider.isis.cfg.impl;
18
19import com.fasterxml.jackson.databind.JsonNode;
20import org.apache.felix.scr.annotations.Reference;
21import org.apache.felix.scr.annotations.ReferenceCardinality;
22import org.onlab.osgi.DefaultServiceDirectory;
23import org.onosproject.core.ApplicationId;
24import org.onosproject.isis.controller.IsisController;
25import org.onosproject.net.config.Config;
26
27/**
28 * Configuration object for ISIS.
29 */
30public class IsisAppConfig extends Config<ApplicationId> {
31 public static final String METHOD = "method";
32 public static final String PROCESSES = "processes";
33
34 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
35 IsisController isisController;
36
37 /**
38 * Returns the configuration method, add, delete etc.
39 *
40 * @return the configuration method, add, delete etc
41 */
42 public String method() {
43 return get(METHOD, null);
44 }
45
46 /**
47 * Returns the configured processes.
48 *
49 * @return the configured processes
50 */
51 public JsonNode processes() {
52
53 JsonNode jsonNodes = object.get(PROCESSES);
54
55 return jsonNodes;
56 }
57
58 @Override
59 public boolean isValid() {
60 this.isisController = DefaultServiceDirectory.getService(IsisController.class);
61
62 return true;
63 }
64}