Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyeapi/api/__pycache__/ospf.cpython-39.pyc
Ðазад
a b�h@4 � @ s@ d Z ddlZddlmZ ddlmZ G dd� de�Zdd� ZdS ) z�Module for working with OSPF configuration in EOS This module provides an API for creating/modifying/deleting OSPF configurations � N)�Entity)� make_iterablec s� e Zd ZdZ� fdd�Zd)dd�Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zd*dd�Z� fdd�Zd+dd�Zd,d!d"�Zd-d#d$�Zd.d%d&�Zd'd(� Z� ZS )/�Ospfz@ The Ospf class implements global Ospf router configuration c s t t| �j|i |�� d S )N)�superr �__init__)�self�args�kwargs�� __class__� �/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pyeapi/api/ospf.pyr / s z Ospf.__init__Nc C s� d}|r|d| 7 }| � |�}|s&dS t� }|�| �|�� |�| �|�� |�| �|�� |�| �|�� |�| �|�� |�| �|�� |S )a6 Returns the OSPF routing configuration Args: vrf (str): VRF name to return OSPF routing config for Returns: dict: keys: router_id (int): OSPF router-id vrf (str): VRF of the OSPF process networks (dict): All networks that are advertised in OSPF ospf_process_id (int): OSPF proc id redistribution (dict): All protocols that are configured to be redistributed in OSPF shutdown (bool): Gives the current shutdown off the process z^router ospf .*� vrf %sN) Z get_block�dict�update�_parse_router_id� _parse_vrf�_parse_networks�_parse_ospf_process_id�_parse_redistribution�_parse_shutdown)r �vrf�match�config�responser r r �get3 s zOspf.getc C s t �d|�}tt|�d��d�S )z�Parses config file for the OSPF proc ID Args: config(str): Running configuration Returns: dict: key: ospf_process_id (int) z^router ospf (\d+)� )�ospf_process_id)�re�searchr �int�group�r r r r r r r V s zOspf._parse_ospf_process_idc C s* t �d|�}|r t|�d�d�S tdd�S )z�Parses config file for the OSPF vrf name Args: config(str): Running configuration Returns: dict: key: ospf_vrf (str) z^router ospf \d+ vrf (\w+)r )r �default)r r r r! r"