Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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.l2monitoring.cfm.service; |
| 17 | |
| 18 | import java.util.Collection; |
| 19 | import java.util.Optional; |
| 20 | |
| 21 | import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation; |
| 22 | import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain; |
| 23 | import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort; |
| 24 | import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId; |
| 25 | |
| 26 | /** |
| 27 | * For the management of Maintenance Domains and Maintenance Associations. |
| 28 | */ |
| 29 | public interface CfmMdService { |
| 30 | |
| 31 | /** |
| 32 | * Get a list of all of the Maintenance Domains on the system. |
| 33 | * @return A collection Maintenance domains from the Distributed MD Store. |
| 34 | */ |
| 35 | Collection<MaintenanceDomain> getAllMaintenanceDomain(); |
| 36 | |
| 37 | /** |
| 38 | * Get a specific Maintenance Domain by its identifier. |
| 39 | * @param mdName An identifier for the Maintenance Domain |
| 40 | * @return A Maintenance Domain from the Distributed MD Store. Empty if not found. |
| 41 | */ |
| 42 | Optional<MaintenanceDomain> getMaintenanceDomain(MdId mdName); |
| 43 | |
| 44 | /** |
| 45 | * Delete a specific Maintenance Domain by its identifier. |
| 46 | * @param mdName An identifier for the Maintenance Domain to be deleted |
| 47 | * @return True if the MD was found and deleted |
| 48 | * @exception CfmConfigException If there were any Meps dependent on the MD or its MAs |
| 49 | */ |
| 50 | boolean deleteMaintenanceDomain(MdId mdName) throws CfmConfigException; |
| 51 | |
| 52 | /** |
| 53 | * Create or replace a Maintenance Domain. |
| 54 | * @param md The Maintenance Domain to create or replace |
| 55 | * @return true if an MD of this name already existed |
| 56 | * @throws CfmConfigException If it is a replacement and there were any |
| 57 | * Meps dependent on the MD or its MAs |
| 58 | */ |
| 59 | boolean createMaintenanceDomain(MaintenanceDomain md) throws CfmConfigException; |
| 60 | |
| 61 | /** |
| 62 | * Get all of the Maintenance Associations for a Maintenance Domain. |
| 63 | * @param mdName The identifier of the Maintenance Domain |
| 64 | * @return A collection of Maintenance Associations |
| 65 | */ |
| 66 | Collection<MaintenanceAssociation> getAllMaintenanceAssociation(MdId mdName); |
| 67 | |
| 68 | /** |
| 69 | * Get a specific Maintenance Association of a specific Maintenance Domain. |
| 70 | * @param mdName The identifier of the Maintenance Domain |
| 71 | * @param maName The identifier of the Maintenance Association |
| 72 | * @return A Maintenance Association from the Distributed MD Store. Empty if not found. |
| 73 | * @throws IllegalArgumentException if MD is not found |
| 74 | */ |
| 75 | Optional<MaintenanceAssociation> getMaintenanceAssociation(MdId mdName, MaIdShort maName); |
| 76 | |
| 77 | /** |
| 78 | * Delete a specific Maintenance Association of a specific Maintenance Domain. |
| 79 | * @param mdName The identifier of the Maintenance Domain |
| 80 | * @param maName The identifier of the Maintenance Association |
| 81 | * @return true if deleted |
| 82 | * @throws CfmConfigException If there were any Meps dependent on the MD or its MAs |
| 83 | * @throws IllegalArgumentException if MD is not found |
| 84 | */ |
| 85 | boolean deleteMaintenanceAssociation(MdId mdName, MaIdShort maName) throws CfmConfigException; |
| 86 | |
| 87 | /** |
| 88 | * Create or replace a Maintenance Domain of a specific Maintenance Domain. |
| 89 | * @param mdName The identifier of the Maintenance Domain |
| 90 | * @param ma A Maintenance Association |
| 91 | * @return true if an MA of this name already existed in the MD |
| 92 | * @throws CfmConfigException If it is a replacement and there were any |
| 93 | * Meps dependent on the MD or its MAs |
| 94 | * @throws IllegalArgumentException if MD is not found |
| 95 | */ |
| 96 | boolean createMaintenanceAssociation(MdId mdName, MaintenanceAssociation ma) throws CfmConfigException; |
| 97 | } |