blob: 4198ee8a5755248dedd36cbab245410dbd3516de [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
2 * Copyright 2017-present 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
17package org.onosproject.l3vpn.netl3vpn;
18
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.driver.DriverService;
21import org.onosproject.yang.model.ModelObjectData;
22
23import java.util.LinkedList;
24import java.util.List;
25
26/**
27 * Representation of standard device model, with interface, instance and its
28 * respective device id.
29 */
30public class DeviceInfo {
31
32 /**
33 * Device id of the device.
34 */
35 private final DeviceId deviceId;
36
37 /**
38 * BGP information of the device.
39 */
40 private BgpInfo bgpInfo;
41
42 /**
43 * List of interface names of the device.
44 */
45 private List<String> ifNames;
46
47 /**
48 * List of network access of the device.
49 */
50 private List<AccessInfo> accesses;
51
52 /**
53 * Constructs device info with a device id.
54 *
55 * @param d device id
56 */
57 public DeviceInfo(DeviceId d) {
58 deviceId = d;
59 }
60
61 /**
62 * Returns the device id.
63 *
64 * @return device id
65 */
janani b35f6cbc2017-03-24 21:56:58 +053066 public DeviceId deviceId() {
janani bf41dec32017-03-24 18:44:07 +053067 return deviceId;
68 }
69
70 /**
71 * Adds a interface name to the list.
72 *
73 * @param ifName interface name
74 */
janani b35f6cbc2017-03-24 21:56:58 +053075 public void addIfName(String ifName) {
janani bf41dec32017-03-24 18:44:07 +053076 if (ifNames == null) {
77 ifNames = new LinkedList<>();
78 }
79 ifNames.add(ifName);
80 }
81
82 /**
83 * Returns the list of interface name.
84 *
85 * @return interface names
86 */
janani b35f6cbc2017-03-24 21:56:58 +053087 public List<String> ifNames() {
janani bf41dec32017-03-24 18:44:07 +053088 return ifNames;
89 }
90
91 /**
92 * Sets the list of interface name.
93 *
94 * @param ifNames interface names
95 */
janani b35f6cbc2017-03-24 21:56:58 +053096 public void ifNames(List<String> ifNames) {
janani bf41dec32017-03-24 18:44:07 +053097 this.ifNames = ifNames;
98 }
99
100 /**
101 * Returns the BGP information.
102 *
103 * @return BGP info
104 */
janani b35f6cbc2017-03-24 21:56:58 +0530105 public BgpInfo bgpInfo() {
janani bf41dec32017-03-24 18:44:07 +0530106 return bgpInfo;
107 }
108
109 /**
110 * Sets the BGP information.
111 *
112 * @param bgpInfo BGP info
113 */
janani b35f6cbc2017-03-24 21:56:58 +0530114 public void bgpInfo(BgpInfo bgpInfo) {
janani bf41dec32017-03-24 18:44:07 +0530115 this.bgpInfo = bgpInfo;
116 }
117
118 /**
119 * Returns the list of network accesses.
120 *
121 * @return network accesses
122 */
janani b35f6cbc2017-03-24 21:56:58 +0530123 public List<AccessInfo> accesses() {
janani bf41dec32017-03-24 18:44:07 +0530124 return accesses;
125 }
126
127 /**
128 * Sets the list of network accesses.
129 *
130 * @param accesses network accesses
131 */
janani b35f6cbc2017-03-24 21:56:58 +0530132 public void accesses(List<AccessInfo> accesses) {
janani bf41dec32017-03-24 18:44:07 +0530133 this.accesses = accesses;
134 }
135
136 /**
137 * Adds a access info to the network accesses list.
138 *
139 * @param accessInfo access info
140 */
janani b35f6cbc2017-03-24 21:56:58 +0530141 public void addAccessInfo(AccessInfo accessInfo) {
janani bf41dec32017-03-24 18:44:07 +0530142 if (accesses == null) {
143 accesses = new LinkedList<>();
144 }
145 accesses.add(accessInfo);
146 }
147
148 /**
149 * Processes the creation of VPN instance to the driver with the model
150 * object data of standard device model. It returns the VPN instance of
151 * driver constructed model object data.
152 *
153 * @param driverSvc driver service
154 * @param modelData std device model object data
155 * @return driver instance model object data
156 */
janani b35f6cbc2017-03-24 21:56:58 +0530157 public ModelObjectData processCreateInstance(DriverService driverSvc,
158 ModelObjectData modelData) {
janani bf41dec32017-03-24 18:44:07 +0530159 // TODO: Need to call the behaviour.
160 return null;
161 }
162
163 /**
164 * Processes the creation of interface to the driver with the model
165 * object data of standard device model. It returns the interface of driver
166 * constructed model object data.
167 *
168 * @param driverSvc driver service
169 * @param modData std device model object data
170 * @return driver interface model object data
171 */
janani b35f6cbc2017-03-24 21:56:58 +0530172 public ModelObjectData processCreateInterface(DriverService driverSvc,
173 ModelObjectData modData) {
janani bf41dec32017-03-24 18:44:07 +0530174 // TODO: Need to call the behaviour.
175 return null;
176 }
177
178 /**
179 * Processes the creation of BGP info to the driver with the BGP info and
180 * the BGP driver configuration. It returns the BGP info of driver
181 * constructed model object data.
182 *
183 * @param driverSvc driver service
184 * @param bgpInfo BGP info
185 * @param driverInfo driver config details
186 * @return driver BGP model object data
187 */
janani b35f6cbc2017-03-24 21:56:58 +0530188 public ModelObjectData processCreateBgpInfo(DriverService driverSvc,
189 BgpInfo bgpInfo,
190 BgpDriverInfo driverInfo) {
janani bf41dec32017-03-24 18:44:07 +0530191 // TODO: Need to call the behaviour.
192 return null;
193 }
194
195 /**
196 * Processes the deletion of VPN instance to the driver with the model
197 * object data of standard device model. It returns the VPN instance of
198 * driver constructed model object data.
199 *
200 * @param driverSvc driver service
201 * @param modData model object data
202 * @return driver instance model object data
203 */
janani b35f6cbc2017-03-24 21:56:58 +0530204 public ModelObjectData processDeleteInstance(DriverService driverSvc,
janani bf41dec32017-03-24 18:44:07 +0530205 ModelObjectData modData) {
206 // TODO: Need to call the behaviour.
207 return null;
208 }
209
210 /**
211 * Processes the deletion of interface to the driver with the model
212 * object data of standard device model. It returns the interface of driver
213 * constructed model object data.
214 *
215 * @param driverSvc driver service
216 * @param objectData model object data
217 * @return driver interface model object data
218 */
janani b35f6cbc2017-03-24 21:56:58 +0530219 public ModelObjectData processDeleteInterface(DriverService driverSvc,
janani bf41dec32017-03-24 18:44:07 +0530220 ModelObjectData objectData) {
221 // TODO: Need to call the behaviour.
222 return null;
223 }
224
225 /**
226 * Processes the deletion of BGP info to the driver with the BGP info and
227 * the BGP driver configuration. It returns the BGP info of driver
228 * constructed model object data.
229 *
230 * @param driverSvc driver service
231 * @param bgpInfo BGP info
232 * @param driverInfo driver config details
233 * @return driver BGP model object data
234 */
janani b35f6cbc2017-03-24 21:56:58 +0530235 public ModelObjectData processDeleteBgpInfo(DriverService driverSvc,
janani bf41dec32017-03-24 18:44:07 +0530236 BgpInfo bgpInfo,
237 BgpDriverInfo driverInfo) {
238 // TODO: Need to call the behaviour.
239 return null;
240 }
241}