Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
174 lines (127 sloc) 3.81 KB

bf_assert

Makes assertions about a Batfish snapshot

Synopsis

  • Makes assertions about the contents and/or behavior of a Batfish snapshot.

Requirements

The following software packages must be installed on hosts that execute this module:

  • pybatfish

Module-specific Options

The following options may be specified for this module:

parameter type required default comments
assertions
list yes
List of assertions to make about the snapshot.
See assertions.rst for documentation of supported assertions.
network
str no Value in the bf_network fact.
Name of the network to make assertions about.
session
dict no Value in the bf_session fact.
Batfish session object required to connect to the Batfish service.
snapshot
str no Value in the bf_snapshot fact.
Name of the snapshot to make assertions about.

Examples

# Confirm there are no undefined references or incompatible BGP sessions
- bf_assert:
    assertions:
      - type: assert_no_undefined_references
        name: Confirm we have no undefined references
      - type: assert_no_incompatible_bgp_sessions
        name: Confirm we have no incompatible BGP sessions

# Confirm 10.10.10.10 is reachable by traffic entering Gig0/0 of as1border1
- bf_assert:
    assertions:
      - type: assert_all_flows_succeed
        name: confirm host is reachable for traffic received on GigEth0/0
        parameters:
          startLocation: '@enter(as1border1[GigabitEthernet0/0])'
          headers:
            dstIps: '10.10.10.10'

# Confirm a filter denies some specific traffic
- bf_assert:
    assertions:
      - type: assert_filter_denies
        name: confirm node1 filter block_access denies TCP traffic on port 22
        parameters:
          filters: 'node1["block_access"]'
          headers:
            applications: 'ssh'

Return Values

name description returned type
result
List of assertion results. There is one entry per assertion, and each entry contains details of the assertion and additional information when the assertion fails.
always list
summary
Summary of action(s) performed.
always str


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

You can’t perform that action at this time.