/* * ============LICENSE_START======================================================= * Actn Interface Tools * ================================================================================ * Copyright (C) 2023 Huawei Canada Limited. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model; import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import java.util.Arrays; /** * Representation of an ODU link resource. */ public class OduResource{ private final short odu0s; private final short odu1s; private final short odu2s; private final short odu2es; private final short odu3s; private final short odu4s; private final short oduFlex; private final byte[] tribPortAvailabilityBitmap; private final byte[] tribSlotAvailabilityBitmap; public final static OduType[] SIMPLE_ODU = { OduType.ODU0, OduType.ODU1, OduType.ODU2, OduType.ODU3, OduType.ODU4 }; public final static OduType[] ADVANCE_ODU = { OduType.ODU0, OduType.ODU1, OduType.ODU2, OduType.ODU3, OduType.ODU4, OduType.ODU2E, OduType.ODU3E2, OduType.ODUFLEX }; /** * Creates an instance of an ODU link resource. * * @param odu0s number of available ODU0 containers * @param odu1s number of available ODU1 containers * @param odu2s number of available ODU2 containers * @param odu2es number of available ODU2e containers * @param odu3s number of available ODU3 containers * @param odu4s number of available ODU4 containers * @param oduFlex available ODUflex bandwidth in terms of ODU0 containers */ public OduResource(short odu0s, short odu1s, short odu2s, short odu2es, short odu3s, short odu4s, short oduFlex, byte[] tpMap, byte[] tsMap) { this.odu0s = odu0s; this.odu1s = odu1s; this.odu2s = odu2s; this.odu2es = odu2es; this.odu3s = odu3s; this.odu4s = odu4s; this.oduFlex = oduFlex; // this.oduFlexCbrs = oduFlexCbrs; this.tribPortAvailabilityBitmap = tpMap == null ? null : Arrays.copyOf(tpMap, tpMap.length); this.tribSlotAvailabilityBitmap = tsMap == null ? null : Arrays.copyOf(tsMap, tsMap.length); } public int[] getOduResourceArray(OduType[] odus){ int size = odus.length; int [] ans = new int [size]; for(int i = 0, e = size; i < e; i++ ) { ans[i] = getNumberOfOdu(odus[i]); } return ans; } public static OduResource getOduResourceFromArray(int [] oduArray) { short odu0s = 0, odu1s = 0, odu2s = 0, odu2es = 0, odu3s = 0, odu4s = 0, oduFlex = 0; for (int i=0, e= oduArray.length; i