Kyuhwi Choi | 5d7c998 | 2016-01-20 13:55:55 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.openstackrouting; |
| 17 | |
| 18 | /** |
| 19 | * An Openstack Neutron Router Interface Model. |
| 20 | */ |
| 21 | public final class OpenstackRouterInterface { |
| 22 | private String id; |
| 23 | private String tenantId; |
| 24 | private String subnetId; |
| 25 | private String portId; |
| 26 | |
| 27 | private OpenstackRouterInterface(String id, String tenantId, |
| 28 | String subnetId, String portId) { |
| 29 | this.id = id; |
| 30 | this.tenantId = tenantId; |
| 31 | this.subnetId = subnetId; |
| 32 | this.portId = portId; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Returns Router Interface ID. |
| 37 | * |
| 38 | * @return router interface ID |
| 39 | */ |
| 40 | public String id() { |
| 41 | return id; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Returns tenant ID. |
| 46 | * |
| 47 | * @return tenant ID |
| 48 | */ |
| 49 | public String tenantId() { |
| 50 | return tenantId; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Returns subnet ID. |
| 55 | * |
| 56 | * @return subnet ID |
| 57 | */ |
| 58 | public String subnetId() { |
| 59 | return subnetId; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Returns port ID. |
| 64 | * |
| 65 | * @return port ID |
| 66 | */ |
| 67 | public String portId() { |
| 68 | return portId; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * An Openstack Router Interface Builder class. |
| 73 | */ |
| 74 | public static final class Builder { |
| 75 | private String id; |
| 76 | private String tenantId; |
| 77 | private String subnetId; |
| 78 | private String portId; |
| 79 | |
| 80 | /** |
| 81 | * Sets Router Interface ID. |
| 82 | * |
| 83 | * @param id router interface ID |
| 84 | * @return Builder object |
| 85 | */ |
| 86 | public Builder id(String id) { |
| 87 | this.id = id; |
| 88 | return this; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Sets tenant ID. |
| 93 | * |
| 94 | * @param tenantId tenant ID |
| 95 | * @return Builder object |
| 96 | */ |
| 97 | public Builder tenantId(String tenantId) { |
| 98 | this.tenantId = tenantId; |
| 99 | return this; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Sets subnet ID. |
| 104 | * |
| 105 | * @param subnetId subnet ID |
| 106 | * @return Builder object |
| 107 | */ |
| 108 | public Builder subnetId(String subnetId) { |
| 109 | this.subnetId = subnetId; |
| 110 | return this; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Sets port ID. |
| 115 | * |
| 116 | * @param portId port ID |
| 117 | * @return Builder object |
| 118 | */ |
| 119 | public Builder portId(String portId) { |
| 120 | this.portId = portId; |
| 121 | return this; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | /** |
| 126 | * Builds an Openstack Router Interface object. |
| 127 | * |
| 128 | * @return OpenstackRouterInterface object |
| 129 | */ |
| 130 | public OpenstackRouterInterface build() { |
| 131 | return new OpenstackRouterInterface(id, tenantId, subnetId, portId); |
| 132 | } |
| 133 | |
| 134 | } |
| 135 | } |