Search in sources :

Example 1 with XtrIdMappingBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder 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());
}
Also used : XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) XtrIdMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) XtrIdUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with XtrIdMappingBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder 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());
}
Also used : XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) XtrIdMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) XtrIdUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with XtrIdMappingBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder 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();
}
Also used : XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) XtrIdUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)

Aggregations

XtrIdUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)3 XtrIdMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder)3 Test (org.junit.Test)2 MappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)2 XtrIdMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping)2 XtrIdMappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)1