use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class AfiListSerializerTest method serialize__NoAddresses.
@Test
public void serialize__NoAddresses() throws Exception {
AfiListBuilder listBuilder = new AfiListBuilder();
List<SimpleAddress> addressList = new ArrayList<SimpleAddress>();
listBuilder.setAddressList(addressList);
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(AfiListLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder().setAfiList(listBuilder.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
LispAddressSerializer.getInstance().serialize(buf, rb.build());
ByteBuffer expectedBuf = hexToByteBuffer(//
"40 03 00 00 " + "01 00 00 00");
ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class ApplicationDataSerializerTest method deserialize__Simple.
@Test
public void deserialize__Simple() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(//
"40 03 00 00 " + //
"04 20 00 0E " + // IPTOS & protocol
"AA BB CC DD " + // local port range
"A6 A1 A6 A2 " + // remote port range
"FF DD FF DE " + "00 01 11 22 33 44"), // AFI=1, IP=0x11223344
null);
assertEquals(ApplicationDataLcaf.class, address.getAddressType());
ApplicationData appAddress = (ApplicationData) address.getAddress();
assertEquals("17.34.51.68", String.valueOf(appAddress.getApplicationData().getAddress().getValue()));
assertEquals(ByteUtil.getPartialInt(new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC }), appAddress.getApplicationData().getIpTos().intValue());
assertEquals((byte) 0xDD, appAddress.getApplicationData().getProtocol().byteValue());
assertEquals((short) 0xA6A1, appAddress.getApplicationData().getLocalPortLow().getValue().shortValue());
assertEquals((short) 0xA6A2, appAddress.getApplicationData().getLocalPortHigh().getValue().shortValue());
assertEquals((short) 0xFFDD, appAddress.getApplicationData().getRemotePortLow().getValue().shortValue());
assertEquals((short) 0xFFDE, appAddress.getApplicationData().getRemotePortHigh().getValue().shortValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressUtil method convertToBinary.
public static Rloc convertToBinary(Rloc rloc) {
Pair<Class<? extends LispAddressFamily>, Address> converted = convertToBinary(rloc.getAddress());
if (converted.getRight() == null) {
return rloc;
}
RlocBuilder rb = new RlocBuilder(rloc);
rb.setAddressType(converted.getLeft());
rb.setAddress(converted.getRight());
return rb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(MacAddress mac, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(MacAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) new MacBuilder().setMac(mac).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(Ipv4PrefixBinary prefix, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4PrefixBinaryAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) prefix);
return builder.build();
}
Aggregations