Skip to content

Management IP Example

This example demonstrates how to create a dynamic attribute to assign a Management IP.

Management IP Configuration
---
ipfabric:
  base_url: null   # Base URL or ENV: IPF_URL
  auth: null  # API Token or ENV: IPF_TOKEN or (IPF_USERNAME and IPF_PASSWORD)
  timeout: 5
  verify: true
  snapshot_id: $last
dry_run: true  # Default true
overwrite: true  # Default false
update_snapshot: true  # Default true
default:  # Applies to all rules except inventory unless overridden or flagged not to merge
  attribute: MGMT_IP
  attribute_filters: &attribute_filters  # Disable by setting merge_default_attribute_filters to false in rules
    - key: siteName
      value: HWLAB
      operator: eq
  filters:  # Disable by setting merge_default_filters to false in rules
    - column: primaryIp
      value: false
      operator: empty
  device_filters: &device_filters  # Disable by setting merge_default_device_filters to false in rules
    - column: vendor
      value: aws|azure|gcp
      operator: nreg
  value:
    api_endpoint: tables/inventory/interfaces
    column: primaryIp
inventory:  # Filters the inventory table for devices to be processed
  filters: *device_filters
  attribute_filters: *attribute_filters
  report_columns:  # Optional Inventory Columns to be included in the report with hostname, siteName, and sn
    - loginIp
rules:
  - name: Loopback0
    merge_default_attribute_filters: true  # Default true
    merge_default_filters: true  # Default true
    merge_default_device_filters: true  # Default true
    filters:
      - column: intName
        value: ^(Lo0|loopback0)$
        operator: ireg
  - name: loopback
    filters:
      - column: intName
        value: loopback
        operator: ieq
  - name: management
    filters:
      - column: intName
        value: ^(management\d?|mgmt)$
        operator: ireg

Merged Configuration

The above configuration will be merged into the following effective configuration:

Management IP Merged Configuration
---
ipfabric:
  base_url: null
  auth: null
  timeout: 5
  verify: true
  snapshot_id: $last
dry_run: true
overwrite: true
update_snapshot: true
inventory:
  filters:
    - value: aws|azure|gcp
      operator: nreg
      column: vendor
  filter_string: null
  attribute_filters:
    - value: HWLAB
      operator: eq
      key: siteName
  report_columns:
    - loginIp
rules:
  - filters:
      - value: ^(Lo0|loopback0)$
        operator: ireg
        column: intName
      - value: false
        operator: empty
        column: primaryIp
    filter_string: null
    attribute_filters:
      - value: HWLAB
        operator: eq
        key: siteName
    attribute: MGMT_IP
    value:
      static: null
      regex: null
      transform: null
      mapping: {}
      null_value: null
      api_endpoint: tables/inventory/interfaces
      column: primaryIp
      sn_column: null
      sort: null
    device_filters:
      - value: aws|azure|gcp
        operator: nreg
        column: vendor
    delete_attribute: null
    name: Loopback0
    merge_default_filters: true
    merge_default_device_filters: true
    merge_default_attribute_filters: true
  - filters:
      - value: loopback
        operator: ieq
        column: intName
      - value: false
        operator: empty
        column: primaryIp
    filter_string: null
    attribute_filters:
      - value: HWLAB
        operator: eq
        key: siteName
    attribute: MGMT_IP
    value:
      static: null
      regex: null
      transform: null
      mapping: {}
      null_value: null
      api_endpoint: tables/inventory/interfaces
      column: primaryIp
      sn_column: null
      sort: null
    device_filters:
      - value: aws|azure|gcp
        operator: nreg
        column: vendor
    delete_attribute: null
    name: loopback
    merge_default_filters: true
    merge_default_device_filters: true
    merge_default_attribute_filters: true
  - filters:
      - value: ^(management\d?|mgmt)$
        operator: ireg
        column: intName
      - value: false
        operator: empty
        column: primaryIp
    filter_string: null
    attribute_filters:
      - value: HWLAB
        operator: eq
        key: siteName
    attribute: MGMT_IP
    value:
      static: null
      regex: null
      transform: null
      mapping: {}
      null_value: null
      api_endpoint: tables/inventory/interfaces
      column: primaryIp
      sn_column: null
      sort: null
    device_filters:
      - value: aws|azure|gcp
        operator: nreg
        column: vendor
    delete_attribute: null
    name: management
    merge_default_filters: true
    merge_default_device_filters: true
    merge_default_attribute_filters: true