blob: 237da05f0cd1508bb9edfb23560f31c852bdbc72 [file] [log] [blame]
Carmelo Cascone87892e22017-11-13 16:01:29 -08001/*
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
17package org.onosproject.net.pi.model;
18
19import com.google.common.annotations.Beta;
20
21/**
22 * Model of a meter in a protocol-independent pipeline.
23 */
24@Beta
25public interface PiMeterModel {
26
27 /**
28 * Meter rate unit.
29 */
30 enum Unit {
31 /**
32 * Measures rate of bytes.
33 */
34 BYTES,
35 /**
36 * Measures rate of packets.
37 */
38 PACKETS
39 }
40
41 /**
42 * Returns the ID of this meter.
43 *
44 * @return meter ID
45 */
46 PiMeterId id();
47
48 /**
49 * Returns the type of this meter.
50 *
51 * @return meter type
52 */
53 PiMeterType meterType();
54
55 /**
56 * Returns the unit of this meter.
57 *
58 * @return unit
59 */
60 Unit unit();
61
62 /**
63 * Returns the table model associated with this meter. Meaningful only if the meter type is {@link
64 * PiMeterType#DIRECT}.
65 *
66 * @return table model
67 */
68 PiTableId table();
69
70 /**
71 * Returns the number of cells of this meter. Meaningful only if the meter type is {@link PiMeterType#INDIRECT}.
72 *
73 * @return size
74 */
75 long size();
76}