Search in sources :

Example 1 with MappingKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey in project lispflowmapping by opendaylight.

the class InstanceIdentifierUtil method createMappingIid.

public static InstanceIdentifier<Mapping> createMappingIid(Eid eid, MappingOrigin orig) {
    Preconditions.checkNotNull(eid, "Mapping needs an EID entry!");
    VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
    MappingKey eidKey = new MappingKey(new EidUri(LispAddressStringifier.getURIString(eid)), orig);
    return InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class, vniKey).child(Mapping.class, eidKey);
}
Also used : VniUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri) VirtualNetworkIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) VirtualNetworkIdentifierKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)

Example 2 with MappingKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey 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);
}
Also used : XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingDatabase(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase) VniUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) VirtualNetworkIdentifierKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) XtrIdMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey) XtrIdUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)

Example 3 with MappingKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey 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 4 with MappingKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey in project lispflowmapping by opendaylight.

the class DataStoreBackEndTest method removeMapping.

/**
 * Tests {@link DataStoreBackEnd#removeMapping} method.
 */
@Test
public void removeMapping() {
    final Mapping mapping = new MappingBuilder().setMappingRecord(getDefaultMappingRecordBuilder().build()).setOrigin(MappingOrigin.Northbound).build();
    dataStoreBackEnd.removeMapping(mapping);
    Mockito.verify(wTxMock).delete(Mockito.eq(LogicalDatastoreType.CONFIGURATION), iidCaptorMapping.capture());
    // result
    MappingKey result = iidCaptorMapping.getValue().firstKeyOf(Mapping.class);
    assertEquals("ipv4:" + IPV4_STRING_1, result.getEidUri().getValue());
    assertEquals(MappingOrigin.Northbound, result.getOrigin());
}
Also used : XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) 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) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with MappingKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey 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)

Aggregations

MappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)7 XtrIdMappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey)7 XtrIdMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping)6 Test (org.junit.Test)5 XtrIdMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Mapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)4 XtrIdUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)3 MappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder)3 EidUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)2 VniUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri)2 VirtualNetworkIdentifierKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey)2 MappingDatabase (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase)1 VirtualNetworkIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier)1