1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
include onos
Exec{path => "/usr/bin:/usr/sbin:/bin:/sbin",}
case $::operatingsystem{
centos:{
$neutron_ovs_agent='neutron-openvswitch-agent'
$ovs_service='openvswitch'
$cmd_remove_agent='chkconfig --del neutron-openvswitch-agent'
}
ubuntu:{
$neutron_ovs_agent='neutron-plugin-openvswitch-agent'
$ovs_service='openvswitch-switch'
$cmd_remove_agent='update-rc.d neutron-plugin-openvswitch-agent remove'
}
}
$roles = $onos::roles
if member($roles, 'primary-controller') {
cs_resource { "p_${neutron_ovs_agent}":
ensure => absent,
before => Service["shut down and disable Neutron's agent services"],
}}
else{
exec{'remove neutron-openvswitch-agent auto start':
command => "touch /opt/service;
$cmd_remove_agent;
sed -i /neutron-openvswitch-agent/d /opt/service",
before => Service["shut down and disable Neutron's agent services"],
}
}
firewall{'222 vxlan':
port => [4789],
proto => 'udp',
action => 'accept',
}->
service {"shut down and disable Neutron's agent services":
name => $neutron_ovs_agent,
ensure => stopped,
enable => false,
}->
exec{'Stop the OpenvSwitch service and clear existing OVSDB':
command => "service $ovs_service stop ;
rm -rf /var/log/openvswitch/* ;
rm -rf /etc/openvswitch/conf.db ;
service $ovs_service start ;"
} ->
exec{'Set ONOS as the manager':
command => "su -s /bin/sh -c 'ovs-vsctl set-manager tcp:${onos::manager_ip}:6640'",
}
$public_eth = $onos::public_eth
if member($roles, 'compute') {
exec{"net config":
command => "ifconfig $public_eth up",
}
}
else
{
exec{"sleep 20 for ovsconnect":
command => "sleep 20",
require => Exec['Set ONOS as the manager'],
}->
exec{"delete public port from ovs of controllers":
command => "ovs-vsctl del-port br-int $public_eth",
}
}
|