blob: c4f860248604408cc774d330a32a00dc55460f1e [file] [log] [blame]
Thomas Vachuska96d55b12015-05-11 08:52:03 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska96d55b12015-05-11 08:52:03 -07003 *
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 */
Thomas Vachuska4998caa2015-08-26 13:28:38 -070016package org.onosproject.net.config.basics;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070017
Ray Milkeya4122362015-08-18 15:19:08 -070018import org.onosproject.net.config.Config;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070019
20/**
21 * Base abstraction for network entities for which admission into control
22 * domain can be selectively configured, e.g. devices, end-stations, links
23 */
24public abstract class AllowedEntityConfig<S> extends Config<S> {
25
Thomas Vachuska36008462016-01-07 15:38:20 -080026 protected static final String ALLOWED = "allowed";
Thomas Vachuska96d55b12015-05-11 08:52:03 -070027
28 /**
29 * Indicates whether the element is allowed for admission into the control
30 * domain.
31 *
32 * @return true if element is allowed
33 */
34 public boolean isAllowed() {
35 return get(ALLOWED, true);
36 }
37
38 /**
39 * Specifies whether the element is to be allowed for admission into the
40 * control domain.
41 *
42 * @param isAllowed true to allow; false to forbid; null to clear
43 * @return self
44 */
45 public AllowedEntityConfig isAllowed(Boolean isAllowed) {
46 return (AllowedEntityConfig) setOrClear(ALLOWED, isAllowed);
47 }
48
49}