Interface P4RuntimeMirror<H extends org.onosproject.net.pi.runtime.PiHandle,E extends org.onosproject.net.pi.runtime.PiEntity>
-
- Type Parameters:
H- Handle classE- Entity class
- All Known Subinterfaces:
P4RuntimeActionProfileGroupMirror,P4RuntimeActionProfileMemberMirror,P4RuntimeDefaultEntryMirror,P4RuntimeMeterMirror,P4RuntimePreEntryMirror,P4RuntimeTableMirror
- All Known Implementing Classes:
AbstractDistributedP4RuntimeMirror,DistributedP4RuntimeActionProfileGroupMirror,DistributedP4RuntimeActionProfileMemberMirror,DistributedP4RuntimeDefaultEntryMirror,DistributedP4RuntimeMeterMirror,DistributedP4RuntimePreEntryMirror,DistributedP4RuntimeTableMirror
@Beta public interface P4RuntimeMirror<H extends org.onosproject.net.pi.runtime.PiHandle,E extends org.onosproject.net.pi.runtime.PiEntity>Service to keep track of the device state for a given class of PI entities. The need of this service comes from the fact that P4 Runtime makes a distinction between INSERT and MODIFY operations, while ONOS drivers use a more generic "APPLY" behaviour (i.e. ADD or UPDATE). When applying an entry, we need to know if another one with the same handle (e.g. table entry with same match key) is already on the device to decide between INSERT or MODIFY. Moreover, this service maintains a "timed" version of PI entities such that we can compute the life of the entity on the device.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.onosproject.net.Annotationsannotations(H handle)Returns annotations associated to the given handle, if present, otherwise null.voidapplyWriteRequest(org.onosproject.p4runtime.api.P4RuntimeWriteClient.WriteRequest request)Uses the given P4Runtime write request to update the state of this mirror by optimistically assuming that all updates in it will succeed.voidapplyWriteResponse(org.onosproject.p4runtime.api.P4RuntimeWriteClient.WriteResponse response)Uses the given P4Runtime write response to update the state of this mirror.TimedEntry<E>get(H handle)Returns entry associated to the given handle, if present, otherwise null.java.util.Collection<TimedEntry<E>>getAll(org.onosproject.net.DeviceId deviceId)Returns all entries for the given device ID.voidput(H handle, E entry)Stores the given entry associating it to the given handle.voidputAnnotations(H handle, org.onosproject.net.Annotations annotations)Stores the given annotations associating it to the given handle.voidremove(H handle)Removes the entry associated to the given handle.voidsync(org.onosproject.net.DeviceId deviceId, java.util.Collection<E> entities)Synchronizes the state of the given device ID with the given collection of PI entities.
-
-
-
Method Detail
-
getAll
java.util.Collection<TimedEntry<E>> getAll(org.onosproject.net.DeviceId deviceId)
Returns all entries for the given device ID.- Parameters:
deviceId- device ID- Returns:
- collection of table entries
-
get
TimedEntry<E> get(H handle)
Returns entry associated to the given handle, if present, otherwise null.- Parameters:
handle- handle- Returns:
- PI table entry
-
put
void put(H handle, E entry)
Stores the given entry associating it to the given handle.- Parameters:
handle- handleentry- entry
-
remove
void remove(H handle)
Removes the entry associated to the given handle.- Parameters:
handle- handle
-
putAnnotations
void putAnnotations(H handle, org.onosproject.net.Annotations annotations)
Stores the given annotations associating it to the given handle.- Parameters:
handle- handleannotations- entry
-
annotations
org.onosproject.net.Annotations annotations(H handle)
Returns annotations associated to the given handle, if present, otherwise null.- Parameters:
handle- handle- Returns:
- PI table annotations
-
sync
void sync(org.onosproject.net.DeviceId deviceId, java.util.Collection<E> entities)Synchronizes the state of the given device ID with the given collection of PI entities.- Parameters:
deviceId- device IDentities- collection of PI entities
-
applyWriteRequest
void applyWriteRequest(org.onosproject.p4runtime.api.P4RuntimeWriteClient.WriteRequest request)
Uses the given P4Runtime write request to update the state of this mirror by optimistically assuming that all updates in it will succeed.- Parameters:
request- P4Runtime write request
-
applyWriteResponse
void applyWriteResponse(org.onosproject.p4runtime.api.P4RuntimeWriteClient.WriteResponse response)
Uses the given P4Runtime write response to update the state of this mirror.- Parameters:
response- P4Runtime write response
-
-