-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "SM-BMS: Support of toragent and tsn roles" into R2.20
- Loading branch information
Showing
11 changed files
with
285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
contrail/environment/modules/contrail/manifests/lib/top_of_rack.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
define contrail::lib::top_of_rack( | ||
$tunnel_ip_address, | ||
$ovs_port, | ||
$http_server_port, | ||
$ip_address, | ||
$id, | ||
$vendor_name, | ||
$ovs_protocol, | ||
$type, | ||
$switch_name, | ||
$discovery_ip_to_use, | ||
$contrail_tsn_ip, | ||
$contrail_tsn_hostname, | ||
$contrail_openstack_ip, | ||
$contrail_config_ip, | ||
$keystone_admin_user, | ||
$keystone_admin_password, | ||
$keystone_admin_tenant) { | ||
|
||
notify { "**** $module_name - $name => $tunnel_ip_address, $ovs_port, $http_server_port , $ip_address, $id, $vendor_name, $ovs_protocol, $ovs_protocol, $switch_name": ; } | ||
|
||
file { "tor-agent-config-$id" : | ||
path => "/etc/contrail/contrail-tor-agent-$id.conf", | ||
content => template("$module_name/contrail_tor_agent_config.erb"), | ||
} | ||
-> | ||
file { "tor-agent-ini-$id" : | ||
path => "/etc/contrail/supervisord_vrouter_files/contrail-tor-agent-$id.ini", | ||
content => template("$module_name/contrail_tor_agent.ini.erb"), | ||
} | ||
-> | ||
file { "tor-agent-svc-$id" : | ||
path => "/etc/init.d/contrail-tor-agent-$id", | ||
mode => 0755, | ||
content => template("$module_name/contrail_tor_agent.svc.erb"), | ||
} | ||
-> | ||
service { "contrail-tor-agent-$id" : | ||
enable => true, | ||
subscribe => [ File["tor-agent-config-$id"] ], | ||
ensure => running, | ||
} | ||
-> | ||
exec { "register-tor-$id" : | ||
command => "python /opt/contrail/utils/provision_physical_device.py \ | ||
--device_name $switch_name --vendor_name $vendor_name\ | ||
--device_mgmt_ip $ip_address --device_tunnel_ip $tunnel_ip_address \ | ||
--device_tor_agent $hostname-$id --device_tsn $contrail_tsn_hostname \ | ||
--api_server_ip $contrail_config_ip --openstack_ip $contrail_openstack_ip \ | ||
--oper add --admin_user $keystone_admin_user \ | ||
--admin_password $keystone_admin_password \ | ||
--admin_tenant_name $keystone_admin_tenant", | ||
provider => shell | ||
} | ||
|
||
|
||
#if $id == "2" { | ||
#file { "contrail-storage-exit-file": | ||
#path => "/etc/contrail/contrail_setup_utils/config-storage-exit.sh", | ||
#ensure => present, | ||
#mode => 0755, | ||
#owner => root, | ||
#group => root, | ||
#content => "exit 1", | ||
#} | ||
#-> | ||
#exec { "contrail-tor-exit-$name" : | ||
#command => "/etc/contrail/contrail_setup_utils/config-storage-exit.sh", | ||
#provider => shell, | ||
#} | ||
#} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
contrail/environment/modules/contrail/manifests/profile/toragent.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class contrail::profile::toragent( | ||
$enable_toragent = $::contrail::params::enable_toragent | ||
) | ||
{ | ||
if ($enable_toragent) { | ||
contain ::contrail::toragent | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
contrail/environment/modules/contrail/manifests/profile/tsn.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class contrail::profile::tsn( | ||
$enable_tsn= $::contrail::params::enable_tsn | ||
) | ||
{ | ||
notify {"*** profile tsn *** $enable_tsn":} | ||
if ($enable_tsn) { | ||
notify {"*** profile tsn enabled ***":;} | ||
contain ::contrail::tsn | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
contrail/environment/modules/contrail/manifests/toragent.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class contrail::toragent( | ||
$config_ip = $::contrail::params::config_ip_list[0], | ||
$contrail_tsn_ip = $::contrail::params::tsn_ip_list[0], | ||
$contrail_tsn_hostname = $::contrail::params::tsn_name_list[0], | ||
$contrail_openstack_ip = $::contrail::params::openstack_ip_list[0], | ||
$internal_vip = $::contrail::params::internal_vip, | ||
$contrail_internal_vip = $::contrail::params::contrail_internal_vip, | ||
$keystone_admin_user = $::contrail::params::keystone_admin_user, | ||
$keystone_admin_password = $::contrail::params::keystone_admin_password, | ||
$keystone_admin_tenant = $::contrail::params::keystone_admin_tenant, | ||
$haproxy = $::contrail::params::haproxy, | ||
) { | ||
# Set config IP to be used. | ||
if ($contrail_internal_vip != "") { | ||
$config_ip_to_use = $contrail_internal_vip | ||
} | ||
elsif ($internal_vip != "") { | ||
$config_ip_to_use = $internal_vip | ||
} | ||
else { | ||
$config_ip_to_use = $config_ip | ||
} | ||
if ($haproxy == true) { | ||
$discovery_ip = "127.0.0.1" | ||
} else { | ||
$discovery_ip = $config_ip_to_use | ||
} | ||
|
||
$tor_defaults = { | ||
'discovery_ip_to_use' => $discovery_ip, | ||
'contrail_tsn_ip' => $contrail_tsn_ip, | ||
'contrail_tsn_hostname' => $contrail_tsn_hostname, | ||
'contrail_config_ip' => $config_ip_to_use, | ||
'keystone_admin_user' => $keystone_admin_user, | ||
'keystone_admin_password' => $keystone_admin_password, | ||
'keystone_admin_tenant' => $keystone_admin_tenant, | ||
'contrail_openstack_ip' => $contrail_openstack_ip | ||
} | ||
contrail::lib::report_status { "toragent_started": state => "toragent_started" } | ||
$tor_config = hiera('contrail::params::top_of_rack', {}) | ||
create_resources(contrail::lib::top_of_rack, $tor_config, $tor_defaults) | ||
contrail::lib::report_status { "toragent_completed": state => "toragent_completed" } | ||
|
||
Contrail::Lib::Report_status['toragent_started'] | ||
-> Contrail::Lib::Top_of_rack <| |> | ||
-> Contrail::Lib::Report_status['toragent_completed'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class contrail::tsn() { | ||
contrail::lib::report_status { "tsn_started": state => "tsn_started" } | ||
-> notify{ "**** $module_name : TSN Role":;} | ||
-> contrail::lib::report_status { "tsn_completed": state => "tsn_completed" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
contrail/environment/modules/contrail/templates/contrail_tor_agent.ini.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[program:contrail-tor-agent-<%=@id-%>] | ||
command=/usr/bin/contrail-tor-agent --config_file /etc/contrail/contrail-tor-agent-<%=@id-%>.conf | ||
priority=420 | ||
autostart=true | ||
killasgroup=true | ||
stopsignal=KILL | ||
stdout_capture_maxbytes=1MB | ||
redirect_stderr=true | ||
stdout_logfile=/var/log/contrail/contrail-tor-agent-<%=@id-%>-stdout.log | ||
stderr_logfile=/dev/null | ||
startsecs=5 | ||
exitcodes=0 ; 'expected' exit codes for process (default 0,2) |
6 changes: 6 additions & 0 deletions
6
contrail/environment/modules/contrail/templates/contrail_tor_agent.svc.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
# chkconfig: 2345 11 01 | ||
# description: Juniper Network Virtualization service offering | ||
|
||
supervisorctl -s unix:///tmp/supervisord_vrouter.sock ${1} `basename ${0}` |
109 changes: 109 additions & 0 deletions
109
contrail/environment/modules/contrail/templates/contrail_tor_agent_config.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# | ||
# Vnswad configuration options | ||
# | ||
|
||
[CONTROL-NODE] | ||
# IP address to be used to connect to control-node. Maximum of 2 IP addresses | ||
# (separated by a space) can be provided. If no IP is configured then the | ||
# value provided by discovery service will be used. (optional) | ||
# server=10.0.0.1 10.0.0.2 | ||
|
||
[DEFAULT] | ||
agent_name=<%=@hostname%>-<%=@id%> | ||
# Everything in this section is optional | ||
|
||
# IP address and port to be used to connect to collector. If these are not | ||
# configured, value provided by discovery service will be used. Multiple | ||
# IP:port strings separated by space can be provided | ||
# collectors=127.0.0.1:8086 | ||
|
||
# Enable/disable debug logging. Possible values are 0 (disable) and 1 (enable) | ||
# debug=0 | ||
|
||
# Aging time for flow-records in seconds | ||
# flow_cache_timeout=0 | ||
|
||
# Hostname of compute-node. If this is not configured value from `hostname` | ||
# will be taken | ||
# hostname= | ||
|
||
# Category for logging. Default value is '*' | ||
# log_category= | ||
|
||
# Local log file name | ||
log_file=/var/log/contrail/contrail-tor-agent-<%=@id%>.log | ||
|
||
# Log severity levels. Possible values are SYS_EMERG, SYS_ALERT, SYS_CRIT, | ||
# SYS_ERR, SYS_WARN, SYS_NOTICE, SYS_INFO and SYS_DEBUG. Default is SYS_DEBUG | ||
# log_level=SYS_DEBUG | ||
|
||
# Enable/Disable local file logging. Possible values are 0 (disable) and 1 (enable) | ||
# log_local=0 | ||
|
||
# Enable/Disable local flow message logging. Possible values are 0 (disable) and 1 (enable) | ||
# log_flow=0 | ||
|
||
# Encapsulation type for tunnel. Possible values are MPLSoGRE, MPLSoUDP, VXLAN | ||
# tunnel_type= | ||
|
||
# Enable/Disable headless mode for agent. In headless mode agent retains last | ||
# known good configuration from control node when all control nodes are lost. | ||
# Possible values are true(enable) and false(disable) | ||
# headless_mode= | ||
|
||
# Define agent mode. Only supported value is "tor" | ||
agent_mode=tor | ||
|
||
|
||
# Http server port for inspecting vnswad state (useful for debugging) | ||
# http_server_port=8085 | ||
http_server_port=<%=@http_server_port%> | ||
|
||
[DISCOVERY] | ||
#If DEFAULT.collectors and/or CONTROL-NODE and/or DNS is not specified this | ||
#section is mandatory. Else this section is optional | ||
|
||
# IP address of discovery server | ||
server=<%=@discovery_ip_to_use%> | ||
|
||
# Number of control-nodes info to be provided by Discovery service. Possible | ||
# values are 1 and 2 | ||
# max_control_nodes=1 | ||
|
||
[DNS] | ||
# IP address to be used to connect to dns-node. Maximum of 2 IP addresses | ||
# (separated by a space) can be provided. If no IP is configured then the | ||
# value provided by discovery service will be used. (Optional) | ||
# server=10.0.0.1 10.0.0.2 | ||
|
||
[NETWORKS] | ||
# control-channel IP address used by WEB-UI to connect to vnswad to fetch | ||
# required information (Optional) | ||
#control_network_ip=$__contrail_control_ip__ | ||
|
||
[TOR] | ||
# IP address of the TOR to manage | ||
tor_ip=<%=@ip_address %> | ||
|
||
# Identifier for ToR. Agent will subscribe to ifmap-configuration by this name | ||
tor_id=<%=@id%> | ||
|
||
# ToR management scheme is based on this type. Only supported value is "ovs" | ||
tor_type=ovs | ||
|
||
# OVS server port number on the ToR | ||
tor_ovs_port=<%=@ovs_port%> | ||
|
||
# IP-Transport protocol used to connect to tor. Supported values are "tcp", "pssl" | ||
tor_ovs_protocol=<%=@ovs_protocol%> | ||
|
||
# Path to ssl certificate for tor-agent, needed for pssl | ||
#ssl_cert=$__contrail_tor_ssl_cert__ | ||
|
||
# Path to ssl private-key for tor-agent, needed for pssl | ||
#ssl_privkey=$__contrail_tor_ssl_privkey__ | ||
|
||
# Path to ssl cacert for tor-agent, needed for pssl | ||
#ssl_cacert=$__contrail_tor_ssl_cacert__ | ||
|
||
tsn_ip=<%=@contrail_tsn_ip%> |