summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-05 11:28:23 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-05 11:28:25 +0200
commitd765eef461e53241cf57bcb6b409dc6fec0efc92 (patch)
tree893e4f9ac72042d6a1cc3bd98bafa4c54db07601 /scripts
parent6e9a0162f84a1baca9acf0ca675ab3c574c7e297 (diff)
downloadvyos-1x-d765eef461e53241cf57bcb6b409dc6fec0efc92.tar.gz
vyos-1x-d765eef461e53241cf57bcb6b409dc6fec0efc92.zip
Python/VyOS validate: extend is_intf_addr_assigned()
Verify if the given IPv4/IPv6 address is assigned to specific interface. It can check both a single IP address (e.g. 192.0.2.1 or a assigned CIDR address 192.0.2.1/24. Used testbench: =============== 20: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 inet 192.0.2.1/24 brd 192.0.2.255 scope global br0 inet 192.0.3.1/24 brd 192.0.3.255 scope global br0 inet6 2001:db8:2::ffff/64 scope global tentative inet6 2001:db8:1::ffff/64 scope global tentative is_intf_addr_assigned('br0', '192.0.2.1/24') -> True is_intf_addr_assigned('br0', '192.0.2.1') -> True is_intf_addr_assigned('br0', '2001:db8:2::ffff/64') -> True is_intf_addr_assigned('br0', '2001:db8:2::ffff') -> True is_intf_addr_assigned('br0', '192.0.100.1/24') -> False is_intf_addr_assigned('br0', '192.0.100.1') -> False is_intf_addr_assigned('br0', '2001:db8:100::ffff/64') -> False is_intf_addr_assigned('br0', '2001:db8:100::ffff') -> False
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions