Turning on tests which were disabled due to movement of authentication to southbound. 07/39407/14
authorJozef Gloncak <jgloncak@cisco.com>
Wed, 25 May 2016 10:41:11 +0000 (12:41 +0200)
committerJozef Gloncak <jgloncak@cisco.com>
Wed, 15 Jun 2016 07:27:15 +0000 (09:27 +0200)
Uncommenting tests.

Change-Id: I7adc6bac17a5c2b0a0e926f68e615254d20ba20e
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServerTest.java

index 85f8fe564ebb29b7589fe04c4ed09b7393bf72b0..fba316b3ec75f237aedd433fc699518f06b7e3d9 100644 (file)
@@ -53,9 +53,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
 import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
@@ -98,12 +95,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -135,9 +126,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.addres
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.HopBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.util.Filter;
@@ -652,27 +640,14 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     public void mapRegisterWithMapNotify() throws SocketTimeoutException {
         cleanUP();
-        insertAuthDataToDataStore(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"),
-                NULL_AUTH_KEY);
-        sleepForSeconds(1);
+        mapService.addAuthenticationKey(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), NULL_AUTH_KEY);
+
+        sleepForSeconds(2);
         sendPacket(mapRegisterPacketWithNotify);
         MapNotify reply = receiveMapNotify();
         assertEquals(7, reply.getNonce().longValue());
     }
 
-    private void insertAuthDataToDataStore(final Eid eid, final MappingAuthkey authKey) {
-        final DataBroker dataBroker = getSession().getSALService(DataBroker.class);
-        final WriteTransaction wTx = dataBroker.newWriteOnlyTransaction();
-        final EidUri eidUri = new EidUri("eidUri");
-        final InstanceIdentifier<AuthenticationKey> iiToAuthenticationKey = InstanceIdentifier.create
-                (MappingDatabase.class).child(VirtualNetworkIdentifier.class, new VirtualNetworkIdentifierKey(new
-                VniUri("0"))).child(AuthenticationKey.class, new AuthenticationKeyKey(eidUri));
-        final AuthenticationKey data = new AuthenticationKeyBuilder().setMappingAuthkey(authKey).setEid(eid).
-                setEidUri(eidUri).build();
-        wTx.put(LogicalDatastoreType.CONFIGURATION, iiToAuthenticationKey, data, true);
-        wTx.submit();
-    }
-
     public void mapRegisterWithMapNotifyAndMapRequest() throws SocketTimeoutException {
         cleanUP();
         Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
index 77ad610180384d52fcb5151e7f80fd671d7cb40e..ca59af44806706e1b3d486b4ba09599feec9400f 100644 (file)
@@ -18,7 +18,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -151,10 +150,8 @@ public class MapServerTest {
         setConfigIniMappingMergeField(false);
     }
 
-    @Ignore  /* commented due to difference at authentication data*/
     @Test
     public void handleMapRegisterTest_MappingMergeFalse() throws NoSuchFieldException, IllegalAccessException {
-        Mockito.when(mapService.getAuthenticationKey(IPV4_EID_1)).thenReturn(MAPPING_AUTHKEY);
         Mockito.when(mapService.getMapping(MappingOrigin.Southbound, IPV4_EID_1)).thenReturn(OLD_MAPPING_RECORD_1);
         Mockito.when(mapService.getData(MappingOrigin.Southbound, IPV4_EID_1, SubKeys.SUBSCRIBERS))
                 .thenReturn(subscriberSetMock_1);
@@ -170,7 +167,6 @@ public class MapServerTest {
         assertEquals(1, subscriberSetMock_1.size());
     }
 
-    @Ignore  /* commented due to difference at authentication data*/
     @Test
     public void handleMapRegisterTest_MappingMergeTrue() throws NoSuchFieldException, IllegalAccessException {
         setConfigIniMappingMergeField(true);
@@ -181,7 +177,6 @@ public class MapServerTest {
                 .setMappingRecordItem(new ArrayList<>());
         mapNotifyBuilder.getMappingRecordItem().add(mappingRecordItemBuilder.build());
 
-        Mockito.when(mapService.getAuthenticationKey(IPV4_EID_1)).thenReturn(MAPPING_AUTHKEY);
         // no mapping changes
         Mockito.when(mapService.getMapping(MappingOrigin.Southbound, IPV4_EID_1))
                 .thenReturn(OLD_MAPPING_RECORD_1);
@@ -192,7 +187,6 @@ public class MapServerTest {
         Mockito.verify(notifyHandler).handleMapNotify(mapNotifyBuilder.build(), null);
     }
 
-    @Ignore /* commented due to difference at authentication data*/
     @Test
     public void handleMapRegisterTest_verifyTransportAddresses() throws NoSuchFieldException, IllegalAccessException {
         setConfigIniMappingMergeField(true);
@@ -482,8 +476,7 @@ public class MapServerTest {
                 .setNonce(mapRegister.getNonce())
                 .setKeyId(mapRegister.getKeyId())
                 .setMergeEnabled(mapRegister.isMergeEnabled())
-                .setMappingRecordItem(new ArrayList<>())
-                .setAuthenticationData(new byte[]{});
+                .setMappingRecordItem(new ArrayList<>());
         mapNotifyBuilder.getMappingRecordItem().add(getDefaultMappingRecordItemBuilder().build());
 
         return mapNotifyBuilder;