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());
}
}
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));
}
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));
}
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;
}
Aggregations