Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/__pycache__/query.cpython-39.pyc
Ðазад
a ]�h � @ s d dl mZ G dd� de�ZdS )� )� RecordSetc @ sH e Zd Zddd�Zddd�Zddd�Zdd d �Zddd�Zdd d�ZdS )�Query�rawc C s || _ || _d S )N)�_schema�_fmt)�selfZschema�fmt� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/query.py�__init__ s zQuery.__init__Nc c s� |p| j }|dkrf|r"d�|�V |D ]<}|r6||�}t|ttf�r\d�dd� |D ��V q&|V q&n8|dkr�|rx|V |D ]}|r�||�}|V q|ntd��d S )N�csv�,c S s g | ]}t |��qS r )�str)�.0�xr r r � <listcomp> � z$Query._formatter.<locals>.<listcomp>r zformat not supported)r �join� isinstance�list�tuple� TypeError)r �cursorr �headerZ transform�recordr r r � _formatter s$ zQuery._formatterc C s d}t | �| j�d�||��S )z8 List all the nodes within the cluster. )�nodenamezJ SELECT DISTINCT f_target FROM interfaces �r r r �fetch�r r r r r r �nodes s ���zQuery.nodesc C s d}t | �| j�d�||��S )zc List point to point edges within the cluster, like GRE or PPP interfaces. )� left_node� right_nodez� SELECT DISTINCT l.f_target, r.f_target FROM p2p AS l INNER JOIN p2p AS r ON l.f_p2p_local = r.f_p2p_remote AND l.f_target != r.f_target r r r r r � p2p_edges2 s ���zQuery.p2p_edgesc C s d}t | �| j�d�||��S )a� List l2 links within the cluster, reconstructed from the ARP caches on the nodes. Works as follows: 1. for every node take the ARP cache 2. for every record in the cache reconstruct two triplets: * the interface index -> the local interface name * the neighbour lladdr -> the remote node and interface name Issues: does not filter out fake lladdr, so CARP interfaces produce fake l2 edges within the cluster. )r! Zleft_ifnameZleft_lladdrr"