blob: d2d51b217fefee94dc90dca988431765af06def8 [file] [log] [blame]
Gamze Abaka1b7816e2019-11-25 06:38:41 +00001/*
2 * Copyright 2016-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.opencord.olt.internalapi;
17
18import com.google.common.collect.ImmutableMap;
19import com.google.common.collect.ImmutableSet;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.meter.MeterId;
22import org.onosproject.net.meter.MeterKey;
23import org.opencord.sadis.BandwidthProfileInformation;
24
25import java.util.Set;
26import java.util.concurrent.CompletableFuture;
27
28/**
29 * Olt service for meter operations.
30 */
31public interface AccessDeviceMeterService {
32
33 /**
34 * Returns information about bandwidthProfile-meterKey (device / meter) mappings
35 * that have been programmed in the data-plane.
36 *
37 * @return an immutable map of bandwidthProfile-meterKey (device / meter) mappings
38 */
39 ImmutableMap<String, Set<MeterKey>> getBpMeterMappings();
40
41 /**
42 * Adds a bandwidthProfile-meterKey (device / meter) mapping that have been programmed
43 * in the data plane.
44 *
45 * @param deviceId the access device id
46 * @param meterId the meter id that is mapped to the bandwidth profile
47 * @param bandwidthProfile the bandwidth profile id
48 */
49 void addMeterIdToBpMapping(DeviceId deviceId, MeterId meterId, String bandwidthProfile);
50
51 /**
52 * Returns the meter id for a given bandwidth profile.
53 *
54 * @param deviceId the access device id
55 * @param bandwidthProfile the bandwidth profile id
56 * @return the meter id
57 */
58 MeterId getMeterIdFromBpMapping(DeviceId deviceId, String bandwidthProfile);
59
60 /**
61 * Returns information about device-meter relations that have been programmed in the
62 * data-plane.
63 *
64 * @return an immutable set of device-meter mappings
65 */
66 ImmutableSet<MeterKey> getProgMeters();
67
68 /**
69 * Creates a meter and sends it to the device.
70 *
71 * @param deviceId the access device id
72 * @param bpInfo the bandwidth profile information
73 * @param meterFuture the meter future to indicate whether the meter creation is
74 * successful or not.
75 * @return meter id that is generated for the given parameters
76 */
77 MeterId createMeter(DeviceId deviceId, BandwidthProfileInformation bpInfo,
78 CompletableFuture<Object> meterFuture);
79
80
81}