use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePath in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withServicePathDestinationAddress_IpPrefixLocatorRecord.
/**
* Tests {@link MappingSystem#getMapping} method with ServicePath type dst address and single IpPrefix type locator
* record. Returns the original mapping.
*/
@Test
public void getMappingTest_NbFirst_withServicePathDestinationAddress_IpPrefixLocatorRecord() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecordBuilder().setRloc(getIpPrefixTypeRloc()).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.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePath 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.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePath in project lispflowmapping by opendaylight.
the class MappingSystem method getMappingNbSbIntersection.
private MappingData getMappingNbSbIntersection(Eid src, Eid dst) {
// lookupPolicy == NB_AND_SB, we return intersection
// of NB and SB mappings, or NB mapping if intersection is empty.
MappingData nbMappingData = (MappingData) pmc.getMapping(src, dst);
if (nbMappingData == null) {
return nbMappingData;
}
// no intersection for Service Path mappings
if (dst.getAddress() instanceof ServicePath) {
return updateServicePathMappingRecord(nbMappingData, dst);
}
MappingData sbMappingData = getSbMappingWithExpiration(src, dst, null);
if (sbMappingData == null) {
return nbMappingData;
}
// both NB and SB mappings exist. Compute intersection of the mappings
return MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePath in project lispflowmapping by opendaylight.
the class MaskUtilTest method normalizeTest_withServicePath.
/**
* Tests {@link MaskUtil#normalize} method with ServicePath.
*/
@Test
public void normalizeTest_withServicePath() {
// expected result
final Eid expectedResult = LispAddressUtil.asServicePathEid(-1, 1L, (short) 0);
// result
final Eid result = MaskUtil.normalize(EID_SERVICE_PATH);
assertEquals(expectedResult, result);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePath in project lispflowmapping by opendaylight.
the class ServicePathTest method deserialize__Simple.
@Test
public void deserialize__Simple() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("40 03 00 00 " + "11 00 00 04 " + "AA BB CC FF"), new LispAddressSerializerContext(null));
assertEquals(ServicePathLcaf.class, address.getAddressType());
ServicePath sp = (ServicePath) address.getAddress();
assertEquals(ByteUtil.getPartialInt(new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC }), sp.getServicePath().getServicePathId().getValue().intValue());
assertEquals((byte) 0xFF, sp.getServicePath().getServiceIndex().byteValue());
}
Aggregations