Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 16 | |
| 17 | package org.onosproject.olt; |
| 18 | |
| 19 | import org.onlab.packet.VlanId; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.PortNumber; |
| 22 | |
| 23 | import static com.google.common.base.Preconditions.checkNotNull; |
| 24 | |
| 25 | /** |
| 26 | * Information about an access device. |
| 27 | */ |
| 28 | public class AccessDeviceData { |
| 29 | private static final String DEVICE_ID_MISSING = "Device ID cannot be null"; |
| 30 | private static final String UPLINK_MISSING = "Uplink cannot be null"; |
| 31 | private static final String VLAN_MISSING = "VLAN ID cannot be null"; |
| 32 | |
| 33 | private final DeviceId deviceId; |
| 34 | private final PortNumber uplink; |
| 35 | private final VlanId vlan; |
| 36 | |
| 37 | /** |
| 38 | * Class constructor. |
| 39 | * |
| 40 | * @param deviceId access device ID |
| 41 | * @param uplink uplink port number |
| 42 | * @param vlan device VLAN ID |
| 43 | */ |
| 44 | public AccessDeviceData(DeviceId deviceId, PortNumber uplink, VlanId vlan) { |
| 45 | this.deviceId = checkNotNull(deviceId, DEVICE_ID_MISSING); |
| 46 | this.uplink = checkNotNull(uplink, UPLINK_MISSING); |
| 47 | this.vlan = checkNotNull(vlan, VLAN_MISSING); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Retrieves the access device ID. |
| 52 | * |
| 53 | * @return device ID |
| 54 | */ |
| 55 | public DeviceId deviceId() { |
| 56 | return deviceId; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Retrieves the uplink port number. |
| 61 | * |
| 62 | * @return port number |
| 63 | */ |
| 64 | public PortNumber uplink() { |
| 65 | return uplink; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Retrieves the VLAN ID assigned to the device. |
| 70 | * |
| 71 | * @return vlan ID |
| 72 | */ |
| 73 | public VlanId vlan() { |
| 74 | return vlan; |
| 75 | } |
| 76 | } |