diff --git a/README.md b/README.md index ebbc86e8a..0d0911700 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,18 @@ Mirantis Fuel Contrail plugin Compatible versions: -- Mirantis Fuel 6.1 -- Juniper Contrail 2.20 +- Mirantis Fuel 7.0 +- Juniper Contrail 3.0 How to build plugin: - Install fuel plugin builder (fpb) - Clone plugin repo and run fpb there: - git clone https://github.com/stackforge/fuel-plugin-contrail + git clone https://github.com/openstack/fuel-plugin-contrail cd fuel-plugin-contrail/ fpb --build . -- Check if file contrail-1.0-1.0.1-1.noarch.rpm was created. +- Check if file contrail-3.0-3.0.0-1.noarch.rpm was created. diff --git a/deployment_scripts/puppet/manifests/site-compute-post.pp b/deployment_scripts/puppet/manifests/site-compute-post.pp index 5417b365d..d009725dc 100644 --- a/deployment_scripts/puppet/manifests/site-compute-post.pp +++ b/deployment_scripts/puppet/manifests/site-compute-post.pp @@ -19,7 +19,7 @@ Exec { path => '/bin:/sbin:/usr/bin:/usr/sbin', refresh => 'echo NOOP_ON_REFRESH class { 'contrail::network': node_role => $node_role, address => $contrail::address, - ifname => $contrail::ifname, + ifname => $contrail::phys_dev, netmask => $contrail::netmask_short, } -> diff --git a/deployment_scripts/puppet/manifests/site-contrail-post1.pp b/deployment_scripts/puppet/manifests/site-contrail-post1.pp index 2d2086987..ae6924480 100644 --- a/deployment_scripts/puppet/manifests/site-contrail-post1.pp +++ b/deployment_scripts/puppet/manifests/site-contrail-post1.pp @@ -21,7 +21,7 @@ if $contrail::node_name =~ /^contrail.\d+$/ { class { 'contrail::network': node_role => $node_role, address => $contrail::address, - ifname => $contrail::ifname, + ifname => $contrail::phys_dev, netmask => $contrail::netmask_short, default_gw => $contrail::default_gw, } diff --git a/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_private_ifname.rb b/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_private_ifname.rb deleted file mode 100644 index 49f8256f6..000000000 --- a/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_private_ifname.rb +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -require 'yaml' - -module Puppet::Parser::Functions -newfunction(:get_private_ifname, :type => :rvalue, :doc => <<-EOS - Returns interface selected as "Private network" in web UI - EOS - ) do |args| - ifname = String.new - yml = YAML.load(File.open("/etc/astute.yaml")) - - yml['network_scheme']['transformations'].each do |entry| - if entry['bridge'] == "br-aux" or entry['bridge'] == "br-mesh" - ifname = entry['name'] - end - end - - return ifname.to_s - end -end diff --git a/deployment_scripts/puppet/modules/contrail/manifests/init.pp b/deployment_scripts/puppet/modules/contrail/manifests/init.pp index 90996c042..17d05f07f 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/init.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/init.pp @@ -49,11 +49,13 @@ $mos_mgmt_vip=hiera('management_vip') $asnum = $settings['contrail_asnum'] $external = $settings['contrail_external'] $route_target = $settings['contrail_route_target'] +$gateways = split($settings['contrail_gateways'], ',') # Network configuration prepare_network_config($network_scheme) -$ifname = get_private_ifname() -$private_if=get_network_role_property('neutron/mesh', 'interface') +$phys_dev=get_network_role_property('neutron/mesh', 'phys_dev') +$interface=get_network_role_property('neutron/mesh', 'interface') +$gateway=$network_scheme['endpoints'][$interface]['gateway'] $address=get_network_role_property('neutron/mesh', 'ipaddr') $cidr=get_network_role_property('neutron/mesh', 'cidr') $netmask=get_network_role_property('neutron/mesh', 'netmask') @@ -64,9 +66,6 @@ $mgmt_cidr=get_network_role_property('management', 'cidr') $mgmt_netmask=get_network_role_property('management', 'netmask') $mgmt_netmask_short=netmask_to_cidr($mgmt_netmask) -$default_gw = hiera('management_vrouter_vip') -$private_gw = $settings['contrail_private_gw'] - $contrail_mgmt_vip=get_last_ip(hiera('management_network_range')) $contrail_private_vip=get_last_ip(hiera('private_network_range')) diff --git a/deployment_scripts/puppet/modules/contrail/manifests/network.pp b/deployment_scripts/puppet/modules/contrail/manifests/network.pp index 14c65339e..074552983 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/network.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/network.pp @@ -19,39 +19,16 @@ class contrail::network ( $netmask, $default_gw = undef ) { - $br_file = $operatingsystem ? { + $br_file = $::operatingsystem ? { 'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh', 'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh', } - $gateways = split($contrail::settings['contrail_gateways'], ',') - - define contrail::network::add_route ( $destination, $gateway ) { - exec {"check_route_to_${name}": - command => "ip route del ${name}", - onlyif => "ip route | grep -E ^${name}' via'.*", - before => L23network::L3::Route[$name], - } - l23network::l3::route {$name: - destination => $name, - gateway => $gateway, - } - } case $node_role { 'base-os':{ - sysctl::value { 'net.ipv4.conf.all.rp_filter': value => '0' } - sysctl::value { 'net.ipv4.conf.default.rp_filter': value => '0' } - sysctl::value { 'net.ipv4.conf.br-mesh.rp_filter': value => '0' } - sysctl::value { 'net.ipv4.conf.br-mgmt.rp_filter': value => '0' } - class { 'l23network': use_ovs => false } - case $contrail::private_gw { - '': { notify { 'No gateway for private network':} } - default: { - contrail::network::add_route { $gateways: - destination => $gateways, - gateway => $contrail::private_gw, - } - } + sysctl::value { + 'net.ipv4.conf.all.rp_filter': value => '2'; + 'net.ipv4.conf.default.rp_filter': value => '2'; } } 'compute':{ @@ -65,7 +42,7 @@ class contrail::network ( command => 'ip addr flush dev br-mesh', returns => [0,1] # Idempotent } - case $operatingsystem { + case $::operatingsystem { 'Ubuntu': { file {'/etc/network/interfaces.d/ifcfg-vhost0': ensure => present, diff --git a/deployment_scripts/puppet/modules/contrail/manifests/provision.pp b/deployment_scripts/puppet/modules/contrail/manifests/provision.pp index b14d59e11..6f69d7ec1 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/provision.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/provision.pp @@ -19,8 +19,6 @@ class contrail::provision ( $node_role ) { path => '/usr/bin:/bin:/sbin', } - $gateways = split($contrail::settings['contrail_gateways'], ',') - define contrail::provision::prov_ext_bgp { exec { "prov_external_bgp_${name}": command => "python /opt/contrail/utils/provision_mx.py \ @@ -51,7 +49,7 @@ then exit 1; fi", creates => '/opt/contrail/prov_control_bgp-DONE', } if $contrail::node_name == $contrail::deployment_node { - contrail::provision::prov_ext_bgp { $gateways: + contrail::provision::prov_ext_bgp { $contrail::gateways: require => [Exec['wait_for_api'],Exec['prov_control_bgp']], } -> exec { 'prov_metadata_services': diff --git a/deployment_scripts/puppet/modules/contrail/templates/agent_param.erb b/deployment_scripts/puppet/modules/contrail/templates/agent_param.erb index 158f4b6b6..6aa823840 100644 --- a/deployment_scripts/puppet/modules/contrail/templates/agent_param.erb +++ b/deployment_scripts/puppet/modules/contrail/templates/agent_param.erb @@ -5,7 +5,7 @@ kmod=vrouter pname=contrail-vrouter-agent LIBDIR=/usr/lib64 DEVICE=vhost0 -dev=<%= scope.function_get_private_ifname([]) %> +dev=<%= scope.lookupvar('contrail::phys_dev') %> vgw_subnet_ip=__VGW_SUBNET_IP__ vgw_intf=__VGW_INTF_LIST__ LOGFILE=--log-file=/var/log/contrail/vrouter.log diff --git a/deployment_scripts/puppet/modules/contrail/templates/contrail-vrouter-agent.conf.erb b/deployment_scripts/puppet/modules/contrail/templates/contrail-vrouter-agent.conf.erb index b40b2c741..6343788f6 100644 --- a/deployment_scripts/puppet/modules/contrail/templates/contrail-vrouter-agent.conf.erb +++ b/deployment_scripts/puppet/modules/contrail/templates/contrail-vrouter-agent.conf.erb @@ -18,8 +18,10 @@ control_network_ip=<%= scope.lookupvar('contrail::address') %> [VIRTUAL-HOST-INTERFACE] name=vhost0 ip=<%= scope.lookupvar('contrail::address') %>/<%= scope.lookupvar('contrail::netmask_short') %> -physical_interface=<%= scope.function_get_private_ifname([]) %> -gateway=<%= scope.lookupvar('contrail::private_gw') %> +physical_interface=<%= scope.lookupvar('contrail::phys_dev') %> +<% if scope.lookupvar('contrail::gateway') != :undef -%> +gateway=<%= scope.lookupvar('contrail::gateway') %> +<% end -%> [GATEWAY-0] [GATEWAY-1] [SERVICE-INSTANCE] diff --git a/deployment_scripts/puppet/modules/contrail/templates/ubuntu-ifcfg-vhost0.erb b/deployment_scripts/puppet/modules/contrail/templates/ubuntu-ifcfg-vhost0.erb index d31ba0fb9..818a639b8 100644 --- a/deployment_scripts/puppet/modules/contrail/templates/ubuntu-ifcfg-vhost0.erb +++ b/deployment_scripts/puppet/modules/contrail/templates/ubuntu-ifcfg-vhost0.erb @@ -1,5 +1,7 @@ auto vhost0 iface vhost0 inet static address <%= scope.lookupvar('contrail::address') %>/<%= scope.lookupvar('contrail::netmask_short') %> +<% if scope.lookupvar('contrail::gateway') != :undef -%> +gateway <%= scope.lookupvar('contrail::gateway') %> +<% end -%> network_name contrail - diff --git a/environment_config.yaml b/environment_config.yaml index 64a4e42d2..19376e521 100644 --- a/environment_config.yaml +++ b/environment_config.yaml @@ -24,15 +24,6 @@ attributes: regex: source: '^(?:(6553[0-5])|(655[0-2]\d)|(65[0-4]\d{2})|(6[0-4]\d{3})|([1-5]\d{4})|([1-9]\d{1,3})|([1-9]))$' error: "Invalid AS number" - contrail_private_gw: - value: '' - label: 'Gateway for Private network' - description: 'The IP address of gateway for contrail private network to reach BGP peers. Empty if not needed.' - weight: 30 - type: "text" - regex: - source: '^((?:\d|1?\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d|1?\d\d|2[0-4]\d|25[0-5])){3})|(?:^)$' - error: "Invalid IP address" contrail_gateways: value: '10.109.3.250' label: 'GW IP'