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

cidr_match and list problem #87

Open
liposs opened this issue Sep 29, 2022 · 1 comment
Open

cidr_match and list problem #87

liposs opened this issue Sep 29, 2022 · 1 comment

Comments

@liposs
Copy link

liposs commented Sep 29, 2022

It seems that the cider_match is not checking all subnets in the list from the file but ONLY the last one:

<input load="text" name="test1-56">
interface Lo4
 ip address 4.4.4.4 32
!
interface Lo3
 ip address 3.3.3.3 32
!
interface Lo2
 ip address 2.2.2.2 32
!
interface Lo1
 ip address 1.1.1.30 32
</input>

<vars name="subnet_list" include="./vars.txt">
</vars>

<group name="test1_56_cidr_match_vars" input="test1-56" contains="ip">
interface {{ interface }}
 ip address {{ ip | cidr_match(subnet_list) }} {{ mask }}
</group>
./vars.txt
subnet_list="1.1.1.0/24"
subnet_list="2.2.2.0/24"

Output:

[
    [
        {
            "subnet_list": {
                "subnet_list": "2.2.2.0/24"
            },
            "test1_56_cidr_match_vars": {
                "interface": "Lo2",
                "ip": "2.2.2.2",
                "mask": "32"
            }
        }
    ]
]

Is there a way to read all subnets from the file and match it against the input? Again it seems that only the last subnet is tested against the input ;(

@dmulyalin
Copy link
Owner

Not with current implementation of TTP cidr_match function, best what can do probably to use macro python function to check subnets overlap.

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

No branches or pull requests

2 participants