Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | |
| 17 | package org.onosproject.routing.config; |
| 18 | |
| 19 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.config.Config; |
| 22 | |
| 23 | /** |
| 24 | * Routing configuration. |
| 25 | */ |
| 26 | public class RouterConfig extends Config<ApplicationId> { |
| 27 | |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 28 | private static final String CP_CONNECT_POINT = "controlPlaneConnectPoint"; |
| 29 | private static final String OSPF_ENABLED = "ospfEnabled"; |
| 30 | private static final String PIM_ENABLED = "pimEnabled"; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Returns the routing control plane connect point. |
| 34 | * |
| 35 | * @return control plane connect point |
| 36 | */ |
| 37 | public ConnectPoint getControlPlaneConnectPoint() { |
| 38 | return ConnectPoint.deviceConnectPoint(object.path(CP_CONNECT_POINT).asText()); |
| 39 | } |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Returns whether OSPF is enabled on this router. |
| 43 | * |
| 44 | * @return true if OSPF is enabled, otherwise false |
| 45 | */ |
| 46 | public boolean getOspfEnabled() { |
| 47 | return object.path(OSPF_ENABLED).asBoolean(false); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns whether PIM is enabled on this router. |
| 52 | * |
| 53 | * @return true if PIM is enabled, otherwise false |
| 54 | */ |
| 55 | public boolean pimEnabled() { |
| 56 | return object.path(PIM_ENABLED).asBoolean(false); |
| 57 | } |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 58 | } |