def count_ref_associators(nickname, server, profile_insts, org_vm):
    """
    Get dict of counts of associator returns for ResultRole == Dependent and
    ResultRole == Antecedent for profiles in list.  This method counts by
    executing repeated AssociationName calls on CIM_ReferencedProfile for each
    profile instance in profile_insts with the result Role set to Dependent and
    then Antecedent to get the count of objects returned.

    Returns a dictionary where keys are profile name and value are a tuple of
    the number of associator instances for each of the AssociatorName calls.

    NOTE: This can take a long time because it executes 2 server requests for
    each profile in profile_insts.
    """
    def get_assoc_count(server, profile_inst):
        """
        Execute Associator names with ResultRole as 'Dependent' and then as
        'Antecedent' and return the count of associations returned for each
        operation
        """
        deps = server.conn.AssociatorNames(
            ObjectName=profile_inst.path,
            AssocClass="CIM_ReferencedProfile",
            ResultRole='Dependent')

        ants = server.conn.AssociatorNames(
            ObjectName=profile_inst.path,
            AssocClass="CIM_ReferencedProfile",
            ResultRole='Antecedent')
        return (len(deps), len(ants))

    assoc_dict = {}
    for profile_inst in profile_insts:
        deps_count, ants_count = get_assoc_count(server, profile_inst)
        pn = profile_name(org_vm, profile_inst)
        assoc_dict[pn] = (deps_count, ants_count)

    title = 'Display antecedent and dependent counts for possible ' \
        'autonomous profiles using slow algorithm.\n' \
        'Displays the number of instances  returned by\n' \
        'Associators request on profile for possible autonomous profiles'
    rows = [(key, value[0], value[1]) for key, value in assoc_dict.items()]

    print_table(title, ['profile', 'Dependent\nCount', 'Antecedent\nCount'],
                rows, sort_columns=0)

    # add rows to the global list for table of
    g_rows = [(nickname, key, value[0], value[1])
              for key, value in assoc_dict.items()]
    ASSOC_PROPERTY_COUNTS.extend(g_rows)
    return assoc_dict
def count_ref_associators ( nickname , server , profile_insts , org_vm ) : def get_assoc_count ( server , profile_inst ) : deps = server . conn . AssociatorNames ( ObjectName = profile_inst . path , AssocClass = "CIM_ReferencedProfile" , ResultRole = 'Dependent' ) ants = server . conn . AssociatorNames ( ObjectName = profile_inst . path , AssocClass = "CIM_ReferencedProfile" , ResultRole = 'Antecedent' ) return ( len ( deps ) , len ( ants ) ) assoc_dict = { } for profile_inst in profile_insts : deps_count , ants_count = get_assoc_count ( server , profile_inst ) pn = profile_name ( org_vm , profile_inst ) assoc_dict [ pn ] = ( deps_count , ants_count ) title = 'Display antecedent and dependent counts for possible ' 'autonomous profiles using slow algorithm.\n' 'Displays the number of instances  returned by\n' 'Associators request on profile for possible autonomous profiles' rows = [ ( key , value [ 0 ] , value [ 1 ] ) for key , value in assoc_dict . items ( ) ] print_table ( title , [ 'profile' , 'Dependent\nCount' , 'Antecedent\nCount' ] , rows , sort_columns = 0 ) g_rows = [ ( nickname , key , value [ 0 ] , value [ 1 ] ) for key , value in assoc_dict . items ( ) ] ASSOC_PROPERTY_COUNTS . extend ( g_rows ) return assoc_dict
Get dict of counts of associator returns for ResultRole == Dependent and
    ResultRole == Antecedent for profiles in list.  This method counts by
    executing repeated AssociationName calls on CIM_ReferencedProfile for each
    profile instance in profile_insts with the result Role set to Dependent and
    then Antecedent to get the count of objects returned.

    Returns a dictionary where keys are profile name and value are a tuple of
    the number of associator instances for each of the AssociatorName calls.

    NOTE: This can take a long time because it executes 2 server requests for
    each profile in profile_insts.