def get_all_queues(db, namespace=None, display=constants.DISPLAY_ALL): queue_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_QUEUE_NAME_MAP') queues = list(queue_names.keys()) if queue_names else {} if display == constants.DISPLAY_ALL: return natsorted(queues) # filter the backend ports display_ports = [q.split(":")[0] for q in queues] display_ports = get_external_ports(display_ports, namespace) queues = [q for q in queues if q.split(":")[0] in display_ports] return natsorted(queues)
def get_all_ports(db, namespace=None, display=constants.DISPLAY_ALL): all_port_names = db.get_all(db.COUNTERS_DB, 'COUNTERS_PORT_NAME_MAP') # Get list of physical ports port_names = {} for i in all_port_names: if i.startswith('Ethernet'): port_names[i] = all_port_names[i] display_ports = list(port_names.keys()) if display == constants.DISPLAY_EXTERNAL: display_ports = get_external_ports(display_ports, namespace) return natsorted(display_ports)