Search in sources :

Example 6 with MappingEntry

use of org.onosproject.mapping.MappingEntry in project onos by opennetworkinglab.

the class MappingsListCommand method printMappings.

/**
 * Prints out mapping information.
 *
 * @param deviceId device identifier
 * @param mappings a collection of mapping
 */
private void printMappings(DeviceId deviceId, List<MappingEntry> mappings) {
    print(SUMMARY_FORMAT, deviceId, mappings.size());
    for (MappingEntry m : mappings) {
        print(MAPPING_ID_FORMAT, Long.toHexString(m.id().value()));
        print(MAPPING_STATE_FORMAT, m.state().name());
        print(MAPPING_KEY_FORMAT, printMappingKey(m.key()));
        printMappingValue(m.value());
    }
}
Also used : MappingEntry(org.onosproject.mapping.MappingEntry)

Example 7 with MappingEntry

use of org.onosproject.mapping.MappingEntry in project onos by opennetworkinglab.

the class MappingManagerTest method removeMappingEntries.

/**
 * Tests removing mapping entries method.
 */
@Test
public void removeMappingEntries() {
    Mapping m1 = addMapping(MAP_DATABASE, 1);
    Mapping m2 = addMapping(MAP_DATABASE, 2);
    addMapping(MAP_DATABASE, 3);
    assertEquals("3 mappings should exist", 3, mappingCount(MAP_DATABASE));
    MappingEntry me1 = new DefaultMappingEntry(m1);
    MappingEntry me2 = new DefaultMappingEntry(m2);
    adminService.removeMappingEntries(MAP_DATABASE, me1, me2);
    assertEquals("1 mappings should exist", 1, mappingCount(MAP_DATABASE));
}
Also used : MappingEntry(org.onosproject.mapping.MappingEntry) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) DefaultMapping(org.onosproject.mapping.DefaultMapping) Mapping(org.onosproject.mapping.Mapping) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) Test(org.junit.Test)

Example 8 with MappingEntry

use of org.onosproject.mapping.MappingEntry in project onos by opennetworkinglab.

the class MappingManagerTest method storeMappingEntry.

/**
 * Tests storing mapping entry method.
 */
@Test
public void storeMappingEntry() {
    Mapping m1 = mapping(1, 1);
    Mapping m2 = mapping(2, 2);
    Mapping m3 = mapping(3, 3);
    MappingEntry me1 = new DefaultMappingEntry(m1);
    MappingEntry me2 = new DefaultMappingEntry(m2);
    MappingEntry me3 = new DefaultMappingEntry(m3);
    assertTrue("store should be empty", Sets.newHashSet(service.getMappingEntries(MAP_DATABASE, LISP_DID)).isEmpty());
    adminService.storeMappingEntry(MAP_DATABASE, me1);
    adminService.storeMappingEntry(MAP_DATABASE, me2);
    adminService.storeMappingEntry(MAP_DATABASE, me3);
    assertEquals("3 mappings should exist", 3, mappingCount(MAP_DATABASE));
}
Also used : MappingEntry(org.onosproject.mapping.MappingEntry) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) DefaultMapping(org.onosproject.mapping.DefaultMapping) Mapping(org.onosproject.mapping.Mapping) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) Test(org.junit.Test)

Example 9 with MappingEntry

use of org.onosproject.mapping.MappingEntry in project onos by opennetworkinglab.

the class MappingManagerTest method addMapping.

/**
 * Adds a new mapping into the mapping store.
 *
 * @param type mapping store type
 * @param tval test value
 * @return a mapping that has been added to the store
 */
private Mapping addMapping(Type type, int tval) {
    Mapping mapping = mapping(tval, tval);
    MappingEntry entry = new DefaultMappingEntry(mapping);
    adminService.storeMappingEntry(type, entry);
    assertNotNull("mapping should be found", service.getMappingEntries(type, LISP_DID));
    return mapping;
}
Also used : MappingEntry(org.onosproject.mapping.MappingEntry) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) DefaultMapping(org.onosproject.mapping.DefaultMapping) Mapping(org.onosproject.mapping.Mapping) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry)

Aggregations

MappingEntry (org.onosproject.mapping.MappingEntry)9 DefaultMapping (org.onosproject.mapping.DefaultMapping)4 DefaultMappingEntry (org.onosproject.mapping.DefaultMappingEntry)4 Mapping (org.onosproject.mapping.Mapping)4 Test (org.junit.Test)3 MappingKey (org.onosproject.mapping.MappingKey)3 MappingTreatment (org.onosproject.mapping.MappingTreatment)3 MappingValue (org.onosproject.mapping.MappingValue)3 DefaultMappingKey (org.onosproject.mapping.DefaultMappingKey)2 DefaultMappingTreatment (org.onosproject.mapping.DefaultMappingTreatment)2 DefaultMappingValue (org.onosproject.mapping.DefaultMappingValue)2 MappingAction (org.onosproject.mapping.actions.MappingAction)2 MappingAddress (org.onosproject.mapping.addresses.MappingAddress)2 MappingInstruction (org.onosproject.mapping.instructions.MappingInstruction)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ItemNotFoundException (org.onlab.util.ItemNotFoundException)1 LispMapRecord (org.onosproject.lisp.msg.protocols.LispMapRecord)1