blob: dc7c026395db708633570f55bec04346469fe535 [file] [log] [blame]
sanghoshin94872a12015-10-16 18:04:34 +09001/*
2 * Copyright 2015 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.openstackswitching;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20
21/**
22 * Represents the network information given by Neutron.
23 */
24public final class OpenstackNetwork {
25
26 private String name;
27 private String tenantId;
28 private String segmentId;
29 private String networkType;
30 private String id;
31
32 /**
33 * Returns the builder object of the OpenstackNetwork class.
34 *
35 * @return OpenstackNetwork builder object
36 */
37 public static OpenstackNetwork.Builder builder() {
38 return new Builder();
39 }
40
41 private OpenstackNetwork(String name, String tenantId, String id, String sid,
42 String type) {
43 this.name = checkNotNull(name);
44 this.tenantId = checkNotNull(tenantId);
45 this.segmentId = checkNotNull(sid);
46 this.id = checkNotNull(id);
47 this.networkType = checkNotNull(type);
48 }
49
50 public String name() {
51 return this.name;
52 }
53
54 public String tenantId() {
55 return this.tenantId;
56 }
57
58 public String id() {
59 return this.id;
60 }
61
62 public String segmentId() {
63 return this.segmentId;
64 }
65
66 public String networkType() {
67 return this.networkType;
68 }
69
70 public static final class Builder {
71 private String name;
72 private String tenantId;
73 private String id;
74 private String sid;
75 private String networkType;
76
77 public Builder name(String name) {
78 this.name = name;
79
80 return this;
81 }
82
83 public Builder tenantId(String tenantId) {
84 this.tenantId = tenantId;
85
86 return this;
87 }
88
89 public Builder id(String id) {
90 this.id = id;
91
92 return this;
93 }
94
95 public Builder segmentId(String sid) {
96 this.sid = sid;
97
98 return this;
99 }
100
101 public Builder networkType(String type) {
102 this.networkType = type;
103
104 return this;
105 }
106
107 public OpenstackNetwork build() {
108 return new OpenstackNetwork(name, tenantId, id, sid, networkType);
109 }
110
111 }
112}