ucscsdk/ucsccoreutils.py
def extract_molist_from_method_response(method_response,
                                        in_hierarchical=False):
    """
    Methods extracts mo list from response received from UcsCentral server i.e.
    external method object

    Args:
        method_response (ExternalMethod Object): response
        in_hierarchical (bool): if True, return all the hierarchical child of
                                    managed objects

    Returns:
        List of ManagedObjects

    Example:
        response = handle.query_dn("org-root", need_response=True)\n
        molist = extract_molist_from_method_response(method_response=response,
                 in_hierarchical=True)
    """

    mo_list = []

    if hasattr(method_response, "out_config"):
        resp_configs = method_response.out_config
    elif hasattr(method_response, "out_configs"):
        resp_configs = method_response.out_configs
    else:
        log.error("method_response should contain out_config(s)")
        return mo_list

    if len(resp_configs.child) == 0:
        return mo_list
    if in_hierarchical:
        current_mo_list = resp_configs.child
        while len(current_mo_list) > 0:
            child_mo_list = []
            for mo in current_mo_list:
                mo_list.append(mo)
                while mo.child_count() > 0:
                    for child in mo.child:
                        mo.child_remove(child)
                        child.mark_clean()
                        child_mo_list.append(child)
                        break
            current_mo_list = child_mo_list
    else:
        mo_list = resp_configs.child

    return mo_list

    Methods extracts mo list from response received from UcsCentral server i.e.
    external method object

    Args:
        method_response (ExternalMethod Object): response
        in_hierarchical (bool): if True, return all the hierarchical child of
                                    managed objects

    Returns:
        List of ManagedObjects

    Example:
        response = handle.query_dn("org-root", need_response=True)\n
        molist = extract_molist_from_method_response(method_response=response,
                 in_hierarchical=True)
    
Methods extracts mo list from response received from UcsCentral server i.e.
external method object
Methods extracts mo list from response received from UcsCentral server i . e . external method object
def extract_molist_from_method_response(method_response,
                                        in_hierarchical=False):
    mo_list = []
    if hasattr(method_response, "out_config"):
        resp_configs = method_response.out_config
    elif hasattr(method_response, "out_configs"):
        resp_configs = method_response.out_configs
    else:
        log.error("method_response should contain out_config(s)")
        return mo_list
    if len(resp_configs.child) == 0:
        return mo_list
    if in_hierarchical:
        current_mo_list = resp_configs.child
        while len(current_mo_list) > 0:
            child_mo_list = []
            for mo in current_mo_list:
                mo_list.append(mo)
                while mo.child_count() > 0:
                    for child in mo.child:
                        mo.child_remove(child)
                        child.mark_clean()
                        child_mo_list.append(child)
                        break
            current_mo_list = child_mo_list
    else:
        mo_list = resp_configs.child
    return mo_list
def extract_molist_from_method_response ( method_response , in_hierarchical = False ) : mo_list = [ ] if hasattr ( method_response , "out_config" ) : resp_configs = method_response . out_config elif hasattr ( method_response , "out_configs" ) : resp_configs = method_response . out_configs else : log . error ( "method_response should contain out_config(s)" ) return mo_list if len ( resp_configs . child ) == 0 : return mo_list if in_hierarchical : current_mo_list = resp_configs . child while len ( current_mo_list ) > 0 : child_mo_list = [ ] for mo in current_mo_list : mo_list . append ( mo ) while mo . child_count ( ) > 0 : for child in mo . child : mo . child_remove ( child ) child . mark_clean ( ) child_mo_list . append ( child ) break current_mo_list = child_mo_list else : mo_list = resp_configs . child return mo_list
Methods extracts mo list from response received from UcsCentral server i.e.
Methods extracts mo list from response received from UcsCentral server i . e .
"""
    Methods extracts mo list from response received from UcsCentral server i.e.
    external method object

    Args:
        method_response (ExternalMethod Object): response
        in_hierarchical (bool): if True, return all the hierarchical child of
                                    managed objects

    Returns:
        List of ManagedObjects

    Example:
        response = handle.query_dn("org-root", need_response=True)\n
        molist = extract_molist_from_method_response(method_response=response,
                 in_hierarchical=True)
    """
List of ManagedObjects
List of ManagedObjects
method_response
None
in_hierarchical
if True, return all the hierarchical child of
managed objects
if True return all the hierarchical child of managed objects
examples
response = handle.query_dn("org-root", need_response=True)\n
molist = extract_molist_from_method_response(method_response=response,
in_hierarchical=True)
response = handle . query_dn ( " org - root " need_response = True ) \ n molist = extract_molist_from_method_response ( method_response = response in_hierarchical = True )