fixing integration tests 73/3473/2
authorDavid Goldberg <david.goldberg@contextream.com>
Fri, 29 Nov 2013 06:50:02 +0000 (08:50 +0200)
committerDavid Goldberg <david.goldberg@contextream.com>
Thu, 5 Dec 2013 07:42:10 +0000 (09:42 +0200)
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
Change-Id: I7de5ffe3b7af1256b57906869e63b8ea8e91050e
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispSegmentLCAFAddressSerializer.java
mappingservice/integrationtest/pom.xml
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java

index 11d8452344724acc144878ffbc7706f598de2ed9..f336a9e2b7610af365ebb647b9704f95331013b7 100644 (file)
@@ -2,6 +2,7 @@ package org.opendaylight.lispflowmapping.implementation.serializer.address;
 
 import java.nio.ByteBuffer;
 
+import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
 import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
@@ -14,6 +15,7 @@ import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.
 
 public class LispSegmentLCAFAddressSerializer extends LispLCAFAddressSerializer {
 
+    private static final int MAX_INSTANCE_ID = 16777216;
     private static final LispSegmentLCAFAddressSerializer INSTANCE = new LispSegmentLCAFAddressSerializer();
 
     // Private constructor prevents instantiation from other classes
@@ -38,10 +40,14 @@ public class LispSegmentLCAFAddressSerializer extends LispLCAFAddressSerializer
 
     @Override
     protected LcafSegmentAddress deserializeData(ByteBuffer buffer, byte res2, short length) {
-        int instanceId = buffer.getInt();
+        long instanceId = (int) ByteUtil.asUnsignedInteger(buffer.getInt());
+
+        if (instanceId > MAX_INSTANCE_ID) {
+            throw new LispSerializationException("Instance ID is longer than 24 bits. got " + instanceId);
+        }
         LispAFIAddress address = LispAddressSerializer.getInstance().deserialize(buffer);
         LcafSegmentBuilder builder = new LcafSegmentBuilder();
-        builder.setInstanceId(ByteUtil.asUnsignedInteger(instanceId) & 0xFFFFFF);
+        builder.setInstanceId(instanceId);
         builder.setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode()).setLcafType((short) LispCanonicalAddressFormatEnum.SEGMENT.getLispCode())
                 .setAddress(new AddressBuilder().setPrimitiveAddress((PrimitiveAddress) LispAFIConvertor.toPrimitive(address)).build());
 
index 952df70437f46870dd12757141b96a9345c309d3..6226b4d6347e43415bb69f330e2cb39fbbaef01c 100644 (file)
                        </plugins>
                </pluginManagement>
                <plugins>
-               <plugin>
-                <groupId>org.ops4j.pax.exam</groupId>
-                <artifactId>maven-paxexam-plugin</artifactId>
-                <version>1.2.4</version>
-                <executions>
-                    <execution>
-                        <id>generate-config</id>
-                        <goals>
-                            <goal>generate-depends-file</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
+                       <plugin>
+                               <groupId>org.ops4j.pax.exam</groupId>
+                               <artifactId>maven-paxexam-plugin</artifactId>
+                               <version>1.2.4</version>
+                               <executions>
+                                       <execution>
+                                               <id>generate-config</id>
+                                               <goals>
+                                                       <goal>generate-depends-file</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-checkstyle-plugin</artifactId>
                        <artifactId>sal-binding-api</artifactId>
                        <version>1.0-SNAPSHOT</version>
                </dependency>
+               <dependency>
+                       <groupId>org.opendaylight.controller</groupId>
+                       <artifactId>sal-binding-it</artifactId>
+                       <version>1.0-SNAPSHOT</version>
+               </dependency>
                <dependency>
                        <groupId>org.opendaylight.controller</groupId>
                        <artifactId>sal-common-api</artifactId>
                        <version>0.5.0-SNAPSHOT</version>
                </dependency>
                <dependency>
-          <groupId>org.opendaylight.controller</groupId>
-          <artifactId>netconf-impl</artifactId>
-          <version>${netconf.version}</version>
-        </dependency>
+                       <groupId>org.opendaylight.controller</groupId>
+                       <artifactId>netconf-impl</artifactId>
+                       <version>${netconf.version}</version>
+               </dependency>
                <dependency>
                        <groupId>org.opendaylight.controller</groupId>
                        <artifactId>containermanager.it.implementation</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
-            <groupId>org.ops4j.pax.exam</groupId>
-            <artifactId>pax-exam</artifactId>
-            <version>${exam.version}</version>
-            <!-- Compile scope here is intentional, it is used in TestHelper 
-                class which could be downloaded via nexus and reused in other integration 
-                tests. -->
-            <scope>compile</scope>
-        </dependency>
+                       <groupId>org.ops4j.pax.exam</groupId>
+                       <artifactId>pax-exam</artifactId>
+                       <version>${exam.version}</version>
+                       <!-- Compile scope here is intentional, it is used in TestHelper class 
+                               which could be downloaded via nexus and reused in other integration tests. -->
+                       <scope>compile</scope>
+               </dependency>
                <dependency>
                        <groupId>org.ops4j.pax.exam</groupId>
                        <artifactId>pax-exam-link-mvn</artifactId>
                        <artifactId>xtend-lib-osgi</artifactId>
                        <version>2.4.3</version>
                </dependency>
+               <dependency>
+                       <groupId>org.opendaylight.yangtools.model</groupId>
+                       <artifactId>opendaylight-l2-types</artifactId>
+                       <version>${opendaylight-l2-types.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.opendaylight.yangtools.model</groupId>
+                       <artifactId>yang-ext</artifactId>
+                       <version>${yang-ext.version}</version>
+               </dependency>
                <dependency>
                        <groupId>org.opendaylight.controller</groupId>
                        <artifactId>sal-binding-broker-impl</artifactId>
                        <version>1.0-SNAPSHOT</version>
                </dependency>
+               <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-netconf-connector</artifactId>
+            <version>${netconf.version}</version>
+            <scope>test</scope>
+        </dependency>
+               <dependency>
+          <groupId>org.opendaylight.controller.model</groupId>
+          <artifactId>model-inventory</artifactId>
+          <version>${mdsal.version}</version>
+        </dependency>
                <dependency>
                        <groupId>org.javassist</groupId>
                        <artifactId>javassist</artifactId>
index a3ced2e25d89b8b005f5a4af5065fa3934350972..f3849c70b24fa5ce56b859095b2e7d6b9724c01f 100644 (file)
@@ -42,6 +42,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.opendaylight.controller.test.sal.binding.it.TestHelper;
 import org.opendaylight.lispflowmapping.implementation.dao.ClusterDAOService;
 import org.opendaylight.lispflowmapping.implementation.serializer.LispMessage;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapNotifySerializer;
@@ -338,6 +339,12 @@ public class MappingServiceIntegrationTest {
                 mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
                 mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
 
+                TestHelper.baseModelBundles(),
+                TestHelper.configMinumumBundles(),
+                TestHelper.bindingIndependentSalBundles(),
+                TestHelper.bindingAwareSalBundles(),
+                TestHelper.mdSalCoreBundles(),
+
                 // Specific bundles
                 mavenBundle(ODL, "sal-binding-api").versionAsInProject(), //
                 mavenBundle(ODL, "sal-binding-config").versionAsInProject(),