use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping in project lispflowmapping by opendaylight.
the class InstanceIdentifierUtil method createXtrIdMappingIid.
public static InstanceIdentifier<XtrIdMapping> createXtrIdMappingIid(Eid eid, MappingOrigin orig, XtrId xtrId) {
Preconditions.checkNotNull(eid, "Mapping needs an EID entry!");
Preconditions.checkNotNull(xtrId, "Mapping needs an xTR-ID entry!");
VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
MappingKey eidKey = new MappingKey(new EidUri(LispAddressStringifier.getURIString(eid)), orig);
XtrIdMappingKey xtrIdKey = new XtrIdMappingKey(new XtrIdUri(LispAddressStringifier.getURIString(xtrId)));
return InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class, vniKey).child(Mapping.class, eidKey).child(XtrIdMapping.class, xtrIdKey);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method removeXtrIdMappingTest.
/**
* Tests {@link DataStoreBackEnd#addXtrIdMapping} method.
*/
@Test
public void removeXtrIdMappingTest() {
XtrIdMapping xtrIdMapping = new XtrIdMappingBuilder().setXtrIdUri(new XtrIdUri(DUMMY_URI)).setMappingRecord(getDefaultMappingRecordBuilder().build()).build();
dataStoreBackEnd.removeXtrIdMapping(xtrIdMapping);
Mockito.verify(wTxMock).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), iidCaptorXtrIdMapping.capture());
// 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping in project lispflowmapping by opendaylight.
the class DSBEInputUtil method toXtrIdMapping.
public static XtrIdMapping toXtrIdMapping(MappingData mappingData) {
Preconditions.checkNotNull(mappingData);
MappingRecord record = mappingData.getRecord();
Preconditions.checkNotNull(mappingData.getRecord());
return new XtrIdMappingBuilder().setXtrIdUri(new XtrIdUri(LispAddressStringifier.getURIString(record.getXtrId()))).setMappingRecord(record).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping in project lispflowmapping by opendaylight.
the class DataStoreBackEnd method addXtrIdMapping.
// This method assumes that it is only called for southbound originated Map-Registers
public void addXtrIdMapping(XtrIdMapping mapping) {
XtrId xtrId = mapping.getMappingRecord().getXtrId();
Preconditions.checkNotNull(xtrId, "Make sure you only call addXtrIdMapping when the MappingRecord " + "contains an xTR-ID");
if (LOG.isDebugEnabled()) {
LOG.debug("MD-SAL: Adding mapping for {}, xTR-ID {}", LispAddressStringifier.getString(mapping.getMappingRecord().getEid()), xtrId);
}
InstanceIdentifier<XtrIdMapping> path = InstanceIdentifierUtil.createXtrIdMappingIid(mapping.getMappingRecord().getEid(), MappingOrigin.Southbound, xtrId);
writePutTransaction(path, mapping, LogicalDatastoreType.OPERATIONAL, "Adding xTR-ID mapping to MD-SAL datastore failed");
}
Aggregations