use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName in project lispflowmapping by opendaylight.
the class LispSimpleAddressStringifierTest method getStringTest_asDistinguishedName.
/**
* Tests {@link LispSimpleAddressStringifier#getString} with DistinguishedName.
*/
@Test
public void getStringTest_asDistinguishedName() {
DistinguishedName distinguishedNameMock = Mockito.mock(DistinguishedName.class);
Mockito.when(distinguishedNameMock.getDistinguishedName()).thenReturn(DISTINGUISHED_NAME);
SimpleAddress simpleAddress = new SimpleAddress(distinguishedNameMock.getDistinguishedName());
assertEquals(DISTINGUISHED_NAME.getValue(), LispSimpleAddressStringifier.getString(simpleAddress));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__EmptyString.
@Test
public void deserialize__EmptyString() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 00"), null);
assertEquals(DistinguishedNameAfi.class, address.getAddressType());
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("", distinguishedName.getDistinguishedName().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__DavidString.
@Test
public void deserialize__DavidString() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 64 61 76 69 64 00"), null);
assertEquals(DistinguishedNameAfi.class, address.getAddressType());
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("david", distinguishedName.getDistinguishedName().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__ReadUntilZero.
@Test
public void deserialize__ReadUntilZero() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 64 61 76 00 69 64"), null);
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("dav", distinguishedName.getDistinguishedName().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromSimpleAddressTest_asAddress.
/**
* Tests {@link LispAddressUtil#addressTypeFromSimpleAddress} and {@link
* LispAddressUtil#addressFromSimpleAddress} methods
* with general address.
*/
@Test
public void addressFromSimpleAddressTest_asAddress() {
final SimpleAddress simpleAddress = new SimpleAddress(DUMMY_CHARACTER_ARRAY_TEST);
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(simpleAddress);
assertEquals(DistinguishedNameAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromSimpleAddress(simpleAddress);
assertTrue(address instanceof DistinguishedName);
}
Aggregations