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 java.math.BigDecimal;
12 import java.util.Arrays;
13 import java.util.HashMap;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.FrequencyGHz;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.FrequencyTHz;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.available.freq.map.AvailFreqMaps;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.available.freq.map.AvailFreqMapsBuilder;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.available.freq.map.AvailFreqMapsKey;
20 import org.opendaylight.yangtools.yang.common.Uint16;
23 * Util class for grid.
26 public final class GridUtils {
31 public static Map<AvailFreqMapsKey, AvailFreqMaps> initFreqMaps4FixedGrid2Available() {
32 byte[] byteArray = new byte[FixedGridConstant.NB_CHANNELS];
33 Arrays.fill(byteArray, (byte) GridConstant.AVAILABLE_SLOT_VALUE);
34 Map<AvailFreqMapsKey, AvailFreqMaps> waveMap = new HashMap<>();
35 AvailFreqMaps availFreqMaps = new AvailFreqMapsBuilder().setMapName(GridConstant.C_BAND)
36 .setFreqMapGranularity(new FrequencyGHz(BigDecimal.valueOf(FixedGridConstant.GRANULARITY)))
37 .setStartEdgeFreq(new FrequencyTHz(BigDecimal.valueOf(FixedGridConstant.START_EDGE_FREQUENCY)))
38 .setEffectiveBits(Uint16.valueOf(FixedGridConstant.EFFECTIVE_BITS))
39 .setFreqMap(byteArray)
41 waveMap.put(availFreqMaps.key(), availFreqMaps);