package org.opendaylight.transportpce.networkmodel.service;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.InstanceIdentifiers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Ignore
+@Disabled
public class FrequenciesServiceTest extends AbstractTest {
private static final Logger LOG = LoggerFactory.getLogger(FrequenciesServiceTest.class);
private static final String OPENROADM_TOPOLOGY_FILE = "src/test/resources/openroadm-topology.xml";
private final BitSet usedBits = new BitSet(8);
private static BitSet availableBits = new BitSet(8);
- @BeforeClass
- public static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
+ @BeforeAll
+ static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
availableBits.set(0, 8, true);
TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), OPENROADM_TOPOLOGY_FILE,
InstanceIdentifiers.OVERLAY_NETWORK_II);
}
@Test
- public void allocateFrequenciesTest() throws IOException {
+ void allocateFrequenciesTest() throws IOException {
FrequenciesService service = new FrequenciesServiceImpl(getDataBroker());
service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
TerminationPoint1 terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-DEG2", "DEG2-CTP-TXRX");
- assertEquals("Lambda 1 should not be available for ctp-attributes",
- BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),usedBits);
- assertNull("cp-attributes should be null", terminationPoint.getCpAttributes());
+ assertEquals(
+ BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey).getFreqMap())
+ .get(760, 768),
+ usedBits,
+ "Lambda 1 should not be available for ctp-attributes");
+ assertNull(terminationPoint.getCpAttributes(), "cp-attributes should be null");
terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-SRG1", "SRG1-PP1-TXRX");
- assertEquals("Lambda 1 should not be available for pp-attributes",
- BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),usedBits);
+ assertEquals(
+ BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey).getFreqMap())
+ .get(760, 768),
+ usedBits,
+ "Lambda 1 should not be available for pp-attributes");
Node1 node = getNetworkNodeFromDatastore("ROADM-A1-SRG1");
- assertEquals("Lambda 1 should not be available for srg-attributes",
- BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),usedBits);
+ assertEquals(
+ BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey).getFreqMap())
+ .get(760, 768),
+ usedBits,
+ "Lambda 1 should not be available for srg-attributes");
}
@Test
- public void releaseFrequenciesTest() throws IOException {
+ void releaseFrequenciesTest() throws IOException {
FrequenciesService service = new FrequenciesServiceImpl(getDataBroker());
service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
service.releaseFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
TerminationPoint1 terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-DEG2", "DEG2-CTP-TXRX");
- assertEquals("Lambda 1 should be available for ctp-attributes",
- BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),availableBits);
+ assertEquals(
+ BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+ .getFreqMap()).get(760, 768),
+ availableBits,
+ "Lambda 1 should be available for ctp-attributes");
terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-SRG1", "SRG1-PP1-TXRX");
- assertEquals("Lambda 1 should be available for pp-attributes",
- BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),availableBits);
+ assertEquals(
+ BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+ .getFreqMap()).get(760, 768),
+ availableBits,
+ "Lambda 1 should be available for pp-attributes");
Node1 node = getNetworkNodeFromDatastore("ROADM-A1-SRG1");
- assertEquals("Lambda 1 should be available for srg-attributes",
- BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey)
- .getFreqMap()).get(760, 768),availableBits);
+ assertEquals(
+ BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey)
+ .getFreqMap()).get(760, 768),
+ availableBits,
+ "Lambda 1 should be available for srg-attributes");
}
private TerminationPoint1 getNetworkTerminationPointFromDatastore(String nodeId, String tpId) {
- InstanceIdentifier<TerminationPoint1> tpIID = OpenRoadmTopology
- .createNetworkTerminationPointIIDBuilder(nodeId, tpId).build();
+ InstanceIdentifier<TerminationPoint1> tpIID = InstanceIdentifiers
+ .createNetworkTerminationPoint1IIDBuilder(nodeId, tpId);
try (ReadTransaction readTx = getDataBroker().newReadOnlyTransaction()) {
Optional<TerminationPoint1> optionalTerminationPoint = readTx
.read(LogicalDatastoreType.CONFIGURATION, tpIID)
return null;
}
}
-
}