fixed northbound source dest mapping and auth TELSDN-644: #close 42/3042/2
authorDavid Goldberg <david.goldberg@contextream.com>
Thu, 21 Nov 2013 05:06:40 +0000 (07:06 +0200)
committerDavid Goldberg <david.goldberg@contextream.com>
Thu, 21 Nov 2013 06:43:02 +0000 (08:43 +0200)
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
Change-Id: Ie62f771d22fa7cbcc733fab072873b7a116fa397
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
31 files changed:
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/EidToLocatorRecordSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/LocatorRecordSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispApplicationDataLCAFAddressSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispListLCAFAddressSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispSegmentLCAFAddressSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispSourceDestLCAFAddressSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispTrafficEngineeringLCAFAddressSerializer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/util/LispAFIConvertor.java [moved from mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/serializer/LispAFIConvertor.java with 98% similarity]
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/util/MaskUtil.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/LispMappingServiceCliTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/authentication/LispAuthenticationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/dao/InMemoryDAOTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MapResolverTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServerTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/MapNotifySerializationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/MapRegisterSerializationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/MapReplySerializationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/MapRequestSerializationTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispApplicationDataLCAFAddressTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispIpv6AddressTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispListLCAFAddressTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispSegmentLCAFAddressTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispSourceDestLCAFAddressTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/serializer/address/LispTrafficEngineeringLCAFAddressTest.java
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/northbound/pom.xml
mappingservice/northbound/src/main/java/org/opendaylight/lispflowmapping/northbound/LispMappingNorthbound.java
mappingservice/northbound/src/main/java/org/opendaylight/lispflowmapping/northbound/YangTransformerNB.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/lisp/LispSouthboundServiceTest.java
mappingservice/yangmodel/src/main/yang/mappingservice.yang

index d29baee9867ffce878b638caf5b71ff043a49be4..75c02d7d50522f48f0cbfe34e7b3ce8b37a82bc7 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKey;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceNoMaskKey;
 import org.opendaylight.lispflowmapping.implementation.lisp.MapResolver;
 import org.opendaylight.lispflowmapping.implementation.lisp.MapServer;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispTypeConverter;
 import org.opendaylight.lispflowmapping.interfaces.dao.IQueryAll;
index dd70e7e15e741c058f7cec3f4391bccbb71352db..4f9b0c063f1a4c6fb8e7cfaedcf4867e5bdcc200 100644 (file)
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.BooleanUtils;
 import org.apache.tomcat.util.buf.HexUtils;
 import org.opendaylight.lispflowmapping.implementation.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.NumberUtil;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord;
index 1180f60b076c4feae2ee455b90848c156ee6b733..d3b674efb4409eb58d43bd4ac622b62ebd1a026c 100644 (file)
@@ -5,6 +5,7 @@ import java.nio.ByteBuffer;
 import org.apache.commons.lang3.BooleanUtils;
 import org.opendaylight.lispflowmapping.implementation.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.NumberUtil;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainerBuilder;
index f564d9b931086e50b073fbfb6d1a912e4f4e1f02..fe7e059378f6d429c879124939727b42b52aa564 100644 (file)
@@ -2,8 +2,8 @@ package org.opendaylight.lispflowmapping.implementation.serializer.address;
 
 import java.nio.ByteBuffer;
 
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.NumberUtil;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index 12373c0162b02602d6a7f72614610567f6ce9d07..86e949a6b626b8f0a3245a97ca5e6ed5cf356ae9 100644 (file)
@@ -4,7 +4,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafListAddress;
index 0cafd8c1e91a8e8af75190748310152ace2bceae..1a75e5343bd61013c3ec537642888ec3c79e1777 100644 (file)
@@ -2,7 +2,7 @@ package org.opendaylight.lispflowmapping.implementation.serializer.address;
 
 import java.nio.ByteBuffer;
 
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafSegmentAddress;
index a308b6ab63b45c4c66c8938151221835d6759e47..8cbbc2b518ea72a49ad46c369def025b733270e8 100644 (file)
@@ -2,7 +2,7 @@ package org.opendaylight.lispflowmapping.implementation.serializer.address;
 
 import java.nio.ByteBuffer;
 
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafSourceDestAddress;
index 420b975a92060cd0d6af90a3ba032848de9ff857..fab820e1a8b56ac89eba22d3f479a6ba17ae0661 100644 (file)
@@ -5,9 +5,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.lang3.BooleanUtils;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.serializer.address.factory.LispAFIAddressSerializerFactory;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafTrafficEngineeringAddress;
index 1304cdbb802479822ab405805d667329fad3f1f3..8f3bff9b463c75186459b70e022d6a87c8f557f9 100644 (file)
@@ -6,7 +6,6 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv4Address;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv6Address;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.Address;
index b0eb0936ae4e620cdd28e61f709ca5175866d15f..7a334014b85ad1cbc260767c460d7180712dcf28 100644 (file)
@@ -18,7 +18,7 @@ import org.jmock.api.Invocation;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.dao.InMemoryDAO;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.tools.junit.MockCommandInterpreter;
index 1b4a12e91a69a9939b0bdc1de4a162d62e8094cc..204c1442119a388c8c6b656a98d84d3d106dc235 100644 (file)
@@ -9,8 +9,8 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Ignore;
 import org.junit.Test;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapRegisterSerializer;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRegister;
index 9fc64d7f28f7323a286e2386f08baf1d473f8b75..a65f976608cf258ab1d572837a458b523a8a652a 100644 (file)
@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispTypeConverter;
 import org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry;
 import org.opendaylight.lispflowmapping.interfaces.dao.MappingServiceRLOC;
index 6f8cce0943e2115bbd42609e774f0b03ef5f8992..9cfeacd2139b9e226ad0abf3d646ed14b981e030 100644 (file)
@@ -15,7 +15,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.dao.IMappingServiceKey;
 import org.opendaylight.lispflowmapping.interfaces.dao.MappingServiceRLOC;
index a17427c4e2f397db8b2f6e9e773ed3930eac7c18..a7d096ca60da1a1afa31018f810dbefff5422d76 100644 (file)
@@ -21,8 +21,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapRegisterSerializer;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.dao.IMappingServiceKey;
 import org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry;
index 5c39ff9d57eec1e94a3a06983f89efb18c4bb20c..c28eb8a573d6990a46e039f9f36f0219819a7338 100644 (file)
@@ -19,6 +19,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapNotify;
index 7a551b8d3559de397c0a0f96af616649b83a4f5a..c9f25342003f1acfca154b341c8007c03fdde805 100644 (file)
@@ -19,6 +19,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
index 186fe86586e6031779a4b25b69b72c0676c297f3..b6a20c0236d67b0c21cfde0c1f44506393412c1c 100644 (file)
@@ -17,6 +17,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Ignore;
 import org.junit.Test;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapReply;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord;
index d986038386230ca23f0fb59676835fda94e16069..c9d39501391d95c218b743b3d9d14afa139ae2a3 100644 (file)
@@ -18,6 +18,7 @@ import java.util.ArrayList;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRequest;
index 75f645b376397ecc108bb8a16a0c63cd7a33c4ea..6cbe049a4865ab8c99274131027bc58690d8127d 100644 (file)
@@ -15,8 +15,8 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index 79eea0077f0aaad617c046824149dca80f397c68..4f3daf8bd6b520e1c73fe66dda93b7b57716ac2e 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.lispflowmapping.implementation.serializer.address;
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Ipv6;
index ee863ae04b34df95078e41e4df392d3d55292415..5b8b6ecaa541695ec1d933b0792c68396a11d2d0 100644 (file)
@@ -19,7 +19,7 @@ import junitx.framework.Assert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index 340b7e6e633b806ed95d803a22a2b3a8526bf5e1..e54150438af9f04a9c05a7fe001d4847ef5a58cc 100644 (file)
@@ -15,7 +15,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index ec35ebd5dd5c7a06723fc801dd286db80bf960fa..53e8604d5d5f8cb81ac9688fb3252d91807a4bd9 100644 (file)
@@ -15,7 +15,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index 7a70a96e3e4ea22c4efa505dece4c687bae382e0..bd2fd7b5ec29b32ad16d451345a2deb9cc8b5602 100644 (file)
@@ -17,7 +17,7 @@ import junitx.framework.ArrayAssert;
 
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.implementation.lisp.exception.LispSerializationException;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
index 0333414956ab16ae7a6578f1567be91496457f17..ce4b2b3e8d608707789dd1bb51427b139348aa0f 100644 (file)
@@ -40,16 +40,15 @@ import org.codehaus.jettison.json.JSONObject;
 import org.codehaus.jettison.json.JSONTokener;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.opendaylight.lispflowmapping.implementation.dao.ClusterDAOService;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.serializer.LispMessage;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapNotifySerializer;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapRegisterSerializer;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapReplySerializer;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapRequestSerializer;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
 import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispPlugin;
@@ -90,11 +89,13 @@ import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispad
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafApplicationDataBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafListBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSegmentBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSourceDest;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSourceDestBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafTrafficEngineeringBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Mac;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.MacBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.NoBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.PrimitiveAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.locatorrecords.LocatorRecord;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.locatorrecords.LocatorRecordBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.mapregisternotification.MapRegisterBuilder;
@@ -483,6 +484,36 @@ public class MappingServiceIntegrationTest {
 
     }
 
+    @Test
+    public void northboundRetrieveSourceDestKey() throws Exception {
+
+        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4 address1 = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) LispAFIConvertor
+                .toPrimitive(LispAFIConvertor.asIPAfiAddress("10.0.0.1"));
+        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4 address2 = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) LispAFIConvertor
+                .toPrimitive(LispAFIConvertor.asIPAfiAddress("10.0.0.2"));
+        int mask1 = 32;
+        int mask2 = 32;
+        LcafSourceDest sourceDestAddress = new LcafSourceDestBuilder().setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
+                .setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
+                .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(address1).build()).setSrcMaskLength((short) mask1)
+                .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(address2).build()).setDstMaskLength((short) mask2).build();
+        String pass = "asdf";
+
+        lms.addAuthenticationKey(LispAFIConvertor.toContainer(sourceDestAddress), mask1, pass);
+
+        // URL url = createGetKeyIPv4URL(address1, mask1);
+        URL url = createGetKeySourceDestURL(address1.getAfi(), ((LispIpv4Address) sourceDestAddress.getSrcAddress().getPrimitiveAddress())
+                .getIpv4Address().getValue(), sourceDestAddress.getSrcMaskLength(), ((LispIpv4Address) sourceDestAddress.getDstAddress()
+                .getPrimitiveAddress()).getIpv4Address().getValue(), sourceDestAddress.getDstMaskLength());
+        String reply = callURL("GET", null, "application/json", null, url);
+        JSONTokener jt = new JSONTokener(reply);
+        JSONObject json = new JSONObject(jt);
+
+        // test that the password matches what was we expected.
+        assertEquals(pass, json.get("key"));
+
+    }
+
     @Test
     public void northboundRetrieveKey() throws Exception {
 
@@ -661,8 +692,6 @@ public class MappingServiceIntegrationTest {
 
     @Test
     public void northboundRetrieveMapping() throws Exception {
-
-        String pass = "";
         LispIpv4Address eid = LispAFIConvertor.asIPAfiAddress("10.0.0.1");
         int mask = 32;
         LispIpv4Address rloc = LispAFIConvertor.asIPAfiAddress("20.0.0.2");
@@ -697,6 +726,52 @@ public class MappingServiceIntegrationTest {
 
     }
 
+    @Test
+    public void northboundRetrieveSourceDestMapping() throws Exception {
+
+        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4 address1 = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) LispAFIConvertor
+                .toPrimitive(LispAFIConvertor.asIPAfiAddress("10.0.0.1"));
+        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4 address2 = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) LispAFIConvertor
+                .toPrimitive(LispAFIConvertor.asIPAfiAddress("10.0.0.2"));
+        int mask1 = 32;
+        int mask2 = 32;
+        LcafSourceDest sourceDestAddress = new LcafSourceDestBuilder().setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
+                .setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
+                .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(address1).build()).setSrcMaskLength((short) mask1)
+                .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(address2).build()).setDstMaskLength((short) mask2).build();
+        LispIpv4Address rloc = LispAFIConvertor.asIPAfiAddress("20.0.0.2");
+
+        // Insert mapping in the database
+        MapRegisterBuilder mapRegister = new MapRegisterBuilder();
+        EidToLocatorRecordBuilder etlr = new EidToLocatorRecordBuilder();
+        etlr.setLispAddressContainer(LispAFIConvertor.toContainer(sourceDestAddress));
+        etlr.setMaskLength((short) mask1);
+        etlr.setRecordTtl(254);
+        etlr.setAuthoritative(false);
+        etlr.setAction(Action.NoAction);
+        LocatorRecordBuilder record = new LocatorRecordBuilder();
+        record.setLispAddressContainer(LispAFIConvertor.toContainer(rloc));
+        record.setRouted(true);
+        etlr.setLocatorRecord(new ArrayList<LocatorRecord>());
+        etlr.getLocatorRecord().add(record.build());
+        mapRegister.setEidToLocatorRecord(new ArrayList<EidToLocatorRecord>());
+        mapRegister.getEidToLocatorRecord().add(etlr.build());
+        lms.handleMapRegister(mapRegister.build());
+
+        // Get mapping using NB interface. No IID used
+        URL url = createGetMappingSourceDestURL(address1.getAfi(), address1.getIpv4Address().getValue(), mask1, address2.getIpv4Address().getValue(),
+                mask2);
+        String reply = callURL("GET", null, "application/json", null, url);
+        JSONTokener jt = new JSONTokener(reply);
+        JSONObject json = new JSONObject(jt);
+
+        // With just one locator, locators is not a JSONArray
+        String rlocRetrieved = json.getJSONObject("locators").getJSONObject("locatorGeneric").getString("ipAddress");
+
+        assertEquals(rloc.getIpv4Address().getValue(), rlocRetrieved);
+
+    }
+
     private URL createGetKeyIPv4URL(LispIpv4Address address, int mask) throws MalformedURLException {
         String restUrl = String.format("http://localhost:8080/lispflowmapping/default/%s/%d/%s/%d", "key", address.getAfi().shortValue(), address
                 .getIpv4Address().getValue(), mask);
@@ -704,6 +779,20 @@ public class MappingServiceIntegrationTest {
         return url;
     }
 
+    private URL createGetKeySourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask) throws MalformedURLException {
+        String restUrl = String.format("http://localhost:8080/lispflowmapping/default/%s/%d/%s/%d/%s/%d", "key", afi, srcAddress, srcMask,
+                dstAddress, dstMask);
+        URL url = new URL(restUrl);
+        return url;
+    }
+
+    private URL createGetMappingSourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask) throws MalformedURLException {
+        String restUrl = String.format("http://localhost:8080/lispflowmapping/default/%s/%d/%s/%d/%s/%d", "mapping", afi, srcAddress, srcMask,
+                dstAddress, dstMask);
+        URL url = new URL(restUrl);
+        return url;
+    }
+
     private URL createGetMappingIPv4URL(int iid, LispIpv4Address address, int mask) throws MalformedURLException {
         String restUrl = String.format("http://localhost:8080/lispflowmapping/default/%s/%d/%d/%s/%d", "mapping", iid, address.getAfi().shortValue(),
                 address.getIpv4Address().getValue(), mask);
index d4010dd8d2b290a2e1a9262aca23ed13ccaad97a..61487925d402097d11c3b8ddb751395e4b5e3352 100644 (file)
                                                        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.maprequest,
                                                        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.maprequestnotification,
                                                        org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.mapregisternotification,
+                                                       org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lcafsourcedestaddress,
+                                                       org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress,
+                                                       org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress,
+                                                       org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924,
                                                        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
                                                        org.opendaylight.lispflowmapping.type,
                                                        org.opendaylight.lispflowmapping.type.lisp,
index 1ea20717a8b8231f9d511853fb4eef10028e1ba4..ff1677863f58c057fb8b6b51078f18ecc007ea7e 100644 (file)
@@ -49,6 +49,7 @@ import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapNotify;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapReply;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainer;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
@@ -373,96 +374,77 @@ public class LispMappingNorthbound implements ILispmappingNorthbound {
         return legacyRecord;
     }
 
-    // /**
-    // * Retrieve a mapping from the LISP mapping system, using
-    // Source-Destination
-    // * LCAF as EID
-    // *
-    // * @param containerName
-    // * name of the container context from which the mapping is going
-    // * to be retrieved
-    // * @param iid
-    // * Instance-ID of the addresses (0 if none)
-    // *
-    // * @param afi
-    // * Address Family of the addresses (IPv4, IPv6 or MAC)
-    // *
-    // * @param srcAdd
-    // * Source address of type defined by afi
-    // *
-    // * @param srcML
-    // * Network mask length of the source address
-    // *
-    // * @param dstAdd
-    // * Destination address of type defined by afi
-    // *
-    // * @param dstML
-    // * Network mask length of the destination address
-    // *
-    // * @return EidToLocatorRecord as a JSON object
-    // *
-    // * <pre>
-    // * Example:
-    // *
-    // * Request URL:
-    // *
-    // http://localhost:8080/lispflowmapping/default/mapping/0/1/10.0.0.1/32/20.0.0.2/32
-    // *
-    // * </pre>
-    // */
-    //
-    // @Path("/{containerName}/mapping/{iid}/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
-    // @GET
-    // @Produces(MediaType.APPLICATION_JSON)
-    // @StatusCodes({ @ResponseCode(code = 401, condition =
-    // "User not authorized to perform this operation"),
-    // @ResponseCode(code = 404, condition =
-    // "The containerName passed was not found"),
-    // @ResponseCode(code = 503, condition = "Service unavailable") })
-    // public EidToLocatorRecord getMapping(@PathParam("containerName") String
-    // containerName, @PathParam("iid") int iid, @PathParam("afi") int afi,
-    // @PathParam("srcAdd") String srcAdd, @PathParam("srcML") int srcML,
-    // @PathParam("dstAdd") String dstAdd, @PathParam("dstML") int dstML) {
-    //
-    // handleContainerDoesNotExist(containerName);
-    //
-    // authorizationCheck(containerName, Privilege.READ);
-    //
-    // LispAddressGeneric srcGeneric = new LispAddressGeneric(afi, srcAdd);
-    // LispAddressGeneric dstGeneric = new LispAddressGeneric(afi, dstAdd);
-    //
-    // if (iid != 0) {
-    // srcGeneric = new
-    // LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode(),
-    // srcGeneric);
-    // srcGeneric.setLcafType(LispCanonicalAddressFormatEnum.SEGMENT.getLispCode());
-    // srcGeneric.setInstanceId(iid);
-    //
-    // dstGeneric = new
-    // LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode(),
-    // dstGeneric);
-    // dstGeneric.setLcafType(LispCanonicalAddressFormatEnum.SEGMENT.getLispCode());
-    // dstGeneric.setInstanceId(iid);
-    // }
-    //
-    // LispAddressGeneric eidGeneric = new
-    // LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode());
-    //
-    // eidGeneric.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
-    // eidGeneric.setSrcAddress(srcGeneric);
-    // eidGeneric.setSrcMaskLength((byte) srcML);
-    // eidGeneric.setDstAddress(dstGeneric);
-    // eidGeneric.setDstMaskLength((byte) dstML);
-    //
-    // int mask = 0; //Not used here
-    //
-    // EidToLocatorRecord record = lookupEID(containerName, mask,
-    // LispAddressConvertorNB.convertToLispAddress(eidGeneric));
-    //
-    // LispAddressConvertorNB.convertRecordToGenericAddress(record);
-    //
-    // return record;
-    // }
+    /**
+     * Retrieve a mapping from the LISP mapping system, using Source-Destination
+     * LCAF as EID
+     * 
+     * @param containerName
+     *            name of the container context from which the mapping is going
+     *            to be retrieved
+     * @param iid
+     *            Instance-ID of the addresses (0 if none)
+     * 
+     * @param afi
+     *            Address Family of the addresses (IPv4, IPv6 or MAC)
+     * 
+     * @param srcAdd
+     *            Source address of type defined by afi
+     * 
+     * @param srcML
+     *            Network mask length of the source address
+     * 
+     * @param dstAdd
+     *            Destination address of type defined by afi
+     * 
+     * @param dstML
+     *            Network mask length of the destination address
+     * 
+     * @return EidToLocatorRecord as a JSON object
+     * 
+     *         <pre>
+     * Example:
+     * 
+     * Request URL:
+     * 
+     *      http://localhost:8080/lispflowmapping/default/mapping/0/1/10.0.0.1/32/20.0.0.2/32
+     * 
+     * </pre>
+     */
+
+    @Path("/{containerName}/mapping/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+            @ResponseCode(code = 404, condition = "The containerName passed was not found"),
+            @ResponseCode(code = 503, condition = "Service unavailable") })
+    public org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord getMapping(@PathParam("containerName") String containerName,
+            @PathParam("afi") int afi, @PathParam("srcAdd") String srcAdd, @PathParam("srcML") int srcML, @PathParam("dstAdd") String dstAdd,
+            @PathParam("dstML") int dstML) {
+
+        handleContainerDoesNotExist(containerName);
+
+        authorizationCheck(containerName, Privilege.READ);
+
+        LispAddressGeneric srcGeneric = new LispAddressGeneric(afi, srcAdd);
+        LispAddressGeneric dstGeneric = new LispAddressGeneric(afi, dstAdd);
+
+        LispAddressGeneric eidGeneric = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode());
+
+        eidGeneric.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
+        eidGeneric.setSrcAddress(srcGeneric);
+        eidGeneric.setSrcMaskLength((byte) srcML);
+        eidGeneric.setDstAddress(dstGeneric);
+        eidGeneric.setDstMaskLength((byte) dstML);
+
+        int mask = 0; // Not used here
+
+        EidToLocatorRecord record = lookupEID(containerName, mask, LispAddressConvertorNB.convertToLispAddress(eidGeneric));
+
+        org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord legacyRecord = YangTransformerNB.reTransformEidToLocatorRecord(record);
+        LispAddressConvertorNB.convertRecordToGenericAddress(legacyRecord);
+
+        return legacyRecord;
+    }
 
     /**
      * Set the authentication key for an EID prefix
@@ -606,93 +588,86 @@ public class LispMappingNorthbound implements ILispmappingNorthbound {
         return authKeyNB;
     }
 
-    // /**
-    // * Retrieve a key used to register a Source-Destination LCAF EID prefix
-    // *
-    // * @param containerName
-    // * name of the container context from which the key is going to
-    // * be retrieved
-    // *
-    // * @param afi
-    // * Address Family of the addresses (IPv4, IPv6 or MAC)
-    // *
-    // * @param srcAdd
-    // * Source address of type defined by afi
-    // *
-    // * @param srcML
-    // * Network mask length of the source address
-    // *
-    // * @param dstAdd
-    // * Destination address of type defined by afi
-    // *
-    // * @param dstML
-    // * Network mask length of the destination address
-    // *
-    // * @return AuthKeyNB as a JSON object
-    // *
-    // * <pre>
-    // * Example:
-    // *
-    // * Request URL:
-    // *
-    // http://localhost:8080/lispflowmapping/default/key/1/10.0.0.1/32/20.0.0.2/32
-    // *
-    // * </pre>
-    // */
-    //
-    // @Path("/{containerName}/key/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
-    // @GET
-    // @Produces(MediaType.APPLICATION_JSON)
-    // @StatusCodes({ @ResponseCode(code = 401, condition =
-    // "User not authorized to perform this operation"),
-    // @ResponseCode(code = 404, condition =
-    // "The containerName passed was not found"),
-    // @ResponseCode(code = 503, condition = "Service unavailable") })
-    // public AuthKeyNB getAuthKey(@PathParam("containerName") String
-    // containerName, @PathParam("afi") int afi, @PathParam("srcAdd") String
-    // srcAdd,
-    // @PathParam("srcML") int srcML, @PathParam("dstAdd") String dstAdd,
-    // @PathParam("dstML") int dstML) {
-    //
-    // handleContainerDoesNotExist(containerName);
-    //
-    // authorizationCheck(containerName, Privilege.READ);
-    //
-    // LispAddressGeneric srcGeneric = new LispAddressGeneric(afi, srcAdd);
-    // LispAddressGeneric dstGeneric = new LispAddressGeneric(afi, dstAdd);
-    //
-    // LispAddressGeneric lispAddressGeneric = new
-    // LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode());
-    //
-    // lispAddressGeneric.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
-    // lispAddressGeneric.setSrcAddress(srcGeneric);
-    // lispAddressGeneric.setSrcMaskLength((byte) srcML);
-    // lispAddressGeneric.setDstAddress(dstGeneric);
-    // lispAddressGeneric.setDstMaskLength((byte) dstML);
-    //
-    // LispAddress lispAddress =
-    // LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
-    //
-    // INorthboundService nbService = (INorthboundService)
-    // ServiceHelper.getInstance(INorthboundService.class, containerName, this);
-    //
-    // int mask = 0; //Not used here
-    //
-    // String key =
-    // nbService.getMappingService().getAuthenticationKey(lispAddress, mask);
-    //
-    // if (key == null) {
-    // return null;
-    // }
-    //
-    // AuthKeyNB authKeyNB = new AuthKeyNB();
-    //
-    // authKeyNB.setKey(key);
-    // authKeyNB.setAddress(lispAddressGeneric);
-    // authKeyNB.setMaskLength(mask);
-    //
-    // return authKeyNB;
-    // }
+    /**
+     * Retrieve a key used to register a Source-Destination LCAF EID prefix
+     * 
+     * @param containerName
+     *            name of the container context from which the key is going to
+     *            be retrieved
+     * 
+     * @param afi
+     *            Address Family of the addresses (IPv4, IPv6 or MAC)
+     * 
+     * @param srcAdd
+     *            Source address of type defined by afi
+     * 
+     * @param srcML
+     *            Network mask length of the source address
+     * 
+     * @param dstAdd
+     *            Destination address of type defined by afi
+     * 
+     * @param dstML
+     *            Network mask length of the destination address
+     * 
+     * @return AuthKeyNB as a JSON object
+     * 
+     *         <pre>
+     * Example:
+     * 
+     * Request URL:
+     * 
+     *      http://localhost:8080/lispflowmapping/default/key/1/10.0.0.1/32/20.0.0.2/32
+     * 
+     * </pre>
+     */
+
+    @Path("/{containerName}/key/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+            @ResponseCode(code = 404, condition = "The containerName passed was not found"),
+            @ResponseCode(code = 503, condition = "Service unavailable") })
+    public AuthKeyNB getAuthKey(@PathParam("containerName") String containerName, @PathParam("afi") int afi, @PathParam("srcAdd") String srcAdd,
+            @PathParam("srcML") int srcML, @PathParam("dstAdd") String dstAdd, @PathParam("dstML") int dstML) {
+
+        handleContainerDoesNotExist(containerName);
+
+        authorizationCheck(containerName, Privilege.READ);
+
+        LispAddressGeneric srcGeneric = new LispAddressGeneric(afi, srcAdd);
+        LispAddressGeneric dstGeneric = new LispAddressGeneric(afi, dstAdd);
+
+        LispAddressGeneric lispAddressGeneric = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode());
+
+        lispAddressGeneric.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
+        lispAddressGeneric.setSrcAddress(srcGeneric);
+        lispAddressGeneric.setSrcMaskLength((byte) srcML);
+        lispAddressGeneric.setDstAddress(dstGeneric);
+        lispAddressGeneric.setDstMaskLength((byte) dstML);
+
+        LispAddress lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
+
+        ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
+
+        int mask = 0; // Not used here
+
+        LispAddressContainer yangAddress = YangTransformerNB.transformLispAddress(lispAddress);
+
+        String key = nbService.getMappingService().getAuthenticationKey(yangAddress, mask);
+
+        if (key == null) {
+            return null;
+        }
+
+        AuthKeyNB authKeyNB = new AuthKeyNB();
+
+        authKeyNB.setKey(key);
+        authKeyNB.setAddress(lispAddressGeneric);
+        authKeyNB.setMaskLength(mask);
+
+        return authKeyNB;
+    }
 
     /**
      * Delete the key used to register an EID prefix
index 7ad5750a86bf64a2ae1fe4df98b2dd4de0ea1f21..37378662dd4589582949e1bc1a9745acdc3ee851 100644 (file)
@@ -12,23 +12,35 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafSourceDestAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispLcafAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRegister;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRequest;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidrecords.EidRecordBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord.Action;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecordBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lcafsourcedestaddress.DstAddressBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lcafsourcedestaddress.SrcAddressBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainer;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainerBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.Address;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.AS;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.ASBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.DistinguishedName;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Ipv4;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Ipv6;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSegment;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSourceDest;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.LcafSourceDestBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.Mac;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.NoBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.PrimitiveAddress;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.DistinguishedNameBuilder;
+import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.MacBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.locatorrecords.LocatorRecord;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.locatorrecords.LocatorRecordBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.mapregisternotification.MapRegisterBuilder;
@@ -37,12 +49,15 @@ import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.maprequest.ItrRloc
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.maprequest.SourceEidBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.maprequestnotification.MapRequestBuilder;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
+import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
 import org.opendaylight.lispflowmapping.type.lisp.EidRecord;
 import org.opendaylight.lispflowmapping.type.lisp.MapReplyAction;
 import org.opendaylight.lispflowmapping.type.lisp.address.LispASAddress;
 import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
 import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
 import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv6Address;
+import org.opendaylight.lispflowmapping.type.lisp.address.LispLCAFAddress;
+import org.opendaylight.lispflowmapping.type.lisp.address.LispSourceDestLCAFAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
 import org.slf4j.Logger;
@@ -90,6 +105,28 @@ public class YangTransformerNB {
             lispAFIAddress = new Ipv6Builder().setIpv6Address(ipv6Address).setAfi(ianaCode).build();
             break;
         case LCAF:
+            LispLCAFAddress lcafAddress = (LispLCAFAddress) lispAddress;
+            switch (lcafAddress.getType()) {
+            case SOURCE_DEST:
+                LispSourceDestLCAFAddress sourceDest = (LispSourceDestLCAFAddress) lcafAddress;
+                LcafSourceDestBuilder SourceDestBuider = new LcafSourceDestBuilder();
+                SourceDestBuider
+                        .setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
+                        .setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
+                        .setSrcMaskLength((short) sourceDest.getSrcMaskLength())
+                        .setDstMaskLength((short) sourceDest.getDstMaskLength())
+                        .setSrcAddress(
+                                new SrcAddressBuilder().setPrimitiveAddress(
+                                        toPrimitive((LispAFIAddress) transformLispAddress(sourceDest.getSrcAddress()).getAddress())).build())
+                        .setDstAddress(
+                                new DstAddressBuilder().setPrimitiveAddress(
+                                        toPrimitive((LispAFIAddress) transformLispAddress(sourceDest.getDstAddress()).getAddress())).build());
+                lispAFIAddress = SourceDestBuider.build();
+                break;
+
+            default:
+                break;
+            }
             break;
         case MAC:
             break;
@@ -122,6 +159,23 @@ public class YangTransformerNB {
             org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv6Address lispIpv6Address = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv6Address) address;
             legacyAddres = new LispIpv6Address(lispIpv6Address.getIpv6Address().getValue());
             break;
+        case 16387:
+            LispLcafAddress lcafAddress = (LispLcafAddress) address;
+            short lcafType = lcafAddress.getLcafType();
+            switch (lcafType) {
+            case 12:
+                LcafSourceDest yangSourceDest = (LcafSourceDest) lcafAddress;
+                LispSourceDestLCAFAddress sourceDest = new LispSourceDestLCAFAddress((byte) 0);
+                sourceDest.setSrcAddress(transformToLispAddress(toContainer(toNonPrimitive(yangSourceDest.getSrcAddress().getPrimitiveAddress()))));
+                sourceDest.setDstAddress(transformToLispAddress(toContainer(toNonPrimitive(yangSourceDest.getDstAddress().getPrimitiveAddress()))));
+                sourceDest.setSrcMaskLength(yangSourceDest.getSrcMaskLength().byteValue());
+                sourceDest.setDstMaskLength(yangSourceDest.getDstMaskLength().byteValue());
+                legacyAddres = sourceDest;
+                break;
+
+            default:
+                break;
+            }
         default:
 
             break;
@@ -244,4 +298,53 @@ public class YangTransformerNB {
 
     }
 
+    public static PrimitiveAddress toPrimitive(LispAFIAddress address) {
+        if (address instanceof Ipv4) {
+            return new org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4Builder()
+                    .setIpv4Address(((Ipv4) address).getIpv4Address()).setAfi(address.getAfi()).build();
+        }
+        if (address instanceof Ipv6) {
+            return new org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv6Builder()
+                    .setIpv6Address(((Ipv6) address).getIpv6Address()).setAfi(address.getAfi()).build();
+        }
+        if (address instanceof Mac) {
+            return new MacBuilder().setAfi(address.getAfi()).setMacAddress(((Mac) address).getMacAddress()).build();
+        }
+        if (address instanceof DistinguishedName) {
+            return new DistinguishedNameBuilder().setAfi(address.getAfi()).setDistinguishedName(((DistinguishedName) address).getDistinguishedName())
+                    .build();
+        }
+        return null;
+    }
+
+    public static LispAFIAddress toNonPrimitive(PrimitiveAddress address) {
+        if (address instanceof org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) {
+            return new Ipv4Builder()
+                    .setIpv4Address(
+                            ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4) address)
+                                    .getIpv4Address()).setAfi(((LispAFIAddress) address).getAfi()).build();
+        }
+        if (address instanceof org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv6) {
+            return new Ipv6Builder()
+                    .setIpv6Address(
+                            ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv6) address)
+                                    .getIpv6Address()).setAfi(((LispAFIAddress) address).getAfi()).build();
+        }
+        if (address instanceof org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Mac) {
+            return new org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.MacBuilder()
+                    .setAfi(((LispAFIAddress) address).getAfi())
+                    .setMacAddress(
+                            ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Mac) address).getMacAddress())
+                    .build();
+        }
+        if (address instanceof org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.DistinguishedName) {
+            return new org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address.DistinguishedNameBuilder()
+                    .setAfi(((LispAFIAddress) address).getAfi())
+                    .setDistinguishedName(
+                            ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.DistinguishedName) address)
+                                    .getDistinguishedName()).build();
+        }
+        return null;
+    }
+
 }
index 07c9d77fa2e5f256364059b63ea13779dc752747..915754abcf4a1bf33ed710cec95248937cae9f7f 100644 (file)
@@ -27,12 +27,12 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.lispflowmapping.implementation.serializer.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.serializer.LispMessage;
 import org.opendaylight.lispflowmapping.implementation.serializer.LispMessageEnum;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapNotifySerializer;
 import org.opendaylight.lispflowmapping.implementation.serializer.MapReplySerializer;
 import org.opendaylight.lispflowmapping.implementation.util.ByteUtil;
+import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.implementation.util.MapNotifyBuilderHelper;
 import org.opendaylight.lispflowmapping.southbound.lisp.exception.LispMalformedPacketException;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
index c49c496f19ac5ff41b9db4c188d3954a805b09f7..3f5e5ce1d6cdb5d485b877ecf31da352ed144c91 100755 (executable)
              leaf dstMaskLength {
                  type uint8;
               }
-              leaf reserved {
-                  type int16;
-              }
         }
         
         grouping LcafApplicationDataAddress {