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.networkmodel.service;
11 import static org.junit.Assert.fail;
13 import java.io.FileNotFoundException;
14 import java.io.FileReader;
15 import java.io.IOException;
16 import java.io.Reader;
17 import java.nio.charset.StandardCharsets;
18 import java.util.concurrent.ExecutionException;
19 import org.junit.BeforeClass;
20 import org.junit.Ignore;
21 import org.junit.Test;
22 import org.opendaylight.transportpce.common.InstanceIdentifiers;
23 import org.opendaylight.transportpce.test.AbstractTest;
24 import org.opendaylight.transportpce.test.converter.DataObjectConverter;
25 import org.opendaylight.transportpce.test.converter.JSONDataObjectConverter;
26 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescription;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
32 //FIXME: disabled because some updates are needed on test-common
33 public class NetworkModelWavelengthServiceTest extends AbstractTest {
34 private static final Logger LOG = LoggerFactory.getLogger(NetworkModelWavelengthServiceTest.class);
35 private static final String OPENROADM_TOPOLOGY_FILE = "src/test/resources/openroadm-topology.xml";
36 private static final String PATH_DESCRIPTION_FILE = "src/test/resources/path_description.json";
37 private static DataObjectConverter dataObjectConverter;
40 public static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
41 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), OPENROADM_TOPOLOGY_FILE,
42 InstanceIdentifiers.OVERLAY_NETWORK_II);
43 dataObjectConverter = JSONDataObjectConverter.createWithDataStoreUtil(getDataStoreContextUtil());
47 public void allocateFrequenciesTest() throws IOException {
48 try (Reader reader = new FileReader(PATH_DESCRIPTION_FILE, StandardCharsets.UTF_8)) {
49 PathDescription pathDescription = (PathDescription) dataObjectConverter.transformIntoNormalizedNode(reader)
51 NetworkModelWavelengthService service = new NetworkModelWavelengthServiceImpl(getDataBroker());
52 service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
53 } catch (IOException e) {
54 LOG.error("Cannot load path description ", e);
55 fail("Cannot load path description ");