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

cisco ios get_probes_config: incorrect "ip sla" parsing #1281

Closed
javcasalc opened this issue Aug 28, 2020 · 2 comments
Closed

cisco ios get_probes_config: incorrect "ip sla" parsing #1281

javcasalc opened this issue Aug 28, 2020 · 2 comments
Milestone

Comments

@javcasalc
Copy link

Hi

I've seen this code is pretty old (3 years, 1bdc4d1#diff-5a3fb7da3626f2d9b4eed6d1e6011e74R1905), and it turns out that it does not work with newer IOS XE like Version 16.12.3 for example.

I would change the probes_regex definition from

probes_regex = r"ip\s+sla\s+(?P<id>\d+)\n" \
            "\s+(?P<probe_type>\S+)\s+(?P<probe_args>.*\n).*" \
            "\s+tag\s+(?P<name>\S+)\n.*" \
            "\s+history\s+buckets-kept\s+(?P<probe_count>\d+)\n.*" \
            "\s+frequency\s+(?P<interval>\d+)$"

to

probes_regex = (
            r"ip\s+sla\s+(?P<id>\d+)\n"
            r"\s+(?P<probe_type>\S+)\s+(?P<probe_args>.*)\n.*"
            r"\s+tag\s+(?P<name>\S+)\n.*"
            r"\s+frequency\s+(?P<interval>\d+)\n.*"
            r"\s+history\s+buckets-kept\s+(?P<probe_count>\d+)$"
        )

and also I think you have to exec sh run | section ip sla [0-9]

csr1000v#sh run | section ip sla [0-9]
ip sla 1
 icmp-echo 10.0.0.2 source-interface GigabitEthernet11
 tag napalm_test
 frequency 15
 history buckets-kept 60

instead of
sh run | include ip sla [0-9]

csr1000v#sh run | include ip sla [0-9]
ip sla 1

in 1bdc4d1#diff-5a3fb7da3626f2d9b4eed6d1e6011e74R1918

Is this ok?

J.

@mirceaulinic
Copy link
Member

Hi J. Yes, please feel free to submit a PR to correct this, as described above (assuming the current tests would pass -- but another test case would be ideally added for this particular scenario). Thanks.

@mirceaulinic mirceaulinic added this to the APPROVED milestone Aug 28, 2020
@javcasalc
Copy link
Author

Hi

kindly check #1285

I must say that the regex expression is pretty ugly, and this time, black/pylama plays against us because the regex string format must not be longer than 100chars.

J.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants