Search in sources :

Example 1 with DistinguishedName

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));
}
Also used : DistinguishedName(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Test(org.junit.Test)

Example 2 with DistinguishedName

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());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) DistinguishedName(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName) Test(org.junit.Test)

Example 3 with DistinguishedName

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());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) DistinguishedName(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName) Test(org.junit.Test)

Example 4 with DistinguishedName

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());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) DistinguishedName(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName) Test(org.junit.Test)

Example 5 with DistinguishedName

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);
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) DistinguishedName(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Test(org.junit.Test)

Aggregations

DistinguishedName (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName)8 Test (org.junit.Test)7 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)4 InetAddress (java.net.InetAddress)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)3 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)3 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)3 Inet4Address (java.net.Inet4Address)2 Inet6Address (java.net.Inet6Address)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 LispAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress)2 NoAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 IpAddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary)2 TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)2 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)2 Iterator (java.util.Iterator)1