B
- The type of the virtual bridge that contains the virtual
interrace.public abstract class VInterface<B extends VtnPortMappableBridge> extends VirtualNode<Vinterface,VInterfaceIdentifier<B>> implements VirtualMapNode
VInterface
describes a configuration and runtime status for a
virtual interface.Modifier | Constructor and Description |
---|---|
protected |
VInterface(VInterfaceIdentifier<B> ifId,
Vinterface vif)
Construct a new instance.
|
protected |
VInterface(VInterfaceIdentifier<B> ifId,
VtnVinterfaceConfig vifc,
VTNPortMapConfig pmap)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
static <T extends VtnPortMappableBridge> |
create(VInterfaceIdentifier<T> ident,
Vinterface vintf)
Construct a new virtual interface instance.
|
void |
destroy(TxContext ctx,
boolean retain)
Destroy the virtual interface.
|
void |
disableInput(PacketContext pctx)
Install a flow entry that drops every incoming packet.
|
void |
filterPacket(PacketContext pctx,
int vid)
Evaluate flow filters for incoming packet received from this virtual
interface.
|
PacketContext |
filterPacket(PacketContext pctx,
int vid,
VirtualBridge<?> bridge)
Evaluate flow filters for outgoing packet to be transmitted by this
virtual interface.
|
VInterfaceIdentifier<B> |
getIdentifier(EtherAddress eaddr,
int vid)
Return the identifier for the virtual mapping which maps the given host.
|
VNodeHop |
getIngressHop(EtherAddress eaddr,
int vid)
Return a
VNodeHop instance that indicates the packet was mapped
by the port mapping. |
VnodeState |
getPortState()
Return the state of the physical switch port mapped to this virtual
interface.
|
VnodeState |
getState()
Return the current state of this virtual interface.
|
Vinterface |
getVinterface()
Return the vinterface container associated with this instance.
|
VinterfaceStatus |
getVinterfaceStatus()
Return the runtime status information of the virtual interface.
|
int |
getVlanId()
Return the VLAN ID mapped to this virtual interface.
|
boolean |
isEnabled()
Determine whether this virtual interface is enabled or not.
|
boolean |
isFilterEmpty()
Determine whether flow filter list in this virtual interface is empty
or not.
|
boolean |
match(SalPort sport,
int vid)
Determine whether the specified VLAN is mapped to this virtual interface
or not.
|
VnodeState |
notifyNode(TxContext ctx,
VtnNodeEvent ev)
Invoked when a physical switch is added, removed, or changed.
|
VnodeState |
notifyPort(TxContext ctx,
VtnPortEvent ev)
Invoked when a physical switch port is added, removed, or changed.
|
protected void |
purgeCache(TxContext ctx,
SalPort sport,
int vid)
Purge all the network caches associated with the VLAN specified by
a pair of physical switch port and VLAN ID.
|
protected abstract void |
purgePortCache(TxContext ctx,
SalPort sport,
int vid)
Purge all the network caches associated with the VLAN specified by
a pair of physical switch port and VLAN ID.
|
void |
redirect(PacketContext pctx,
RedirectFlowException rex,
VirtualBridge<B> bridge)
Redirect the given packet to this virtual interface as outgoing packet.
|
VtnUpdateType |
removePortMap(TxContext ctx)
Remove the port mapping from this interface.
|
void |
resume(TxContext ctx)
Resume the port mapping.
|
void |
setEnabled(TxContext ctx,
boolean value)
Set the enabled state to this virtual interface, and update the
vinterface-status container in the MD-SAL datastore.
|
VtnUpdateType |
setPortMap(TxContext ctx,
VTNPortMapConfig pmap)
Change the configuration for the port mapping.
|
void |
transmit(PacketContext pctx,
Set<PortVlan> sent)
Transmit the given packet to the physical network mapped to this
virtual interface.
|
getFlowFilterList
getIdentifier, getInitialValue, getLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIdentifier
protected VInterface(VInterfaceIdentifier<B> ifId, VtnVinterfaceConfig vifc, VTNPortMapConfig pmap)
This constructor is used to resume runtime status of the virtual interface on bootstrap.
ifId
- The location of the virtual interface.vifc
- Configuration of the virtual interface.pmap
- Port mapping configuration.protected VInterface(VInterfaceIdentifier<B> ifId, Vinterface vif)
ifId
- The location of the virtual interface.vif
- A Vinterface
instance read from the MD-SAL
datastore.public static final <T extends VtnPortMappableBridge> VInterface<T> create(VInterfaceIdentifier<T> ident, Vinterface vintf)
T
- The type of the parent virtual bridge.ident
- The virtual interface identifier.vintf
- The virtual interface.VInterface
instance.public final VnodeState getState()
public final VnodeState getPortState()
public final Vinterface getVinterface()
Vinterface
instance.public final VinterfaceStatus getVinterfaceStatus()
VinterfaceStatus
instance.public final VtnUpdateType setPortMap(TxContext ctx, VTNPortMapConfig pmap) throws VTNException
ctx
- MD-SAL datastore transaction context.pmap
- A VTNPortMapConfig
that contains the port mapping
configuration to be applied.
Specifying null
results in undefined behavior.VtnUpdateType
instance if the port mapping
configuration has been changed. null
if not changed.VTNException
- An error occurred.public final VtnUpdateType removePortMap(TxContext ctx) throws VTNException
ctx
- MD-SAL datastore transaction context.VtnUpdateType.REMOVED
if the port mapping configuration
has been removed. null
if not changed.VTNException
- An error occurred.public final void setEnabled(TxContext ctx, boolean value) throws VTNException
ctx
- MD-SAL datastore transaction context.value
- A new value of the enabled state.VTNException
- An error occurred.public final void destroy(TxContext ctx, boolean retain)
ctx
- MD-SAL datastore transaction context.retain
- true
means that the parent virtual node will be
retained. false
means that the parent virtual
node is being destroyed.public final boolean isFilterEmpty()
true
if this virtual interface contains no flow filter.
false
otherwise.public final void resume(TxContext ctx) throws VTNException
ctx
- MD-SAL datastore transaction context.VTNException
- An error occurred.public final VnodeState notifyNode(TxContext ctx, VtnNodeEvent ev)
ctx
- MD-SAL datastore transaction context.ev
- A VtnNodeEvent
instance.public final VnodeState notifyPort(TxContext ctx, VtnPortEvent ev)
ctx
- MD-SAL datastore transaction context.ev
- A VtnPortEvent
instance.public final boolean match(SalPort sport, int vid)
Note that this method does not see the state of this node.
This method returns true
if the specified VLAN is mapped to
this virtual interface by port mapping.
sport
- A SalPort
instance that specifies the physicalvid
- The VLAN ID.true
only if the specified VLAN is mapped to this
virtual interface.
treated as input of this node.public final void transmit(PacketContext pctx, Set<PortVlan> sent) throws RedirectFlowException, VTNException
pctx
- A runtime context for a received packet.sent
- A set of PortVlan
which indicates the network
already processed.RedirectFlowException
- The given packet was redirected by a flow filter.VTNException
- An error occurred.public int getVlanId()
public final void redirect(PacketContext pctx, RedirectFlowException rex, VirtualBridge<B> bridge) throws DropFlowException, RedirectFlowException, VTNException
pctx
- A runtime context for a received packet.rex
- An exception that keeps information about the packet
redirection.bridge
- A VirtualBridge
instance associated with this
virtual interface.DropFlowException
- The given packet was discarded by a DROP flow filter.RedirectFlowException
- The given packet was redirected by a REDIRECT flow filter.VTNException
- An error occurred.protected final void purgeCache(TxContext ctx, SalPort sport, int vid) throws VTNException
This method is used to purge network data cached by obsolete port mapping.
ctx
- MD-SAL datastore transaction context.sport
- A SalPort
instance that specifies the physical
switch port mapped by the port mapping.
Node that null
is specified if no switch port
is mapped by the port mapping.vid
- The VLAN ID specified by the port mapping configuration.VTNException
- An error occurred.protected abstract void purgePortCache(TxContext ctx, SalPort sport, int vid) throws VTNException
This method in this class does nothing. Subclass can override this method to purge network data cached by obsolete port mapping.
ctx
- MD-SAL datastore transaction context.sport
- A SalPort
instance that specifies the physical
switch port mapped by the port mapping.
Specifying null
results in undefined behavior.vid
- The VLAN ID specified by the port mapping configuration.VTNException
- An error occurred.public final VInterfaceIdentifier<B> getIdentifier(EtherAddress eaddr, int vid)
This method always returns the identifier for this virtual interface because port mapping does not specifies the host to be mapped.
getIdentifier
in interface VirtualMapNode
eaddr
- Unused.vid
- Unused.public final boolean isEnabled()
isEnabled
in interface VirtualMapNode
true
only if this virtual interface is enabled.public VNodeHop getIngressHop(EtherAddress eaddr, int vid)
VNodeHop
instance that indicates the packet was mapped
by the port mapping.getIngressHop
in interface VirtualMapNode
eaddr
- Unused.vid
- Unused.VNodeHop
instance.public void disableInput(PacketContext pctx)
disableInput
in interface VirtualMapNode
pctx
- A runtime context for a received packet.public void filterPacket(PacketContext pctx, int vid) throws DropFlowException, RedirectFlowException
filterPacket
in interface VirtualMapNode
pctx
- A runtime context for a received packet.vid
- A VLAN ID to be used for packet matching.
A VLAN ID configured in the given packet is used if a
negative value is specified.DropFlowException
- The given packet was discarded by a flow filter.RedirectFlowException
- The given packet was redirected by a flow filter.public PacketContext filterPacket(PacketContext pctx, int vid, VirtualBridge<?> bridge) throws DropFlowException, RedirectFlowException
filterPacket
in interface VirtualMapNode
pctx
- A runtime context for a received packet.vid
- A VLAN ID to be used for packet matching.
A VLAN ID configured in the given packet is used if a
negative value is specified.bridge
- A VirtualBridge
instance associated with this
virtual mapping.PacketContext
to be used for transmitting packet.DropFlowException
- The given packet was discarded by a flow filter.RedirectFlowException
- The given packet was redirected by a flow filter.Copyright © 2018 OpenDaylight. All rights reserved.