aristanetworks/cvprac

Get Device Reconcile Config

Closed this issue · 2 comments

Provide a means to get the configuration generated when a designed configuration is reconciled against a devices running configuration.

required code would look a bit like :

def get_device_reconcile_config(self, device_mac):
    ''' Returns the Reconcile configuration for the device provided.

        Args:
            device_mac (str): Mac address of the device to get the Reconciled
                configuration for.

        Returns:
            reconciledConfig config (string): The string of configuration
            elements different from the running config.
    '''
    self.log.debug('get_device_reconcile_config: device_mac: %s' % device_mac)
    configlet_list = self.get_configlets_by_device_id(device_mac)
    configletKey_list = []
    for configlet in configlet_list:
        configletKey_list.append(configlet['key'])
    body = {'configIdList':configletKey_list, 'netElementId':device_mac, 'pageType':'viewConfig'}
    validate_compare = self.clnt.post('/provisioning/validateAndCompareConfiglets.do',
                         data=body,
                         timeout=self.request_timeout)
    reconcile_config = ''
    if 'reconciledConfig' in validate_compare:
        reconcile_config = validate_compare['reconciledConfig']
    return reconcile_config

Hi @Hugh-Adams

I think this would fit better into how the API is currently formatted to create a method for the /provisioning/validateAndCompareConfiglets.do and return all the data instead of only the reconciledConfig if it is found. I'll look into adding this.

Hi @mharista,

Thanks that would work as well, I guess whoever is going to use cvp-rac needs to know the CVP API as well.