janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.l3vpn.netl3vpn; |
| 18 | |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.driver.DriverService; |
| 21 | import org.onosproject.yang.model.ModelObjectData; |
| 22 | |
| 23 | import java.util.LinkedList; |
| 24 | import java.util.List; |
| 25 | |
| 26 | /** |
| 27 | * Representation of standard device model, with interface, instance and its |
| 28 | * respective device id. |
| 29 | */ |
| 30 | public 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 66 | public DeviceId deviceId() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 67 | return deviceId; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Adds a interface name to the list. |
| 72 | * |
| 73 | * @param ifName interface name |
| 74 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 75 | public void addIfName(String ifName) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 76 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 87 | public List<String> ifNames() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 88 | return ifNames; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Sets the list of interface name. |
| 93 | * |
| 94 | * @param ifNames interface names |
| 95 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 96 | public void ifNames(List<String> ifNames) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 97 | this.ifNames = ifNames; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Returns the BGP information. |
| 102 | * |
| 103 | * @return BGP info |
| 104 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 105 | public BgpInfo bgpInfo() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 106 | return bgpInfo; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Sets the BGP information. |
| 111 | * |
| 112 | * @param bgpInfo BGP info |
| 113 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 114 | public void bgpInfo(BgpInfo bgpInfo) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 115 | this.bgpInfo = bgpInfo; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Returns the list of network accesses. |
| 120 | * |
| 121 | * @return network accesses |
| 122 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 123 | public List<AccessInfo> accesses() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 124 | return accesses; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Sets the list of network accesses. |
| 129 | * |
| 130 | * @param accesses network accesses |
| 131 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 132 | public void accesses(List<AccessInfo> accesses) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 133 | this.accesses = accesses; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Adds a access info to the network accesses list. |
| 138 | * |
| 139 | * @param accessInfo access info |
| 140 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 141 | public void addAccessInfo(AccessInfo accessInfo) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 142 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 157 | public ModelObjectData processCreateInstance(DriverService driverSvc, |
| 158 | ModelObjectData modelData) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 159 | // 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 172 | public ModelObjectData processCreateInterface(DriverService driverSvc, |
| 173 | ModelObjectData modData) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 174 | // 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 188 | public ModelObjectData processCreateBgpInfo(DriverService driverSvc, |
| 189 | BgpInfo bgpInfo, |
| 190 | BgpDriverInfo driverInfo) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 191 | // 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 204 | public ModelObjectData processDeleteInstance(DriverService driverSvc, |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 205 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 219 | public ModelObjectData processDeleteInterface(DriverService driverSvc, |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 220 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame^] | 235 | public ModelObjectData processDeleteBgpInfo(DriverService driverSvc, |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 236 | BgpInfo bgpInfo, |
| 237 | BgpDriverInfo driverInfo) { |
| 238 | // TODO: Need to call the behaviour. |
| 239 | return null; |
| 240 | } |
| 241 | } |