module infix-ip {
  yang-version 1.1;
  namespace "urn:infix:params:xml:ns:yang:infix-ip";
  prefix infix-ip;

  import ietf-interfaces {
    prefix if;
  }
  import ietf-ip {
    prefix ip;
  }
  import ietf-inet-types {
    prefix inet;
  }
  import ietf-yang-types {
    prefix yang;
  }

  description "This module augments ietf-ip with Infix extensions and deviations.";

  revision 2025-11-02 {
    description "Change autoconf to presence container, removing enabled leaf.";
    reference "Internal, issue #1109.";
  }
  revision 2024-09-16 {
    description "Add support for IPv4LL request-address.";
    reference "Internal.";
  }
  revision 2023-09-14 {
    description "Added deviations for unsupported parts of ietf-ip.";
    reference "Internal.";
  }
  revision 2023-04-24 {
    description "Initial revision.";
    reference   "RFC 7277: A YANG Data Model for IP Management";
  }

  /*
   * Data nodes
   */
  augment "/if:interfaces/if:interface/ip:ipv4" {
    container autoconf {
      presence "Enable IPv4 link-local address autoconfiguration for this interface.";
      description "Parameters to control the autoconfiguration of IPv4 address.";
      reference "RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses";

      leaf request-address {
        description "Try to acquire the specified IP address, if available.

                     With this setting the IPv4LL client will start by
                     requesting this address.  However, if it is not
                     available it falls back to the default algorithm.";
        type inet:ipv4-address;
        must "substring(., 1, 7) = '169.254'" {
            error-message "Must be from the IPv4LL range 169.254.0.0/16.";
        }
        must "not(substring(., string-length(.) - 1, 2) = '.0' or substring(., string-length(.) - 3, 4) = '.255')" {
            error-message "Addresses ending in .0 or .255 are reserved.";
        }
      }
    }
  }

  deviation "/if:interfaces/if:interface/ip:ipv4/ip:address/ip:subnet/ip:netmask" {
    deviate not-supported;
  }

  deviation "/if:interfaces/if:interface/ip:ipv4/ip:neighbor" {
    deviate not-supported;
  }

  deviation "/if:interfaces/if:interface/ip:ipv6/ip:address/ip:status" {
    deviate not-supported;
  }

  deviation "/if:interfaces/if:interface/ip:ipv6/ip:neighbor" {
    deviate not-supported;
  }
}
