use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method asKeyValueAddressEid.
public static Eid asKeyValueAddressEid(SimpleAddress key, SimpleAddress value) {
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(key);
kvab.setValue(value);
KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(kvab.build()).build();
EidBuilder builder = new EidBuilder();
builder.setAddressType(KeyValueAddressLcaf.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) address);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(Ipv4AddressBinary address, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4BinaryAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) new Ipv4BinaryBuilder().setIpv4Binary(address).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method asSrcDstEid.
public static Eid asSrcDstEid(SourceDestKey sd, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(SourceDestKeyLcaf.class);
builder.setVirtualNetworkId(vni);
builder.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(sd).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(IpPrefix prefix, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddress(addressFromIpPrefix(prefix));
builder.setAddressType(addressTypeFromIpPrefix(prefix));
builder.setVirtualNetworkId(vni);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.
the class KeyValueAddressSerializerTest method serialize__Simple.
@Test
public void serialize__Simple() throws Exception {
KeyValueAddressBuilder addressBuilder = new KeyValueAddressBuilder();
addressBuilder.setKey(new SimpleAddress(new IpAddress(new Ipv4Address("17.34.51.68"))));
addressBuilder.setValue(new SimpleAddress(new IpAddress(new Ipv4Address("34.51.68.85"))));
EidBuilder eb = new EidBuilder();
eb.setAddressType(KeyValueAddressLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress((Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(addressBuilder.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
LispAddressSerializer.getInstance().serialize(buf, eb.build());
ByteBuffer expectedBuf = hexToByteBuffer(//
"40 03 00 00 " + //
"0F 00 00 0C " + // AFI=1, IP=0x11223344
"00 01 11 22 33 44 " + // AFI=1, IP=0x22334455
"00 01 22 33 44 55");
ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
}
Aggregations