add PcePathDescription Test
[transportpce.git] / pce / src / test / java / org / opendaylight / transportpce / pce / gnpy / GnpyUtilitiesImplTest.java
1 /*
2  * Copyright © 2020 Orange Labs, 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 package org.opendaylight.transportpce.pce.gnpy;
9
10 import org.junit.Before;
11 import org.junit.Test;
12 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
13 import org.opendaylight.transportpce.common.network.RequestProcessor;
14 import org.opendaylight.transportpce.pce.constraints.PceConstraints;
15 import org.opendaylight.transportpce.pce.constraints.PceConstraintsCalc;
16 import org.opendaylight.transportpce.pce.utils.PceTestData;
17 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
18 import org.opendaylight.transportpce.pce.utils.TransactionUtils;
19 import org.opendaylight.transportpce.test.AbstractTest;
20
21 public class GnpyUtilitiesImplTest extends AbstractTest {
22
23     private GnpyUtilitiesImpl gnpyUtilitiesImpl;
24     private NetworkTransactionImpl networkTransaction;
25
26     @Before
27     public void setUp()throws Exception {
28         PceTestUtils.writeNetworkIntoDataStore(this.getDataBroker(), this.getDataStoreContextUtil(),
29                 TransactionUtils.getNetworkForSpanLoss());
30         networkTransaction = new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker()));
31
32
33     }
34
35     @Test(expected = Exception.class)
36     public void askNewPathFromGnpyTest() throws Exception {
37         gnpyUtilitiesImpl = new GnpyUtilitiesImpl(networkTransaction, PceTestData.getPCERequest());
38         PceConstraintsCalc constraints =
39                 new PceConstraintsCalc(PceTestData.getPCE_simpletopology_test1_request(), networkTransaction);
40         PceConstraints pceHardConstraints = constraints.getPceHardConstraints();
41         gnpyUtilitiesImpl.askNewPathFromGnpy(pceHardConstraints);
42     }
43
44     @Test(expected = Exception.class)
45     public void gnpyResponseOneDirectionTest() throws Exception {
46         gnpyUtilitiesImpl = new GnpyUtilitiesImpl(networkTransaction, PceTestData.getPCERequest());
47         gnpyUtilitiesImpl.gnpyResponseOneDirection(null);
48     }
49
50
51 }