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 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.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 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));
}
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 LispNotificationHelperTest method getTransportAddressFromRlocTest_withIpv4Address.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with Ipv4 type address.
*/
@Test
public void getTransportAddressFromRlocTest_withIpv4Address() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(LispMessage.PORT_NUM)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_IPV4));
}
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 LispNotificationHelperTest method getMappingTest_SiteIdNotPresent.
/**
* Tests {@link LispNotificationHelper#getMapping} method with invalid address, isXtrSiteIdPresent == false.
*/
@Test
public void getMappingTest_SiteIdNotPresent() {
final MappingBuilder mappingBuilder_1 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV4).build()).setEidUri(new EidUri("ipv4:" + IPV4_STRING)).setOrigin(MappingOrigin.Southbound);
final MappingBuilder mappingBuilder_2 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV6).build()).setEidUri(new EidUri("ipv6:" + IPV6_STRING)).setOrigin(MappingOrigin.Southbound);
assertEquals(Lists.newArrayList(mappingBuilder_1.build(), mappingBuilder_2.build()), LispNotificationHelper.getMapping(getDefaultAddMapping(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 DataStoreBackEndTest method addXtrIdMappingTest.
/**
* Tests {@link DataStoreBackEnd#addXtrIdMapping} method.
*/
@Test
public void addXtrIdMappingTest() {
XtrIdMapping xtrIdMapping = new XtrIdMappingBuilder().setXtrIdUri(new XtrIdUri(DUMMY_URI)).setMappingRecord(getDefaultMappingRecordBuilder().build()).build();
dataStoreBackEnd.addXtrIdMapping(xtrIdMapping);
Mockito.verify(wTxMock).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), iidCaptorXtrIdMapping.capture(), Mockito.eq(xtrIdMapping), Mockito.eq(true));
// result
XtrIdMappingKey xtrIdResult = iidCaptorXtrIdMapping.getValue().firstKeyOf(XtrIdMapping.class);
MappingKey mappingResult = iidCaptorXtrIdMapping.getValue().firstKeyOf(Mapping.class);
assertEquals(DatatypeConverter.printHexBinary(XTR_ID), xtrIdResult.getXtrIdUri().getValue());
assertEquals(MappingOrigin.Southbound, mappingResult.getOrigin());
assertEquals("ipv4:" + IPV4_STRING_1, mappingResult.getEidUri().getValue());
}
Aggregations