Skip to content

Commit

Permalink
Merge "SM-BMS: Support of toragent and tsn roles" into R2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 29, 2015
2 parents 4eee216 + b71a692 commit 8107f82
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contrail/environment/modules/contrail/manifests/compute.pp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
$nfs_server = $::contrail::params::nfs_server,
$orchestrator = $::contrail::params::orchestrator,
$contrail_logoutput = $::contrail::params::contrail_logoutput,
$contrail_host_roles = $::contrail::params::host_roles,
) inherits ::contrail::params {

$contrail_num_controls = inline_template("<%= @control_ip_list.length %>")
Expand Down Expand Up @@ -310,6 +311,11 @@
$vmware_physical_intf = "eth1"
}

if 'tsn' in $contrail_host_roles {
$contrail_agent_mode = 'tsn'
} else {
$contrail_agent_mode = ""
}
# Debug Print all variable values
notify {"host_control_ip = $host_control_ip":; } ->
notify {"config_ip = $config_ip":; } ->
Expand Down
73 changes: 73 additions & 0 deletions contrail/environment/modules/contrail/manifests/lib/top_of_rack.pp
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,
#}
#}

}
4 changes: 4 additions & 0 deletions contrail/environment/modules/contrail/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,13 @@
$webui_ip_list,
$openstack_ip_list,
$compute_ip_list,
$tsn_ip_list,
$config_name_list,
$compute_name_list,
$control_name_list,
$collector_name_list,
$openstack_name_list,
$tsn_name_list,
$internal_vip = "",
$external_vip = "",
$contrail_internal_vip = "",
Expand Down Expand Up @@ -614,6 +616,8 @@
$enable_collector = true,
$enable_webui = true,
$enable_compute = true,
$enable_tsn = true,
$enable_toragent = true,
$enable_storage_compute = true,
$enable_storage_master = true,
$enable_pre_exec_vnc_galera = true,
Expand Down
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 contrail/environment/modules/contrail/manifests/profile/tsn.pp
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 contrail/environment/modules/contrail/manifests/toragent.pp
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']
}
5 changes: 5 additions & 0 deletions contrail/environment/modules/contrail/manifests/tsn.pp
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" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
# Enable/disable debug logging. Possible values are 0 (disable) and 1 (enable)
# debug=0

# Agent mode : can be vrouter / tsn / tor (default is vrouter)
<% if @contrail_agent_mode != "" -%>
agent_mode=tsn
<% end -%>

# Aging time for flow-records in seconds
# flow_cache_timeout=0

Expand Down
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)
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}`
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%>

0 comments on commit 8107f82

Please sign in to comment.