Package org.onosproject.net.pi.service
Interface PiTranslator<T extends PiTranslatable,E extends PiEntity>
-
- Type Parameters:
T- PD entity class (translatable to PI)E- PI entity class
- All Known Subinterfaces:
PiFlowRuleTranslator,PiGroupTranslator,PiMeterTranslator,PiReplicationGroupTranslator
@Beta public interface PiTranslator<T extends PiTranslatable,E extends PiEntity>A translator of PI entities to equivalent PD ones which offer means to learn translated entities for later use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidforget(PiHandle handle)Removes any mapping for the given PI entity handle.voidlearn(PiHandle handle, PiTranslatedEntity<T,E> entity)Stores a mapping between the given translated entity and handle.Optional<PiTranslatedEntity<T,E>>lookup(PiHandle handle)Returns a PI translated entity that was previously associated with the given handle, if present.Etranslate(T original, PiPipeconf pipeconf)Translate the given PD entity (original) and returns a PI entity that is equivalent to he PD one for the given pipeconf.
-
-
-
Method Detail
-
translate
E translate(T original, PiPipeconf pipeconf) throws PiTranslationException
Translate the given PD entity (original) and returns a PI entity that is equivalent to he PD one for the given pipeconf.- Parameters:
original- PD entitypipeconf- pipeconf- Returns:
- PI entity
- Throws:
PiTranslationException- if a translation is not possible (see message for an explanation)
-
learn
void learn(PiHandle handle, PiTranslatedEntity<T,E> entity)
Stores a mapping between the given translated entity and handle.- Parameters:
handle- PI entity handleentity- PI translated entity
-
lookup
Optional<PiTranslatedEntity<T,E>> lookup(PiHandle handle)
Returns a PI translated entity that was previously associated with the given handle, if present. If not present, it means a mapping between the two has not been learned by the system (vialearn(PiHandle, PiTranslatedEntity)) or that it has been removed (viaforget(PiHandle)). the- Parameters:
handle- PI entity handle- Returns:
- optional PI translated entity
-
forget
void forget(PiHandle handle)
Removes any mapping for the given PI entity handle.- Parameters:
handle- PI entity handle.
-
-