2 * Copyright 2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.openstackswitching;
18 import static com.google.common.base.Preconditions.checkNotNull;
22 * Represents the network information given by Neutron.
24 public final class OpenstackNetwork {
27 private String tenantId;
28 private String segmentId;
30 private NetworkType networkType;
32 public enum NetworkType {
34 * Currently only VXLAN moded is supported.
43 * Returns the builder object of the OpenstackNetwork class.
45 * @return OpenstackNetwork builder object
47 public static OpenstackNetwork.Builder builder() {
51 private OpenstackNetwork(String name, String tenantId, String id, String sid,
53 this.name = checkNotNull(name);
54 this.tenantId = checkNotNull(tenantId);
55 this.segmentId = checkNotNull(sid);
56 this.id = checkNotNull(id);
57 this.networkType = type;
60 public String name() {
64 public String tenantId() {
72 public String segmentId() {
73 return this.segmentId;
76 public NetworkType networkType() {
77 return this.networkType;
80 public static final class Builder {
82 private String tenantId;
85 private NetworkType networkType;
87 public Builder name(String name) {
93 public Builder tenantId(String tenantId) {
94 this.tenantId = tenantId;
99 public Builder id(String id) {
105 public Builder segmentId(String sid) {
111 public Builder networkType(NetworkType type) {
112 this.networkType = type;
117 public OpenstackNetwork build() {
118 return new OpenstackNetwork(name, tenantId, id, sid, networkType);