blob: bdcfd1dea9146808e02b272b46886c0d21a623cd [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 /**
70 * Get the load on the given port pair id.
71 *
72 * @param portPairId port pair id
73 * @return load on the given port pair id.
74 */
Phaneendra Manda0c423422016-04-19 00:31:53 +053075 int getLoad(PortPairId portPairId);
76
77 /**
78 * Get the map of port pair id and its load.
79 *
80 * @return port pair and load map
81 */
82 Map<PortPairId, Integer> portPairLoadMap();
Phaneendra Manda329a1272016-02-10 22:57:00 +053083
84 /**
Phaneendra Manda3e128832015-10-26 22:13:38 +053085 * Returns whether this port pair group is an exact match to the
86 * port pair group given in the argument.
87 * <p>
88 * Exact match means the Port pairs match with the given port pair group.
89 * It does not consider the port pair group id, name and description.
90 * </p>
91 * @param portPairGroup other port pair group to match against
92 * @return true if the port pairs are an exact match, otherwise false
93 */
94 boolean exactMatch(PortPairGroup portPairGroup);
95
96 /**
97 * A port pair group builder..
98 */
99 interface Builder {
100
101 /**
102 * Assigns the port pair group id to this object.
103 *
104 * @param portPairGroupId the port pair group id
105 * @return this the builder object
106 */
107 Builder setId(PortPairGroupId portPairGroupId);
108
109 /**
110 * Assigns tenant id to this object.
111 *
112 * @param tenantId tenant id of port pair group
113 * @return this the builder object
114 */
115 Builder setTenantId(TenantId tenantId);
116
117 /**
118 * Assigns the name to this object.
119 *
120 * @param name name of the port pair group
121 * @return this the builder object
122 */
123 Builder setName(String name);
124
125 /**
126 * Assigns the description to this object.
127 *
128 * @param description description of the port pair group
129 * @return this the builder object
130 */
131 Builder setDescription(String description);
132
133 /**
134 * Assigns the port pairs associated with the port pair group
135 * to this object.
136 *
137 * @param portPairs list of port pairs
138 * @return this the builder object
139 */
140 Builder setPortPairs(List<PortPairId> portPairs);
141
142 /**
143 * Builds a port pair group object.
144 *
145 * @return a port pair group object.
146 */
147 PortPairGroup build();
148 }
149}