Search in sources :

Example 1 with DistinguishedNameBuilder

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

the class DistinguishedNameSerializer method deserializeEidData.

@Override
protected Eid deserializeEidData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(DistinguishedNameAfi.class);
    eb.setVirtualNetworkId(getVni(ctx));
    eb.setAddress(new DistinguishedNameBuilder().setDistinguishedName(deserializeData(buffer)).build());
    return eb.build();
}
Also used : DistinguishedNameBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Example 2 with DistinguishedNameBuilder

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

the class DistinguishedNameSerializerTest method serialize__Simple.

@Test
public void serialize__Simple() throws Exception {
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(DistinguishedNameAfi.class);
    eb.setVirtualNetworkId(null);
    eb.setAddress(new DistinguishedNameBuilder().setDistinguishedName(new DistinguishedNameType("david")).build());
    ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
    LispAddressSerializer.getInstance().serialize(buf, eb.build());
    ByteBuffer expectedBuf = hexToByteBuffer("00 11 64 61 76 69 64 00");
    ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
}
Also used : DistinguishedNameBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) DistinguishedNameType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 3 with DistinguishedNameBuilder

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

the class LispAddressUtil method toEid.

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

Example 4 with DistinguishedNameBuilder

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

the class DistinguishedNameSerializer method deserializeRlocData.

@Override
protected Rloc deserializeRlocData(ByteBuffer buffer) {
    RlocBuilder rb = new RlocBuilder();
    rb.setAddressType(DistinguishedNameAfi.class);
    rb.setVirtualNetworkId(null);
    rb.setAddress(new DistinguishedNameBuilder().setDistinguishedName(deserializeData(buffer)).build());
    return rb.build();
}
Also used : DistinguishedNameBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder) RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)

Aggregations

DistinguishedNameBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder)4 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)3 ByteBuffer (java.nio.ByteBuffer)1 Test (org.junit.Test)1 DistinguishedNameType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType)1 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)1