Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2015 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 | package org.onosproject.incubator.net.domain; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onosproject.incubator.net.config.Config; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Configuration for an intent domain including a name, set of internal devices, |
| 27 | * set of edge ports, and the application bound to control the domain. |
| 28 | */ |
| 29 | @Beta |
| 30 | public abstract class IntentDomainConfig extends Config<IntentDomainId> { |
| 31 | |
| 32 | private static final String DOMAIN_NAME = "domainName"; |
| 33 | private static final String APPLICATION_NAME = "applicationName"; |
| 34 | |
| 35 | /** |
| 36 | * Returns the friendly name for the domain. |
| 37 | * |
| 38 | * @return domain name |
| 39 | */ |
| 40 | public String domainName() { |
| 41 | return get(DOMAIN_NAME, subject.toString()); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Sets the friendly name for the domain. |
| 46 | * |
| 47 | * @param domainName new name for the domain; null to clear |
| 48 | * @return self |
| 49 | */ |
| 50 | public IntentDomainConfig domainName(String domainName) { |
| 51 | return (IntentDomainConfig) setOrClear(DOMAIN_NAME, domainName); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Returns the friendly name for the domain. |
| 56 | * |
| 57 | * @return domain name |
| 58 | */ |
| 59 | public String applicationName() { |
| 60 | return get(APPLICATION_NAME, null); //TODO maybe not null? |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Sets the friendly name for the domain. |
| 65 | * |
| 66 | * @param applicationName new name for the domain; null to clear |
| 67 | * @return self |
| 68 | */ |
| 69 | public IntentDomainConfig applicationName(String applicationName) { |
| 70 | return (IntentDomainConfig) setOrClear(APPLICATION_NAME, applicationName); |
| 71 | } |
| 72 | |
| 73 | //TODO sets |
| 74 | abstract Set<DeviceId> internalDevices(); |
| 75 | abstract Set<ConnectPoint> edgePorts(); |
| 76 | |
| 77 | } |