blob: 3c308d6f6459955eac797ab94463f2416893d422 [file] [log] [blame]
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +02001/*
2 * Copyright 2019-present Open Networking Foundation
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.drivers.gnoi;
18
19import org.onlab.packet.ChassisId;
20import org.onosproject.net.AnnotationKeys;
21import org.onosproject.net.DefaultAnnotations;
22import org.onosproject.net.Device;
23import org.onosproject.net.device.DefaultDeviceDescription;
24import org.onosproject.net.device.DeviceDescription;
25import org.onosproject.net.device.DeviceDescriptionDiscovery;
26import org.onosproject.net.device.PortDescription;
27
28import java.util.Collections;
29import java.util.List;
30
31/**
32 * Implementation of DeviceDescriptionDiscovery for gNOI devices.
33 */
34public class GnoiDeviceDescriptionDiscovery
35 extends AbstractGnoiHandlerBehaviour implements DeviceDescriptionDiscovery {
36
37 private static final String UNKNOWN = "unknown";
38
39 @Override
40 public DeviceDescription discoverDeviceDetails() {
41
42 return new DefaultDeviceDescription(
43 data().deviceId().uri(),
44 Device.Type.SWITCH,
45 data().driver().manufacturer(),
46 data().driver().hwVersion(),
47 data().driver().swVersion(),
48 UNKNOWN,
49 new ChassisId(),
50 false,
51 DefaultAnnotations.builder()
52 .set(AnnotationKeys.PROTOCOL, "gNOI")
53 .build());
54 }
55
56
57 @Override
58 public List<PortDescription> discoverPortDetails() {
59 return Collections.emptyList();
60 }
61}