Skip to content

IP Fabric Dynamic Attributes

Tip

Please use the main branch when viewing on the IP Fabric Documentation Portal for all Integrations. These documents are not versioned. However, you can find versioned files in the GitLab releases.

ipf_dynamic_attributes is a Python package designed to automate the creation and management of dynamic attributes in IP Fabric environments. It provides a flexible configuration system for defining rules, filters, and attribute mappings, enabling streamlined attribute synchronization and reporting.

Danger

Integrations should be installed outside of the IP Fabric VM unless the IP Fabric team explicitly instructs otherwise.

Warning

Any action on the Command-Line Interface (CLI) using the root, osadmin, or autoboss account may cause irreversible, detrimental changes to the product. Actions taken without direct communication with the IP Fabric Support or Solution Architect teams can render the system unusable.

Features

  • Define dynamic attribute rules using YAML, JSON, TOML or Python configuration.
  • Support for static and calculated attribute values, including regex extraction and value mapping.
  • Support for regex-based searching of device configs.
  • Flexible filtering for inventory and device data.
  • Default dry-run mode for safe testing.
  • Creates a pandas DataFrame for easy data manipulation and reporting.
  • Multiple configuration files can be merged into a single file for easier management.

Minimum Requirements

  • Python 3.9+
  • IP Fabric version 7.2 or higher
  • IP Fabric SDK version 7.2 or higher

Installation

PIP

To install the ipf_dynamic_attributes package, you can use pip:

pip install ipf_dynamic_attributes

If you would like to output reports in Excel format, you can also install the xlsxwriter package:

pip install ipf_dynamic_attributes[excel]

Extension

Coming soon…

Running

Command Line Interface (CLI)

To run the utility from the command line, you can use the following command:

> ipf_dynamic_attributes [<path_to_config_file> ...]

For full usage information, you can run -h|--help:

Command Line Help
> ipf_dynamic_attributes -h
usage: ipf_dynamic_attributes.cmd [-h] [-f {csv,json,excel}] [-o OUTFILE] [-m] [-d {true,false,0,1}] [-u {true,false,0,1}] [-i IPFABRIC_OVERRIDE] [filenames ...]

IP Fabric Dynamic Attribute.

positional arguments:
  filenames             Configuration filename(s), defaults to 'config.yml'.

options:
  -h, --help            show this help message and exit
  -f {csv,json,excel}, --format {csv,json,excel}
                        Output format for the report. Default is 'csv'. Use 'json' for JSON output.
  -o OUTFILE, --outfile OUTFILE
                        Output filename to send report instead of standard out.
  -m, --merge-only      Merge the default rule settings into rules and display the resulting file; does not run any automation.
                        This will also merge multiple configuration files into a single file.
  -d {true,false,0,1}, --dry-run-override {true,false,0,1}
                        Override 'dry_run' setting in configuration(s); defaults to null to use value(s) in the config.
                        If specifying multiple config files, all 'dry_run' values must be the same unless this flag is set.
  -u {true,false,0,1}, --update-snapshot-override {true,false,0,1}
                        Override 'update_snapshot' setting in configuration(s); defaults to null to use value(s) in the config.
                        If specifying multiple config files, all 'update_snapshot' values must be the same unless this flag is set.
  -i IPFABRIC_OVERRIDE, --ipfabric-override IPFABRIC_OVERRIDE
                        Override 'ipfabric' setting in configurations; defaults to null to use value in the config file(s).
                        If specifying multiple config files, all 'ipfabric' values must be the same unless this flag is set to the name of the file to use the IP Fabric configuration settings from.     

    This script will run the AttributeSync with the provided configuration file(s) which defaults to 'config.yml'.
    You can specify a different or multiple configuration files by passing the filename as an argument:
    ipf_dynamic_attributes mgmt-ip.yml region.yml

Printing Merged Configurations

To merge the default rule settings into the rules and display the resulting file without running any automation, you can use the -m or --merge-only option. This will also merge multiple configuration files into a single file:

ipf_dynamic_attributes -m config.yml config2.yml

Extension

Coming soon…

Python Script

See example in GitLab Repository.