Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/__pycache__/source.cpython-39.pyc
Ðазад
a ]�h?B � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl mZ ddlm Z ddlmZ ddlmZ ddlmZ ddlmZ d d lmZmZ d dlmZmZmZ ej�d�r�dd lm Z ddl!m"Z" ddl#m$Z$ ndZ$dZ"d Z%dZ&G dd� de'�Z(G dd� de)�Z*dS )aa Local RTNL ---------- Local RTNL source is a simple `IPRoute` instance. By default NDB starts with one local RTNL source names `localhost`:: >>> ndb = NDB() >>> ndb.sources.summary().format("json") [ { "name": "localhost", "spec": "{'target': 'localhost', 'nlm_generator': 1}", "state": "running" }, { "name": "localhost/nsmanager", "spec": "{'target': 'localhost/nsmanager'}", "state": "running" } ] >>> ndb.sources['localhost'] [running] <IPRoute {'target: 'localhost', 'nlm_generator': 1}> The `localhost` RTNL source starts an additional async cache thread. The `nlm_generator` option means that instead of collections the `IPRoute` object returns generators, so `IPRoute` responses will not consume memory regardless of the RTNL objects number:: >>> ndb.sources['localhost'].nl.link('dump') <generator object RTNL_API.filter_messages at 0x7f61a99a34a0> See also: :ref:`iproute` Network namespaces ------------------ There are two ways to connect additional sources to an NDB instance. One is to specify sources when creating an NDB object:: ndb = NDB(sources=[{'target': 'localhost'}, {'netns': 'test01'}]) Another way is to call `ndb.sources.add()` method:: ndb.sources.add(netns='test01') This syntax: `{target': 'localhost'}` and `{'netns': 'test01'}` is the short form. The full form would be:: {'target': 'localhost', # the label for the DB 'kind': 'local', # use IPRoute class to start the source 'nlm_generator': 1} # {'target': 'test01', # the label 'kind': 'netns', # use NetNS class 'netns': 'test01'} # See also: :ref:`netns` Remote systems -------------- It is possible also to connect to remote systems using SSH. In order to use this kind of sources it is required to install the `mitogen <https://github.com/dw/mitogen>`_ module. The `remote` kind of sources uses the `RemoteIPRoute` class. The short form:: ndb.sources.add(hostname='worker1.example.com') In some more extended form:: ndb.sources.add(**{'target': 'worker1.example.com', 'kind': 'remote', 'hostname': 'worker1.example.com', 'username': 'jenkins', 'check_host_keys': False}) See also: :ref:`remote` � N)� basestring)�IPRoute)�NetlinkError)�NetlinkSocketBase)�ifinfmsg)� RemoteIPRoute� )�ShutdownException�State)� cmsg_event�cmsg_failed�cmsg_sstart�linux)�netns)�NetNSManager)�NetNS� c @ s e Zd Zdd� Zdd� ZdS )�SourceProxyc C s || _ t�� | _|| _d S �N)�ndb�queue�Queue�events�target)�selfr r � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/source.py�__init__t s zSourceProxy.__init__c O s� t t�� j�}t�� | jj|<