Class DefaultL2TunnelHandler
- java.lang.Object
-
- org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler
-
- All Implemented Interfaces:
L2TunnelHandler
public class DefaultL2TunnelHandler extends Object implements L2TunnelHandler
Handler for pseudowire management.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.onosproject.segmentrouting.pwaas.L2TunnelHandler
L2TunnelHandler.Direction, L2TunnelHandler.Pipeline, L2TunnelHandler.Result
-
-
Constructor Summary
Constructors Constructor Description DefaultL2TunnelHandler(SegmentRoutingManager segmentRoutingManager)Create a l2 tunnel handler for the deploy and for the tear down of pseudo wires.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description L2TunnelHandler.ResultcheckIfPwExists(long tunnelId, boolean pending)Check if pseudowire exists in the store.L2TunnelHandler.ResultdeployPseudowire(L2TunnelDescription pw)Adds a single pseudowire.com.google.common.collect.ImmutableMap<String,org.onosproject.net.flowobjective.NextObjective>getInitNext()Returns the PW init next objective store.Set<L2TunnelDescription>getL2Descriptions(boolean pending)Combines policies and tunnels to create descriptions.List<L2TunnelPolicy>getL2PendingPolicies()Returns a copy of the pending l2 policies that exist in the store.List<L2Tunnel>getL2PendingTunnels()Returns a copy of the pending l2 tunnels that exist in the store.List<L2TunnelPolicy>getL2Policies()Returns a copy of the l2 policies that exist in the store.List<L2Tunnel>getL2Tunnels()Returns a copy of the l2 tunnels that exist in the store.com.google.common.collect.ImmutableMap<String,org.onosproject.net.flowobjective.NextObjective>getTermNext()Returns the PW termination next objective store.voidinit()Used by manager only in initialization.voidremoveNextId(int nextId)Removes given next ID from both PW init/term next obj store.voidtearDown(Set<L2TunnelDescription> pwToRemove)Deprecated.L2TunnelHandler.ResulttearDownPseudowire(long l2TunnelId)Helper function for removing a single pseudowire.L2TunnelHandler.ResultverifyGlobalValidity(L2TunnelDescription pwToAdd)Verifies global validity for existing pseudowires, both ones in the pending store and the ones installed.
-
-
-
Constructor Detail
-
DefaultL2TunnelHandler
public DefaultL2TunnelHandler(SegmentRoutingManager segmentRoutingManager)
Create a l2 tunnel handler for the deploy and for the tear down of pseudo wires.- Parameters:
segmentRoutingManager- the segment routing manager
-
-
Method Detail
-
init
public void init()
Used by manager only in initialization.- Specified by:
initin interfaceL2TunnelHandler
-
getL2Descriptions
public Set<L2TunnelDescription> getL2Descriptions(boolean pending)
Description copied from interface:L2TunnelHandlerCombines policies and tunnels to create descriptions.- Specified by:
getL2Descriptionsin interfaceL2TunnelHandler- Parameters:
pending- if it is true return pending to be installed pseudowires from the appropriate store, else return installed pseudowires- Returns:
- Set of l2 tunnel descriptions.
-
getL2Policies
public List<L2TunnelPolicy> getL2Policies()
Description copied from interface:L2TunnelHandlerReturns a copy of the l2 policies that exist in the store.- Specified by:
getL2Policiesin interfaceL2TunnelHandler- Returns:
- The l2 policies
-
getL2Tunnels
public List<L2Tunnel> getL2Tunnels()
Description copied from interface:L2TunnelHandlerReturns a copy of the l2 tunnels that exist in the store.- Specified by:
getL2Tunnelsin interfaceL2TunnelHandler- Returns:
- The l2 tunnels.
-
getL2PendingPolicies
public List<L2TunnelPolicy> getL2PendingPolicies()
Description copied from interface:L2TunnelHandlerReturns a copy of the pending l2 policies that exist in the store.- Specified by:
getL2PendingPoliciesin interfaceL2TunnelHandler- Returns:
- The l2 policies
-
getL2PendingTunnels
public List<L2Tunnel> getL2PendingTunnels()
Description copied from interface:L2TunnelHandlerReturns a copy of the pending l2 tunnels that exist in the store.- Specified by:
getL2PendingTunnelsin interfaceL2TunnelHandler- Returns:
- The l2 tunnels.
-
verifyGlobalValidity
public L2TunnelHandler.Result verifyGlobalValidity(L2TunnelDescription pwToAdd)
Description copied from interface:L2TunnelHandlerVerifies global validity for existing pseudowires, both ones in the pending store and the ones installed.- Specified by:
verifyGlobalValidityin interfaceL2TunnelHandler- Parameters:
pwToAdd- the new pseudowire to add- Returns:
- a Result describing the outcome
-
getInitNext
public com.google.common.collect.ImmutableMap<String,org.onosproject.net.flowobjective.NextObjective> getInitNext()
Description copied from interface:L2TunnelHandlerReturns the PW init next objective store.- Specified by:
getInitNextin interfaceL2TunnelHandler- Returns:
- current contents of the l2InitiationNextObjStore
-
getTermNext
public com.google.common.collect.ImmutableMap<String,org.onosproject.net.flowobjective.NextObjective> getTermNext()
Description copied from interface:L2TunnelHandlerReturns the PW termination next objective store.- Specified by:
getTermNextin interfaceL2TunnelHandler- Returns:
- current contents of the l2TerminationNextObjStore
-
removeNextId
public void removeNextId(int nextId)
Description copied from interface:L2TunnelHandlerRemoves given next ID from both PW init/term next obj store.- Specified by:
removeNextIdin interfaceL2TunnelHandler- Parameters:
nextId- next ID
-
deployPseudowire
public L2TunnelHandler.Result deployPseudowire(L2TunnelDescription pw)
Adds a single pseudowire.- Parameters:
pw- The pseudowire to deploy- Returns:
- result of pseudowire deployment
-
checkIfPwExists
public L2TunnelHandler.Result checkIfPwExists(long tunnelId, boolean pending)
Description copied from interface:L2TunnelHandlerCheck if pseudowire exists in the store.- Specified by:
checkIfPwExistsin interfaceL2TunnelHandler- Parameters:
tunnelId- The tunnel id to check for.pending- Check in pending store for pseudowires.- Returns:
- The result of the operation.
-
tearDownPseudowire
public L2TunnelHandler.Result tearDownPseudowire(long l2TunnelId)
Helper function for removing a single pseudowire. Tries to remove pseudowire from any store it might reside (pending or installed).- Parameters:
l2TunnelId- the id of the pseudowire to tear down- Returns:
- Returns SUCCESS if no error is obeserved or an appropriate error on a failure
-
tearDown
@Deprecated public void tearDown(Set<L2TunnelDescription> pwToRemove)
Deprecated.Description copied from interface:L2TunnelHandlerHelper function to handle the pw removal.This method should for the mastership of the device because it is used only from network configuration updates, thus we only want one instance only to program each pseudowire.
- Specified by:
tearDownin interfaceL2TunnelHandler- Parameters:
pwToRemove- the pseudo wires to remove
-
-