use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromDistinguishedNameTest_withNull.
/**
* Test {@link LispAddressUtil#addressFromDistinguishedName(DistinguishedNameType)} method with null value.
*/
@Test
public void addressFromDistinguishedNameTest_withNull() {
final Address testedAddress = LispAddressUtil.addressFromDistinguishedName(null);
assertNull(testedAddress);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType 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());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method toEid_distinguishedName.
/**
* Test
* - {@link LispAddressUtil#toEid(DistinguishedNameType, InstanceIdType)}
* - {@link LispAddressUtil#asDistinguishedNameEid(String)}
* - {@link LispAddressUtil#asDistinguishedNameEid(String, long)}
* methods with various input.
*/
@Test
public void toEid_distinguishedName() {
Eid eidFromDistinguishedName = LispAddressUtil.toEid(DISTINGUISHED_NAME_TYPE_TEST, INSTANCE_ID_TYPE_TEST);
verifyToEidWithDistinguishedName(eidFromDistinguishedName, true);
eidFromDistinguishedName = LispAddressUtil.asDistinguishedNameEid(DISTINGUISHED_NAME_TYPE_VALUE_TEST);
verifyToEidWithDistinguishedName(eidFromDistinguishedName, false);
eidFromDistinguishedName = LispAddressUtil.asDistinguishedNameEid(DISTINGUISHED_NAME_TYPE_VALUE_WITH_MAC_TEST, INSTANCE_ID_TYPE_VALUE_TEST);
verifyToEidWithMacAddress(eidFromDistinguishedName, true);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromDistinguishedNameTest_withDistinguishedName.
/**
* Test {@link LispAddressUtil#addressFromDistinguishedName(DistinguishedNameType)} method with distinguished name.
*/
@Test
public void addressFromDistinguishedNameTest_withDistinguishedName() {
final DistinguishedNameType distinguishedNameType = new DistinguishedNameType(DISTINGUISHED_NAME_TYPE_VALUE_TEST);
final Address testedAddress = LispAddressUtil.addressFromDistinguishedName(distinguishedNameType);
assertTrue(testedAddress instanceof DistinguishedName);
assertEquals(distinguishedNameType, ((DistinguishedName) testedAddress).getDistinguishedName());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.DistinguishedNameType 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();
}
Aggregations