use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder 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.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder in project lispflowmapping by opendaylight.
the class LispXtrSouthboundHandlerTest method getDefaultMapRequestBuilder.
private static MapRequestBuilder getDefaultMapRequestBuilder() {
final ItrRloc itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddressType(Ipv4BinaryAfi.class).setAddress(new Ipv4BinaryBuilder().setIpv4Binary(new Ipv4AddressBinary(new byte[] { 127, 0, 0, 2 })).build()).build()).build();
final EidItem eidItem = new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_STRING_2 + IPV4_STRING_PREFIX)).build();
return new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc)).setEidItem(Lists.newArrayList(eidItem)).setNonce(NONCE).setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(IPV4_STRING_1)).build()).setAuthoritative(false).setMapDataPresent(false).setPitr(false).setProbe(false).setSmr(false).setSmrInvoked(false);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method removePrefixIfNecessary.
static Eid removePrefixIfNecessary(Eid eid) {
EidBuilder eb = new EidBuilder(eid);
Address address = eid.getAddress();
if (address instanceof Ipv4PrefixBinary) {
Ipv4Binary convertedEid = new Ipv4BinaryBuilder().setIpv4Binary(((Ipv4PrefixBinary) address).getIpv4AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv4BinaryAfi.class).build();
} else if (address instanceof Ipv6PrefixBinary) {
Ipv6Binary convertedEid = new Ipv6BinaryBuilder().setIpv6Binary(((Ipv6PrefixBinary) address).getIpv6AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv6BinaryAfi.class).build();
}
return eid;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method ipAddressToByteArray_ipv4Binary.
/**
* Tests {@link LispAddressUtil#ipAddressToByteArray(Address)} method with ipv4Binary value.
*/
@Test
public void ipAddressToByteArray_ipv4Binary() {
final Ipv4Binary expectedIpv4 = new Ipv4BinaryBuilder().setIpv4Binary(IPV4_ADDRESS_BINARY_TEST).build();
final byte[] testedAddress = LispAddressUtil.ipAddressToByteArray(expectedIpv4);
assertArrayEquals(IPV4_ADDRESS_BYTES_A_TEST, testedAddress);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder in project lispflowmapping by opendaylight.
the class LispAddressUtil method toRloc.
public static Rloc toRloc(Ipv4AddressBinary address) {
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(Ipv4BinaryAfi.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) new Ipv4BinaryBuilder().setIpv4Binary(address).build());
return builder.build();
}
Aggregations