def __init__(self, config, init=True):
        LookingGlassLocalLogger.__init__(self, __name__)

        self.log.info("Initializing %s", self.__class__.__name__)

        self.vxlanDestPort = config.get("vxlan_dst_port", None)

        DataplaneDriver.__init__(self, config, init)
Exemple #2
0
    def __init__(self, config, init=True):
        LookingGlassLocalLogger.__init__(self, __name__)

        self.log.info("Initializing %s", self.__class__.__name__)

        try:
            self.vxlanDestPort = int(config.get("vxlan_dst_port", 0)) or None
        except ValueError:
            raise Exception("Could not parse specified vxlan_dst_port: %s" %
                            config["vxlan_dst_port"])

        DataplaneDriver.__init__(self, config, init)
    def __init__(self, config, init=True):
        LookingGlassLocalLogger.__init__(self)
        self.log.info("Initializing MPLSOVSVRFDataplane")

        try:
            (o, _) = self._runCommand("ovs-ofctl -V | head -1 |"
                                      " awk '{print $4}'")
            self.ovsRelease = o[0]
            self.log.info("OVS release: %s", self.ovsRelease)
        except:
            self.log.warning("Could not determine OVS release")
            self.ovsRelease = None

        self.config = config

        self.mpls_interface = config.get("mpls_interface", None)

        try:
            self.useGRE = getBoolean(config["mpls_over_gre"])
        except KeyError:
            self.useGRE = not (self.mpls_interface
                               and self.mpls_interface != "*gre*")

        if not self.mpls_interface:
            if not self.useGRE:
                raise Exception("mpls_over_gre force-disabled, but no "
                                "mpls_interface specified")
            else:
                self.useGRE = True
                self.log.info("Defaulting to use of MPLS-over-GRE (no "
                              "mpls_interface specified)")
        elif self.mpls_interface == "*gre*":
            if not self.useGRE:
                raise Exception("mpls_over_gre force-disabled, but "
                                "mpls_interface set to '*gre', cannot "
                                "use bare MPLS")
            else:
                self.log.info("mpls_interface is '*gre*', will thus use "
                              "MPLS-over-GRE")
                self.useGRE = True
                self.mpls_interface = None
        else:
            if self.useGRE:
                self.log.warning("mpls_over_gre set to True, "
                                 "ignoring mpls_interface parameter")
                self.mpls_interface = None
            else:
                self.log.info("Will use bare MPLS on interface %s",
                              self.mpls_interface)

        self.bridge = DEFAULT_OVS_BRIDGE
        try:
            self.bridge = config["ovs_bridge"]
        except KeyError:
            self.log.warning("No bridge configured, will use default: %s",
                             DEFAULT_OVS_BRIDGE)

        self.ovs_table_incoming = DEFAULT_OVS_TABLE
        try:
            self.ovs_table_incoming = int(config["ovs_table_incoming"])
        except KeyError:
            self.log.debug(
                "No ovs_table_incoming configured, "
                "will use default table %s", DEFAULT_OVS_TABLE)

        self.ovs_table_vrfs = DEFAULT_OVS_TABLE
        try:
            self.ovs_table_vrfs = int(config["ovs_table_vrfs"])
        except KeyError:
            self.log.debug(
                "No ovs_table_vrfs configured, will use default"
                " table %s", DEFAULT_OVS_TABLE)

        self.vxlanEncap = getBoolean(config.get("vxlan_encap", "False"))

        self.proxy_arp = getBoolean(config.get("proxy_arp", "True"))

        # unless useGRE is enabled, check that fping is installed
        if not self.useGRE:
            self._runCommand("fping -v", raiseExceptionOnError=True)

        if (not self.vxlanEncap
                and StrictVersion(self.ovsRelease) < StrictVersion("2.4.0")):
            self.log.warning(
                "%s requires at least OVS 2.4.0 (you are running %s)",
                self.__class__.__name__, self.ovsRelease)

        DataplaneDriver.__init__(self, config, init)
    def __init__(self, config, init=True):
        LookingGlassLocalLogger.__init__(self)
        self.log.info("Initializing MPLSOVSVRFDataplane")

        try:
            (o, _) = self._runCommand("ovs-ofctl -V | head -1 |"
                                      " awk '{print $4}'")
            self.ovsRelease = o[0]
            self.log.info("OVS kernel module %s", self.ovsRelease)
        except:
            self.log.warning("Could not determine OVS release")
            self.ovsRelease = None

        self.config = config

        self.mpls_interface = config.get("mpls_interface", None)

        try:
            self.useGRE = getBoolean(config["mpls_over_gre"])
        except KeyError:
            self.useGRE = not (self.mpls_interface and
                               self.mpls_interface != "*gre*")

        if not self.mpls_interface:
            if not self.useGRE:
                raise Exception("mpls_over_gre force-disabled, but no "
                                "mpls_interface specified")
            else:
                self.useGRE = True
                self.log.info("Defaulting to use of MPLS-over-GRE (no "
                              "mpls_interface specified)")
        elif self.mpls_interface == "*gre*":
            if not self.useGRE:
                raise Exception("mpls_over_gre force-disabled, but "
                                "mpls_interface set to '*gre', cannot "
                                "use bare MPLS")
            else:
                self.log.info("mpls_interface is '*gre*', will thus use "
                              "MPLS-over-GRE")
                self.useGRE = True
                self.mpls_interface = None
        else:
            if self.useGRE:
                self.log.warning("mpls_over_gre set to True, "
                                 "ignoring mpls_interface parameter")
                self.mpls_interface = None
            else:
                self.log.info("Will use bare MPLS on interface %s",
                              self.mpls_interface)

        self.bridge = DEFAULT_OVS_BRIDGE
        try:
            self.bridge = config["ovs_bridge"]
        except KeyError:
            self.log.warning("No bridge configured, will use default: %s",
                             DEFAULT_OVS_BRIDGE)

        self.ovs_table_incoming = DEFAULT_OVS_TABLE
        try:
            self.ovs_table_incoming = int(config["ovs_table_incoming"])
        except KeyError:
            self.log.debug("No ovs_table_incoming configured, "
                           "will use default table %s", DEFAULT_OVS_TABLE)

        self.ovs_table_vrfs = DEFAULT_OVS_TABLE
        try:
            self.ovs_table_vrfs = int(config["ovs_table_vrfs"])
        except KeyError:
            self.log.debug("No ovs_table_vrfs configured, will use default"
                           " table %s", DEFAULT_OVS_TABLE)

        self.vxlanEncap = getBoolean(config.get("vxlan_encap", "False"))

        # check that fping is installed
        if not self.useGRE:
            self._runCommand("fping -v", raiseExceptionOnError=True)

        if (not self.vxlanEncap and
                StrictVersion(self.ovsRelease) < StrictVersion("2.4.0")):
            self.log.warning(
                "%s requires at least OVS 2.4.0 (you are running %s)",
                self.__class__.__name__, self.ovsRelease)

        DataplaneDriver.__init__(self, config, init)
 def __init__(self, config, init=True):
     LookingGlassLocalLogger.__init__(self)
     DataplaneDriver.__init__(self, config, init)
 def __init__(self, config, init=True):
     LookingGlassLocalLogger.__init__(self)
     DataplaneDriver.__init__(self, config, init)