public final class VTNManagerProviderImpl extends Object implements org.osgi.framework.SynchronousBundleListener, VTNManager, VTNManagerProvider, VtnVersionService
Modifier and Type | Field and Description |
---|---|
static long |
API_VERSION
Current API version of the VTN Manager.
|
Constructor and Description |
---|
VTNManagerProviderImpl(org.osgi.framework.BundleContext bctx,
org.opendaylight.controller.md.sal.binding.api.DataBroker broker,
org.opendaylight.controller.sal.binding.api.RpcProviderRegistry rpcReg,
org.opendaylight.controller.md.sal.binding.api.NotificationService nsv,
org.opendaylight.controller.md.sal.binding.api.NotificationPublishService npsv,
org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService eos)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
VTNFuture<VtnFlowId> |
addFlow(VTNFlowBuilder builder)
Add the given VTN data flow.
|
void |
asyncBarrier(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef nref)
Send a barrier request to the specified switch asynchronously.
|
void |
bundleChanged(org.osgi.framework.BundleEvent ev)
Invoked when the manager.implementation bundle has a lifecycle change.
|
boolean |
canReuse()
Determine whether this instance can be reused or not.
|
void |
close()
Close the VTN Manager provider service.
|
void |
execute(Runnable task)
Execute the specified task on one of worker threads in the pool.
|
boolean |
executeTask(Runnable task)
Execute the specified task asynchronously.
|
org.opendaylight.controller.md.sal.binding.api.DataBroker |
getDataBroker()
Return a data broker service instance.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<GetManagerVersionOutput>> |
getManagerVersion()
Return the version information of the VTN Manager.
|
com.google.common.base.Optional<org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState> |
getOwnershipState(org.opendaylight.controller.md.sal.common.api.clustering.Entity ent)
Return the current ownership state information about the given entity.
|
RouteResolver |
getRouteResolver()
Return the packet route resolver associated with the system default
routing policy.
|
RouteResolver |
getRouteResolver(Integer id)
Return a packet route resolver.
|
<T extends org.opendaylight.yangtools.yang.binding.RpcService> |
getRpcService(Class<T> type)
Return an implementation of the specified RPC service.
|
VTNTimer |
getTimer()
Return the global timer.
|
VTNConfig |
getVTNConfig()
Return a
VTNConfig instance that contains current configuration. |
<T extends org.opendaylight.yangtools.yang.binding.RpcService> |
getVtnRpcService(Class<T> type)
Return an implementation of the RPC service provided by the VTN Manager.
|
boolean |
isOwner(VTNEntityType etype)
Determine whether this process process is the owner of the given
global entity.
|
TxContext |
newTxContext()
Create a new read-only MD-SAL datastore transaction context.
|
<T> VTNFuture<T> |
post(TxTask<T> task)
Post a new transaction for MD-SAL datastore.
|
<T> VTNFuture<T> |
postFirst(TxTask<T> task)
Post a new transaction for MD-SAL datastore.
|
<T> VTNFuture<T> |
postSync(TxTask<T> task)
Post a new MD-SAL transaction task.
|
void |
publish(org.opendaylight.yangtools.yang.binding.Notification n)
Publish the given MD-SAL notification.
|
org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration |
registerEntity(org.opendaylight.controller.md.sal.common.api.clustering.Entity ent)
Register a candidate for ownership of the given entity.
|
org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration |
registerListener(VTNEntityType etype,
org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener listener)
Register a listener that listens the ownership status of the entity
specified by the given type.
|
void |
registerRpc(NodeRpcInvocation<?,?> rpc)
Register the specified RPC invocation routed to the specifiec switch.
|
VTNFuture<Void> |
removeFlows(FlowRemover remover)
Remove flow entries that match the given condition.
|
<T> void |
setCallback(Future<T> future,
com.google.common.util.concurrent.FutureCallback<? super T> cb)
Set the given future callback to the given future.
|
void |
transmit(List<org.apache.commons.lang3.tuple.Pair<SalPort,Packet>> packets)
Transmit all the given packets.
|
void |
transmit(SalPort egress,
Packet packet)
Transmit the given packet.
|
void |
unregisterRpc(NodeRpcInvocation<?,?> rpc)
Unregister the specified RPC invocation.
|
public static final long API_VERSION
public VTNManagerProviderImpl(org.osgi.framework.BundleContext bctx, org.opendaylight.controller.md.sal.binding.api.DataBroker broker, org.opendaylight.controller.sal.binding.api.RpcProviderRegistry rpcReg, org.opendaylight.controller.md.sal.binding.api.NotificationService nsv, org.opendaylight.controller.md.sal.binding.api.NotificationPublishService npsv, org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService eos)
bctx
- A BundleContext
instance associated with the
bundle that contains this class.broker
- A DataBroker
service instance.rpcReg
- A RpcProviderRegistry
service instance.nsv
- A NotificationService
service instance.npsv
- A NotificationPublishService
service instance.eos
- A EntityOwnershipService
serivce instance.public boolean canReuse()
true
only if this instance can be reused.public void bundleChanged(org.osgi.framework.BundleEvent ev)
bundleChanged
in interface org.osgi.framework.BundleListener
ev
- A BundleEvent
instance.public VTNConfig getVTNConfig()
VTNConfig
instance that contains current configuration.getVTNConfig
in interface VTNManagerProvider
VTNConfig
instance.public TxContext newTxContext()
newTxContext
in interface VTNManagerProvider
public VTNTimer getTimer()
getTimer
in interface VTNManagerProvider
public boolean executeTask(Runnable task)
executeTask
in interface VTNManagerProvider
task
- A task to be executed on this thread pool.true
is returned if the specified task was submitted.
false
is returned if the specified tas was rejected.public <T> void setCallback(Future<T> future, com.google.common.util.concurrent.FutureCallback<? super T> cb)
If the given future implements ListenableFuture
, this method
adds the given callback to the given future, and the callback will
be invoked by a thread which is executing the future.
If not, the given callback will be invoked on another thread
asynchronously.
setCallback
in interface VTNManagerProvider
T
- The type of the object returned by the given future.future
- A Future
instance to wait for its completion.cb
- A FutureCallback
instance.public org.opendaylight.controller.md.sal.binding.api.DataBroker getDataBroker()
getDataBroker
in interface VTNManagerProvider
DataBroker
instance.public void transmit(SalPort egress, Packet packet)
transmit
in interface VTNManagerProvider
egress
- A SalPort
instance which specifies the egress
switch port.packet
- A Packet
instance to transmit.public void transmit(List<org.apache.commons.lang3.tuple.Pair<SalPort,Packet>> packets)
transmit
in interface VTNManagerProvider
packets
- A list of packets to transmit.
The left of each elements indicates the egress switch
port, and the right indiciates a packet to transmit.public RouteResolver getRouteResolver()
getRouteResolver
in interface VTNManagerProvider
RouteResolver
instance on success.
null
if the routing management is already closed.public RouteResolver getRouteResolver(Integer id)
getRouteResolver
in interface VTNManagerProvider
id
- The identifier of the path policy.RouteResolver
instance if found.
null
if not fonud.public VTNFuture<VtnFlowId> addFlow(VTNFlowBuilder builder)
addFlow
in interface VTNManagerProvider
builder
- A VTNFlowBuilder
instance which contains
data flow to be installed.public VTNFuture<Void> removeFlows(FlowRemover remover)
removeFlows
in interface VTNManagerProvider
remover
- A FlowRemover
instance which determines VTN data
flows to be removed.public org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration registerEntity(org.opendaylight.controller.md.sal.common.api.clustering.Entity ent) throws org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException
registerEntity
in interface VTNManagerProvider
ent
- The entity to be registered as a candidate of ownership.EntityOwnershipCandidateRegistration
instance.org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException
- The given entity is already registered.public org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration registerListener(VTNEntityType etype, org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener listener)
registerListener
in interface VTNManagerProvider
etype
- The type of the VTN global entity.listener
- An EntityOwnershipListener
instance.EntityOwnershipListenerRegistration
instance.public com.google.common.base.Optional<org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState> getOwnershipState(org.opendaylight.controller.md.sal.common.api.clustering.Entity ent)
getOwnershipState
in interface VTNManagerProvider
ent
- The entity to query.Optional
instance that contains the entity ownership
state if present.public boolean isOwner(VTNEntityType etype)
isOwner
in interface VTNManagerProvider
etype
- The type of VTN global entity.
Specifying non-global entity type results in undefined
behavior.true
if this process is the owner of the given global
entity. false
otherwise.public <T extends org.opendaylight.yangtools.yang.binding.RpcService> T getRpcService(Class<T> type) throws VTNException
getRpcService
in interface VTNManagerProvider
T
- The type of the RPC service.type
- A class which specifies the RPC service.VTNException
- The specified RPC service was not found.public <T extends org.opendaylight.yangtools.yang.binding.RpcService> T getVtnRpcService(Class<T> type) throws VTNException
getVtnRpcService
in interface VTNManagerProvider
T
- The type of the RPC service.type
- A class which specifies the RPC service.VTNException
- The specified RPC service was not found.public void publish(org.opendaylight.yangtools.yang.binding.Notification n)
publish
in interface VTNManagerProvider
n
- A Notification
instance to be published.public <T> VTNFuture<T> postSync(TxTask<T> task)
This method associates a new VTNFuture
instance with the
given task, including all background tasks started by the task.
Note that the given task is never canceled even if the returned
VTNFuture
is cancelled. Future.cancel(boolean)
on
the returned value only cancels the wait for background tasks.
postSync
in interface VTNManagerProvider
T
- The type of the object to be returned by the task.task
- A TxTask
instance.VTNFuture
associated with the given task and its
background tasks.public void close()
close
in interface AutoCloseable
close
in interface VTNManagerProvider
public void registerRpc(NodeRpcInvocation<?,?> rpc)
registerRpc
in interface NodeRpcWatcher
rpc
- An RPC invocation to be registered.public void unregisterRpc(NodeRpcInvocation<?,?> rpc)
unregisterRpc
in interface NodeRpcWatcher
rpc
- An RPC invocation to be unregistered.public void asyncBarrier(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef nref)
asyncBarrier
in interface BarrierSender
nref
- Reference to the target node.public void execute(Runnable task)
execute
in interface Executor
task
- A task to be executed on this thread pool.NullPointerException
- task
is null
.public <T> VTNFuture<T> post(TxTask<T> task)
This method put the given task at the tail of the transaction queue.
public <T> VTNFuture<T> postFirst(TxTask<T> task)
This method put the given task at the head of the transaction queue.
public Future<org.opendaylight.yangtools.yang.common.RpcResult<GetManagerVersionOutput>> getManagerVersion()
getManagerVersion
in interface VtnVersionService
Future
associated with the RPC task.Copyright © 2018 OpenDaylight. All rights reserved.