Beispiel #1
0
def basic_overcloud_network():
    """Run setup for neutron networking.

    Configure the following:
        The overcloud network using subnet pools

    """
    cli_utils.setup_logging()

    # Get network configuration settings
    network_config = {}
    # Declared overcloud settings
    network_config.update(OVERCLOUD_NETWORK_CONFIG)
    # Default undercloud settings
    network_config.update(DEFAULT_UNDERCLOUD_NETWORK_CONFIG)
    # Environment specific settings
    network_config.update(generic_utils.get_undercloud_env_vars())

    # Get keystone session
    keystone_session = openstack_utils.get_overcloud_keystone_session()

    # Handle network for Openstack-on-Openstack scenarios
    if juju_utils.get_provider_type() == "openstack":
        undercloud_ks_sess = openstack_utils.get_undercloud_keystone_session()
        network.setup_gateway_ext_port(network_config,
                                       keystone_session=undercloud_ks_sess)

    # Confugre the overcloud network
    network.setup_sdn(network_config, keystone_session=keystone_session)
Beispiel #2
0
def setup():
    """Run setup for BGP networking.

    Configure the following:
        The overcloud network using subnet pools
        The overcloud BGP speaker
        The BGP peer
        Advertising of the FIPs via BGP
        Advertising of the project network(s) via BGP

    :returns: None
    :rtype: None
    """
    cli_utils.setup_logging()

    # Get network configuration settings
    network_config = {}
    # Declared overcloud settings
    network_config.update(OVERCLOUD_NETWORK_CONFIG)
    # Default undercloud settings
    network_config.update(DEFAULT_UNDERCLOUD_NETWORK_CONFIG)
    # Environment specific settings
    network_config.update(generic_utils.get_undercloud_env_vars())

    # Get keystone session
    keystone_session = openstack_utils.get_overcloud_keystone_session()

    # Confugre the overcloud network
    network.setup_sdn(network_config, keystone_session=keystone_session)
    # Configure BGP
    bgp_speaker.setup_bgp_speaker(
        peer_application_name=DEFAULT_PEER_APPLICATION_NAME,
        keystone_session=keystone_session)
Beispiel #3
0
    def test_get_undercloud_env_vars(self):
        self.patch_object(generic_utils.os.environ, "get")

        def _get_env(key):
            return _env.get(key)

        self.get.side_effect = _get_env

        # OSCI backward compatible env vars
        _env = {
            "NET_ID": "netid",
            "NAMESERVER": "10.0.0.10",
            "GATEWAY": "10.0.0.1",
            "CIDR_EXT": "10.0.0.0/24",
            "FIP_RANGE": "10.0.200.0:10.0.200.254"
        }
        _expected_result = {}
        _expected_result["net_id"] = _env["NET_ID"]
        _expected_result["external_dns"] = _env["NAMESERVER"]
        _expected_result["default_gateway"] = _env["GATEWAY"]
        _expected_result["external_net_cidr"] = _env["CIDR_EXT"]
        _expected_result["start_floating_ip"] = _env["FIP_RANGE"].split(":")[0]
        _expected_result["end_floating_ip"] = _env["FIP_RANGE"].split(":")[1]
        self.assertEqual(generic_utils.get_undercloud_env_vars(),
                         _expected_result)

        # Overriding configure.network named variables
        _override = {
            "start_floating_ip": "10.100.50.0",
            "end_floating_ip": "10.100.50.254",
            "default_gateway": "10.100.0.1",
            "external_net_cidr": "10.100.0.0/16"
        }
        _env.update(_override)
        _expected_result.update(_override)
        self.assertEqual(generic_utils.get_undercloud_env_vars(),
                         _expected_result)