X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=olm%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Folm%2Fpower%2FPowerMgmtTest.java;h=67519f78c7f9ab2908f42247fa21bcb2aaf98f6f;hb=a2c0845af51f68102d9f32df83cdfa93fbf9bb35;hp=3307bb035d7ed0f7b2613c4242fb6897a40ffeeb;hpb=2df235e965f3b4ff99f2e7bfc5a2911869c97c03;p=transportpce.git diff --git a/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java b/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java index 3307bb035..67519f78c 100644 --- a/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java +++ b/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java @@ -13,6 +13,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; +import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.MountPointService; import org.opendaylight.transportpce.common.StringConstants; @@ -20,6 +21,7 @@ import org.opendaylight.transportpce.common.crossconnect.CrossConnect; import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl; import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121; import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221; +import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl710; import org.opendaylight.transportpce.common.device.DeviceTransactionManager; import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl; import org.opendaylight.transportpce.common.mapping.MappingUtils; @@ -28,21 +30,22 @@ import org.opendaylight.transportpce.common.mapping.PortMapping; import org.opendaylight.transportpce.common.mapping.PortMappingImpl; import org.opendaylight.transportpce.common.mapping.PortMappingVersion121; import org.opendaylight.transportpce.common.mapping.PortMappingVersion221; +import org.opendaylight.transportpce.common.mapping.PortMappingVersion710; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl221; +import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl710; import org.opendaylight.transportpce.olm.stub.MountPointServiceStub; import org.opendaylight.transportpce.olm.stub.MountPointStub; import org.opendaylight.transportpce.olm.util.OlmPowerServiceRpcImplUtil; import org.opendaylight.transportpce.olm.util.TransactionUtils; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownInput; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; public class PowerMgmtTest extends AbstractTest { - private MountPoint mountPoint; private MountPointService mountPointService; private DeviceTransactionManager deviceTransactionManager; @@ -52,38 +55,45 @@ public class PowerMgmtTest extends AbstractTest { private PowerMgmt powerMgmt; private CrossConnectImpl121 crossConnectImpl121; private CrossConnectImpl221 crossConnectImpl22; + private CrossConnectImpl710 crossConnectImpl710; private MappingUtils mappingUtils; private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121; private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl22; + private OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710; + private PortMappingVersion710 portMappingVersion710; private PortMappingVersion221 portMappingVersion22; private PortMappingVersion121 portMappingVersion121; + private DataBroker dataBroker; @Before public void setUp() { - this.mountPoint = new MountPointStub(this.getDataBroker()); + dataBroker = this.getNewDataBroker(); + this.mountPoint = new MountPointStub(dataBroker); this.mountPointService = new MountPointServiceStub(mountPoint); // this.mappingUtils = new MappingUtilsImpl(getDataBroker()); - this.mappingUtils = Mockito.spy(new MappingUtilsImpl(getDataBroker())); + this.mappingUtils = Mockito.spy(new MappingUtilsImpl(dataBroker)); Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(mappingUtils) .getOpenRoadmVersion(Mockito.anyString()); this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000); this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager); this.crossConnectImpl22 = new CrossConnectImpl221(deviceTransactionManager); this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121, - this.crossConnectImpl22); + this.crossConnectImpl22, this.crossConnectImpl710); + this.portMappingVersion22 = new PortMappingVersion221(dataBroker, deviceTransactionManager); + this.portMappingVersion121 = new PortMappingVersion121(dataBroker, deviceTransactionManager); + this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion710, + this.portMappingVersion22, this.portMappingVersion121); this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager); - this.openRoadmInterfacesImpl22 = new OpenRoadmInterfacesImpl221(deviceTransactionManager); + this.openRoadmInterfacesImpl22 = new OpenRoadmInterfacesImpl221(deviceTransactionManager, this.portMapping, + this.portMappingVersion22); + this.openRoadmInterfacesImpl710 = new OpenRoadmInterfacesImpl710(deviceTransactionManager, this.portMapping, + this.portMappingVersion710); this.openRoadmInterfaces = new OpenRoadmInterfacesImpl((this.deviceTransactionManager), - this.mappingUtils,this.openRoadmInterfacesImpl121,this.openRoadmInterfacesImpl22); + this.mappingUtils,this.openRoadmInterfacesImpl121,this.openRoadmInterfacesImpl22, + this.openRoadmInterfacesImpl710); this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces); - this.portMappingVersion22 = - 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 = Mockito.spy(this.portMapping); - this.powerMgmt = new PowerMgmtImpl(this.getDataBroker(), this.openRoadmInterfaces, this.crossConnect, + this.powerMgmt = new PowerMgmtImpl(this.dataBroker, this.openRoadmInterfaces, this.crossConnect, this.deviceTransactionManager); } @@ -147,7 +157,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, null); Thread.sleep(1000); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -159,7 +169,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes2() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction2(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction2(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -171,7 +181,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes3() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -195,7 +205,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes312() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput4(); @@ -207,7 +217,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes32() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3(); @@ -219,7 +229,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes4() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "network"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "network"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput2(); @@ -244,7 +254,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes42() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3(); @@ -256,7 +266,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes422() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput4(); @@ -268,7 +278,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes43() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();