blob: 26a39331a4eaf9edc7e98415f4fc39a2be814eec [file] [log] [blame]
Sean Condon0e89bda2017-03-21 14:23:19 +00001/*
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 */
16package org.onosproject.incubator.net.l2monitoring.cfm.service;
17
18import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain;
19import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
20import org.onosproject.store.Store;
21
22import java.util.Collection;
23import java.util.Optional;
24
25/**
26 * {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain Maintenance Domain's} storage interface.
27 * Note: because the MaintenanceDomain is immutable if anything needs to be
28 * changed in it, then it must be replaced in the store. This includes adding
29 * and deleting Maintenance Associations from an MD.
30 */
31public interface MdStore extends Store<MdEvent, MdStoreDelegate> {
32 /**
33 * Get a list of all of the Maintenance Domains on the system.
34 * @return A collection Maintenance domains from the MD Store.
35 */
36 Collection<MaintenanceDomain> getAllMaintenanceDomain();
37
38 /**
39 * Get a specific Maintenance Domain by its identifier.
40 * @param mdName An identifier for the Maintenance Domain
41 * @return A Maintenance Domain from the MD Store. Empty if not found.
42 */
43 Optional<MaintenanceDomain> getMaintenanceDomain(MdId mdName);
44
45 /**
46 * Delete a specific Maintenance Domain by its identifier.
47 * @param mdName An identifier for the Maintenance Domain to be deleted
48 * @return True if the MD was found and deleted
49 */
50 boolean deleteMaintenanceDomain(MdId mdName);
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 */
57 boolean createUpdateMaintenanceDomain(MaintenanceDomain md);
58}