def _create_ucsm_host_to_service_profile_mapping(self):
ucsm_ips = list(CONF.ml2_cisco_ucsm.ucsms)<EOL>for ucsm_ip in ucsm_ips:<EOL><INDENT>with self.ucsm_connect_disconnect(ucsm_ip) as handle:<EOL><INDENT>try:<EOL><INDENT>sp_list_temp = handle.ConfigResolveClass('<STR_LIT>', None,<EOL>inHierarchical=False)<EOL>if sp_list_temp and sp_list_temp.OutConfigs is not None:<EOL><INDENT>sp_list = sp_list_temp.OutConfigs.GetChild() or []<EOL>for sp in sp_list:<EOL><INDENT>if sp.PnDn:<EOL><INDENT>server_name = self._get_server_name(handle, sp,<EOL>ucsm_ip)<EOL>if (server_name and not sp.OperSrcTemplName):<EOL><INDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>', server_name, ucsm_ip)<EOL>key = (ucsm_ip, server_name)<EOL>self.ucsm_sp_dict[key] = str(sp.Dn)<EOL>self.ucsm_host_dict[server_name] = ucsm_ip<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>raise cexc.UcsmConfigReadFailed(ucsm_ip=ucsm_ip, exc=e)<EOL><DEDENT><DEDENT><DEDENT>
Reads list of Service profiles and finds associated Server.