Skip to content

Cloud Site Separation by Tags

This example demonstrates how to use Dynamic Attributes to perform Site Separation of Cloud devices based on their tags.

IP Fabric Technology > Cloud > Nodes > Tags table:

Cloud Tags Table

We have two tags we want to use to assign the siteName attribute for our Cloud devices:

  1. Topology tag: first priority
  2. Project tag: if Topology tag is not present then use Project tag.

Result:

hostname siteName slug sn attribute name api_endpoint new_value update create
Multi-account LAB Transit Gateway AWS:EU-WEST-2 aws3 tgw-0baa8b3a91a77f9a7 siteName Use Topology Tag Value to Assign Site Name tables/cloud/nodes/tags TGW MULTI ACCOUNT ATTACHMENTS true true
main-a AWS:EU-CENTRAL-1 aws3 nat-0c991866d6462d307 siteName Use Project Tag Value to Assign Site Name tables/cloud/nodes/tags MAIN true true
main AWS:EU-CENTRAL-1 aws3 vgw-089c2ce9b84d86dd0 siteName Use Project Tag Value to Assign Site Name tables/cloud/nodes/tags MAIN true true
Network Core AWS:EU-WEST-2 aws3 vpc-058d9c2aa9cd15bda siteName Use Topology Tag Value to Assign Site Name tables/cloud/nodes/tags TGW MULTI ACCOUNT ATTACHMENTS true true
main AWS:EU-CENTRAL-1 aws3 vpc-02c76f4b2991b552a siteName Use Project Tag Value to Assign Site Name tables/cloud/nodes/tags MAIN true true
IGW for the App Spoke VPC AWS:EU-WEST-2 aws3 igw-0043ec4dfbd88eb11 siteName Use Topology Tag Value to Assign Site Name tables/cloud/nodes/tags CISCO-LIVE-2023 true true
IGW for the Web Spoke VPC AWS:EU-WEST-2 aws3 igw-066286cd5447b3af3 siteName Use Topology Tag Value to Assign Site Name tables/cloud/nodes/tags CISCO-LIVE-2023 true true
main AWS:EU-CENTRAL-1 aws3 igw-0744b1e40613b65c7 siteName Use Project Tag Value to Assign Site Name tables/cloud/nodes/tags MAIN true true
IGW for the DB Spoke VPC AWS:EU-WEST-2 aws3 igw-087045836748172f1 siteName Use Topology Tag Value to Assign Site Name tables/cloud/nodes/tags CISCO-LIVE-2023 true true
IPF-LAB AWS:EU-CENTRAL-1 aws3 tgw-0ed714a2e8eee6c34 siteName false false

Configuration File

Cloud Tag 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: false  # Default true
update_snapshot: true  # Default true

default:  # Applies to all rules except inventory unless overridden or flagged not to merge
  overwrite: true  # Defaults to false to avoid overwriting existing attributes
  attribute: siteName
  value:
      api_endpoint: /tables/cloud/nodes/tags
      column: tagValue
      transform: upper

inventory:
  filters:  # Filter only Cloud Devices in Inventory
    - column: vendor
      value: aws|azure|gcp
      operator: reg
  report_columns: # Optional Inventory Columns to be included in the report with hostname, siteName, and sn
    - slug

rules:
  - name: Use Topology Tag Value to Assign Site Name
    filters:
      - column: tagName
        value: Topology
        operator: eq

  - name: Use Project Tag Value to Assign Site Name
    filters:
      - column: tagName
        value: Project
        operator: eq

Merged Configuration

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

Region Merged Configuration
dry_run: false
update_snapshot: true
inventory:
  attribute_filters: []
  filter_string: null
  filters: []
  report_columns:
  - loginIp
ipfabric:
  auth: null
  base_url: null
  snapshot_id: $last
  timeout: 5
  verify: true
rules:
- attribute: siteName
  attribute_filters: []
  delete_attribute: null
  device_filters: []
  filter_string: null
  filters:
  - column: tagName
    operator: eq
    value: Topology
  inventory:
    attribute_filters: []
    filter_string: null
    filters:
    - column: vendor
      operator: eq
      value: aws|azure|gcp
    report_columns:
    - slug
  merge_default_attribute_filters: true
  merge_default_device_filters: true
  merge_default_filters: true
  name: 'tag.yaml: Use Topology Tag Value to Assign Site Name'
  overwrite: true
  value:
    api_endpoint: /tables/cloud/nodes/tags
    column: tagValue
    default_mapping_value: null
    mapping: {}
    null_value: null
    regex: null
    sn_column: null
    sort: null
    static: null
    transform: upper
- attribute: siteName
  attribute_filters: []
  delete_attribute: null
  device_filters: []
  filter_string: null
  filters:
  - column: tagName
    operator: eq
    value: Project
  inventory:
    attribute_filters: []
    filter_string: null
    filters:
    - column: vendor
      operator: eq
      value: aws|azure|gcp
    report_columns:
    - slug
  merge_default_attribute_filters: true
  merge_default_device_filters: true
  merge_default_filters: true
  name: 'tag.yaml: Use Project Tag Value to Assign Site Name'
  overwrite: true
  value:
    api_endpoint: /tables/cloud/nodes/tags
    column: tagValue
    default_mapping_value: null
    mapping: {}
    null_value: null
    regex: null
    sn_column: null
    sort: null
    static: null
    transform: upper