Exemplo n.º 1
0
    def __init__(self):
        lg.LookingGlassLocalLogger.__init__(self)

        cfg.CONF.register_opts(self.driver_opts,
                               constants.config_group(self.type))

        self.config = cfg.CONF.get(constants.config_group(self.type))

        assert issubclass(self.dataplane_instance_class, VPNInstanceDataplane)

        self.local_address = self.config.get("dataplane_local_address")

        if self.local_address is None:
            self.local_address = cfg.CONF.BGP.local_address

        self.log.info("Will use %s as local_address", self.local_address)

        # Linux kernel version check
        o = self._run_command("uname -r")
        self.kernel_release = o[0][0].split("-")[0]
        if self.required_kernel:
            if (version.StrictVersion(self.kernel_release) <
                    version.StrictVersion(self.required_kernel)):
                self.log.warning(
                    "%s requires at least Linux kernel %s"
                    " (you are running %s)", self.__class__.__name__,
                    self.required_kernel, self.kernel_release)

        # Flag to trigger cleanup all dataplane states on first call to
        # vif_plugged
        self.first_init = True
Exemplo n.º 2
0
def instantiate_dataplane_drivers():
    LOG.debug("Building dataplane drivers...")

    if 'DATAPLANE_DRIVER' in cfg.CONF:
        LOG.warning("Config file is obsolete, should have a "
                    "DATAPLANE_DRIVER_IPVPN section instead of"
                    " DATAPLANE_DRIVER")

    drivers = {}
    for vpn_type in constants.VPN_TYPES:
        dp_config = cfg.CONF.get(constants.config_group(vpn_type))

        driver_name = dp_config.dataplane_driver
        LOG.debug("Instantiating dataplane driver for %s, with %s", vpn_type,
                  driver_name)
        try:
            driver_class = stevedore.driver.DriverManager(
                namespace='%s.%s' %
                (DATAPLANE_DRIVER_ENTRY_POINT_PFX, vpn_type),
                name=driver_name,
            ).driver

            drivers[vpn_type] = driver_class()
        except Exception:
            LOG.exception(
                "Error while instantiating dataplane driver for "
                "%s with %s", vpn_type, driver_name)
            raise

    return drivers
Exemplo n.º 3
0
def register_driver_opts(vpn_type, driver_opts):
    cfg.CONF.register_opts(driver_opts, constants.config_group(vpn_type))
Exemplo n.º 4
0
# NOTE(tmorin): have dataplane_local_address default to
#               cfg.CONF.BGP.local_address does not work (import order issue)
# TODO(tmorin): list possible values for dataplane_driver,
#               see what neutron-db-manage does
dataplane_common_opts = [
    cfg.Opt("dataplane_local_address",
            type=config.InterfaceAddress(),
            help=("IP address to use as next-hop in our route "
                  "advertisements, will be used to send us "
                  "VPN traffic")),
    cfg.StrOpt("dataplane_driver", default="dummy", help="Dataplane driver.")
]

for vpn_type in constants.VPN_TYPES:
    cfg.CONF.register_opts(dataplane_common_opts,
                           constants.config_group(vpn_type))


def register_driver_opts(vpn_type, driver_opts):
    cfg.CONF.register_opts(driver_opts, constants.config_group(vpn_type))


# prefix for setuptools entry points for dataplane drivers
DATAPLANE_DRIVER_ENTRY_POINT_PFX = "bagpipe.dataplane"


def instantiate_dataplane_drivers():
    LOG.debug("Building dataplane drivers...")

    if 'DATAPLANE_DRIVER' in cfg.CONF:
        LOG.warning("Config file is obsolete, should have a "
Exemplo n.º 5
0
def list_dataplane_driver_ipvpn_mpls_ovs_opts():
    return [
        (constants.config_group(constants.IPVPN).lower(),
         mpls_ovs_dataplane.MPLSOVSDataplaneDriver.driver_opts),
    ]
Exemplo n.º 6
0
def list_dataplane_driver_evpn_linux_vxlan_opts():
    return [
        (constants.config_group(constants.EVPN).lower(),
         linux_vxlan.LinuxVXLANDataplaneDriver.driver_opts),
    ]
Exemplo n.º 7
0
def list_dataplane_driver_evpn_opts():
    return [
        (constants.config_group(constants.EVPN).lower(),
         dataplane_drivers.dataplane_common_opts),
    ]