Skip to content

HTTP Server Example

This example demonstrates how to create a dynamic attribute based on an HTTP(S) server configuration. The rule will extract if the HTTP server is disabled from the device configuration and set a dynamic attribute.

HTTP Server Configuration
---
ipfabric:
  base_url: null  # Recommended to use Environment Variables
  auth: null
  timeout: 5
  verify: true
  snapshot_id: $last
dry_run: true
overwrite: true
update_snapshot: true
default_config:
  filters:
    - value: cisco
      operator: eq
      column: vendor
inventory:
  filters:
    - value: NL  # Example Site Filter
      operator: eq
      column: siteName
  report_columns:
    - loginIp
default: null
rules:
  - name: HTTP Server
    attribute: IP_HTTP_SERVER
    value:
      static: DISABLED
      regex:
        pattern: ^no ip http server
        group: 0
        flags:
          - IGNORECASE
          - MULTILINE
      config: current
      no_config_value: IPF Unsupported
      null_value: ENABLED
  - name: HTTPS Server
    attribute: IP_HTTPS_SERVER
    value:
      static: DISABLED
      regex:
        pattern: ^no ip http secure-server
        group: 0
        flags:
          - IGNORECASE
          - MULTILINE
      config: current
      no_config_value: IPF Unsupported
      null_value: ENABLED

Merged Configuration

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

HTTP Server 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: NL
      operator: eq
      column: siteName
  filter_string: null
  attribute_filters: []
  report_columns:
    - loginIp
rules:
  - filters:
      - value: cisco
        operator: eq
        column: vendor
    filter_string: null
    attribute: IP_HTTP_SERVER
    delete_attribute: null
    name: HTTP Server
    value:
      static: DISABLED
      regex:
        pattern: ^no ip http server
        group: 0
        flags:
          - IGNORECASE
          - MULTILINE
      transform: null
      mapping: {}
      null_value: ENABLED
      config: current
      no_config_value: IPF Unsupported
    merge_default_filters: true
  - filters:
      - value: cisco
        operator: eq
        column: vendor
    filter_string: null
    attribute: IP_HTTPS_SERVER
    delete_attribute: null
    name: HTTPS Server
    value:
      static: DISABLED
      regex:
        pattern: ^no ip http secure-server
        group: 0
        flags:
          - IGNORECASE
          - MULTILINE
      transform: null
      mapping: {}
      null_value: ENABLED
      config: current
      no_config_value: IPF Unsupported
    merge_default_filters: true