def AddCIMClasses(grph, rootNode, entity_host, nameSpace, className, entity_id): # Maybe some of these servers are not able to display anything about this object. pairNameNodeWbem = None if wbemOk: if lib_wbem.ValidClassWbem(entity_host, className): pairNameNodeWbem = CreateWbemNode(grph, rootNode, entity_host, nameSpace, className, entity_id) pairNameNodeWmi = None if lib_wmi.ValidClassWmi(className): pairNameNodeWmi = CreateWmiNode(grph, rootNode, entity_host, nameSpace, className, entity_id) # Match the two inheritance trees. if pairNameNodeWbem and pairNameNodeWmi: for (baseClsNam, nodeWbem) in lib_util.six_iteritems(pairNameNodeWbem): try: nodeWmi = pairNameNodeWmi[baseClsNam] except KeyError: continue nodeClsAll = lib_util.EntityClassNode(baseClsNam, nameSpace, entity_host, "WBEM ou WMI") grph.add((nodeClsAll, pc.property_wbem_data, nodeWbem)) grph.add((nodeClsAll, pc.property_wmi_data, nodeWmi))
def AddWbemServers(entity_host, name_space, entity_type, entity_id): map_wbem = dict() try: # Maybe some of these servers are not able to display anything about this object. import lib_wbem wbem_servers_desc_list = lib_wbem.GetWbemUrlsTyped( entity_host, name_space, entity_type, entity_id) for url_server in wbem_servers_desc_list: # TODO: Filter only entity_host if lib_wbem.ValidClassWbem(entity_type): wbem_node = lib_common.NodeUrl(url_server[0]) if entity_host: txt_literal = "WBEM url, host=%s class=%s" % (entity_host, entity_type) else: txt_literal = "WBEM url, current host, class=%s" % entity_type wbem_host_node = lib_uris.gUriGen.HostnameUri(url_server[1]) map_wbem[wbem_node] = [(pc.property_information, lib_util.NodeLiteral(txt_literal)), (pc.property_host, wbem_host_node)] # TODO: This could try to open a HTTP server on this machine, possibly with port 80. # grph.add( ( wbem_host_node, pc.property_information, lib_util.NodeLiteral("Url to host") ) ) except ImportError: pass return map_wbem
def AddCIMClasses(grph, root_node, entity_host, name_space, class_name, entity_id): """entity_type = "CIM_Process", "Win32_Service" etc... This might happen at an intermediary level, with inheritance (To be implemented). Maybe some of these servers are not able to display anything about this object.""" pair_name_node_wbem = None if wbem_ok: if lib_wbem.ValidClassWbem(class_name): pair_name_node_wbem = _create_wbem_node(grph, root_node, entity_host, name_space, class_name, entity_id) pair_name_node_wmi = None if lib_wmi.ValidClassWmi(class_name): pair_name_node_wmi = _create_wmi_node(grph, root_node, entity_host, name_space, class_name, entity_id) # Match the two inheritance trees. if pair_name_node_wbem and pair_name_node_wmi: for base_cls_nam, node_wbem in lib_util.six_iteritems( pair_name_node_wbem): try: nodeWmi = pair_name_node_wmi[base_cls_nam] except KeyError: continue node_cls_all = lib_util.EntityClassNode(base_cls_nam, name_space, entity_host, "WBEM ou WMI") grph.add((node_cls_all, pc.property_wbem_data, node_wbem)) grph.add((node_cls_all, pc.property_wmi_data, nodeWmi))
def AddWbemServers(entity_host, nameSpace, entity_type, entity_id): DEBUG( "AddWbemServers entity_host=%s nameSpace=%s entity_type=%s entity_id=%s", entity_host, nameSpace, entity_type, entity_id) mapWbem = dict() try: # Maybe some of these servers are not able to display anything about this object. import lib_wbem wbem_servers_desc_list = lib_wbem.GetWbemUrlsTyped( entity_host, nameSpace, entity_type, entity_id) # sys.stderr.write("wbem_servers_desc_list len=%d\n" % len(wbem_servers_desc_list)) for url_server in wbem_servers_desc_list: # TODO: Filter only entity_host # sys.stderr.write("url_server=%s\n" % str(url_server)) if lib_wbem.ValidClassWbem(entity_type): wbemNode = lib_common.NodeUrl(url_server[0]) if entity_host: txtLiteral = "WBEM url, host=%s class=%s" % (entity_host, entity_type) else: txtLiteral = "WBEM url, current host, class=%s" % ( entity_type) wbemHostNode = lib_common.gUriGen.HostnameUri(url_server[1]) mapWbem[wbemNode] = [(pc.property_information, lib_common.NodeLiteral(txtLiteral)), (pc.property_host, wbemHostNode)] # TODO: This could try to pen a HTTP server on this machine, possibly with port 80. # grph.add( ( wbemHostNode, pc.property_information, lib_common.NodeLiteral("Url to host") ) ) except ImportError: pass return mapWbem