Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC | Sectional Exiting at Parent Level #142

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jtdub
Copy link
Contributor

@jtdub jtdub commented Dec 19, 2024

In [1]: from hier_config import WorkflowRemediation, get_hconfig, Platform

In [3]: running_config_text = """
   ...: prefix-set ALL
   ...:   0.0.0.0/0 eq 32
   ...: end-set
   ...: !
   ...: prefix-set PEERINGS
   ...:   1.1.1.1/32,
   ...:   2.2.2.2/32,
   ...:   10.0.1.0/24,
   ...:   172.16.0.0/12,
   ...:   192.168.3.0/26
   ...: end-set
   ...: """
   
   In [4]: generated_config_text = """
   ...: prefix-set ALL
   ...:   0.0.0.0/0 eq 32
   ...: end-set
   ...: !
   ...: prefix-set PEERINGS
   ...:   1.1.1.1/32,
   ...:   172.16.0.0/12,
   ...:   192.168.3.0/26
   ...: end-set
   ...: """
   
   In [5]: running_config = get_hconfig(Platform.CISCO_XR, running_config_text)
   ...: generated_config = get_hconfig(Platform.CISCO_XR, generated_config_text)

In [6]: workflow = WorkflowRemediation(running_config, generated_config)

In [7]: print(workflow.remediation_config)
prefix-set PEERINGS
  1.1.1.1/32,
  172.16.0.0/12,
  192.168.3.0/26
end-set

In [8]: pfx = running_config.get_child(equals="prefix-set ALL")
   ...: pfx.sectional_exit_text_parent_level
Out[8]: True

@jtdub jtdub requested a review from aedwardstx December 19, 2024 01:28
@jtdub jtdub self-assigned this Dec 19, 2024
@jtdub jtdub marked this pull request as draft December 19, 2024 01:28
@jtdub jtdub changed the title add ability to set sectional exit text at the parent level POC | Sectional Exiting at Parent Level Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant