* and is availabl at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.lispflowmapping.type.lisp;
+package org.opendaylight.lispflowmapping.southbound.serializer;
import static org.junit.Assert.assertEquals;
import org.junit.Ignore;
import org.junit.Test;
+import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
+import org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord;
+import org.opendaylight.lispflowmapping.type.lisp.LocatorRecord;
+import org.opendaylight.lispflowmapping.type.lisp.MapReply;
+import org.opendaylight.lispflowmapping.type.lisp.MapReplyAction;
import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv6Address;
-import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
-public class MapReplyTest extends BaseTestCase {
+public class MapReplySerializationTest extends BaseTestCase {
@Test
@Ignore
mr.setProbe(true);
mr.setEchoNonceEnabled(false);
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
byte firstByte = packet.get(0);
assertHexEquals((byte) 0x28, firstByte);
mr.setProbe(false);
mr.setEchoNonceEnabled(true);
- packet = mr.serialize();
+ packet = MapReplySerializer.getInstance().serialize(mr);
firstByte = packet.get(0);
assertHexEquals((byte) 0x24, firstByte);
}
mr.addEidToLocator(new EidToLocatorRecord().setPrefix(new LispIpv6Address("::8")));
mr.addEidToLocator(new EidToLocatorRecord().setPrefix(new LispIpv4Address(0x08020405)));
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
assertEquals(2, packet.get(3));
packet.position(24); /* EID in first record */
eidToLocator.setPrefix(new LispIpv4Address(1));
mr.addEidToLocator(eidToLocator);
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
packet.position(18);
assertHexEquals((byte) 0x00, packet.get()); // MapReplyAction.NoAction
eidToLocator.setAction(null);
mr.addEidToLocator(eidToLocator);
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
packet.position(18);
assertHexEquals((byte) 0x00, packet.get()); // MapReplyAction.NoAction
eidToLocator2.setMapVersion((short) 29);
mr.addEidToLocator(eidToLocator2);
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
packet.position(12); /* First record */
assertEquals(7, packet.getInt());
mr.addEidToLocator(eidToLocator);
- ByteBuffer packet = mr.serialize();
+ ByteBuffer packet = MapReplySerializer.getInstance().serialize(mr);
packet.position(12 + 16); /* First locator record */
assertHexEquals((byte) 0xF3, packet.get());