use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder 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.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder 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());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder in project lispflowmapping by opendaylight.
the class KeyValueAddressSerializer method deserializeData.
private Address deserializeData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
SimpleAddress keyAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
SimpleAddress valueAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(keyAddress);
kvab.setValue(valueAddress);
return 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();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method asKeyValueAddressRloc.
public static Rloc asKeyValueAddressRloc(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();
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(KeyValueAddressLcaf.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) address);
return builder.build();
}
Aggregations