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