def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]
        
        for table in output.values():
            display_table = []
            for row in table.values():
                for acl in row:
                    acl_name = acl['acl_name']
                    for entries in acl['TABLE_seqno'].values():
                        if isinstance(entries,dict):
                            entries=[entries]
                        for entry in entries:
                            ordered_entry = OrderedDict()
                            ordered_entry['acl-name'] = acl_name
                            ordered_entry['seqno'] = entry['seqno']
                            keys = [k for k in entry.keys() if k != 'seqno']
                            for key in sorted(keys):
                                ordered_entry[key] = entry[key]
                            display_table.append(ordered_entry)
            print_table(display_table)
        print()
    return True
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    #     print("Execute command '%s' on network device %s" % (command, device_url(**device_config)))
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        print_table(response[c])
        print()
    return True
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
#     print("Execute command '%s' on network device %s" % (command, device_url(**device_config)))
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        print_table(response[c])
        print()
    return True
Example #4
0
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]
        table_intf = output['TABLE_intf']
        rows_intf = table_intf['ROW_intf']
        if not isinstance(rows_intf, list):
            rows_intf = [rows_intf]
        print_table(rows_intf)
        print()
    return True
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print("Output for command:", c)
        output = response[c]
        table_intf = output["TABLE_intf"]
        rows_intf = table_intf["ROW_intf"]
        if not isinstance(rows_intf, list):
            rows_intf = [rows_intf]
        print_table(rows_intf)
        print()
    return True
Example #6
0
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]

        table_vrf = output['TABLE_vrf']
        display_table = []
        rows_vrf = table_vrf['ROW_vrf']
        if not isinstance(rows_vrf, list):
            rows_vrf = [rows_vrf]
        for row_vrf in rows_vrf:
            display_vrf = OrderedDict()
            keys = [k for k in row_vrf if not k.startswith('TABLE')]
            for k in sorted(keys):
                display_vrf[k] = row_vrf[k]
            table_addrf = row_vrf['TABLE_addrf']
            rows_addrf = table_addrf['ROW_addrf']
            if not isinstance(rows_addrf, list):
                rows_addrf = [rows_addrf]
            for row_addrf in rows_addrf:
                display_addrf = OrderedDict(display_vrf)
                keys = [k for k in row_addrf if not k.startswith('TABLE')]
                for k in sorted(keys):
                    display_addrf[k] = row_addrf[k]
                table_prefix = row_addrf['TABLE_prefix']
                rows_prefix = table_prefix['ROW_prefix']
                if not isinstance(rows_prefix, list):
                    rows_prefix = [rows_prefix]
                for row_prefix in rows_prefix:
                    display_prefix = OrderedDict(display_addrf)
                    keys = [k for k in row_prefix if not k.startswith('TABLE')]
                    for k in sorted(keys):
                        display_prefix[k] = row_prefix[k]
                    table_path = row_prefix['TABLE_path']
                    rows_path = table_path['ROW_path']
                    if not isinstance(rows_path, list):
                        rows_path = [rows_path]
                    for row_path in rows_path:
                        display_path = OrderedDict(display_prefix)
                        keys = [k for k in row_path if not k.startswith('TABLE')]
                        for k in sorted(keys):
                            display_path[k] = row_path[k]
                        display_table.append(display_path)
        print_table(display_table)
        print()
    return True
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]
        
        table_intf =output['TABLE_intf']
        rows = [row.values() for row in table_intf]
        rows=list(chain(*rows))
        print_table(rows)
        print()

        table_vrf =output['TABLE_vrf']
        rows = [row.values() for row in table_vrf]
        rows=list(chain(*rows))
        print_table(rows)
        print()
    return True
Example #8
0
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]

        table_cdp = output['TABLE_cdp_neighbor_brief_info']
        display_table = []
        rows_cdp = table_cdp['ROW_cdp_neighbor_brief_info']
        if not isinstance(rows_cdp, list):
            rows_cdp = [rows_cdp]
        for row_cdp in rows_cdp:
            display_cdp = OrderedDict()
            keys = [k for k in row_cdp if not k.startswith('TABLE')]
            for k in sorted(keys):
                display_cdp[k] = row_cdp[k]
            display_table.append(display_cdp)
        print_table(display_table)
        print()
    return True
def demonstrate(session):
    """ Execute a command, print the output, return 'true' if successful. """
    response = cli_show(session, command)
    for c in response:
        print('Output for command:', c)
        output = response[c]

        table_cdp = output['TABLE_cdp_neighbor_brief_info']
        display_table = []
        rows_cdp=table_cdp['ROW_cdp_neighbor_brief_info']
        if not isinstance(rows_cdp, list):
            rows_cdp = [rows_cdp]
        for row_cdp in rows_cdp:
            display_cdp = OrderedDict()
            keys = [k for k in row_cdp if not k.startswith('TABLE')]
            for k in sorted(keys):
                display_cdp[k] = row_cdp[k]
            display_table.append(display_cdp)
        print_table(display_table)
        print()
    return True