use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class LispAuthenticationTest method validate__NoAuthentication.
@Test
public void validate__NoAuthentication() throws Exception {
// LISP(Type = 3 Map-Register, P=1, M=1
// Record Counter: 1
// Nonce: (something)
// Key ID: 0x0000
// AuthDataLength: 0:
// EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
// No-Action
// Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
final ByteBuffer byteBuffer = hexToByteBuffer("38 00 01 01 FF BB " + "00 00 00 00 00 00 00 00 00 00 " + "00 00 " + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a");
MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
assertTrue(validate(mapRegister, byteBuffer, EID, 0, PASSWORD));
assertTrue(validate(mapRegister, byteBuffer, EID, 0, WRONG_PASSWORD));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asLocatorRecords.
/**
* Tests {@link LispAddressUtil#asLocatorRecords(List)} method.
*/
@Test
public void asLocatorRecords() {
final List<Rloc> expectedRlocs = Arrays.asList(LispAddressUtil.toRloc(IPV4_ADDRESS_TEST), LispAddressUtil.toRloc(IPV6_ADDRESS_TEST));
final List<LocatorRecord> locatorRecords = LispAddressUtil.asLocatorRecords(expectedRlocs);
assertEquals(expectedRlocs.size(), locatorRecords.size());
for (Rloc rloc : expectedRlocs) {
assertTrue("Rloc " + rloc + " should be part of " + "locator records list list", isRlocInLocatorRecords(locatorRecords, rloc));
}
for (LocatorRecord locatorRecord : locatorRecords) {
assertFalse(locatorRecord.isLocalLocator());
assertFalse(locatorRecord.isRlocProbed());
assertTrue(locatorRecord.isRouted());
assertTrue(1 == locatorRecord.getWeight());
assertTrue(1 == locatorRecord.getPriority());
assertTrue(1 == locatorRecord.getMulticastWeight());
assertTrue(1 == locatorRecord.getMulticastPriority());
assertEquals("SFC_LISP", locatorRecord.getLocatorId());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asKeyValueAddress.
/**
* Tests {@link LispAddressUtil#asKeyValueAddress(String, SimpleAddress)} method.
*/
@Test
public void asKeyValueAddress() {
final Rloc rloc = LispAddressUtil.asKeyValueAddress(DISTINGUISHED_NAME_TYPE_VALUE_TEST, SIMPLE_ADDRESS_MAC_TEST);
verifyKeyValueAddress(rloc, SIMPLE_ADDRESS_DISTINGUISHED_TEST);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method toRloc.
/**
* Tests:
* - {@link LispAddressUtil#toRloc(InetAddress)}
* - {@link LispAddressUtil#toRloc(Ipv4Address)}
* - {@link LispAddressUtil#toRloc(Ipv6Address)}
* - {@link LispAddressUtil#toRloc(SimpleAddress)}
* methods.
*/
@Test
public void toRloc() throws UnknownHostException {
InetAddress ipv4AddressInet = Inet4Address.getByAddress(IPV4_ADDRESS_BYTES_A_TEST);
final Rloc rlocFromInetAddress = LispAddressUtil.toRloc(ipv4AddressInet);
assertEquals(Ipv4BinaryAfi.class, rlocFromInetAddress.getAddressType());
assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromInetAddress.getAddress()).getIpv4Binary());
final Rloc rlocFromIpv4Address = LispAddressUtil.toRloc(IPV4_ADDRESS_TEST);
assertEquals(Ipv4Afi.class, rlocFromIpv4Address.getAddressType());
assertEquals(IPV4_ADDRESS_VALUE_TEST, ((Ipv4) rlocFromIpv4Address.getAddress()).getIpv4().getValue());
final Rloc rlocFromIpv6Address = LispAddressUtil.toRloc(IPV6_ADDRESS_TEST);
assertEquals(Ipv6Afi.class, rlocFromIpv6Address.getAddressType());
assertEquals(IPV6_ADDRESS_VALUE_TEST, ((Ipv6) rlocFromIpv6Address.getAddress()).getIpv6().getValue());
final Rloc rlocFromSimpleAddress = LispAddressUtil.toRloc(SIMPLE_ADDRESS_IPV4_TEST);
assertEquals(Ipv4BinaryAfi.class, rlocFromSimpleAddress.getAddressType());
assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromSimpleAddress.getAddress()).getIpv4Binary());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class LocatorRecordSerializer method deserialize.
protected LocatorRecord deserialize(ByteBuffer buffer) {
LocatorRecordBuilder builder = new LocatorRecordBuilder();
builder.setPriority((short) ByteUtil.getUnsignedByte(buffer));
builder.setWeight((short) ByteUtil.getUnsignedByte(buffer));
builder.setMulticastPriority((short) ByteUtil.getUnsignedByte(buffer));
builder.setMulticastWeight((short) ByteUtil.getUnsignedByte(buffer));
byte flags = (byte) buffer.getShort();
builder.setLocalLocator(ByteUtil.extractBit(flags, Flags.LOCAL_LOCATOR));
builder.setRlocProbed(ByteUtil.extractBit(flags, Flags.RLOC_PROBED));
builder.setRouted(ByteUtil.extractBit(flags, Flags.ROUTED));
Rloc rloc = LispAddressSerializer.getInstance().deserializeRloc(buffer);
builder.setRloc(rloc);
builder.setLocatorId(LispAddressStringifier.getString(rloc));
return builder.build();
}
Aggregations