blob: 0114470e5b79c1b94728a9f00fbd335e8e153667 [file] [log] [blame]
Phaneendra Manda3e128832015-10-26 22:13:38 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Phaneendra Manda3e128832015-10-26 22:13:38 +05303 *
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.vtnrsc;
17
18import java.util.List;
Phaneendra Manda0c423422016-04-19 00:31:53 +053019import java.util.Map;
Phaneendra Manda3e128832015-10-26 22:13:38 +053020
21/**
22 * Abstraction of an entity providing Port Pair Group information.
23 * A port pair group consists of one or more port pairs.
24 */
25public interface PortPairGroup {
26
27 /**
28 * Returns the ID of this port pair group.
29 *
30 * @return the port pair group id
31 */
32 PortPairGroupId portPairGroupId();
33
34 /**
35 * Returns the tenant id of this port pair group.
36 *
37 * @return the tenant id
38 */
39 TenantId tenantId();
40
41 /**
42 * Returns the name of this port pair group.
43 *
44 * @return name of port pair group
45 */
46 String name();
47
48 /**
49 * Returns the description of this port pair group.
50 *
51 * @return description of port pair group
52 */
53 String description();
54
55 /**
56 * Returns the list of port pairs associated with this port pair group.
57 *
58 * @return list of port pairs
59 */
60 List<PortPairId> portPairs();
61
62 /**
Phaneendra Manda329a1272016-02-10 22:57:00 +053063 * Adds the load on the given port pair id.
64 *
65 * @param portPairId port pair id.
66 */
Phaneendra Manda0c423422016-04-19 00:31:53 +053067 void addLoad(PortPairId portPairId);
Phaneendra Manda329a1272016-02-10 22:57:00 +053068
69 /**
Phaneendra Manda8db7d092016-06-04 00:17:24 +053070 * Reset the load for all the port pairs in the group.
71 */
72 void resetLoad();
73
74 /**
Phaneendra Manda329a1272016-02-10 22:57:00 +053075 * Get the load on the given port pair id.
76 *
77 * @param portPairId port pair id
78 * @return load on the given port pair id.
79 */
Phaneendra Manda0c423422016-04-19 00:31:53 +053080 int getLoad(PortPairId portPairId);
81
82 /**
83 * Get the map of port pair id and its load.
84 *
85 * @return port pair and load map
86 */
87 Map<PortPairId, Integer> portPairLoadMap();
Phaneendra Manda329a1272016-02-10 22:57:00 +053088
89 /**
Phaneendra Manda3e128832015-10-26 22:13:38 +053090 * Returns whether this port pair group is an exact match to the
91 * port pair group given in the argument.
92 * <p>
93 * Exact match means the Port pairs match with the given port pair group.
94 * It does not consider the port pair group id, name and description.
95 * </p>
96 * @param portPairGroup other port pair group to match against
97 * @return true if the port pairs are an exact match, otherwise false
98 */
99 boolean exactMatch(PortPairGroup portPairGroup);
100
101 /**
102 * A port pair group builder..
103 */
104 interface Builder {
105
106 /**
107 * Assigns the port pair group id to this object.
108 *
109 * @param portPairGroupId the port pair group id
110 * @return this the builder object
111 */
112 Builder setId(PortPairGroupId portPairGroupId);
113
114 /**
115 * Assigns tenant id to this object.
116 *
117 * @param tenantId tenant id of port pair group
118 * @return this the builder object
119 */
120 Builder setTenantId(TenantId tenantId);
121
122 /**
123 * Assigns the name to this object.
124 *
125 * @param name name of the port pair group
126 * @return this the builder object
127 */
128 Builder setName(String name);
129
130 /**
131 * Assigns the description to this object.
132 *
133 * @param description description of the port pair group
134 * @return this the builder object
135 */
136 Builder setDescription(String description);
137
138 /**
139 * Assigns the port pairs associated with the port pair group
140 * to this object.
141 *
142 * @param portPairs list of port pairs
143 * @return this the builder object
144 */
145 Builder setPortPairs(List<PortPairId> portPairs);
146
147 /**
148 * Builds a port pair group object.
149 *
150 * @return a port pair group object.
151 */
152 PortPairGroup build();
153 }
154}