From 8b9e2b3c6ca5221249b8aa7dc792e756ee92209a Mon Sep 17 00:00:00 2001 From: Michael Henkel Date: Fri, 16 Jun 2017 10:49:57 -0700 Subject: Contrail: Fix controlplane/dataplane network asignments & enable optional dpdk This patch will move the Contrail roles communication towards OpenStack APIs from the public/external network to the internal_api network. I will also add the option to enable dpdk for Contrail. Change-Id: Ia835df656031cdf28de20f41ec6ab1c028dced23 Closes-Bug: 1698422 --- manifests/network/contrail/vrouter.pp | 96 +++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 21 deletions(-) (limited to 'manifests/network/contrail/vrouter.pp') diff --git a/manifests/network/contrail/vrouter.pp b/manifests/network/contrail/vrouter.pp index 678a77d..37c7a7b 100644 --- a/manifests/network/contrail/vrouter.pp +++ b/manifests/network/contrail/vrouter.pp @@ -45,7 +45,7 @@ # [*api_server*] # (optional) IP address of api server # String value. -# Defaults to hiera('contrail_config_vip') +# Defaults to hiera('contrail_config_vip',hiera('internal_api_virtual_ip')) # # [*api_port*] # (optional) port of api server @@ -62,11 +62,6 @@ # Integer value. # Defaults to hiera('contrail::auth_port') # -# [*auth_port_ssl*] -# (optional) keystone ssl port. -# Integer value. -# Defaults to hiera('contrail::auth_port_ssl') -# # [*auth_protocol*] # (optional) authentication protocol. # String value. @@ -90,7 +85,7 @@ # [*disc_server_ip*] # (optional) IPv4 address of discovery server. # String (IPv4) value. -# Defaults to hiera('contrail_config_vip'), +# Defaults to hiera('contrail::disc_server_ip') # # [*disc_server_port*] # (optional) port Discovery server listens on. @@ -132,16 +127,21 @@ # String value. # Defaults to hiera('contrail::vrouter::physical_interface') # -# [*public_vip*] +# [*internal_vip*] # (optional) Public VIP to Keystone # String (IPv4) value. -# Defaults to hiera('public_virtual_ip') +# Defaults to hiera('internal_api_virtual_ip') # # [*is_tsn*] # (optional) Turns vrouter into TSN # String value. # Defaults to hiera('contrail::vrouter::is_tsn',false) # +# [*is_dpdk*] +# (optional) Turns vrouter into DPDK Compute Node +# String value. +# Defaults to hiera('contrail::vrouter::is_dpdk',false) +# class tripleo::network::contrail::vrouter ( $step = Integer(hiera('step')), $admin_password = hiera('contrail::admin_password'), @@ -149,15 +149,14 @@ class tripleo::network::contrail::vrouter ( $admin_token = hiera('contrail::admin_token'), $admin_user = hiera('contrail::admin_user'), $api_port = hiera('contrail::api_port'), - $api_server = hiera('contrail_config_vip'), + $api_server = hiera('contrail_config_vip',hiera('internal_api_virtual_ip')), $auth_host = hiera('contrail::auth_host'), $auth_port = hiera('contrail::auth_port'), - $auth_port_ssl = hiera('contrail::auth_port_ssl'), $auth_protocol = hiera('contrail::auth_protocol'), $ca_file = hiera('contrail::service_certificate',false), $cert_file = hiera('contrail::service_certificate',false), - $control_server = hiera('contrail_control_node_ips'), - $disc_server_ip = hiera('contrail_config_vip'), + $control_server = hiera('contrail::vrouter::control_node_ips'), + $disc_server_ip = hiera('contrail_config_vip',hiera('internal_api_virtual_ip')), $disc_server_port = hiera('contrail::disc_server_port'), $gateway = hiera('contrail::vrouter::gateway'), $host_ip = hiera('contrail::vrouter::host_ip'), @@ -166,18 +165,23 @@ class tripleo::network::contrail::vrouter ( $metadata_secret = hiera('contrail::vrouter::metadata_proxy_shared_secret'), $netmask = hiera('contrail::vrouter::netmask'), $physical_interface = hiera('contrail::vrouter::physical_interface'), - $public_vip = hiera('public_virtual_ip'), + $internal_vip = hiera('internal_api_virtual_ip'), $is_tsn = hiera('contrail::vrouter::is_tsn',false), + $is_dpdk = hiera('contrail::vrouter::is_dpdk',false), ) { $cidr = netmask_to_cidr($netmask) notify { 'cidr': message => $cidr, } - $macaddress = inline_template("<%= scope.lookupvar('::macaddress_${physical_interface}') -%>") #include ::contrail::vrouter # NOTE: it's not possible to use this class without a functional # contrail controller up and running - $control_server_list = join($control_server, ' ') + if size($control_server) == 0 { + #$control_server_list = join(hiera('contrail_control_node_ips'), ' ') + $control_server_list = '' + } else { + $control_server_list = join($control_server, ' ') + } if $auth_protocol == 'https' { $keystone_config = { 'KEYSTONE' => { @@ -186,7 +190,7 @@ class tripleo::network::contrail::vrouter ( 'admin_token' => $admin_token, 'admin_user' => $admin_user, 'auth_host' => $auth_host, - 'auth_port' => $auth_port_ssl, + 'auth_port' => $auth_port, 'auth_protocol' => $auth_protocol, 'insecure' => $insecure, 'memcached_servers' => $memcached_servers, @@ -196,8 +200,8 @@ class tripleo::network::contrail::vrouter ( } $vnc_api_lib_config = { 'auth' => { - 'AUTHN_SERVER' => $public_vip, - 'AUTHN_PORT' => $auth_port_ssl, + 'AUTHN_SERVER' => $auth_host, + 'AUTHN_PORT' => $auth_port, 'AUTHN_PROTOCOL' => $auth_protocol, 'certfile' => $cert_file, 'cafile' => $ca_file, @@ -219,18 +223,59 @@ class tripleo::network::contrail::vrouter ( } $vnc_api_lib_config = { 'auth' => { - 'AUTHN_SERVER' => $public_vip, + 'AUTHN_SERVER' => $auth_host, }, } } if $is_tsn { + $macaddress = inline_template("<%= scope.lookupvar('::macaddress_${physical_interface}') -%>") $vrouter_agent_config = { - 'DEBUG' => { + 'DEFAULT' => { 'agent_mode' => 'tsn', }, + 'DNS' => { + 'server' => $control_server_list, + }, + 'CONTROL-NODE' => { + 'server' => $control_server_list, + }, + 'NETWORKS' => { + 'control_network_ip' => $host_ip, + }, + 'VIRTUAL-HOST-INTERFACE' => { + 'compute_node_address' => $host_ip, + 'gateway' => $gateway, + 'ip' => "${host_ip}/${cidr}", + 'name' => 'vhost0', + 'physical_interface' => $physical_interface, + }, + 'METADATA' => { + 'metadata_proxy_secret' => $metadata_secret, + }, + 'DISCOVERY' => { + 'server' => $disc_server_ip, + 'port' => $disc_server_port, + }, + } + } elsif $is_dpdk { + $pciaddress = generate('/bin/cat','/etc/contrail/dpdk_pci') + $macaddress = generate('/bin/cat','/etc/contrail/dpdk_mac') + $vrouter_agent_config = { + 'DEFAULT' => { + 'platform' => 'dpdk', + 'physical_uio_driver' => 'uio_pci_generic', + 'physical_interface_mac' => $macaddress, + 'physical_interface_address' => $pciaddress, + }, + 'DNS' => { + 'server' => $control_server_list, + }, 'CONTROL-NODE' => { 'server' => $control_server_list, }, + 'NETWORKS' => { + 'control_network_ip' => $host_ip, + }, 'VIRTUAL-HOST-INTERFACE' => { 'compute_node_address' => $host_ip, 'gateway' => $gateway, @@ -247,10 +292,17 @@ class tripleo::network::contrail::vrouter ( }, } } else { + $macaddress = inline_template("<%= scope.lookupvar('::macaddress_${physical_interface}') -%>") $vrouter_agent_config = { + 'DNS' => { + 'server' => $control_server_list, + }, 'CONTROL-NODE' => { 'server' => $control_server_list, }, + 'NETWORKS' => { + 'control_network_ip' => $host_ip, + }, 'VIRTUAL-HOST-INTERFACE' => { 'compute_node_address' => $host_ip, 'gateway' => $gateway, @@ -272,6 +324,7 @@ class tripleo::network::contrail::vrouter ( gateway => $gateway, host_ip => $host_ip, is_tsn => $is_tsn, + is_dpdk => $is_dpdk, macaddr => $macaddress, mask => $cidr, netmask => $netmask, @@ -297,6 +350,7 @@ class tripleo::network::contrail::vrouter ( keystone_admin_password => $admin_password, keystone_admin_tenant_name => $admin_tenant_name, is_tsn => $is_tsn, + is_dpdk => $is_dpdk, } } } -- cgit 1.2.3-korg