diff options
-rw-r--r-- | interface-definitions/include/interface/ipv6-address-eui64.xml.i | 3 | ||||
-rwxr-xr-x | src/validators/ipv6-eui64-prefix | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/interface-definitions/include/interface/ipv6-address-eui64.xml.i b/interface-definitions/include/interface/ipv6-address-eui64.xml.i index 47f60c439..fe1f43df4 100644 --- a/interface-definitions/include/interface/ipv6-address-eui64.xml.i +++ b/interface-definitions/include/interface/ipv6-address-eui64.xml.i @@ -7,8 +7,9 @@ <description>IPv6 /64 network</description> </valueHelp> <constraint> - <validator name="ipv6-prefix"/> + <validator name="ipv6-eui64-prefix"/> </constraint> + <constraintErrorMessage>EUI64 prefix length must be 64</constraintErrorMessage> <multi/> </properties> </leafNode> diff --git a/src/validators/ipv6-eui64-prefix b/src/validators/ipv6-eui64-prefix new file mode 100755 index 000000000..d7f262633 --- /dev/null +++ b/src/validators/ipv6-eui64-prefix @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +# Validator used to check if given IPv6 prefix is of size /64 required by EUI64 + +from sys import argv +from sys import exit + +if __name__ == '__main__': + if len(argv) != 2: + exit(1) + + prefix = argv[1] + if prefix.split('/')[1] == '64': + exit(0) + + exit(1) |