Port-mapping for 7.1.0 models
[transportpce.git] / olm / src / test / java / org / opendaylight / transportpce / olm / service / OlmPowerServiceImplTest.java
index c4b7c254a59a01b4c652d865bc0b3ae519e64d72..cbfe928eb7d666c586afa81618343dbc2201f484 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.transportpce.olm.service;
 
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mockito;
@@ -33,10 +32,12 @@ 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.power.PowerMgmt;
 import org.opendaylight.transportpce.olm.power.PowerMgmtImpl;
 import org.opendaylight.transportpce.olm.stub.MountPointServiceStub;
@@ -71,7 +72,6 @@ import org.powermock.api.mockito.PowerMockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Ignore
 public class OlmPowerServiceImplTest  extends AbstractTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(OlmPowerServiceImplTest.class);
@@ -87,6 +87,8 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
     private MappingUtils mappingUtils;
     private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
     private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl22;
+    private OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710;
+    private PortMappingVersion710 portMappingVersion710;
     private PortMappingVersion221 portMappingVersion22;
     private PortMappingVersion121 portMappingVersion121;
     private OlmPowerService olmPowerService;
@@ -99,10 +101,11 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
 
     @Before
     public void setUp() {
-        this.mountPoint = new MountPointStub(this.getDataBroker());
+        this.dataBroker =  getNewDataBroker();
+        this.mountPoint = new MountPointStub(this.dataBroker);
         this.mountPointService = new MountPointServiceStub(mountPoint);
         this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
-        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);
@@ -112,21 +115,25 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
                 this.crossConnectImpl22);
         this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager);
         this.openRoadmInterfacesImpl22 = new OpenRoadmInterfacesImpl221(deviceTransactionManager);
+        this.openRoadmInterfacesImpl710 = new OpenRoadmInterfacesImpl710(deviceTransactionManager);
         this.openRoadmInterfaces = new OpenRoadmInterfacesImpl((this.deviceTransactionManager),
-                this.mappingUtils,this.openRoadmInterfacesImpl121,this.openRoadmInterfacesImpl22);
+                this.mappingUtils,this.openRoadmInterfacesImpl121,this.openRoadmInterfacesImpl22,
+            this.openRoadmInterfacesImpl710);
         this.portMappingVersion22 =
-                new PortMappingVersion221(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
+                new PortMappingVersion221(dataBroker, deviceTransactionManager, this.openRoadmInterfaces);
         this.portMappingVersion121 =
-                new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22, this.portMappingVersion121);
+                new PortMappingVersion121(dataBroker, deviceTransactionManager, this.openRoadmInterfaces);
+        this.portMappingVersion710 =
+            new PortMappingVersion710(dataBroker, deviceTransactionManager, this.openRoadmInterfaces);
+        this.portMapping = new PortMappingImpl(dataBroker, this.portMappingVersion710,
+            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);
-        this.olmPowerService = new OlmPowerServiceImpl(this.getDataBroker(), this.powerMgmt,
+        this.olmPowerService = new OlmPowerServiceImpl(this.dataBroker, this.powerMgmt,
             this.deviceTransactionManager, this.portMapping, this.mappingUtils, this.openRoadmInterfaces);
-        this.dataBroker =  PowerMockito.spy(getDataBroker());
         this.powerMgmtMock = PowerMockito.mock(PowerMgmtImpl.class);
-        this.olmPowerServiceMock = new OlmPowerServiceImpl(this.getDataBroker(), this.powerMgmtMock,
+        this.olmPowerServiceMock = new OlmPowerServiceImpl(this.dataBroker, this.powerMgmtMock,
             this.deviceTransactionManager, this.portMapping, this.mappingUtils, this.openRoadmInterfaces);
         this.olmPowerServiceMock = Mockito.mock(OlmPowerServiceImpl.class);
         MockitoAnnotations.initMocks(this);
@@ -195,7 +202,6 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
         Assert.assertEquals("Failed", output.getResult());
     }
 
-    @Ignore
     @Test
     public void testCalculateSpanlossBase3() {
         NetworkKey overlayTopologyKey = new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID));
@@ -204,7 +210,7 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
             .augmentation(Network1.class)
             .build();
         Network1 network = TransactionUtils.getNetwork();
-        TransactionUtils.writeTransaction(this.getDataBroker(), networkIID, network);
+        TransactionUtils.writeTransaction(this.dataBroker, networkIID, network);
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
@@ -220,7 +226,6 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
     }
 
 
-    @Ignore
     @Test
     public void testCalculateSpanlossBase4() {
         NetworkKey overlayTopologyKey = new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID));
@@ -229,7 +234,7 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
             .augmentation(Network1.class)
             .build();
         Network1 network = TransactionUtils.getEmptyNetwork();
-        TransactionUtils.writeTransaction(this.getDataBroker(), networkIID, network);
+        TransactionUtils.writeTransaction(this.dataBroker, networkIID, network);
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
@@ -241,7 +246,6 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
 
     }
 
-    @Ignore
     @Test
     public void testCalculateSpanlossBase5() {
         NetworkKey overlayTopologyKey = new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID));
@@ -250,7 +254,7 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
             .augmentation(Network1.class)
             .build();
         Network1 network = TransactionUtils.getNullNetwork();
-        TransactionUtils.writeTransaction(this.getDataBroker(), networkIID, network);
+        TransactionUtils.writeTransaction(this.dataBroker, networkIID, network);
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
@@ -277,7 +281,7 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
             .augmentation(Network1.class)
             .build();
         Network1 network = TransactionUtils.getNetwork();
-        TransactionUtils.writeTransaction(this.getDataBroker(), networkIID, network);
+        TransactionUtils.writeTransaction(this.dataBroker, networkIID, network);
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
@@ -288,7 +292,6 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
         Assert.assertEquals(null, output);
     }
 
-    @Ignore
     @Test
     public void testServicePowerReset() {
         ServicePowerResetInput input = OlmPowerServiceRpcImplUtil.getServicePowerResetInput();
@@ -296,7 +299,6 @@ public class OlmPowerServiceImplTest  extends AbstractTest {
         Assert.assertEquals(null, output);
     }
 
-    @Ignore
     @Test
     public void testServicePowerTurndownSuccessResult() {
         ServicePowerTurndownInput servicePowerTurndownInput = OlmPowerServiceRpcImplUtil.getServicePowerTurndownInput();