(data)
return oid_collection
Extract oids from profile `data`

    Return a collection of oid nodes, indexed by their oid
Extract oids from profile `data`
Extract oids from profile data
def _extract_oid_collection_from_profile_data(data):
    """
    Extract oids from profile `data`

    Return a collection of oid nodes, indexed by their oid
    """
    oid_collection = {}
    for metric in data['metrics']:
        oid_node = {'mib': metric['MIB']}
        if 'table' in metric:
            table = metric['table']
            if 'OID' in table:
                oid_node['name'] = table['name']
                oid_node['oid'] = table['OID']
                oid_collection[table['OID']] = oid_node
            if 'symbols' in table:
                for symbol in table['symbols']:
                    if 'OID' in symbol:
                        oid_node['name'] = symbol['name']
                        oid_node['oid'] = symbol['OID']
                        oid_collection[symbol['OID']] = oid_node
        elif 'symbol' in metric:
            symbol = metric['symbol']
            if 'OID' in symbol:
                oid_node['name'] = symbol['name']
                oid = symbol['OID']
                # remove trailing 0 from oid
                if oid.endswith('.0'):
                    oid = oid[:-2]
                oid_node['oid'] = oid
                oid_collection[oid] = oid_node
    return oid_collection
def _extract_oid_collection_from_profile_data ( data ) : oid_collection = { } for metric in data [ 'metrics' ] : oid_node = { 'mib' : metric [ 'MIB' ] } if 'table' in metric : table = metric [ 'table' ] if 'OID' in table : oid_node [ 'name' ] = table [ 'name' ] oid_node [ 'oid' ] = table [ 'OID' ] oid_collection [ table [ 'OID' ] ] = oid_node if 'symbols' in table : for symbol in table [ 'symbols' ] : if 'OID' in symbol : oid_node [ 'name' ] = symbol [ 'name' ] oid_node [ 'oid' ] = symbol [ 'OID' ] oid_collection [ symbol [ 'OID' ] ] = oid_node elif 'symbol' in metric : symbol = metric [ 'symbol' ] if 'OID' in symbol : oid_node [ 'name' ] = symbol [ 'name' ] oid = symbol [ 'OID' ] # remove trailing 0 from oid if oid . endswith ( '.0' ) : oid = oid [ : - 2 ] oid_node [ 'oid' ] = oid oid_collection [ oid ] = oid_node return oid_collection