Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/objects/__pycache__/__init__.cpython-39.pyc
Ðазад
a ]�hG� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z ddl mZ ddlm Z ddlmZ ddlmZmZ dd lmZmZ dd lmZ ddlmZ dZdZdZd Zdd� ZG dd� de�Z dS )a, General structure ================= The NDB objects are dictionary-like structures that represent network objects -- interfaces, routes, addresses etc. They support the common dict API, like item getting, setting, iteration through key and values. In addition to that, NDB object add specific calls, see the API section below. Most of the NDB object types store all attributes in a flat one level dictionary. Some, like multihop routes, implement nested structures. In addition to that, some objects like `Interface` provide views on the DB that list only related objects -- addresses, routes and neighbours. More on these topic see in the corresponding sections. NDB objects and RTNL API ======================== The dictionary fields represent RTNL messages fields and NLA names, and the objects are used as argument dictionaries to normal `IPRoute` methods like `link()` or `route()`. Thus everything described for the `IPRoute` methods is valid here as well. See also: :ref:`iproute` .. testsetup:: from pyroute2 import IPMock as IPRoute from pyroute2 import NDB from pyroute2 import config config.mock_iproute = True .. testcode:: # create a vlan interface with IPRoute eth0 = 2 with IPRoute() as ipr: ipr.link("add", ifname="vlan1108", kind="vlan", link=eth0, vlan_id=1108) # same with NDB: with NDB(log="stderr") as ndb: vlan = ndb.interfaces.create( ifname="vlan1108", kind="vlan", link="eth0", vlan_id=1108, ) vlan.commit() Slightly simplifying, if a network object doesn't exist, NDB will run an RTNL method with "add" argument, if exists -- "set", and to remove an object NDB will call the method with "del" argument. API === � N)�partial)�cli)�NetlinkError)�RequestProcessor� )�AuthManager� check_auth)�InvalidateHandlerException�State)� cmsg_event)�Record� � c C s� t |�� �t | j�kr&| j�d� d S | jjj| j| d j | j dfi |��| d d� | jjj| j| d j | j dfi |��| d d� | � � d S )Nz)ignore incomplete idx_req in the fallback�target�set��source�get)r �keys�kspec�log�debug�ndb�_event_queue�put�sources�api�load_sql)�self�idx_req�req� r! ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pyroute2/ndb/objects/__init__.py�fallback_addY s ����r# c s� e Zd ZdZdZdZg Zg Zg Zi Z i Z eZg Z dZdZdZdZdZdZdZdZdZdZg ZdZdZdZdZedd� �Zejdd� �Zedd� �Z ed d � �Z!e!jdd � �Z!e"dd � �Z#e"dd� �Z$e"dd� �Z%e"dd� �Z&e"dd� �Z'e"dd� �Z(e)dd� �Z*dwdd�Z+e"dxdd��Z,e)e-fdd ��Z.d!d"� Z/d#d$� Z0d%d&� Z1ed'd(� �Z2e"d)d*� �Z3e"d+d,� �Z4e"d-d.� �Z5d/d0� Z6d1d2� Z7d3d4� Z8e9d5�d6d7� �Z:e9d8�d9d:� �Z;d;d<� Z<d=d>� Z=e>j?d?d@� �Z@e>jAe9d5�dydAdB���ZBdCdD� ZCdzdFdG�ZDdHdI� ZEe9d8�d{dJdK��ZFdLdM� ZGdNdO� ZHe9d8�d|dPdQ��ZIdRdS� ZJedTdU� �ZKe9d8�dVdW� �ZLdXdY� ZMdZd[� ZNd\d]� ZOd^d_� ZPd`da� ZQdbdc� ZRe9d8�ddde� �ZSe9d8�d}dgdh��ZTd~didj�ZUdkdl� ZVdmdn� ZW� fdodp�ZXdqdr� ZYddsdt�ZZdudv� Z[� Z\S )��RTNL_Objectz� The common base class for NDB objects -- interfaces, routes, rules addresses etc. Implements common logic for all the classes, like item setting, commit/rollback, RTNL event filters, loading values from the DB backend etc. NFc C s | j S )z� Main reference table for the object. The SQL schema of this table is used to build the object key and to verify fields. Read-write property. ��_table�r r! r! r"