use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method toRloc.
/**
* Tests:
* - {@link LispAddressUtil#toRloc(InetAddress)}
* - {@link LispAddressUtil#toRloc(Ipv4Address)}
* - {@link LispAddressUtil#toRloc(Ipv6Address)}
* - {@link LispAddressUtil#toRloc(SimpleAddress)}
* methods.
*/
@Test
public void toRloc() throws UnknownHostException {
InetAddress ipv4AddressInet = Inet4Address.getByAddress(IPV4_ADDRESS_BYTES_A_TEST);
final Rloc rlocFromInetAddress = LispAddressUtil.toRloc(ipv4AddressInet);
assertEquals(Ipv4BinaryAfi.class, rlocFromInetAddress.getAddressType());
assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromInetAddress.getAddress()).getIpv4Binary());
final Rloc rlocFromIpv4Address = LispAddressUtil.toRloc(IPV4_ADDRESS_TEST);
assertEquals(Ipv4Afi.class, rlocFromIpv4Address.getAddressType());
assertEquals(IPV4_ADDRESS_VALUE_TEST, ((Ipv4) rlocFromIpv4Address.getAddress()).getIpv4().getValue());
final Rloc rlocFromIpv6Address = LispAddressUtil.toRloc(IPV6_ADDRESS_TEST);
assertEquals(Ipv6Afi.class, rlocFromIpv6Address.getAddressType());
assertEquals(IPV6_ADDRESS_VALUE_TEST, ((Ipv6) rlocFromIpv6Address.getAddress()).getIpv6().getValue());
final Rloc rlocFromSimpleAddress = LispAddressUtil.toRloc(SIMPLE_ADDRESS_IPV4_TEST);
assertEquals(Ipv4BinaryAfi.class, rlocFromSimpleAddress.getAddressType());
assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromSimpleAddress.getAddress()).getIpv4Binary());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method convertFromBinaryTest_eid.
/**
* Tests {@link LispAddressUtil#convertToBinary(Eid)} method with ipv4Prefix, ipv6Prefix, ipv4, ipv6.
*/
@Test
public void convertFromBinaryTest_eid() {
final Eid resultIpv4Prefix = LispAddressUtil.convertFromBinary(IPV4_ADDRESS_PREFIX_BINARY_EID_1);
verifyToEidWithIpv4Prefix(resultIpv4Prefix, false, MASK_OK_TEST, Ipv4PrefixAfi.class);
final Eid resultIpv6Prefix = LispAddressUtil.convertFromBinary(IPV6_ADDRESS_PREFIX_BINARY_EID_1);
verifyToEidWithIpv6Prefix(resultIpv6Prefix, false, MASK_OK_TEST, Ipv6PrefixAfi.class);
final Eid resultIpv4 = LispAddressUtil.convertFromBinary(IPV4_ADDRESS_BINARY_EID);
verifyToEidWithIpv4(resultIpv4, false);
final Eid resultIpv6 = LispAddressUtil.convertFromBinary(IPV6_ADDRESS_BINARY_EID);
verifyToEidWithIpv6(resultIpv6, false);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromIpPrefix_ipv4.
/**
* Tests {@link LispAddressUtil#addressFromIpPrefix(IpPrefix)} and {@link
* LispAddressUtil#addressTypeFromIpPrefix(IpPrefix)}
* methods with ipv4 address.
*/
@Test
public void addressFromIpPrefix_ipv4() {
IpPrefix ipv4Prefix = new IpPrefix(new Ipv4Prefix(IPV4_ADDRESS_PREFIX_VALUE_TEST));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromIpPrefix(ipv4Prefix);
assertEquals(Ipv4PrefixAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromIpPrefix(ipv4Prefix);
assertTrue(address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix);
assertEquals(IPV4_ADDRESS_PREFIX_VALUE_TEST, ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix) address).getIpv4Prefix().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRegister_isMappingKeepAliveAndMapNotifyGenerated.
/**
* Tests whether handling of map-register message will generate mapping-keep-alive notification.
*/
@Test
public void mapRegister_isMappingKeepAliveAndMapNotifyGenerated() throws InterruptedException, UnknownHostException {
byte[] eidPrefixAfi = new byte[] { // eid-prefix-afi
0x00, 0x01 };
byte[] eidPrefix = new byte[] { // ipv4 address
0x0a, 0x0a, 0x0a, 0x0a };
// send stream of byte -> map register message
InOrder inOrder = Mockito.inOrder(mockLispSouthboundPlugin);
final MapRegisterCacheKey cacheKey = MapRegisterCacheTestUtil.createMapRegisterCacheKey(eidPrefix);
MapRegisterCacheTestUtil.beforeMapRegisterInvocationValidation(cacheKey, mapRegisterCache);
ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
mapRegisterInvocationForCacheTest(eidPrefixAfi, eidPrefix);
inOrder.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
MapRegisterCacheTestUtil.afterMapRegisterInvocationValidation(cacheKey, mapRegisterCache, eidPrefixAfi, eidPrefix);
// sending the same byte stream -> map register second time
captor = ArgumentCaptor.forClass(AddMapping.class);
mapRegisterInvocationForCacheTest(eidPrefixAfi, eidPrefix);
inOrder.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
// mapping-keep-alive message should be generated
MapRegisterCacheTestUtil.afterSecondMapRegisterInvocationValidation(mockLispSouthboundPlugin, eidPrefixAfi, eidPrefix);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class PortDataProcessorTest method deleteTest.
/**
* Tests {@link PortDataProcessor#delete} method.
*/
@Test
public void deleteTest() {
// expected result
final RemoveMappingInput expectedResult = LispUtil.buildRemoveMappingInput(LispAddressUtil.asIpv4PrefixEid(IPV4 + "/32"));
portDataProcessor.delete(portMock);
Mockito.verify(odlMappingserviceServiceMock).removeMapping(expectedResult);
}
Aggregations