Skip to content

Commit

Permalink
Merge "SM-TOR: use single variable for ToR config"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jan 23, 2016
2 parents 51675d1 + 496f51e commit 50a1391
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
21 changes: 12 additions & 9 deletions src/server_mgr_main.py
Expand Up @@ -4094,16 +4094,19 @@ def provision_server(self):
#self._smgr_log.log(self._smgr_log.DEBUG, "TOR1 of %s => %s" % (role_server['id'],server_params_compute))
node_id = role_server['id']
switches = server_params_compute['switches']
provision_params['tor_ha_config'][node_id] = []
provision_params['tor_ha_config'][node_id]= {}
provision_params['tor_ha_config'][node_id]['switches'] = switches
host_control_ip = self._smgr_puppet.get_control_ip(provision_params, role_server.get('ip_address', ""))
provision_params['tor_ha_config'][node_id]['tsn_ip'] = str(host_control_ip)
#self._smgr_log.log(self._smgr_log.DEBUG, "TOR3 %s => %s" % (server['id'],server_params_compute['switch_name']))
for i in range(len(switches)):
switch_detail = {}
switch_detail['tor_name'] = switches[i]['switch_name']
switch_detail['ovs_port'] = switches[i]['ovs_port']
switch_detail['protocol'] = switches[i]['ovs_protocol']
host_control_ip = self._smgr_puppet.get_control_ip(provision_params, role_server.get('ip_address', ""))
switch_detail['tsn_ip'] = host_control_ip
provision_params['tor_ha_config'][node_id].append(switch_detail)
#for i in range(len(switches)):
#switch_detail = {}
#switch_detail['tor_name'] = switches[i]['switch_name']
#switch_detail['ovs_port'] = switches[i]['ovs_port']
#switch_detail['protocol'] = switches[i]['ovs_protocol']
#host_control_ip = self._smgr_puppet.get_control_ip(provision_params, role_server.get('ip_address', ""))
#switch_detail['tsn_ip'] = host_control_ip
#provision_params['tor_ha_config'][node_id].append(switch_detail)

#self._smgr_log.log(self._smgr_log.DEBUG, "tor config of %s => %s" % (server['id'], server_tor_config))
self._smgr_log.log(self._smgr_log.DEBUG, "TOR2 %s => %s" % (server['id'], provision_params['tor_ha_config']))
Expand Down
25 changes: 16 additions & 9 deletions src/server_mgr_puppet.py
Expand Up @@ -478,20 +478,27 @@ def build_contrail_hiera_file(
# enf if server_control_ip...

data += 'contrail::params::host_roles: %s\n' %(str(provision_params['host_roles']))
data += 'contrail::params::tor_ha_config: "%s"\n' %(str(provision_params['tor_ha_config']))
if 'toragent' in provision_params['host_roles'] :
tor_config = eval(provision_params.get("top_of_rack", ""))
#self._smgr_log.log(self._smgr_log.DEBUG, "tor_config => %s" % tor_config)
switch_list = tor_config.get('switches', "")
if switch_list:
data += 'contrail::params::top_of_rack:\n'
tor_config = provision_params.get("tor_ha_config", "")
data += 'contrail::params::tor_ha_config:\n'
for host_tor_config in tor_config.keys():
data += ' %s:\n' %(host_tor_config)
switch_list = tor_config[host_tor_config].get('switches', "")
tsn_ip = tor_config[host_tor_config].get('tsn_ip', "")
if switch_list:
for switch in switch_list:
data += ' %s%s:\n' %(switch['switch_name'],switch['id'])
data += ' %s%s:\n' %(switch['switch_name'],switch['id'])
data += ' tsn_ip: "%s"\n' % (tsn_ip)
for key,value in switch.items():
#self._smgr_log.log(self._smgr_log.DEBUG, "switch key=> %s,value => %s" % (key,value))
data += ' %s: "%s"\n' % (key,value)
data += ' %s: "%s"\n' % (key,value)
if key == 'ovs_protocol' and value.lower() == 'pssl':
self.generate_tor_certs(switch, provision_params)
#end pssl condition
#end key,value for loop
#end switch for loop
#end switch_list if condition
#end tor_config loop
#end toragent in host_roles

if 'storage-compute' in provision_params['host_roles'] or 'storage-master' in provision_params['host_roles']:
## Storage code
Expand Down

0 comments on commit 50a1391

Please sign in to comment.