Flexgrid for pce and network model
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / fixedflex / GridConstant.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.transportpce.common.fixedflex;
10
11 import com.google.common.collect.HashBasedTable;
12 import com.google.common.collect.Table;
13 import java.util.Map;
14 import org.opendaylight.transportpce.common.ServiceRateConstant;
15 import org.opendaylight.transportpce.common.StringConstants;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
17 import org.opendaylight.yangtools.yang.common.Uint32;
18
19 /**
20  * Constant class common to fixed grid and flex grid.
21  *
22  */
23 public final class GridConstant {
24
25     public static final String C_BAND = "cband";
26     public static final int AVAILABLE_SLOT_VALUE = 255;
27     public static final int USED_SLOT_VALUE = 0;
28     public static final double GRANULARITY = 6.25;
29     public static final int EFFECTIVE_BITS = 768;
30     public static final double START_EDGE_FREQUENCY = 191.325;
31     public static final int NB_OCTECTS = 96;
32     public static final double CENTRAL_FREQUENCY = 193.1;
33     public static final int NB_SLOTS_100G = 8;
34     public static final int NB_SLOTS_400G = 14;
35     /**
36      * Map for associate service type with nb slots.
37      */
38     public static final Map<String, Integer> SPECTRAL_WIDTH_SLOT_NUMBER_MAP = Map.of(
39             StringConstants.SERVICE_TYPE_100GE, NB_SLOTS_100G,
40             StringConstants.SERVICE_TYPE_400GE, NB_SLOTS_400G,
41             StringConstants.SERVICE_TYPE_OTU4, NB_SLOTS_100G);
42     /**
43      * Map to associate service rate to modulation format.
44      */
45     public static final Map<Uint32, ModulationFormat> RATE_MODULATION_FORMAT_MAP = Map.of(
46             ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk,
47             ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk,
48             ServiceRateConstant.RATE_300, ModulationFormat.DpQam8,
49             ServiceRateConstant.RATE_400, ModulationFormat.DpQam16);
50     /**
51      * Map to associate service rate and modulation format to frequency width.
52      */
53     public static final Table<Uint32, ModulationFormat, String> FREQUENCY_WIDTH_TABLE = initFrequencyWidthTable();
54
55     public static final long IRRELEVANT_WAVELENGTH_NUMBER = 0;
56
57     private GridConstant() {
58     }
59
60     private static Table<Uint32, ModulationFormat, String> initFrequencyWidthTable() {
61         Table<Uint32, ModulationFormat, String> frequencyWidthTable = HashBasedTable.create();
62         frequencyWidthTable.put(ServiceRateConstant.RATE_100, ModulationFormat.DpQpsk, "40");
63         frequencyWidthTable.put(ServiceRateConstant.RATE_200, ModulationFormat.DpQpsk, "80");
64         frequencyWidthTable.put(ServiceRateConstant.RATE_300, ModulationFormat.DpQam8, "80");
65         frequencyWidthTable.put(ServiceRateConstant.RATE_400, ModulationFormat.DpQam16, "80");
66         return frequencyWidthTable;
67     }
68 }