blob: 162ec3009721c2c79f33c97e19cb00dcf1278577 [file] [log] [blame]
sunishvkf7c56552016-07-18 16:02:39 +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.ospf.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.net.config.Config;
25import org.onosproject.ospf.controller.OspfController;
26
27/**
28 * Configuration object for OSPF.
29 */
30public class OspfAppConfig extends Config<ApplicationId> {
31 public static final String METHOD = "method";
32 public static final String ATTRIBUTE = "attribute";
33 public static final String PROCESSES = "processes";
34 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
35 private OspfController ospfController;
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 configuration attribute, area, process etc.
48 *
49 * @return the configuration attribute, area, process etc
50 */
51 public String attribute() {
52 return get(ATTRIBUTE, null);
53 }
54
55 /**
56 * Returns the configured processes.
57 *
58 * @return the configured processes
59 */
60 public JsonNode processes() {
61 JsonNode jsonNodes = object.get(PROCESSES);
62
63 return jsonNodes;
64 }
65
66 @Override
67 public boolean isValid() {
68 this.ospfController = DefaultServiceDirectory.getService(OspfController.class);
69
70 return true;
71 }
72}