blob: fc858fcc3d1ee1955a8c4886a0c89d72872aebaf [file] [log] [blame]
Kyuhwi Choi5d7c9982016-01-20 13:55:55 +09001/*
2 * Copyright 2016 Open Networking Laboratory
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.openstackrouting;
17
18/**
19 * An Openstack Neutron Router Model.
20 */
21public final class OpenstackRouter {
22
23 public enum RouterStatus {
24 UP,
25 DOWN,
26 ACTIVE,
27 }
28
29 private String tenantId;
30 private String id;
31 private String name;
32 private RouterStatus status;
33 private boolean adminStateUp;
34 private OpenstackExternalGateway gatewayExternalInfo;
35
36 private OpenstackRouter(String id, String tenantId, String name, RouterStatus status,
37 boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) {
38 this.id = id;
39 this.tenantId = tenantId;
40 this.name = name;
41 this.status = status;
42 this.adminStateUp = adminStateUp;
43 this.gatewayExternalInfo = gatewayExternalInfo;
44
45 }
46
Daniel Park3a06c522016-01-28 20:51:12 +090047 public static OpenstackRouter.Builder builder() {
48 return new Builder();
49 }
50
Kyuhwi Choi5d7c9982016-01-20 13:55:55 +090051 /**
52 * Returns tenant ID.
53 *
54 * @return tenant ID
55 */
56 public String tenantId() {
57 return tenantId;
58 }
59
60 /**
61 * Returns router ID.
62 *
63 * @return router ID
64 */
65 public String id() {
66 return id;
67 }
68
69 /**
70 * Returns router name.
71 *
72 * @return router name
73 */
74 public String name() {
75 return name;
76 }
77
78 /**
79 * Returns router status.
80 *
81 * @return router stauts
82 */
83 public RouterStatus status() {
84 return status;
85 }
86
87 /**
88 * Returns whether admin state up or not.
89 *
90 * @return true if admin state up, false otherwise
91 */
92 public boolean adminStateUp() {
93 return adminStateUp;
94 }
95
96 /**
97 * Returns external gateway information.
98 *
99 * @return external gateway information
100 */
101 public OpenstackExternalGateway gatewayExternalInfo() {
102 return gatewayExternalInfo;
103 }
104
105 /**
106 * An Openstack Router Builder class.
107 */
108 public static final class Builder {
109
110 private String tenantId;
111 private String id;
112 private String name;
113 private RouterStatus status;
114 private Boolean adminStateUp;
115 private OpenstackExternalGateway gatewayExternalInfo;
116
117 /**
118 * Sets router ID.
119 *
120 * @param id router ID
121 * @return Builder object
122 */
123 public Builder id(String id) {
124 this.id = id;
125 return this;
126 }
127
128 /**
129 * Sets router name.
130 *
131 * @param name router name
132 * @return Builder object
133 */
134 public Builder name(String name) {
135 this.name = name;
136 return this;
137 }
138
139 /**
140 * Sets router status.
141 *
142 * @param status router status
143 * @return Builder object
144 */
145 public Builder status(RouterStatus status) {
146 this.status = status;
147 return this;
148 }
149
150 /**
151 * Sets tenant ID.
152 *
153 * @param tenantId Tenant ID
154 * @return Builder object
155 */
156 public Builder tenantId(String tenantId) {
157 this.tenantId = tenantId;
158 return this;
159 }
160
161 /**
162 * Sets whether admin state up or not.
163 *
164 * @param adminStateUp true if admin state is up, false otherwise
165 * @return Builder object
166 */
167 public Builder adminStateUp(boolean adminStateUp) {
168 this.adminStateUp = adminStateUp;
169 return this;
170 }
171
172 /**
173 * Sets external gateway information.
174 *
175 * @param gatewayExternalInfo external gateway information
176 * @return Builder object
177 */
178 public Builder gatewayExternalInfo(OpenstackExternalGateway gatewayExternalInfo) {
179 this.gatewayExternalInfo = gatewayExternalInfo;
180 return this;
181 }
182
183 /**
184 * Builds an OpenstackRouter object.
185 *
186 * @return OpenstasckRouter object
187 */
188 public OpenstackRouter build() {
189 return new OpenstackRouter(id, tenantId, name, status,
190 adminStateUp, gatewayExternalInfo);
191 }
192 }
193
194
195}