Search in sources :

Example 1 with Ipv4PrefixBuilder

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder in project lispflowmapping by opendaylight.

the class SourceDestKeyHelperTest method getSrcTest_sourceDestKey.

/**
 * Tests {@link SourceDestKeyHelper#getSrc} method with SourceDestKey address type.
 */
@Test
public void getSrcTest_sourceDestKey() {
    final Eid expectedResult = new EidBuilder().setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IPV4_PREFIX_SOURCE).build()).setVirtualNetworkId(INSTANCE_ID).setAddressType(Ipv4PrefixAfi.class).build();
    assertEquals(expectedResult, SourceDestKeyHelper.getSrc(EID_SOURCE_DEST_KEY));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv4PrefixAfi(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi) Test(org.junit.Test)

Example 2 with Ipv4PrefixBuilder

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder in project lispflowmapping by opendaylight.

the class LispAddressUtil method toEid.

public static Eid toEid(Ipv4Prefix prefix, InstanceIdType vni) {
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv4PrefixAfi.class);
    builder.setVirtualNetworkId(vni);
    builder.setAddress((Address) new Ipv4PrefixBuilder().setIpv4Prefix(prefix).build());
    return builder.build();
}
Also used : Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Example 3 with Ipv4PrefixBuilder

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder in project lispflowmapping by opendaylight.

the class LispAddressUtil method asIpv4PrefixEid.

public static Eid asIpv4PrefixEid(Eid eid, Inet4Address address, short mask) {
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv4PrefixAfi.class);
    builder.setVirtualNetworkId(eid.getVirtualNetworkId());
    builder.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IetfInetUtil.INSTANCE.ipv4PrefixFor(address, mask)).build());
    return builder.build();
}
Also used : Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Example 4 with Ipv4PrefixBuilder

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__SegmentLCAF.

public void registerAndQuery__SegmentLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipString = "10.20.255.30";
    int instanceId = 6;
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(Ipv4PrefixAfi.class);
    eb.setVirtualNetworkId(new InstanceIdType((long) instanceId));
    eb.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipString)).build());
    MapReply reply = registerAddressAndQuery(eb.build());
    Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(Ipv4PrefixAfi.class, receivedAddress.getAddressType());
    assertEquals(ipString, ((Ipv4Prefix) receivedAddress.getAddress()).getIpv4Prefix().getValue());
    assertEquals(instanceId, receivedAddress.getVirtualNetworkId().getValue().intValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix)

Example 5 with Ipv4PrefixBuilder

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder in project lispflowmapping by opendaylight.

the class SourceDestKeyHelperTest method getDstTest_sourceDestKey.

/**
 * Tests {@link SourceDestKeyHelper#getDst} method with SourceDestKey address type.
 */
@Test
public void getDstTest_sourceDestKey() {
    final Eid expectedResult = new EidBuilder().setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IPV4_PREFIX_DEST).build()).setVirtualNetworkId(INSTANCE_ID).setAddressType(Ipv4PrefixAfi.class).build();
    assertEquals(expectedResult, SourceDestKeyHelper.getDst(EID_SOURCE_DEST_KEY));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv4PrefixAfi(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi) Test(org.junit.Test)

Aggregations

Ipv4PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder)6 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)6 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)3 Test (org.junit.Test)2 Ipv4PrefixAfi (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi)2 InstanceIdType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix)1 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)1 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)1 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)1