/
commandline.py
572 lines (526 loc) · 26.1 KB
/
commandline.py
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
from fabric.api import env, sudo
from host import *
from cluster import *
from analytics import *
from interface import *
from multitenancy import *
from fabfile.tasks.esxi_defaults import apply_esxi_defaults
def frame_vnc_database_cmd(host_string, cmd="setup-vnc-database"):
parent_cmd = cmd
database_host = host_string
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = get_contrail_internal_vip() or hstr_to_ip(cfgm_host)
database_host_list = [get_control_host_string(entry)\
for entry in env.roledefs['database']]
database_ip_list = [hstr_to_ip(db_host) for db_host in database_host_list]
database_host=get_control_host_string(host_string)
database_host_password=get_env_passwords(host_string)
tgt_ip = hstr_to_ip(database_host)
if parent_cmd != "remove-cassandra-node" and parent_cmd != 'decommission-cassandra-node':
#derive kafka broker id from the list of servers specified
broker_id = sorted(database_ip_list).index(tgt_ip)
cassandra_user = get_cassandra_user()
cassandra_password = get_cassandra_password()
cmd += " --self_ip %s" % tgt_ip
cmd += " --cfgm_ip %s" % cfgm_ip
database_dir = get_database_dir()
if database_dir is not None:
cmd += " --data_dir %s" % database_dir
analytics_data_dir = get_analytics_data_dir()
if analytics_data_dir is not None:
cmd += " --analytics_data_dir %s" % analytics_data_dir
ssd_data_dir = get_ssd_data_dir()
if ssd_data_dir is not None:
cmd += " --ssd_data_dir %s" % ssd_data_dir
if (len(env.roledefs['database'])>2):
cmd += " --seed_list %s" % ','.join(database_ip_list[:2])
else:
cmd += " --seed_list %s" % (hstr_to_ip(get_control_host_string(
env.roledefs['database'][0])))
cmd += " --zookeeper_ip_list %s" % ' '.join(database_ip_list)
if parent_cmd == "setup-vnc-database" or parent_cmd == "update-zoo-servers":
cmd += " --database_index %d" % (database_host_list.index(database_host) + 1)
minimum_diskGB = get_minimum_diskGB()
if minimum_diskGB is not None:
cmd += " --minimum_diskGB %s" % minimum_diskGB
if parent_cmd == "setup-vnc-database" and get_kafka_enabled() is not None:
cmd += " --kafka_broker_id %d" % broker_id
if parent_cmd == "remove-cassandra-node":
cmd += " --node_to_delete %s" % hstr_to_ip(host_string)
if cassandra_user is not None:
cmd += " --cassandra_user %s" % cassandra_user
cmd += " --cassandra_password %s" % cassandra_password
return cmd
def frame_vnc_openstack_cmd(host_string, cmd="setup-vnc-openstack"):
amqp_server_ip = get_openstack_amqp_server()
self_host = get_control_host_string(host_string)
self_ip = hstr_to_ip(self_host)
mgmt_self_ip = hstr_to_ip(host_string)
openstack_host_password = get_env_passwords(host_string)
authserver_ip = get_authserver_ip(ignore_vip=True,
openstack_node=host_string)
(_, openstack_admin_password) = get_authserver_credentials()
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = hstr_to_ip(cfgm_host)
internal_vip = get_openstack_internal_vip()
cmd += " --self_ip %s" % self_ip
cmd += " --keystone_ip %s" % authserver_ip
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --keystone_admin_passwd %s" % openstack_admin_password
cmd += " --cfgm_ip %s " % cfgm_ip
cmd += " --keystone_auth_protocol %s" % get_authserver_protocol()
cmd += " --amqp_server_ip %s" % amqp_server_ip
cmd += " --quantum_service_protocol %s" % get_quantum_service_protocol()
cmd += " --service_token %s" % get_service_token()
cmd += " --service-dbpass %s" % get_service_dbpass()
cmd += " --keystone_service_tenant_name %s" % get_keystone_service_tenant_name()
cmd += " --region_name %s" % get_region_name()
cmd += " --neutron_password %s" % get_neutron_password()
cmd += " --nova_password %s" % get_nova_password()
cmd += ' --openstack_index %s' % (env.roledefs['openstack'].index(
host_string) + 1)
haproxy = get_haproxy()
if haproxy:
cmd += " --haproxy %s" % haproxy
openstack_ip_list = []
if internal_vip:
# Highly available setup
openstack_ip_list = ' '.join([hstr_to_ip(openstack_host)
for openstack_host in env.roledefs['openstack']])
cmd += ' --internal_vip %s' % (internal_vip)
cmd += ' --mgmt_self_ip %s' % mgmt_self_ip
contrail_internal_vip = get_contrail_internal_vip()
if contrail_internal_vip:
# Highly available setup with multiple interface
cmd += ' --contrail_internal_vip %s' % (contrail_internal_vip)
if openstack_ip_list:
cmd += ' --openstack_ip_list %s' % openstack_ip_list
osapi_compute_workers, conductor_workers = get_nova_workers()
if osapi_compute_workers:
cmd += ' --osapi_compute_workers %s' % osapi_compute_workers
if conductor_workers:
cmd += ' --conductor_workers %s' % conductor_workers
sriov_enabled = get_sriov_enabled()
if sriov_enabled:
cmd += ' --sriov'
return cmd
def frame_vnc_config_cmd(host_string, cmd="setup-vnc-config"):
nworkers = 1
quantum_port = '9697'
cfgm_host=get_control_host_string(host_string)
tgt_ip = hstr_to_ip(cfgm_host)
# Prefer local collector node
cfgm_host_list = [get_control_host_string(entry)\
for entry in env.roledefs['cfgm']]
collector_host_list = [get_control_host_string(entry)\
for entry in env.roledefs['collector']]
collector_ip = None
if cmd != 'update-ifmap-users':
if cfgm_host in collector_host_list:
collector_ip = tgt_ip
else:
# Select based on index
hindex = cfgm_host_list.index(cfgm_host)
hindex = hindex % len(env.roledefs['collector'])
collector_host = get_control_host_string(
env.roledefs['collector'][hindex])
collector_ip = hstr_to_ip(collector_host)
mt_opt = '--multi_tenancy' if get_mt_enable() else ''
cassandra_ip_list = [hstr_to_ip(get_control_host_string(cassandra_host))\
for cassandra_host in env.roledefs['database']]
control_ip_list = []
if 'control' in env.roledefs:
control_ip_list = [hstr_to_ip(get_control_host_string(control_host))\
for control_host in env.roledefs['control']]
orch = get_orchestrator()
cassandra_user = get_cassandra_user()
cassandra_password = get_cassandra_password()
cmd += " --self_ip %s" % tgt_ip
cmd += " --collector_ip %s %s" % (collector_ip, mt_opt)
cmd += " --cassandra_ip_list %s" % ' '.join(cassandra_ip_list)
cmd += " --zookeeper_ip_list %s" % ' '.join(cassandra_ip_list)
if control_ip_list:
cmd += " --control_ip_list %s" % ' '.join(control_ip_list)
cmd += " --quantum_port %s" % quantum_port
cmd += " --nworkers %d" % nworkers
cmd += " --service_token %s" % get_service_token()
cmd += " --amqp_ip_list %s" % ' '.join(get_amqp_servers())
cmd += " --amqp_port %s" % get_amqp_port()
cmd += " --orchestrator %s" % orch
haproxy = get_haproxy()
if haproxy:
cmd += " --haproxy %s" % haproxy
if orch == 'openstack':
(_, openstack_admin_password) = get_authserver_credentials()
authserver_ip = get_authserver_ip()
# Pass keystone arguments in case for openstack orchestrator
cmd += " --keystone_ip %s" % authserver_ip
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --keystone_admin_passwd %s" % openstack_admin_password
cmd += " --keystone_service_tenant_name %s" % get_keystone_service_tenant_name()
cmd += ' --neutron_password %s' % get_neutron_password()
cmd += " --keystone_auth_protocol %s" % get_authserver_protocol()
cmd += " --keystone_auth_port %s" % get_authserver_port()
cmd += " --keystone_insecure %s" % get_keystone_insecure_flag()
cmd += " --region_name %s" % get_region_name()
manage_neutron = get_manage_neutron()
if manage_neutron == 'no':
# Skip creating neutron service tenant/user/role etc in keystone.
cmd += ' --manage_neutron %s' % manage_neutron
else:
cmd += ' --manage_neutron no'
internal_vip = get_openstack_internal_vip()
contrail_internal_vip = get_contrail_internal_vip()
if internal_vip:
# Highly available openstack setup
cmd += ' --internal_vip %s' % (internal_vip)
if contrail_internal_vip:
# Highly available contrail setup
cmd += ' --contrail_internal_vip %s' % (contrail_internal_vip)
if cassandra_user is not None:
cmd += ' --cassandra_user %s' % (cassandra_user)
cmd += ' --cassandra_password %s' % (cassandra_password)
return cmd
def frame_vnc_vcenter_plugin_cmd(host_string, cmd="setup-vcenter-plugin"):
# Frame the command to provision vcenter-plugin
vcenter_info = getattr(env, 'vcenter_servers', None)
if not vcenter_info:
print 'Error: vcenter block is not defined in testbed file.Exiting'
return
else:
for v in vcenter_info.keys():
if get_orchestrator() == 'vcenter':
vcenter_server = vcenter_info[v]
break
else:
if host_string.split('@')[1] == vcenter_info[v]['vcenter_compute']:
vcenter_server = vcenter_info[v]
break
cassandra_ip_list = [hstr_to_ip(get_control_host_string(\
cassandra_host)) for cassandra_host in env.roledefs['database']]
if get_orchestrator() == 'vcenter':
cfgm_ip = get_contrail_internal_vip() or\
hstr_to_ip(get_control_host_string(host_string));
else:
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = get_contrail_internal_vip() or hstr_to_ip(cfgm_host)
cmd += " --vcenter_url %s" % vcenter_server['server']
cmd += " --vcenter_username %s" % vcenter_server['username']
cmd += " --vcenter_password %s" % vcenter_server['password']
cmd += " --vcenter_datacenter %s" % vcenter_server['datacenter']
cmd += " --vcenter_dvswitch %s" % vcenter_server['dv_switch']['dv_switch_name']
if 'ipfabricpg' in vcenter_server.keys():
cmd += " --vcenter_ipfabricpg %s" % vcenter_server['ipfabricpg']
else:
# If unspecified, set it to default value
cmd += " --vcenter_ipfabricpg contrail-fab-pg"
cmd += " --api_hostname %s" % cfgm_ip
cmd += " --api_port 8082"
zk_servers_ports = ','.join(['%s:2181' %(s) for s in cassandra_ip_list])
cmd += " --zookeeper_serverlist %s" % zk_servers_ports
if 'vcenter_compute' in env.roledefs:
cmd += " --vcenter_mode vcenter-as-compute"
# Pass keystone arguments in case of vcenter-as-compute mode
authserver_ip = get_authserver_ip()
ks_admin_user, ks_admin_password = get_authserver_credentials()
cmd += " --keystone_ip %s" % authserver_ip
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --keystone_admin_user %s" % ks_admin_user
cmd += " --keystone_admin_passwd %s" % ks_admin_password
cmd += " --keystone_admin_tenant_name %s" % get_admin_tenant_name()
cmd += " --keystone_auth_protocol %s" % get_authserver_protocol()
cmd += " --keystone_auth_port %s" % get_authserver_port()
else:
cmd += " --vcenter_mode vcenter-only"
return cmd
def frame_vnc_webui_cmd(host_string, cmd="setup-vnc-webui"):
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = hstr_to_ip(cfgm_host)
webui_host = get_control_host_string(host_string)
ncollectors = len(env.roledefs['collector'])
database_host_list=[]
for entry in env.roledefs['database']:
database_host_list.append(get_control_host_string(entry))
webui_host_list=[]
for entry in env.roledefs['webui']:
webui_host_list.append(get_control_host_string(entry))
# Prefer local collector node
if webui_host in env.roledefs['collector']:
collector_ip = hstr_to_ip(webui_host)
else:
# Select based on index
hindex = webui_host_list.index(webui_host)
hindex = hindex % ncollectors
collector_host = get_control_host_string(env.roledefs['collector'][hindex])
collector_ip = hstr_to_ip(collector_host)
cassandra_ip_list = [hstr_to_ip(cassandra_host) for cassandra_host in database_host_list]
orch = get_orchestrator()
# If redis password is specified in testbed file, then add that to the
# redis config file
redis_password = get_redis_password()
cmd += " --cfgm_ip %s" % cfgm_ip
cmd += " --collector_ip %s" % collector_ip
cmd += " --cassandra_ip_list %s" % ' '.join(cassandra_ip_list)
cmd += " --orchestrator %s" % orch
if redis_password is not None:
cmd += " --redis_password %s" % redis_password
internal_vip = get_openstack_internal_vip()
if internal_vip:
# Highly available setup
cmd += " --internal_vip %s" % internal_vip
contrail_internal_vip = get_contrail_internal_vip()
if contrail_internal_vip:
# Highly available setup with multiple interfaces
cmd += " --contrail_internal_vip %s" % contrail_internal_vip
if orch == 'openstack':
openstack_host = get_control_host_string(env.roledefs['openstack'][0])
openstack_ip = hstr_to_ip(openstack_host)
authserver_ip = get_authserver_ip()
ks_admin_user, ks_admin_password = get_authserver_credentials()
cmd += " --keystone_ip %s" % authserver_ip
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --openstack_ip %s" % openstack_ip
cmd += " --admin_user %s" % ks_admin_user
cmd += " --admin_password %s" % ks_admin_password
cmd += " --admin_tenant_name %s" % get_admin_tenant_name()
elif orch == 'vcenter':
vcenter_info = getattr(env, 'vcenter_servers', None)
if not vcenter_info:
print 'Error: vcenter block is not defined in testbed file.Exiting'
return
else:
for v in vcenter_info:
vcenter_server = vcenter_info[v]
break
# vcenter provisioning parameters
cmd += " --vcenter_ip %s" % vcenter_server['server']
cmd += " --vcenter_port %s" % vcenter_server['port']
cmd += " --vcenter_auth %s" % vcenter_server['auth']
cmd += " --vcenter_datacenter %s" % vcenter_server['datacenter']
cmd += " --vcenter_dvswitch %s" % vcenter_server['dv_switch']['dv_switch_name']
return cmd
def frame_vnc_control_cmd(host_string, cmd='setup-vnc-control'):
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = get_contrail_internal_vip() or hstr_to_ip(cfgm_host)
control_host = get_control_host_string(host_string)
tgt_ip = hstr_to_ip(control_host)
collector_host_list=[]
for entry in env.roledefs['collector']:
collector_host_list.append(get_control_host_string(entry))
control_host_list=[]
for entry in env.roledefs['control']:
control_host_list.append(get_control_host_string(entry))
# Prefer local collector node
if control_host in collector_host_list:
collector_ip = tgt_ip
else:
# Select based on index
hindex = control_host_list.index(control_host)
hindex = hindex % len(env.roledefs['collector'])
collector_host = get_control_host_string(env.roledefs['collector'][hindex])
collector_ip = hstr_to_ip(collector_host)
cmd += ' --self_ip %s' % tgt_ip
cmd += ' --cfgm_ip %s' % cfgm_ip
cmd += ' --collector_ip %s' % collector_ip
return cmd
def frame_vnc_compute_cmd(host_string, cmd='setup-vnc-compute',
manage_nova_compute='yes', configure_nova='yes'):
orch = get_orchestrator()
ncontrols = len(env.roledefs['control'])
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = get_contrail_internal_vip() or hstr_to_ip(cfgm_host)
cfgm_user = env.roledefs['cfgm'][0].split('@')[0]
cfgm_passwd = get_env_passwords(env.roledefs['cfgm'][0])
compute_host = get_control_host_string(host_string)
(tgt_ip, tgt_gw) = get_data_ip(host_string)
metadata_secret = get_metadata_secret()
compute_mgmt_ip= host_string.split('@')[1]
compute_control_ip= hstr_to_ip(compute_host)
amqp_server_ip = get_contrail_amqp_server()
# Using amqp running in openstack node
if (get_from_testbed_dict('openstack', 'manage_amqp', 'no') == 'yes' or
get_from_testbed_dict('openstack', 'amqp_host', None)):
amqp_server_ip = get_openstack_amqp_server()
cpu_mode = get_nova_cpu_mode()
cpu_model = get_nova_cpu_model()
# Frame the command line to provision compute node.
cmd += " --self_ip %s" % compute_control_ip
cmd += " --cfgm_ip %s" % cfgm_ip
cmd += " --cfgm_user %s" % cfgm_user
cmd += " --cfgm_passwd %s" % cfgm_passwd
cmd += " --ncontrols %s" % ncontrols
cmd += " --amqp_server_ip %s" % amqp_server_ip
cmd += " --service_token %s" % get_service_token()
cmd += " --orchestrator %s" % get_orchestrator()
cmd += " --hypervisor %s" % get_hypervisor(host_string)
haproxy = get_haproxy()
if haproxy:
cmd += " --haproxy %s" % haproxy
if tgt_ip != compute_mgmt_ip:
cmd += " --non_mgmt_ip %s" % tgt_ip
cmd += " --non_mgmt_gw %s" % tgt_gw
if orch == 'openstack':
openstack_mgmt_ip = hstr_to_ip(env.roledefs['openstack'][0])
authserver_ip = get_authserver_ip()
ks_auth_protocol = get_authserver_protocol()
ks_auth_port = get_authserver_port()
ks_admin_user, ks_admin_password = get_authserver_credentials()
cmd += " --keystone_ip %s" % authserver_ip
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --openstack_mgmt_ip %s" % openstack_mgmt_ip
cmd += " --keystone_auth_protocol %s" % ks_auth_protocol
cmd += " --keystone_auth_port %s" % ks_auth_port
cmd += " --quantum_service_protocol %s" % get_quantum_service_protocol()
cmd += " --keystone_admin_user %s" % ks_admin_user
cmd += " --keystone_admin_password %s" % ks_admin_password
cmd += " --nova_password %s" % get_nova_password()
cmd += " --neutron_password %s" % get_neutron_password()
cmd += " --service_tenant_name %s" % get_keystone_service_tenant_name()
if cpu_mode is not None:
cmd += " --cpu_mode %s" % cpu_mode
if cpu_mode == 'custom':
if cpu_model is None:
raise Exception('cpu model is required for custom cpu mode')
cmd += " --cpu_model %s" % cpu_model
# Add metadata_secret if available
if metadata_secret:
cmd += " --metadata_secret %s" % metadata_secret
# HA arguments
internal_vip = get_openstack_internal_vip()
if internal_vip:
# Highly availbale setup
cmd += " --internal_vip %s" % internal_vip
external_vip = get_from_testbed_dict('ha', 'external_vip', None)
if external_vip:
cmd += ' --external_vip %s' % external_vip
if manage_nova_compute == 'no':
cmd = cmd + " --no_contrail_openstack"
contrail_internal_vip = get_contrail_internal_vip()
if contrail_internal_vip:
# Highly availbale setup with mulitple interfaces
cmd += " --contrail_internal_vip %s" % contrail_internal_vip
if internal_vip or contrail_internal_vip:
cmd += " --mgmt_self_ip %s" % compute_mgmt_ip
if configure_nova == 'no':
cmd = cmd + " --no_nova_config"
# Simple Gateway(vgw) arguments
(set_vgw, gateway_routes, public_subnet, public_vn_name, vgw_intf_list) = get_vgw_details(host_string)
if set_vgw:
cmd += " --vgw_public_subnet %s" % str([(';'.join(str(e) for e in public_subnet)).replace(" ","")])
cmd += " --vgw_public_vn_name %s" % str([(';'.join(str(e) for e in public_vn_name)).replace(" ","")])
cmd += " --vgw_intf_list %s" % str([(';'.join(str(e) for e in vgw_intf_list)).replace(" ","")])
if gateway_routes:
cmd += " --vgw_gateway_routes %s" % str([(';'.join(str(e) for e in gateway_routes)).replace(" ","")])
sriov_string = get_sriov_details(host_string)
if sriov_string:
cmd += " --sriov %s" % sriov_string
if 'vcenter_compute' in env.roledefs:
compute_host = 'root' + '@' + compute_mgmt_ip
if compute_host in env.roledefs['vcenter_compute'][:]:
vcenter_info = getattr(env, 'vcenter_servers', None)
for v in vcenter_info.keys():
vcenter_server = vcenter_info[v]
if compute_mgmt_ip == vcenter_server['vcenter_compute']:
cmd += " --vcenter_server %s" % vcenter_server['server']
cmd += " --vcenter_username %s" % vcenter_server['username']
cmd += " --vcenter_password %s" % vcenter_server['password']
cluster_list = vcenter_server['cluster']
cluster_list_now = ""
for cluster in cluster_list:
cluster_list_now += cluster
cluster_list_now += ","
cluster_list_now = cluster_list_now.rstrip(',')
cmd += " --vcenter_cluster %s" % cluster_list_now
cmd += " --vcenter_dvswitch %s" % vcenter_server['dv_switch']['dv_switch_name']
# Contrail with vmware as orchestrator
esxi_data = get_vmware_details(host_string)
if esxi_data:
apply_esxi_defaults(esxi_data)
datacenter_mtu = get_vmware_datacenter_mtu(esxi_data['vcenter_server'])
cmd += " --vmware %s" % esxi_data['ip']
cmd += " --vmware_username %s" % esxi_data['username']
cmd += " --vmware_passwd %s" % esxi_data['password']
cmd += " --vmware_vmpg_vswitch %s" % esxi_data['vm_vswitch']
mode = get_mode(env.host_string)
cmd += " --mode %s" % mode
cmd += " --vmware_vmpg_vswitch_mtu %s" % datacenter_mtu
cmd += " --vmware_datanic_mtu %s" % datacenter_mtu
dpdk = getattr(env, 'dpdk', None)
if dpdk:
if host_string in dpdk:
cmd += " --dpdk"
return cmd
def frame_vnc_collector_cmd(host_string, cmd='setup-vnc-collector'):
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = get_contrail_internal_vip() or hstr_to_ip(cfgm_host)
collector_host_password = get_env_passwords(host_string)
collector_host = get_control_host_string(host_string)
ncollectors = len(env.roledefs['collector'])
redis_master_host = get_control_host_string(env.roledefs['collector'][0])
if collector_host == redis_master_host:
is_redis_master = True
else:
is_redis_master = False
tgt_ip = hstr_to_ip(collector_host)
database_host_list = [get_control_host_string(database_host) for database_host in env.roledefs['database']]
if collector_host in database_host_list:
database_host_list.remove(collector_host)
database_host_list.insert(0, collector_host)
cassandra_ip_list = [hstr_to_ip(cassandra_host) for cassandra_host in database_host_list]
zookeeper_ip_list = [hstr_to_ip(zookeeper_host) for zookeeper_host in database_host_list]
redis_master_ip = hstr_to_ip(redis_master_host)
cassandra_user = get_cassandra_user()
cassandra_password = get_cassandra_password()
# Frame the command line to provision collector
cmd += " --cassandra_ip_list %s" % (' '.join(cassandra_ip_list))
cmd += " --zookeeper_ip_list %s" % (' '.join(zookeeper_ip_list))
cmd += " --amqp_ip_list %s" % ' '.join(get_amqp_servers())
cmd += " --amqp_port %s" % get_amqp_port()
cmd += " --cfgm_ip %s" % cfgm_ip
cmd += " --self_collector_ip %s" % tgt_ip
cmd += " --num_nodes %d " % ncollectors
analytics_syslog_port = get_collector_syslog_port()
if analytics_syslog_port is not None:
cmd += "--analytics_syslog_port %d " % analytics_syslog_port
analytics_database_ttl = get_database_ttl()
if analytics_database_ttl is not None:
cmd += "--analytics_data_ttl %d " % analytics_database_ttl
analytics_config_audit_ttl = get_analytics_config_audit_ttl()
if analytics_config_audit_ttl is not None:
cmd += "--analytics_config_audit_ttl %d " % analytics_config_audit_ttl
analytics_statistics_ttl = get_analytics_statistics_ttl()
if analytics_statistics_ttl is not None:
cmd += "--analytics_statistics_ttl %d " % analytics_statistics_ttl
analytics_flow_ttl = get_analytics_flow_ttl()
if analytics_flow_ttl is not None:
cmd += "--analytics_flow_ttl %d " % analytics_flow_ttl
analytics_redis_password = get_redis_password()
if analytics_redis_password is not None:
cmd += "--redis_password %s " % analytics_redis_password
cmd += "--kafka_enabled %s" % get_kafka_enabled()
orchestrator = get_orchestrator()
if orchestrator == 'openstack':
# Pass keystone arguments in case for openstack orchestrator
ks_admin_user, ks_admin_password = get_authserver_credentials()
cmd += " --keystone_ip %s" % get_authserver_ip()
cmd += " --keystone_version %s" % get_keystone_version()
cmd += " --keystone_admin_user %s" % ks_admin_user
cmd += " --keystone_admin_passwd %s" % ks_admin_password
cmd += " --keystone_admin_tenant_name %s" % \
get_admin_tenant_name()
cmd += " --keystone_auth_protocol %s" % \
get_authserver_protocol()
cmd += " --keystone_auth_port %s" % get_authserver_port()
cmd += " --keystone_insecure %s" % get_keystone_insecure_flag()
internal_vip = get_contrail_internal_vip()
if internal_vip:
# Highly Available setup
cmd += " --internal_vip %s" % internal_vip
if cassandra_user is not None:
cmd += " --cassandra_user %s" % cassandra_user
cmd += " --cassandra_password %s" % cassandra_password
analytics_aaa_mode = get_analytics_aaa_mode()
if orchestrator != 'openstack':
analytics_aaa_mode = 'no-auth'
cmd += " --aaa_mode %s" % analytics_aaa_mode
return cmd