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_T, NB_SLOTS_100G,
46 StringConstants.SERVICE_TYPE_400GE, NB_SLOTS_400G,
47 StringConstants.SERVICE_TYPE_OTU4, NB_SLOTS_100G);
50 * Map to associate service rate to modulation format.
52 public static final Map<Uint32, ModulationFormat> RATE_MODULATION_FORMAT_MAP = Map.of(
53 ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk,
54 ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk,
55 ServiceRateConstant.RATE_300, ModulationFormat.DpQam8,
56 ServiceRateConstant.RATE_400, ModulationFormat.DpQam16);
59 * Map to associate service rate and modulation format to frequency width.
61 public static final Table<Uint32, ModulationFormat, String> FREQUENCY_WIDTH_TABLE = initFrequencyWidthTable();
63 public static final long IRRELEVANT_WAVELENGTH_NUMBER = 0;
66 * Map to associate width format to slot width.
68 public static final Map<BigDecimal, BigDecimal> WIDTH_SLOT_WIDTH_MAP = Map.of(
69 WIDTH_40, SLOT_WIDTH_50,
70 WIDTH_80, SLOT_WIDTH_87_5);
72 public static final int FIXED_GRID_FREQUENCY_PRECISION = 4;
74 public static final int FLEX_GRID_FREQUENCY_PRECISION = 5;
77 * Map to associate service rate and modulation format to frequency slot width.
79 public static final Table<Uint32, ModulationFormat, BigDecimal> FREQUENCY_SLOT_WIDTH_TABLE =
80 initFrequencySlotWidthTable();
81 public static final String SPECTRAL_SLOT_SEPARATOR = ":";
82 public static final String NAME_PARAMETERS_SEPARATOR = "-";
85 * Map for associate service rate with nb slots.
87 public static final Map<Uint32, Integer> RATE_SPECTRAL_WIDTH_SLOT_NUMBER_MAP = Map.of(
88 ServiceRateConstant.RATE_100, NB_SLOTS_100G,
89 ServiceRateConstant.RATE_200, NB_SLOTS_100G,
90 ServiceRateConstant.RATE_300, NB_SLOTS_100G,
91 ServiceRateConstant.RATE_400, NB_SLOTS_400G);
93 private GridConstant() {
96 private static Table<Uint32, ModulationFormat, String> initFrequencyWidthTable() {
97 Table<Uint32, ModulationFormat, String> frequencyWidthTable = HashBasedTable.create();
98 frequencyWidthTable.put(ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk, String.valueOf(WIDTH_40));
99 frequencyWidthTable.put(ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk, String.valueOf(WIDTH_80));
100 frequencyWidthTable.put(ServiceRateConstant.RATE_300, ModulationFormat.DpQam8, String.valueOf(WIDTH_80));
101 frequencyWidthTable.put(ServiceRateConstant.RATE_400, ModulationFormat.DpQam16, String.valueOf(WIDTH_80));
102 return frequencyWidthTable;
105 private static Table<Uint32, ModulationFormat, BigDecimal> initFrequencySlotWidthTable() {
106 Table<Uint32, ModulationFormat, BigDecimal> frequencyWidthTable = HashBasedTable.create();
107 frequencyWidthTable.put(ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk, SLOT_WIDTH_50);
108 frequencyWidthTable.put(ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk, SLOT_WIDTH_87_5);
109 frequencyWidthTable.put(ServiceRateConstant.RATE_300, ModulationFormat.DpQam8, SLOT_WIDTH_87_5);
110 frequencyWidthTable.put(ServiceRateConstant.RATE_400, ModulationFormat.DpQam16, SLOT_WIDTH_87_5);
111 return frequencyWidthTable;