2 * Copyright © 2020 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.transportpce.common.fixedflex;
11 import com.google.common.collect.HashBasedTable;
12 import com.google.common.collect.Table;
13 import java.math.BigDecimal;
15 import org.opendaylight.transportpce.common.ServiceRateConstant;
16 import org.opendaylight.transportpce.common.StringConstants;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
18 import org.opendaylight.yangtools.yang.common.Uint32;
21 * Constant class common to fixed grid and flex grid.
24 public final class GridConstant {
26 public static final String C_BAND = "cband";
27 public static final int AVAILABLE_SLOT_VALUE = 255;
28 public static final int USED_SLOT_VALUE = 0;
29 public static final double GRANULARITY = 6.25;
30 public static final int EFFECTIVE_BITS = 768;
31 public static final double START_EDGE_FREQUENCY = 191.325;
32 public static final int NB_OCTECTS = 96;
33 public static final double CENTRAL_FREQUENCY = 193.1;
34 public static final int NB_SLOTS_100G = 8;
35 public static final int NB_SLOTS_400G = 14;
36 public static final BigDecimal WIDTH_80 = BigDecimal.valueOf(80);
37 public static final BigDecimal WIDTH_40 = BigDecimal.valueOf(40);
38 public static final BigDecimal SLOT_WIDTH_50 = BigDecimal.valueOf(50);
39 public static final BigDecimal SLOT_WIDTH_87_5 = BigDecimal.valueOf(87.5);
42 * Map for associate service type with nb slots.
44 public static final Map<String, Integer> SPECTRAL_WIDTH_SLOT_NUMBER_MAP = Map.of(
45 StringConstants.SERVICE_TYPE_100GE, NB_SLOTS_100G,
46 StringConstants.SERVICE_TYPE_400GE, NB_SLOTS_400G,
47 StringConstants.SERVICE_TYPE_OTU4, NB_SLOTS_100G);
49 * Map to associate service rate to modulation format.
51 public static final Map<Uint32, ModulationFormat> RATE_MODULATION_FORMAT_MAP = Map.of(
52 ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk,
53 ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk,
54 ServiceRateConstant.RATE_300, ModulationFormat.DpQam8,
55 ServiceRateConstant.RATE_400, ModulationFormat.DpQam16);
57 * Map to associate service rate and modulation format to frequency width.
59 public static final Table<Uint32, ModulationFormat, String> FREQUENCY_WIDTH_TABLE = initFrequencyWidthTable();
61 public static final long IRRELEVANT_WAVELENGTH_NUMBER = 0;
64 * Map to associate width format to slot width.
66 public static final Map<BigDecimal, BigDecimal> WIDTH_SLOT_WIDTH_MAP = Map.of(
67 WIDTH_40, SLOT_WIDTH_50,
68 WIDTH_80, SLOT_WIDTH_87_5);
70 private GridConstant() {
73 private static Table<Uint32, ModulationFormat, String> initFrequencyWidthTable() {
74 Table<Uint32, ModulationFormat, String> frequencyWidthTable = HashBasedTable.create();
75 frequencyWidthTable.put(ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk, String.valueOf(WIDTH_40));
76 frequencyWidthTable.put(ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk, String.valueOf(WIDTH_80));
77 frequencyWidthTable.put(ServiceRateConstant.RATE_300, ModulationFormat.DpQam8, String.valueOf(WIDTH_80));
78 frequencyWidthTable.put(ServiceRateConstant.RATE_400, ModulationFormat.DpQam16, String.valueOf(WIDTH_80));
79 return frequencyWidthTable;