# Info: KCL ExternalNFS task schemas for provisioning (Provisioning)
# Author: JesusPerezLorenzo 
# Release: 0.0.4
# Date: 10-12-2023

import regex

schema ExternalNFS:
    # NFS server IP
    ip: str = "$network_private_ip"
    # NFS net to share
    net: str = "$net"
    # NFS share path
    shared: str = "/shared"

    check:
        regex.match(ip,"^\$.*$") or regex.match(ip, "^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])$"), "'ip = ${ip}' check value definition (use $vaule or xx.xx.xx.xx)"
        regex.match(net,"^\$.*$") or regex.match(net, "^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}\/(?:3[0-2]|[0-2]?[0-9])$"), "'net = ${net}' check value definition"
