Skip to content

Delete Attribute

The delete_attribute: true key should be used with caution inside Table or Config Rules.

It will delete the attribute from the device if it does not match any rule. This can be used to ensure that only dynamic attributes are set to the device and any manual updates will be removed.

The process of applying dynamic attributes with deletion works as follows:

  1. Collect the filtered list inventory of devices from IP Fabric.
  2. Process rule 1 and set the attribute if the device matches the rule.
  3. Loop through the entire filtered list of devices:
    1. If the device matched the rule and has a new value set then the new value will be applied.
    2. If the device does not have a current attribute value set then it is skipped.
    3. If the device did not match the rule and has a current attribute value set then the attribute will be flagged for deletion.
  4. Process next rule(s):
    1. If the device already has a new attribute value set then it is skipped as the first match takes priority.
    2. If the device matches this rule and does not have a dynamic attribute value assigned: 1. The deletion flagged is removed. 2. The value from this rule is applied.
  5. After processing all rules, the device will either:
    1. Have the correct attribute value set in IP Fabric based on the dynamic rules.
    2. The current configured attribute value is deleted.
    3. If no new dynamic attribute value is set and no current value was configured then no action is performed.

Because of this implementation if this flag is set to true in any rule then deletion will occur for the specified Attribute Name in that rule.

flowchart TD
    Inventory([Get Filtered Device Inventory]) --> Rule[[Process Rule]]
    Rule --> Process{Has a Dynamic Attribute been set?}
    Process -->|Yes| Match[/Set New Value/]
    Process -->|No| Deletion{Is Deletion Enabled?}
    Deletion -->|Yes| Delete[/Flag to Delete/]
    Deletion -->|No| Skip[No Updates]
    Delete --> Rule
    Skip --> Rule
    Match --> Calc[[Calculate Changes]]
    Delete --> Calc
    Calc --> Dryrun{Is Dry Run Disabled?}
    Dryrun -->|Yes| Update[Apply Changes]
    Dryrun -->|No| Report([Return Report])
    Update --> Report

    style Delete fill:#880808
    style Match fill:#008000 

Example Configuration

rules:
  - name: Assign Cloud Region
    delete_attribute: true
    attribute: CLOUD_REGION
    value:
      api_endpoint: tables/cloud/nodes/inventory
      column: location
      null_value: GLOBAL
  - name: AWS
    attribute: REGION
    value:
      api_endpoint: tables/cloud/vendors/aws/inventory
      column: region
      transform: upper

In this example the CLOUD_REGION attribute will be deleted if the device does not match the rule. The REGION attribute will not be deleted as it is not set to delete_attribute: true.