blob: 4cfbc9285da8e9e6e643bd953e840c8b52993679 [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 counter in protocol-independent pipeline.
23 */
24@Beta
25public interface PiCounterModel {
26
27 /**
28 * Counter unit.
29 */
30 enum Unit {
31 /**
32 * Counts only bytes.
33 */
34 BYTES,
35 /**
36 * Counts only packets.
37 */
38 PACKETS,
39 /**
40 * Counts both packets and bytes.
41 */
42 PACKETS_AND_BYTES
43 }
44
45 /**
46 * Returns the ID of this counter.
47 *
48 * @return counter ID
49 */
50 PiCounterId id();
51
52 /**
53 * Returns the type of counter.
54 *
55 * @return counter type
56 */
57 PiCounterType counterType();
58
59 /**
60 * Returns the unit of this counter.
61 *
62 * @return counter unit
63 */
64 Unit unit();
65
66 /**
67 * Returns the table ID associated with this counter. Meaningful only if the counter type is {@link
68 * PiCounterType#DIRECT}.
69 *
70 * @return table model
71 */
72 PiTableId table();
73
74 /**
75 * Returns the number of cells of this counter. Meaningful only if the counter type is {@link
76 * PiCounterType#INDIRECT}.
77 *
78 * @return size
79 */
80 long size();
81}