blob: 170930f70ff41dc095f19bf525ec1ffe9400829d [file] [log] [blame]
Yuta HIGUCHI69ef9dd2017-03-10 16:01:11 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Yuta HIGUCHI69ef9dd2017-03-10 16:01:11 -08003 *
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 */
16package org.onosproject.driver.optical.config;
17
18import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription;
19
20import java.util.List;
21import java.util.stream.Collectors;
22import java.util.stream.LongStream;
23
24import org.onlab.packet.ChassisId;
25import org.onlab.util.Frequency;
26import org.onlab.util.Spectrum;
27import org.onosproject.net.Device.Type;
28import org.onosproject.net.DefaultAnnotations;
29import org.onosproject.net.PortNumber;
30import org.onosproject.net.SparseAnnotations;
31import org.onosproject.net.device.DefaultDeviceDescription;
32import org.onosproject.net.device.DeviceDescription;
33import org.onosproject.net.device.DeviceDescriptionDiscovery;
34import org.onosproject.net.device.PortDescription;
35import org.onosproject.net.driver.AbstractHandlerBehaviour;
36
37/**
38 * DeviceDescriptionDiscovery for Polatis.
39 */
40public class PolatisDeviceDiscovery
41 extends AbstractHandlerBehaviour
42 implements DeviceDescriptionDiscovery {
43
44
45 @Override
46 public DeviceDescription discoverDeviceDetails() {
47 Type type = Type.FIBER_SWITCH;
48 String manufacturer = "Polatis";
49 String hwVersion = "N-VST-48x48-HU1-DMHNV-805";
50 String swVersion = "6.6.1.7";
51 String serialNumber = "1503";
52 ChassisId chassis = new ChassisId();
53 boolean defaultAvailable = true;
54 SparseAnnotations annotations = DefaultAnnotations.builder().build();
55 return new DefaultDeviceDescription(this.data().deviceId().uri(),
56 type,
57 manufacturer,
58 hwVersion,
59 swVersion,
60 serialNumber,
61 chassis,
62 defaultAvailable,
63 annotations);
64 }
65
66 @Override
67 public List<PortDescription> discoverPortDetails() {
68 SparseAnnotations ingress = DefaultAnnotations.builder()
69 .set("port-type", "INGRESS_PORT")
70 .build();
71 SparseAnnotations egress = DefaultAnnotations.builder()
72 .set("port-type", "EGRESS_PORT")
73 .build();
74 return LongStream.rangeClosed(1, 96)
75 .mapToObj(n -> omsPortDescription(PortNumber.portNumber(n),
76 true,
77 Spectrum.U_BAND_MIN,
78 Spectrum.O_BAND_MAX,
79 Frequency.ofGHz(100),
80 (n <= 48) ? ingress : egress)
81 )
82 .collect(Collectors.toList());
83 }
84
85}