<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>2.25.0</version>
+ <version>3.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
import java.util.concurrent.ExecutionException;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint64;
-@Ignore
+
public class OlmPowerServiceRpcImplTest extends AbstractTest {
private MountPoint mountPoint;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownInput;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
-@Ignore
+
public class PowerMgmtTest extends AbstractTest {
private MountPoint mountPoint;
public void setUp() {
this.mountPoint = new MountPointStub(this.getDataBroker());
this.mountPointService = new MountPointServiceStub(mountPoint);
- this.mappingUtils = new MappingUtilsImpl(getDataBroker());
+ // this.mappingUtils = new MappingUtilsImpl(getDataBroker());
this.mappingUtils = Mockito.spy(new MappingUtilsImpl(getDataBroker()));
Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(mappingUtils)
.getOpenRoadmVersion(Mockito.anyString());
new PortMappingVersion221(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
this.portMappingVersion121 =
new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
- this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22, this.portMappingVersion121);
+ this.portMapping = new PortMappingImpl(getDataBroker(),
+ this.portMappingVersion22, this.portMappingVersion121);
this.portMapping = Mockito.spy(this.portMapping);
this.powerMgmt = new PowerMgmtImpl(this.getDataBroker(), this.openRoadmInterfaces, this.crossConnect,
this.deviceTransactionManager);
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Ignore
+
public class OlmPowerServiceImplSpanLossBaseTest extends AbstractTest {
private static final Logger LOG = LoggerFactory.getLogger(OlmPowerServiceImplSpanLossBaseTest.class);
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Ignore
+
public class OlmPowerServiceImplTest extends AbstractTest {
private static final Logger LOG = LoggerFactory.getLogger(OlmPowerServiceImplTest.class);
<version>3.0.2</version>
<optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.transportpce</groupId>
+ <artifactId>test-common</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>2.25.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-core</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<repositories>
--- /dev/null
+/*
+ * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.transportpce.pce.PceComplianceCheckResult;
+
+public class PceComplianceCheckResultTest {
+
+ PceComplianceCheckResult pceComplianceCheckResult = new PceComplianceCheckResult(false, "message");
+
+ @Test
+ public void checkGetter() {
+ Assert.assertEquals(false, pceComplianceCheckResult.hasPassed());
+ Assert.assertNotNull(pceComplianceCheckResult.getMessage());
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.transportpce.pce.utils.PceTestData;
+
+public class PceSendingPceRPCsTest {
+
+ private PceSendingPceRPCs pceSendingPceRPCs;
+
+ @Before
+ public void setUp() {
+ pceSendingPceRPCs = new PceSendingPceRPCs(PceTestData.getPCE_test1_request_54(), null);
+ }
+
+ @Test
+ public void cancelResourceReserve() {
+ pceSendingPceRPCs.cancelResourceReserve();
+ Assert.assertEquals(true, pceSendingPceRPCs.getSuccess());
+ }
+
+ @Test
+ public void pathComputationTest() throws Exception {
+
+ pceSendingPceRPCs.pathComputation();
+
+ }
+
+ @Test
+ public void checkMessage() {
+ Assert.assertNull(pceSendingPceRPCs.getMessage());
+ }
+
+ @Test
+ public void responseCodeTest() {
+ Assert.assertNull(pceSendingPceRPCs.getResponseCode());
+ }
+
+ @Test
+ public void pathComputationWithConstraintsTest() {
+ pceSendingPceRPCs.pathComputationWithConstraints(null, null);
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SortPortsByNameTest {
+
+ private SortPortsByName sortPortsByName = new SortPortsByName();
+
+ @Test
+ public void compareTest() {
+ Assert.assertEquals(12, sortPortsByName.compare("value22", "valu10"));
+ }
+
+ @Test
+ public void compareWithoutNUM() {
+ Assert.assertEquals(0, sortPortsByName.compare("value", "value"));
+ }
+
+ @Test
+ public void compareLessThan() {
+ Assert.assertEquals(-11, sortPortsByName.compare("value1", "value12"));
+ }
+
+
+}
--- /dev/null
+/*
+ * Copyright © 2020 Orange, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.constraints;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.opendaylight.transportpce.test.AbstractTest;
+
+public class PceConstraintsTest extends AbstractTest {
+ private static PceConstraints pceConstraints = new PceConstraints();
+
+ @Before
+ public void setup() {
+ pceConstraints = new PceConstraints();
+ }
+
+ @Test
+ public void setAndGetMaxLatencyTest() {
+ Assert.assertEquals(-1, this.pceConstraints.getMaxLatency().intValue());
+ pceConstraints.setMaxLatency(-2L);
+ Assert.assertEquals(-2, this.pceConstraints.getMaxLatency().intValue());
+ }
+
+ @Test
+ public void setAndGetExcludeSupNodesTest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeSupNodes().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setExcludeSupNodes(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeSupNodes().size());
+ }
+
+ @Test
+ public void setAndGetExcludeSRLGTest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeSRLG().size());
+ List<Long> nodes = new ArrayList<>();
+ nodes.add(1L);
+ this.pceConstraints.setExcludeSRLG(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeSRLG().size());
+ }
+
+ @Test
+ public void setAndGetExcludeCLLITest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeCLLI().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setExcludeCLLI(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeCLLI().size());
+ }
+
+ @Test
+ public void setAndGetExcludeClliNodesTest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeClliNodes().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setExcludeClliNodes(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeClliNodes().size());
+ }
+
+ @Test
+ public void setAndGetExcludeSrlgLinksTest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeSrlgLinks().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setExcludeSrlgLinks(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeSrlgLinks().size());
+ }
+
+ @Test
+ public void setAndGetExcludeNodesTest() {
+ Assert.assertEquals(0, this.pceConstraints.getExcludeNodes().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setExcludeNodes(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getExcludeNodes().size());
+ }
+
+ @Test
+ public void setAndGetIncludeNodesTest() {
+ Assert.assertEquals(0, this.pceConstraints.getIncludeNodes().size());
+ List<String> nodes = new ArrayList<>();
+ nodes.add("test");
+ this.pceConstraints.setIncludeNodes(nodes);
+ Assert.assertEquals(1, this.pceConstraints.getIncludeNodes().size());
+ }
+
+ @Test
+ public void getTypeAndNameOfResourcePairTest() {
+ PceConstraints.ResourcePair resourcePair = new PceConstraints
+ .ResourcePair(PceConstraints.ResourceType.CLLI, "test");
+ Assert.assertEquals(resourcePair.getType(), PceConstraints.ResourceType.CLLI);
+ Assert.assertEquals("test", resourcePair.getName());
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce.utils.networkanalyzer;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.pce.networkanalyzer.PceCalculation;
+import org.opendaylight.transportpce.pce.networkanalyzer.PceResult;
+import org.opendaylight.transportpce.pce.utils.PceTestData;
+import org.opendaylight.transportpce.test.AbstractTest;
+
+public class PceCalculationTest extends AbstractTest {
+
+ private PceCalculation pceCalculation;
+
+ // setup object
+ @Before
+ public void setUp() {
+ PceResult pceResult = new PceResult();
+ pceResult.setRC("200");
+
+ pceCalculation = new PceCalculation(
+ PceTestData.getPCERequest(),
+ new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker())),
+ null,
+ null,
+ pceResult);
+
+
+ }
+
+ @Test
+ public void testPceCalculationValues() {
+
+ pceCalculation.retrievePceNetwork();
+ Assert.assertEquals("100GE", pceCalculation.getServiceType());
+ Assert.assertNotNull(pceCalculation.getReturnStructure());
+
+ Assert.assertNull(pceCalculation.getaendPceNode());
+ Assert.assertNull(pceCalculation.getzendPceNode());
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce.utils.service;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
+import org.opendaylight.transportpce.pce.utils.PceTestData;
+import org.opendaylight.transportpce.test.AbstractTest;
+
+public class PathComputationServiceImplTest extends AbstractTest {
+
+ private PathComputationServiceImpl pathComputationServiceImpl;
+
+ @Before
+ public void setUp() {
+ pathComputationServiceImpl = new PathComputationServiceImpl(
+ new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker())),
+ this.getNotificationPublishService());
+ pathComputationServiceImpl.init();
+ }
+
+ @Test
+ public void pathComputationRequestTest() {
+ Assert.assertNotNull(pathComputationServiceImpl.pathComputationRequest(PceTestData.getPCERequest()));
+ pathComputationServiceImpl.close();
+ }
+}
.build();
ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
.setServiceFormat(ServiceFormat.Ethernet)
- .setServiceRate(0L)
+ .setServiceRate(100L)
.setClli("clli11")
.setNodeId("XPONDER-2-2")
.setTxDirection(new TxDirectionBuilder().setPort(
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>odlparent</artifactId>
- <version>6.0.4</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>6.0.4</version>
+ <relativePath/>
+ </parent>
- <groupId>org.opendaylight.transportpce</groupId>
- <artifactId>transportpce-aggregator</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <name>transportpce</name>
- <packaging>pom</packaging>
+ <groupId>org.opendaylight.transportpce</groupId>
+ <artifactId>transportpce-aggregator</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <name>transportpce</name>
+ <packaging>pom</packaging>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/transportpce.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/transportpce.git</developerConnection>
- <tag>HEAD</tag>
- <url>https://wiki.opendaylight.org/view/transportpce:Main</url>
- </scm>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/transportpce.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/transportpce.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/transportpce:Main</url>
+ </scm>
- <modules>
- <module>ordmodels</module>
- <module>tapimodels</module>
- <module>api</module>
- <module>common</module>
- <module>test-common</module>
- <module>renderer</module>
- <module>networkmodel</module>
- <module>inventory</module>
- <module>olm</module>
- <module>pce</module>
- <module>servicehandler</module>
- <module>tapi</module>
- <module>features</module>
- <module>karaf</module>
- </modules>
+ <modules>
+ <module>ordmodels</module>
+ <module>tapimodels</module>
+ <module>api</module>
+ <module>common</module>
+ <module>test-common</module>
+ <module>renderer</module>
+ <module>networkmodel</module>
+ <module>inventory</module>
+ <module>olm</module>
+ <module>pce</module>
+ <module>servicehandler</module>
+ <module>tapi</module>
+ <module>features</module>
+ <module>karaf</module>
+ </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
- <excludePackageNames>*</excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
+ <excludePackageNames>*</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
+
+