Skip to main content

Detect simulated BGP changes using Invariant

To detect changes in simulated BGP sessions between two network snapshots, fetch the bgp_session_status report for each snapshot and compare them.

First, retrieve the report for your current snapshot. Replace <current_snapshot_uuid> with the actual snapshot ID.

invariant show bgp_session_status --snapshot <current_snapshot_uuid> --json > current_bgp_sessions.json

Next, retrieve the report for the previous or baseline snapshot. Replace <previous_snapshot_uuid> with its ID.

invariant show bgp_session_status --snapshot <previous_snapshot_uuid> --json > previous_bgp_sessions.json

Use a diff tool to compare the two files. Changes in the Established_Status field indicate differences in BGP session establishment.

diff current_bgp_sessions.json previous_bgp_sessions.json
# Example output might show a change in session status:
# < "Local_IP": "169.254.25.161",
# < "Established_Status": "ESTABLISHED",
# ---
# > "Local_IP": "169.254.25.161",
# > "Established_Status": "NOT_ESTABLISHED", # Example change

See Output > BGP > bgp_session_status for report details.