use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getDefaultAddMapping.
private static AddMapping getDefaultAddMapping(boolean isXtrSiteIdPresent) {
final MappingRecordItem mappingRecordItem_1 = new MappingRecordItemBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV4).build()).build();
final MappingRecordItem mappingRecordItem_2 = new MappingRecordItemBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV6).build()).build();
final MapRegisterBuilder mapRegisterBuilder = new MapRegisterBuilder().setMappingRecordItem(Lists.newArrayList(mappingRecordItem_1, mappingRecordItem_2)).setXtrSiteIdPresent(isXtrSiteIdPresent).setSiteId(SITE_ID);
return new AddMappingBuilder().setMapRegister(mapRegisterBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getMappingTest.
/**
* Tests {@link LispNotificationHelper#getMapping} method with invalid address.
*/
@Test
public void getMappingTest() {
final MappingBuilder mappingBuilder_1 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV4).build()).setEidUri(new EidUri("ipv4:" + IPV4_STRING)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID));
final MappingBuilder mappingBuilder_2 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV6).build()).setEidUri(new EidUri("ipv6:" + IPV6_STRING)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID));
assertEquals(Lists.newArrayList(mappingBuilder_1.build(), mappingBuilder_2.build()), LispNotificationHelper.getMapping(getDefaultAddMapping(true)));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method getCommonLocatorRecords_priorityCheck.
/**
* Tests {@link MappingMergeUtil#getCommonLocatorRecords} method, verifies that NB common locator's priority is set
* to correct value (based on SB locator's priority).
*/
@Test
public void getCommonLocatorRecords_priorityCheck() {
LocatorRecordBuilder nbLocatorRecordBuilder1 = new LocatorRecordBuilder().setRloc(IPV4_RLOC_1).setPriority((short) 1).setLocatorId("NB-locator-id");
LocatorRecordBuilder sbLocatorRecordBuilder1 = new LocatorRecordBuilder().setRloc(IPV4_RLOC_1).setPriority((short) 255).setLocatorId("SB-locator-id");
LocatorRecordBuilder nbLocatorRecordBuilder2 = new LocatorRecordBuilder().setRloc(IPV4_RLOC_2).setPriority((short) 1).setLocatorId("NB-locator-id");
LocatorRecordBuilder sbLocatorRecordBuilder2 = new LocatorRecordBuilder().setRloc(IPV4_RLOC_2).setPriority((short) 254).setLocatorId("SB-locator-id");
final MappingRecordBuilder nbMappingRecordBuilder = getDefaultMappingRecordBuilder();
nbMappingRecordBuilder.getLocatorRecord().add(nbLocatorRecordBuilder1.build());
nbMappingRecordBuilder.getLocatorRecord().add(nbLocatorRecordBuilder2.build());
final MappingRecordBuilder sbMappingRecordBuilder = getDefaultMappingRecordBuilder();
sbMappingRecordBuilder.getLocatorRecord().add(sbLocatorRecordBuilder1.build());
sbMappingRecordBuilder.getLocatorRecord().add(sbLocatorRecordBuilder2.build());
MappingData nbMappingData = getDefaultMappingData(nbMappingRecordBuilder.build());
MappingData sbMappingData = getDefaultMappingData(sbMappingRecordBuilder.build());
// result
final MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
final Iterator<LocatorRecord> iterator = result.getRecord().getLocatorRecord().iterator();
final LocatorRecord resultLocator_1 = iterator.next();
final LocatorRecord resultLocator_2 = iterator.next();
assertEquals(2, result.getRecord().getLocatorRecord().size());
assertEquals("NB-locator-id", resultLocator_1.getLocatorId());
// priority changed to 255
assertEquals(255, (short) resultLocator_1.getPriority());
assertEquals("NB-locator-id", resultLocator_2.getLocatorId());
// priority remains original
assertEquals(1, (short) resultLocator_2.getPriority());
}
Aggregations