module odl-lisp-address-types {

    yang-version 1;
    namespace "urn:opendaylight:lfm:lisp-binary-address-types";
    prefix "lisp-binary";

    import ietf-lisp-address-types { prefix laddr; revision-date 2015-11-05; }
    import odl-inet-binary-types { prefix bin; revision-date 2016-03-03; }

    contact
        "Lori Jakab <lojakab@cisco.com>";

    description
        "Augments for ietf-lisp-address-types to support binary IPv4 and IPv6
         addresses and prefixes internally in OpenDaylight";

    revision "2016-05-04" {
        description "Initial revision.";
    }

    identity ipv4-binary-afi {
        base laddr:lisp-address-family;
        description
            "IANA IPv4 address family (binary representation).";
    }

    identity ipv6-binary-afi {
        base laddr:lisp-address-family;
        description
            "IANA IPv6 address family (binary representation).";
    }

    identity ipv4-prefix-binary-afi {
        base laddr:lisp-address-family;
        description
          "IANA IPv4 address family prefix (binary representation).";
      }

    identity ipv6-prefix-binary-afi {
        base laddr:lisp-address-family;
        description
          "IANA IPv6 address family prefix (binary representation).";
    }

    grouping augmented-lisp-address {
        uses laddr:lisp-address {
            augment "address" {
                case ipv4-binary {
                    leaf ipv4-binary {
                        when "../address-type = 'ipv4-binary-afi'" {
                            description
                                "When AFI is IPv4 (binary).";
                        }
                        type bin:ipv4-address-binary;
                        description
                            "IPv4 (binary) address.";
                    }
                }
                case ipv6-binary {
                    leaf ipv6-binary {
                        when "../address-type = 'ipv6-binary-afi'" {
                            description
                                "When AFI is IPv6 (binary).";
                        }
                        type bin:ipv6-address-binary;
                        description
                            "IPv6 (binary) address.";
                    }
                }
                case ipv4-prefix-binary {
                    leaf ipv4-address-binary {
                        when "../address-type = 'ipv4-prefix-binary-afi'" {
                            description
                                "When AFI is IPv4 (binary).";
                        }
                        type bin:ipv4-address-binary;
                        description
                            "IPv4 (binary) address.";
                    }
                    leaf ipv4-mask-length {
                        when "../address-type = 'ipv4-prefix-binary-afi'" {
                            description
                                "When AFI is IPv4 (binary).";
                        }
                        type uint8 {
                            range "0..32";
                        }
                        description
                            "IPv4 mask length.";
                    }
                }
                case ipv6-prefix-binary {
                    leaf ipv6-address-binary {
                        when "../address-type = 'ipv6-prefix-binary-afi'" {
                            description
                                "When AFI is IPv6 (binary).";
                        }
                        type bin:ipv6-address-binary;
                        description
                            "IPv6 (binary) address.";
                    }
                    leaf ipv6-mask-length {
                        when "../address-type = 'ipv6-prefix-binary-afi'" {
                            description
                                "When AFI is IPv6 (binary).";
                        }
                        type uint8 {
                            range "0..128";
                        }
                        description
                            "IPv6 mask length.";
                    }
                }
            }
        }
    }
}