blob: 90ed74030555f245e1e3fe56c47f4e618ae587f6 [file] [log] [blame]
Jonathan Hart3e594642015-10-20 17:31:24 -07001/*
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
17package org.onosproject.olt;
18
19import org.onlab.packet.VlanId;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.PortNumber;
22import org.onosproject.net.config.Config;
23
24/**
25 * Config object for access device data.
26 */
27public class AccessDeviceConfig extends Config<DeviceId> {
28
29 private static final String UPLINK = "uplink";
30 private static final String VLAN = "vlan";
31
32 /**
33 * Gets the access device configuration for this device.
34 *
35 * @return access device configuration
36 */
37 public AccessDeviceData getOlt() {
38 PortNumber uplink = PortNumber.portNumber(node.path(UPLINK).asText());
39 VlanId vlan = VlanId.vlanId(Short.parseShort(node.path(VLAN).asText()));
40
41 return new AccessDeviceData(subject(), uplink, vlan);
42 }
43}