Class ElanBridgeManager


  • @Singleton
    public class ElanBridgeManager
    extends java.lang.Object
    This class provides functions for creating bridges via OVSDB, specifically the br-int bridge.
    • Constructor Summary

      Constructors 
      Constructor Description
      ElanBridgeManager​(ElanConfig elanConfig, org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager interfaceManager, org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils southboundUtils, org.opendaylight.mdsal.binding.api.DataBroker dataBroker)
      Construct a new ElanBridgeManager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node ovsdbNode, java.lang.String bridgeName, @Nullable java.lang.String mac)
      Add a bridge to the OVSDB node but check that it does not exist in the CONFIGURATION.
      boolean addPatchPort​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, java.lang.String bridgeName, java.lang.String portName, java.lang.String peerPortName)
      Add a patch port to a bridge.
      boolean addPortToBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, java.lang.String bridgeName, java.lang.String portName)
      Add a port to a bridge.
      org.opendaylight.yangtools.yang.common.Uint64 getDatapathId​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)  
      java.util.Optional<org.opendaylight.yangtools.yang.common.Uint64> getDpIdFromManagerNodeId​(java.lang.String managerNodeId)  
      java.lang.String getIntBridgePortNameFor​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node bridgeNode, java.lang.String providerMappingValue)
      Get the name of the port in br-int for the given provider-mapping value.
      java.lang.String getIntegrationBridgeName()  
      java.lang.String getIntSidePatchPortName​(java.lang.String interfaceName)
      Get the name of the patch-port which is patched to the bridge containing interfaceName.
      java.util.Map<java.lang.String,​java.lang.String> getOpenvswitchOtherConfigMap​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, java.lang.String key)
      .
      @Nullable java.lang.String getProviderInterfaceName​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node bridgeNode, java.lang.String physicalNetworkName)  
      @Nullable java.lang.String getProviderInterfaceName​(org.opendaylight.yangtools.yang.common.Uint64 dpId, java.lang.String physicalNetworkName)  
      @Nullable java.lang.String getProviderMappingValue​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, java.lang.String physicalNetworkName)
      Get the OVS node physical interface name from provider mappings.
      void handleNewProviderNetBridges​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node originalNode, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node updatedNode)  
      boolean hasDatapathID​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)  
      boolean isBridgeNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
      Is this node a bridge.
      boolean isBridgeOnOvsdbNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node ovsdbNode, java.lang.String bridgename)  
      boolean isIntegrationBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
      Is this Node the integration bridge (br-int).
      boolean isOvsdbNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
      Is the Node object an OVSDB node.
      boolean isUserSpaceEnabled()
      Is OVS running in userspace mode?
      void processNodePrep​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, boolean generateIntBridgeMac)
      Advance the "preperation" of the OVSDB node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PROVIDER_MAPPINGS_KEY

        public static final java.lang.String PROVIDER_MAPPINGS_KEY
        See Also:
        Constant Field Values
    • Constructor Detail

      • ElanBridgeManager

        @Inject
        public ElanBridgeManager​(ElanConfig elanConfig,
                                 org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager interfaceManager,
                                 org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils southboundUtils,
                                 org.opendaylight.mdsal.binding.api.DataBroker dataBroker)
        Construct a new ElanBridgeManager.
        Parameters:
        elanConfig - the elan configuration
        interfaceManager - InterfaceManager
        southboundUtils - southboutUtils
        dataBroker - DataBroker
    • Method Detail

      • isUserSpaceEnabled

        public boolean isUserSpaceEnabled()
        Is OVS running in userspace mode?
        Returns:
        true if the ovsdb.userspace.enabled variable is set to true
      • isOvsdbNode

        public boolean isOvsdbNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
        Is the Node object an OVSDB node.
        Parameters:
        node - unidentified node object
        Returns:
        true if the Node is an OVSDB node
      • isIntegrationBridge

        public boolean isIntegrationBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
        Is this Node the integration bridge (br-int).
        Parameters:
        node - unidentified noe object
        Returns:
        true if the Node is a bridge and it is the integration bridge
      • isBridgeNode

        public boolean isBridgeNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
        Is this node a bridge.
        Parameters:
        node - unidentified node object
        Returns:
        true if this node is a bridge
      • processNodePrep

        public void processNodePrep​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node,
                                    boolean generateIntBridgeMac)
        Advance the "preperation" of the OVSDB node. This re-entrant method advances the state of an OVSDB node towards the prepared state where all bridges and patch ports are created and active. This method should be invoked for the OVSDB node and the integration bridge node BUT IT IS SAFE TO INVOKE IT ON ANY NODE.
        Parameters:
        node - A node
        generateIntBridgeMac - whether or not the int bridge's mac should be set to a random value
      • handleNewProviderNetBridges

        public void handleNewProviderNetBridges​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node originalNode,
                                                org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node updatedNode)
      • addBridge

        public boolean addBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node ovsdbNode,
                                 java.lang.String bridgeName,
                                 @Nullable java.lang.String mac)
        Add a bridge to the OVSDB node but check that it does not exist in the CONFIGURATION. If it already exists in OPERATIONAL, update it with all configurable parameters but make sure to maintain the same datapath-id.
        Parameters:
        ovsdbNode - Which OVSDB node
        bridgeName - Name of the bridge
        mac - mac address to set on the bridge or null
        Returns:
        true if no errors occurred
      • getOpenvswitchOtherConfigMap

        public java.util.Map<java.lang.String,​java.lang.String> getOpenvswitchOtherConfigMap​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node,
                                                                                                   java.lang.String key)
        .
      • getProviderMappingValue

        public @Nullable java.lang.String getProviderMappingValue​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node,
                                                                  java.lang.String physicalNetworkName)
        Get the OVS node physical interface name from provider mappings.
        Parameters:
        node - OVSDB node
        physicalNetworkName - name of physical network
        Returns:
        physical network name
      • getIntBridgePortNameFor

        public java.lang.String getIntBridgePortNameFor​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node bridgeNode,
                                                        java.lang.String providerMappingValue)
        Get the name of the port in br-int for the given provider-mapping value. This is either a patch port to a bridge with providerMappingValue - patch-<providerMappingValue> or simply a port with the same name as providerMappingValue
        Parameters:
        bridgeNode - br-int Node
        providerMappingValue - this is the last part of provider_mappings=net_name:THIS
        Returns:
        the name of the port on br-int
      • getIntSidePatchPortName

        public java.lang.String getIntSidePatchPortName​(java.lang.String interfaceName)
        Get the name of the patch-port which is patched to the bridge containing interfaceName. Patch port name is truncated to the maximum allowed characters
        Parameters:
        interfaceName - The external interface
        Returns:
        interface name
      • addPortToBridge

        public boolean addPortToBridge​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node,
                                       java.lang.String bridgeName,
                                       java.lang.String portName)
        Add a port to a bridge.
        Parameters:
        node - the bridge node
        bridgeName - name of the bridge
        portName - name of port to add
        Returns:
        true if successful in writing to mdsal
      • addPatchPort

        public boolean addPatchPort​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node,
                                    java.lang.String bridgeName,
                                    java.lang.String portName,
                                    java.lang.String peerPortName)
        Add a patch port to a bridge.
        Parameters:
        node - the bridge node
        bridgeName - name of the bridge
        portName - name of the port
        peerPortName - name of the port's peer (the other side)
        Returns:
        true if successful
      • getDpIdFromManagerNodeId

        public java.util.Optional<org.opendaylight.yangtools.yang.common.Uint64> getDpIdFromManagerNodeId​(java.lang.String managerNodeId)
      • getProviderInterfaceName

        public @Nullable java.lang.String getProviderInterfaceName​(org.opendaylight.yangtools.yang.common.Uint64 dpId,
                                                                   java.lang.String physicalNetworkName)
      • getProviderInterfaceName

        public @Nullable java.lang.String getProviderInterfaceName​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node bridgeNode,
                                                                   java.lang.String physicalNetworkName)
      • hasDatapathID

        public boolean hasDatapathID​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)
      • isBridgeOnOvsdbNode

        public boolean isBridgeOnOvsdbNode​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node ovsdbNode,
                                           java.lang.String bridgename)
      • getIntegrationBridgeName

        public java.lang.String getIntegrationBridgeName()
      • getDatapathId

        public org.opendaylight.yangtools.yang.common.Uint64 getDatapathId​(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node)