Esempio n. 1
0
def audit_operation(device,
                    interfaces,
                    configuration,
                    include_shared_config=False):
    ''' Device script is expected to fetch the device configuration and reconcile with the
    configuration passed by IFC.

    In this call IFC will pass entire device configuration across all graphs. The device
    should insert/modify any missing configuration on the device. It should remove any extra
    configuration found on the device.

    @param device: dict
        a device dictionary
    @param interfaces: list of strings
        a list of interfaces for this device.
        e.g. [ 'E0/0', 'E0/1', 'E1/0', 'E1/0' ]
    @param configuration: dict
        Entire configuration on the device.
    @param include_shared_config: boolean
        Flag to indicate if the function configuration should be modified.
    @return: Faults dictionary through the exception_handler decorator

    '''
    sts = STS()
    input_clis = read_clis(device)
    output_clis = generate_asa_delta_cfg(configuration, input_clis, device,
                                         interfaces, sts,
                                         include_shared_config)
    deliver_clis(device, output_clis)
    is_STS = False
    if is_STS:
        query_sts_audit_table(device, sts)
        if sts.sts_table:
            deliver_sts_table(device, sts, True)
def audit_operation(device,
                    interfaces,
                    configuration,
                    include_shared_config = False):
    ''' Device script is expected to fetch the device configuration and reconcile with the
    configuration passed by IFC.

    In this call IFC will pass entire device configuration across all graphs. The device
    should insert/modify any missing configuration on the device. It should remove any extra
    configuration found on the device.

    @param device: dict
        a device dictionary
    @param interfaces: list of strings
        a list of interfaces for this device.
        e.g. [ 'E0/0', 'E0/1', 'E1/0', 'E1/0' ]
    @param configuration: dict
        Entire configuration on the device.
    @param include_shared_config: boolean
        Flag to indicate if the function configuration should be modified.
    @return: Faults dictionary through the exception_handler decorator

    '''
    sts = STS()
    input_clis = read_clis(device)
    output_clis = generate_asa_delta_cfg(configuration, input_clis, device, interfaces, sts, include_shared_config)
    deliver_clis(device, output_clis)
    is_STS = False
    if is_STS:
        query_sts_audit_table(device, sts)
        if sts.sts_table:
            deliver_sts_table(device, sts, True)
Esempio n. 3
0
def modify_operation(device, interfaces, configuration):
    '''Modify the configuration on ASA device.
    The configuration dictionary follows the format described above.

    This function is called for create, modify and destroy of graph and its associated functions

    @param device: dict
        a device dictionary
    @param configuration: dict
        configuration in delta form
    @return: Faults dictionary through the exception_handler decorator
    '''
    sts = STS()
    clis = ifc2asa(configuration, device, interfaces, sts)
    deliver_clis(device, clis)
    is_STS = False
    if is_STS:
        if sts.sts_table:
            deliver_sts_table(device, sts, False)
def modify_operation(device,
                     interfaces,
                     configuration):
    '''Modify the configuration on ASA device.
    The configuration dictionary follows the format described above.

    This function is called for create, modify and destroy of graph and its associated functions

    @param device: dict
        a device dictionary
    @param configuration: dict
        configuration in delta form
    @return: Faults dictionary through the exception_handler decorator
    '''
    sts = STS()
    clis = ifc2asa(configuration, device, interfaces, sts)
    deliver_clis(device, clis)
    is_STS = False
    if is_STS:
        if sts.sts_table:
            deliver_sts_table(device, sts, False)