19
26
"nvp": NVP_PLUGIN_CONF
31
"quantum-plugin-openvswitch",
32
"quantum-plugin-openvswitch-agent",
36
"nvp": [ # No agent required
37
"quantum-plugin-nicira"
43
"quantum-plugin-openvswitch-agent",
22
55
DB_USER = "quantum"
23
56
QUANTUM_DB = "quantum"
57
KEYSTONE_SERVICE = "quantum"
25
59
QUANTUM_CONF = "/etc/quantum/quantum.conf"
26
60
L3_AGENT_CONF = "/etc/quantum/l3_agent.ini"
30
64
RABBIT_USER = "nova"
31
65
RABBIT_VHOST = "nova"
34
71
def add_bridge(name):
35
72
status = subprocess.check_output(["ovs-vsctl", "show"])
36
73
if "Bridge {}".format(name) not in status:
74
utils.juju_log('INFO',
75
'Creating bridge {}'.format(name))
37
76
subprocess.check_call(["ovs-vsctl", "add-br", name])
40
79
def del_bridge(name):
41
80
status = subprocess.check_output(["ovs-vsctl", "show"])
42
81
if "Bridge {}".format(name) in status:
82
utils.juju_log('INFO',
83
'Deleting bridge {}'.format(name))
43
84
subprocess.check_call(["ovs-vsctl", "del-br", name])
47
88
status = subprocess.check_output(["ovs-vsctl", "show"])
48
89
if ("Bridge {}".format(name) in status and
49
90
"Interface \"{}\"".format(port) not in status):
91
utils.juju_log('INFO',
92
'Adding port {} to bridge {}'
50
94
subprocess.check_call(["ovs-vsctl", "add-port", name, port])
95
subprocess.check_call(["ip", "link", "set", port, "up"])
53
98
def del_bridge_port(name, port):
54
99
status = subprocess.check_output(["ovs-vsctl", "show"])
55
100
if ("Bridge {}".format(name) in status and
56
101
"Interface \"{}\"".format(port) in status):
102
utils.juju_log('INFO',
103
'Deleting port {} from bridge {}'
57
105
subprocess.check_call(["ovs-vsctl", "del-port", name, port])
106
subprocess.check_call(["ip", "link", "set", port, "down"])
109
def configure_ext_net(username,
120
ext_net_len = cidr.split('/')[1]
121
quantum = client.Client(username=username,
126
networks = quantum.list_networks(name=ext_net_name)
127
if len(networks['networks']) == 0:
128
utils.juju_log('INFO',
129
'Configuring external bridge')
132
'name': ext_net_name,
133
'router:external': True
136
utils.juju_log('INFO',
137
'Creating new external network definition: {}'
138
.format(ext_net_name))
139
network = quantum.create_network(network_msg)
140
utils.juju_log('INFO',
141
'New external network created: {}'
142
.format(network['network']['id']))
146
'name': '{}_subnet'.format(ext_net_name),
147
'network_id': network['network']['id'],
148
'enable_dhcp': False,
149
'gateway_ip': default_gateway,
152
'allocation_pools': [
154
'start': start_floating_ip,
155
'end': end_floating_ip
160
utils.juju_log('INFO',
161
'Creating new subnet for {}'
162
.format(ext_net_name))
163
subnet = quantum.create_subnet(subnet_msg)
164
utils.juju_log('INFO',
165
'New subnet created: {}'
166
.format(subnet['subnet']['id']))
168
utils.juju_log('INFO',
169
'Configuring external bridge connectivity')
170
subprocess.check_call(['ip', 'addr', 'flush',
172
subprocess.check_call(['ip', 'addr', 'add',
173
'{}/{}'.format(gateway_ip, ext_net_len),
175
subprocess.check_call(['ip', 'addr', 'set',