use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toRloc.
public static Rloc toRloc(Ipv6AddressBinary address) {
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(Ipv6BinaryAfi.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) new Ipv6BinaryBuilder().setIpv6Binary(address).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toRloc.
public static Rloc toRloc(InetAddress address) {
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(binaryAddressTypeFromInet(address));
builder.setVirtualNetworkId(null);
builder.setAddress(binaryAddressFromInet(address));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toRloc.
public static Rloc toRloc(Ipv6Address address) {
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(Ipv6Afi.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) new Ipv6Builder().setIpv6(address).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method asTeLcafRloc.
public static Rloc asTeLcafRloc(List<IpAddress> hopList) {
ExplicitLocatorPathBuilder teAddrBuilder = new ExplicitLocatorPathBuilder();
teAddrBuilder.setHop(new ArrayList<Hop>());
for (IpAddress hop : hopList) {
HopBuilder hopBuilder = new HopBuilder();
hopBuilder.setAddress(new SimpleAddress(hop));
hopBuilder.setHopId("Hop " + teAddrBuilder.getHop().size());
hopBuilder.setLrsBits(new LrsBits(false, false, false));
teAddrBuilder.getHop().add(hopBuilder.build());
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder elpBuilder = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder();
elpBuilder.setExplicitLocatorPath(teAddrBuilder.build());
RlocBuilder teBuilder = new RlocBuilder();
teBuilder.setAddress(elpBuilder.build());
teBuilder.setAddressType(ExplicitLocatorPathLcaf.class);
return teBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializerTest method serialize__Simple.
@Test
public void serialize__Simple() throws Exception {
List<Hop> hops = new ArrayList<Hop>();
hops.add(new HopBuilder().setAddress(SimpleAddressBuilder.getDefaultInstance("170.187.204.221")).build());
hops.add(new HopBuilder().setAddress(SimpleAddressBuilder.getDefaultInstance("17.34.51.68")).build());
ExplicitLocatorPathBuilder elpb = new ExplicitLocatorPathBuilder();
elpb.setHop(hops);
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ExplicitLocatorPathLcaf.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.ExplicitLocatorPathBuilder().setExplicitLocatorPath(elpb.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
LispAddressSerializer.getInstance().serialize(buf, rb.build());
ByteBuffer expectedBuf = hexToByteBuffer(//
"40 03 00 00 " + //
"0A 00 00 10 " + // IPv4
"00 00 00 01 AA BB CC DD " + // IPv4
"00 00 00 01 11 22 33 44");
ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
}
Aggregations