3 �^! � @ sh d dl mZ ddlmZ ddlmZ ddlmZmZ edddd g�Z G d d� de�Z G dd � d e�ZdS )� )� namedtuple� )�ContextWrapper)�DiffResultDescriptor)� Difference�WrapperZmodified_ibendportconZruleZ added_contextZremoved_contextc @ s8 e Zd ZdZed�Zed�Zed�Zdd� Zdd� Z dS )�IbendportconsDifferencez?Determine the difference in ibendportcons between two policies.�diff_ibendportconsc C s� | j jdj| �� | jdd� | jj� D �dd� | jj� D ��\| _| _}g | _ x<|D ]4\}}t |j�t |j�krT| j jt ||j|j�� qTW dS )z>Generate the difference in ibendportcons between the policies.zLGenerating ibendportcon differences from {0.left_policy} to {0.right_policy}c s s | ]}t |�V qd S )N)�IbendportconWrapper)�.0�n� r �$/usr/lib64/python3.6/ibendportcon.py� <genexpr>0 s z=IbendportconsDifference.diff_ibendportcons.<locals>.<genexpr>c s s | ]}t |�V qd S )N)r )r r r r r r 1 s N)�log�info�formatZ _set_diffZleft_policyZ ibendportconsZright_policy�added_ibendportcons�removed_ibendportcons�modified_ibendportconsr �context�append�modified_ibendportcon_record)�selfZmatched_ibendportconsZ left_ibepZ right_ibepr r r r '