use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4 in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withNullExpiredNbMapping.
/**
* Tests {@link MappingSystem#getMapping} method with NB mapping == null, expired mapping.
*/
@Test
public void getMappingTest_NbFirst_withNullExpiredNbMapping() {
final MappingData mappingData = getDefaultMappingData();
mappingData.setTimestamp(EXPIRED_DATE);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(null);
Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(mappingData, null);
final Mapping mapping = new MappingBuilder().setEidUri(new EidUri("ipv4:" + IPV4_DST)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID)).setMappingRecord(mappingData.getRecord()).build();
assertNull(mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
Mockito.verify(dsbeMock).removeMapping(mapping);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4 in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbSbIntersection_withServicePathDestinationAddress.
/**
* Tests {@link MappingSystem#getMapping} method, northbound and southbound intersection with ServicePath type dst
* address and single Ipv4 type locator record. Returns the original mapping.
*/
@Test
public void getMappingTest_NbSbIntersection_withServicePathDestinationAddress() throws NoSuchFieldException, IllegalAccessException {
setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4 in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst.
/**
* Tests {@link MappingSystem#getMapping} method with Ipv4 type dst address.
*/
@Test
public void getMappingTest_NbFirst() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4 in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbSbIntersection_withSbNull.
/**
* Tests {@link MappingSystem#getMapping} method, northbound and southbound intersection with single Ipv4 type
* locator, southbound null. Returns the original mapping.
*/
@Test
public void getMappingTest_NbSbIntersection_withSbNull() throws NoSuchFieldException, IllegalAccessException {
setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
getDefaultLocatorRecordBuilder().build())).build();
MappingData nbMappingData = getDefaultMappingData(mappingRecord);
MappingData sbMappingData = getDefaultMappingData(mappingRecord);
sbMappingData.setTimestamp(EXPIRED_DATE);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(nbMappingData);
Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(sbMappingData, null);
final Mapping mapping = new MappingBuilder().setEidUri(new EidUri("ipv4:" + IPV4_DST)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID)).setMappingRecord(mappingRecord).build();
assertEquals(nbMappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
Mockito.verify(dsbeMock).removeMapping(mapping);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4 in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withApplicationDataIpv4Address.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with ApplicationData type Ipv4 address.
*/
@Test
public void getTransportAddressFromRlocTest_withApplicationDataIpv4Address() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(PORT)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_APPLICATION_DATA_IPV4));
}
Aggregations