blob: 5c99306c11fd589a63c1e3f9481912efc83ea084 [file] [log] [blame]
Jian Li1c10cf22021-03-05 01:32:04 +09001/*
2 * Copyright 2021-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.onosproject.kubevirtnetworking.api;
17
18import org.onlab.packet.IpPrefix;
19
20/**
21 * Representation of security group rule.
22 */
23public interface KubevirtSecurityGroupRule {
24
25 /**
26 * Returns the security group rule identifier.
27 *
28 * @return security group rule identifier
29 */
30 String id();
31
32 /**
33 * Returns the security group identifier.
34 *
35 * @return security group identifier
36 */
37 String securityGroupId();
38
39 /**
40 * Returns the traffic direction.
41 *
42 * @return traffic direction
43 */
44 String direction();
45
46 /**
47 * Returns the ethernet type.
48 *
49 * @return ethernet type
50 */
51 String etherType();
52
53 /**
54 * Returns the maximum port range.
55 *
56 * @return maximum port range
57 */
58 Integer portRangeMax();
59
60 /**
61 * Returns the minimum port range.
62 *
63 * @return minimum port range
64 */
65 Integer portRangeMin();
66
67 /**
68 * Returns the network protocol.
69 *
70 * @return network protocol
71 */
72 String protocol();
73
74 /**
75 * Returns the remote IP prefix.
76 *
77 * @return remote IP prefix
78 */
79 IpPrefix remoteIpPrefix();
80
81 /**
82 * Returns the remote group identifier.
83 *
84 * @return remote group identifier
85 */
86 String remoteGroupId();
87
88 /**
Jian Li8f944d42021-03-23 00:43:29 +090089 * Returns the security group rule with updated direction.
90 *
91 * @param direction direction
92 * @return updated security group
93 */
94 KubevirtSecurityGroupRule updateDirection(String direction);
95
96 /**
Jian Li1c10cf22021-03-05 01:32:04 +090097 * A default builder interface.
98 */
99 interface Builder {
100 /**
101 * Builds an immutable security group rule instance.
102 *
103 * @return kubevirt security group rule
104 */
105 KubevirtSecurityGroupRule build();
106
107 /**
108 * Returns kubevirt security group rule builder with supplied id.
109 *
110 * @param id security group rule id
111 * @return security group rule builder
112 */
113 Builder id(String id);
114
115 /**
116 * Returns kubevirt security group rule builder with supplied security group id.
117 *
118 * @param securityGroupId security group id
119 * @return security group rule builder
120 */
121 Builder securityGroupId(String securityGroupId);
122
123 /**
124 * Returns kubevirt security group rule builder with supplied direction.
125 *
126 * @param direction traffic direction
127 * @return security group rule builder
128 */
129 Builder direction(String direction);
130
131 /**
132 * Returns kubevirt security group rule builder with supplied etherType.
133 *
134 * @param etherType network etherType
135 * @return security group rule builder
136 */
137 Builder etherType(String etherType);
138
139 /**
140 * Returns kubevirt security group rule builder with supplied maximum port range.
141 *
142 * @param portRangeMax maximum port range
143 * @return security group rule builder
144 */
145 Builder portRangeMax(Integer portRangeMax);
146
147 /**
148 * Returns kubevirt security group rule builder with supplied minimum port range.
149 *
150 * @param portRangeMin minimum port range
151 * @return security group rule builder
152 */
153 Builder portRangeMin(Integer portRangeMin);
154
155 /**
156 * Returns kubevirt security group rule builder with supplied protocol.
157 *
158 * @param protocol network protocol
159 * @return security group rule builder
160 */
161 Builder protocol(String protocol);
162
163 /**
164 * Returns kubevirt security group rule builder with supplied remote IP prefix.
165 *
166 * @param remoteIpPrefix remote IP prefix
167 * @return security group rule builder
168 */
169 Builder remoteIpPrefix(IpPrefix remoteIpPrefix);
170
171 /**
172 * Returns kubevirt security group rule builder with supplied remote group id.
173 *
174 * @param remoteGroupId remote group id
175 * @return security group rule builder
176 */
177 Builder remoteGroupId(String remoteGroupId);
178 }
179}