huawei-dhcp

Dynamic Host Configuration Protocol.

  • Version: 2020-04-10

    huawei-dhcp@2020-04-10


    
      module huawei-dhcp {
    
        yang-version 1;
    
        namespace "urn:huawei:yang:huawei-dhcp";
    
        prefix dhcp;
    
        import huawei-ifm {
          prefix ifm;
        }
        import huawei-vlan {
          prefix vlan;
        }
        import huawei-bd {
          prefix bd;
        }
        import huawei-extension {
          prefix ext;
        }
        import huawei-pub-type {
          prefix pub-type;
        }
        import ietf-inet-types {
          prefix inet;
        }
        import ietf-yang-types {
          prefix yang;
        }
        import huawei-ethernet {
          prefix ethernet;
        }
    
        include huawei-dhcp-relay;
        include huawei-dhcp-server;
        include huawei-dhcp-snooping;
        include huawei-dhcp-client;
    
        organization
          "Huawei Technologies Co., Ltd.";
    
        contact
          "Huawei Industrial Base
    Bantian, Longgang
    Shenzhen 518129
    People's Republic of China
    Website: http://www.huawei.com
    Email: support@huawei.com";
    
        description
          "Dynamic Host Configuration Protocol.";
    
        revision "2020-04-10" {
          description "Add session-car.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-03-03" {
          description "Initial revision.";
          reference
            "Huawei private.";
    
        }
    
        ext:task-name "dhcp";
    
        typedef option82-sub-option-type {
          type enumeration {
            enum "circuit-id" {
              value 1;
              description
                "DHCP option82 sub-option circuit-ID.";
            }
            enum "remote-id" {
              value 2;
              description
                "DHCP option82 sub-option remote-ID.";
            }
            enum "circuit-remote" {
              value 3;
              description
                "DHCP option82 sub-option circuit-ID and sub-option remote-ID.";
            }
          }
          description
            "The type of option82 sub-option.";
        }
    
        typedef option82-format {
          type enumeration {
            enum "common" {
              value 1;
              description
                "DHCP option82 common format.";
            }
            enum "extend" {
              value 2;
              description
                "DHCP option82 extend format.";
            }
            enum "user-defined" {
              value 3;
              description
                "DHCP option82 user-defined format.";
            }
            enum "default" {
              value 4;
              description
                "DHCP option82 default format.";
            }
            enum "type1" {
              value 5;
              description
                "DHCP option82 type1 format.";
            }
            enum "type2" {
              value 6;
              description
                "DHCP option82 type2 format.";
            }
            enum "self-define" {
              value 7;
              description
                "DHCP option82 self-define format.";
            }
            enum "default-extra" {
              value 8;
              description
                "DHCP option82 extra default format.";
            }
            enum "cn-telecom" {
              value 9;
              description
                "DHCP option82 cn-telecom format.";
            }
            enum "self-define-extra" {
              value 10;
              description
                "DHCP option82 extra self-define format.";
            }
            enum "intracom-vxlan" {
              value 11;
              description
                "DHCP option82 Intracom-VXLAN format.";
            }
            enum "cn-telecom-inherit" {
              value 12;
              description
                "DHCP option82 cn-telecom-inherit format.";
            }
          }
          description
            "The type of DHCP option82 format.";
        }
    
        typedef server-enable-state {
          type enumeration {
            enum "enable" {
              value 1;
              description
                "Enable the function of DHCP server on an interface.";
            }
            enum "disable" {
              value 2;
              description
                "Disable the function of DHCP server on an interface.";
            }
          }
          description
            "The state of DHCP server flag.";
        }
    
        typedef recycle-address-state {
          type enumeration {
            enum "used" {
              value 1;
              description
                "The IP address is in use.";
            }
            enum "conflicted" {
              value 2;
              description
                "The IP address is in conflict state.";
            }
          }
          description
            "Status of the DHCP address pool.";
        }
    
        container dhcp {
          description
            "Configure Dynamic Host Configuration Protocol.";
          container common {
            description "Configure basic DHCP.";
            container global {
              description
                "Configure globally configured attributes.";
              leaf enable {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP globally.";
              }
    
              leaf ignore-hostname {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP ignore hostname.";
              }
    
              leaf rate-limit-enable {
                type boolean;
                default "true";
                description
                  "Enable/disable DHCP packets rate limit.";
              }
    
              leaf rate-limit {
                type uint32 {
                  range "1..4000";
                }
                units "pps";
                default "800";
                description
                  "DHCP packets rate limit value.";
              }
    
              leaf aging-time {
                type uint32 {
                  range "1..1440";
                }
                units "min";
                default "30";
                description
                  "DHCP session CAR aging time.";
              }
            }  // container global
    
            container session-car {
              must
                "pir-value >= cir-value and pbs-value >= cbs-value";
              description
                "Configure session CAR.";
              leaf enable {
                type boolean;
                default "true";
                description
                  "Enable/disable session CAR.";
              }
    
              leaf cir-value {
                type uint32 {
                  range "0..1000000";
                }
                units "kbit/s";
                default "512";
                description
                  "Specify the session CAR CIR value.";
              }
    
              leaf cbs-value {
                type uint32 {
                  range "0..9000000";
                }
                units "Byte";
                default "64000";
                description
                  "Specify the session CAR CBS value.";
              }
    
              leaf pir-value {
                type uint32 {
                  range "0..1000000";
                }
                units "kbit/s";
                default "1200";
                description
                  "Specify the session CAR PIR value.";
              }
    
              leaf pbs-value {
                type uint32 {
                  range "0..9000000";
                }
                units "Byte";
                default "150000";
                description
                  "Specify the session CAR PBS value.";
              }
            }  // container session-car
    
            container chasten {
              description
                "Configure DHCP user connection throttling.";
              leaf enable {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP user connection throttling.";
              }
    
              leaf request-packets {
                type uint32 {
                  range "1..10000";
                }
                default "10";
                description "Request packets.";
              }
    
              leaf check-period {
                type uint32 {
                  range "1..3600";
                }
                units "s";
                default "180";
                description "Check period.";
              }
    
              leaf restrain-period {
                type uint32 {
                  range "1..3600";
                }
                units "s";
                default "300";
                description "Restrain period.";
              }
            }  // container chasten
    
            container global-packet-statistics {
              config false;
              description
                "Statistics of DHCP global packets.";
              leaf total-packets-receive {
                type uint32;
                description
                  "Total received count of packets.";
              }
    
              leaf discarded-packets-receive {
                type uint32;
                description
                  "Total discarded count of received packets.";
              }
    
              leaf bootp-request-packets-receive {
                type uint32;
                description
                  "Count of received bootp request packets.";
              }
    
              leaf bootp-reply-packets-receive {
                type uint32;
                description
                  "Count of received bootp reply packets.";
              }
    
              leaf discover-packets-receive {
                type uint32;
                description
                  "Count of received DHCP discover packets.";
              }
    
              leaf offer-packets-receive {
                type uint32;
                description
                  "Count of received DHCP offer packets.";
              }
    
              leaf request-packets-receive {
                type uint32;
                description
                  "Count of received DHCP request packets.";
              }
    
              leaf ack-packets-receive {
                type uint32;
                description
                  "Count of received DHCP ACK packets.";
              }
    
              leaf release-packets-receive {
                type uint32;
                description
                  "Count of received DHCP release packets.";
              }
    
              leaf nak-packets-receive {
                type uint32;
                description
                  "Count of received DHCP NAK packets.";
              }
    
              leaf decline-packets-receive {
                type uint32;
                description
                  "Count of received DHCP decline packets.";
              }
    
              leaf inform-packets-receive {
                type uint32;
                description
                  "Count of received DHCP inform packets.";
              }
    
              leaf total-packets-send {
                type uint32;
                description
                  "Total sent count of packets.";
              }
    
              leaf total-discarded-packets {
                type uint32;
                description
                  "Total discarded count of sent packets.";
              }
            }  // container global-packet-statistics
          }  // container common
    
          container relay {
            description "Configure DHCP relay.";
            uses dhcp:dhcp-relay-type;
          }  // container relay
    
          container server {
            description "Configure DHCP server.";
            uses dhcp:dhcp-server-type;
          }  // container server
    
          container snooping {
            description
              "Configure DHCP snooping.";
            uses dhcp:dhcp-snooping-type;
          }  // container snooping
    
          container client {
            description "Configure DHCP client.";
            uses dhcp:dhcp-client-type;
          }  // container client
        }  // container dhcp
    
        rpc reset-address-state {
          ext:node-ref "/dhcp:dhcp/dhcp:server/dhcp:global-ip-pools/dhcp:global-ip-pool";
          description "Reset address state.";
          input {
            leaf pool-name {
              type leafref {
                path "/dhcp:dhcp/dhcp:server/dhcp:global-ip-pools/dhcp:global-ip-pool/dhcp:ip-pool-name";
              }
              mandatory true;
              description "Pool name.";
            }
    
            leaf start-ip-address {
              type inet:ipv4-address-no-zone;
              mandatory true;
              description "Start IP address.";
            }
    
            leaf end-ip-address {
              type inet:ipv4-address-no-zone;
              description "End IP address.";
            }
    
            leaf reset-flag {
              type recycle-address-state;
              mandatory true;
              description "Address Status.";
            }
          }
        }  // rpc reset-address-state
    
        rpc reset-pool-maxusage {
          ext:node-ref "/dhcp:dhcp/dhcp:server/dhcp:global-ip-pools/dhcp:global-ip-pool/dhcp:ip-pool-max-usage";
          description "Reset pool maxusage.";
          input {
            leaf pool-name {
              type leafref {
                path "/dhcp:dhcp/dhcp:server/dhcp:global-ip-pools/dhcp:global-ip-pool/dhcp:ip-pool-name";
              }
              description "Pool name.";
            }
          }
        }  // rpc reset-pool-maxusage
    
        rpc reset-client-ip {
          ext:node-ref "/dhcp:dhcp/dhcp:client";
          description
            "The DHCP client releases the IP address.";
          input {
            leaf if-name {
              type leafref {
                path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
              }
              description "Interface name.";
            }
          }
        }  // rpc reset-client-ip
    
        rpc reset-if-dynamic-bind-table {
          ext:node-ref "/ifm:ifm/ifm:interfaces/ifm:interface/dhcp:dhcp-snooping-if";
          description
            "Reset the dynamic binding table on an interface.";
          input {
            leaf if-name {
              type leafref {
                path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
              }
              mandatory true;
              description "Interface name.";
            }
    
            leaf ip-address {
              type inet:ipv4-address-no-zone;
              mandatory true;
              description "IP address.";
            }
    
            leaf mac-address {
              type pub-type:mac-address;
              description "MAC address.";
            }
    
            leaf vlan-id {
              type uint16 {
                range "1..4094";
              }
              description "VLAN ID.";
            }
    
            leaf cevlan-id {
              type uint16 {
                range "1..4094";
              }
              description "CE VLAN ID.";
            }
    
            leaf lease-day {
              type uint16 {
                range "0..999";
              }
              units "d";
              default "7";
              description "The lease time day.";
            }
    
            leaf lease-hour {
              type uint16 {
                range "0..23";
              }
              units "h";
              default "0";
              description "The lease time hour.";
            }
    
            leaf lease-minute {
              type uint16 {
                range "0..59";
              }
              units "min";
              default "0";
              description
                "The lease time minute.";
            }
          }
        }  // rpc reset-if-dynamic-bind-table
    
        rpc reset-vlan-dynamic-bind-table {
          ext:node-ref "/vlan:vlan/vlan:vlans/vlan:vlan/dhcp:dhcp-snooping-vlan";
          description
            "Reset the dynamic binding table in a VLAN.";
          input {
            leaf vlan-id {
              type uint16 {
                range "1..4094";
              }
              mandatory true;
              description "VLAN ID.";
            }
    
            leaf ip-address {
              type inet:ipv4-address-no-zone;
              mandatory true;
              description "IP address.";
            }
    
            leaf mac-address {
              type pub-type:mac-address;
              description "MAC address.";
            }
    
            leaf if-name {
              type leafref {
                path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
              }
              mandatory true;
              description "Interface name.";
            }
    
            leaf cevlan-id {
              type uint16 {
                range "1..4094";
              }
              description "CE VLAN ID.";
            }
    
            leaf lease-day {
              type uint16 {
                range "0..999";
              }
              units "d";
              default "7";
              description "The lease time day.";
            }
    
            leaf lease-hour {
              type uint16 {
                range "0..23";
              }
              units "h";
              default "0";
              description "The lease time hour.";
            }
    
            leaf lease-minute {
              type uint16 {
                range "0..59";
              }
              units "min";
              default "0";
              description
                "The lease time minute.";
            }
          }
        }  // rpc reset-vlan-dynamic-bind-table
    
        augment /ifm:ifm/ifm:interfaces/ifm:interface {
          description
            "Extend interface attribute.";
          container dhcp-if {
            description
              "Configure DHCP attributes on an interface.";
            container dhcp-packet-setting {
              when
                "(not(../../ifm:l2-mode-enable='true'))";
              description
                "Configure DHCP packets.";
              leaf ip-ttl {
                type uint8 {
                  range "1..255";
                }
                must
                  "not(../../../dhcp:dhcp-client-if/dhcp:address-allocation)";
                description "IP time to live.";
              }
    
              leaf dscp-outbound {
                type uint8 {
                  range "0..63";
                }
                must
                  "not(../../../dhcp:dhcp-client-if/dhcp:address-allocation)";
                description "DSCP outbound.";
              }
    
              leaf server-enable {
                type server-enable-state;
                description
                  "Enable/disable the function of DHCP server on an interface.";
              }
            }  // container dhcp-packet-setting
    
            container option82-formats {
              description
                "List of DHCP option82 formats.";
              list option82-format {
                key "sub-option-type";
                description
                  "Configure a DHCP option82 format.";
                leaf sub-option-type {
                  type option82-sub-option-type;
                  description
                    "DHCP option82 sub-option type.";
                }
    
                leaf option82-format {
                  type option82-format;
                  must
                    "(((../sub-option-type != 'circuit-remote') and ((../option82-format = 'self-define'  or ../option82-format = 'user-defined') and ../user-define-text)) or ((../sub-option-type = 'circuit-remote') and (../option82-format = 'type1' or ../option82-format = 'type2' or ../option82-format = 'cn-telecom' or ../option82-format = 'cn-telecom-inherit' or ((../option82-format = 'self-define'  or ../option82-format = 'user-defined') and ../user-define-text))))";
                  mandatory true;
                  description
                    "DHCP option82 format.";
                }
    
                leaf user-define-text {
                  when
                    "../option82-format = 'self-define' or ../option82-format = 'user-defined'";
                  type string {
                    length "1..255";
                    pattern '([^\t]{1,})';
                  }
                  mandatory true;
                  description
                    "DHCP option82 user-defined string.";
                }
              }  // list option82-format
            }  // container option82-formats
    
            container option82-insert-setting {
              description
                "Configure all interfaces to insert or forcibly insert DHCP option82 to DHCP packets.";
              choice option82-insert-format {
                description
                  "Specify DHCP option82 insertion format.";
                case insert-format {
                  description
                    "Configure all interfaces to insert DHCP option82 to DHCP packets.";
                  leaf insert {
                    type empty;
                    description
                      "Configure all interfaces to insert DHCP option82 to DHCP packets.";
                  }
                }  // case insert-format
    
                case rebuild-format {
                  description
                    "Configure all interfaces to forcibly insert DHCP option82 to DHCP packets.";
                  leaf rebuild {
                    type empty;
                    description
                      "Configure all interfaces to forcibly insert DHCP option82 to DHCP packets.";
                  }
                }  // case rebuild-format
              }  // choice option82-insert-format
            }  // container option82-insert-setting
          }  // container dhcp-if
    
          container dhcp-client-if {
            description
              "Configure DHCP client attributes on an interface.";
            leaf address-allocation {
              type empty;
              description
                "DHCP client allocate IP.";
            }
    
            leaf expected-lease {
              type uint32 {
                range "60..864000";
              }
              units "s";
              description
                "DHCP client expected lease.";
            }
    
            leaf option60 {
              type string {
                length "1..128";
                pattern '([^\t]{1,})';
              }
              description
                "The value of DHCP client option60 on an interface.";
            }
    
            container client-status {
              config false;
              description
                "Operational state of DHCP client.";
              leaf fsm-state {
                type client-state;
                config false;
                description
                  "DHCP client status.";
              }
    
              leaf mac-address {
                type pub-type:mac-address;
                config false;
                description "User MAC address.";
              }
    
              leaf ip-address {
                type inet:ipv4-address-no-zone;
                config false;
                description "IP address.";
              }
    
              leaf ip-mask {
                type inet:ipv4-address-no-zone;
                config false;
                description "IP mask.";
              }
    
              leaf server-address {
                type inet:ipv4-address-no-zone;
                config false;
                description "Server IP address.";
              }
    
              leaf lease-obtained-time {
                type yang:date-and-time;
                config false;
                description
                  "Lease obtained time.";
              }
    
              leaf lease-expire-time {
                type yang:date-and-time;
                config false;
                description
                  "Lease expires time.";
              }
    
              leaf lease-renew-time {
                type yang:date-and-time;
                config false;
                description "Lease renews time.";
              }
    
              leaf lease-rebind-time {
                type yang:date-and-time;
                config false;
                description
                  "Lease rebinds time.";
              }
            }  // container client-status
    
            container client-statistics {
              config false;
              description
                "Statistics of DHCP client.";
              leaf total-packets-received {
                type uint32;
                config false;
                description
                  "The number of totol packets received.";
              }
    
              leaf offer-packets-received {
                type uint32;
                config false;
                description
                  "The number of offer packets received.";
              }
    
              leaf ack-packets-received {
                type uint32;
                config false;
                description
                  "The number of ACK packets received.";
              }
    
              leaf nak-packets-received {
                type uint32;
                config false;
                description
                  "The number of NAK packets received.";
              }
    
              leaf total-packets-send {
                type uint32;
                config false;
                description
                  "The number of totol packets send.";
              }
    
              leaf discovery-packets-send {
                type uint32;
                config false;
                description
                  "The number of discover packets send.";
              }
    
              leaf request-packets-send {
                type uint32;
                config false;
                description
                  "The number of request packets send.";
              }
    
              leaf reboot-request-packets-send {
                type uint32;
                config false;
                description
                  "The number of reboot request packets send.";
              }
    
              leaf select-request-packets-send {
                type uint32;
                config false;
                description
                  "The number of select request packets send.";
              }
    
              leaf renew-request-packets-send {
                type uint32;
                config false;
                description
                  "The number of renew request packets send.";
              }
    
              leaf rebind-request-packets-send {
                type uint32;
                config false;
                description
                  "The number of rebind request packets send.";
              }
    
              leaf decline-packets-send {
                type uint32;
                config false;
                description
                  "The number of decline packets send.";
              }
    
              leaf release-packets-send {
                type uint32;
                config false;
                description
                  "The number of release packets send.";
              }
            }  // container client-statistics
          }  // container dhcp-client-if
    
          container dhcp-snooping-if {
            description
              "Configure DHCP snooping interface attributes.";
            container basic-attribute {
              when
                "/dhcp:dhcp/dhcp:snooping/dhcp:global/dhcp:enable='true'";
              description
                "Configure Basic DHCP snooping attribute on the interface.";
              leaf enable {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP snooping on an interface. DHCP snooping cannot be enabled on both a VLANIF interface and a VLAN, DHCP snooping cannot be enabled both on a VBDIF interface and in a BD, DHCP snooping cannot be enabled on both a VBDIF interface and a Layer 2 sub-interface.";
              }
    
              leaf trust-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable trusted interfaces.";
              }
    
              leaf check-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable ARP check.";
              }
    
              leaf alarm-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the ARP alarm function.";
              }
    
              leaf alarm-arp-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "ARP alarm threshold.";
              }
    
              leaf check-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable IP check.";
              }
    
              leaf alarm-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the IP alarm function.";
              }
    
              leaf alarm-ip-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "IP alarm threshold.";
              }
    
              leaf alarm-reply-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the alarm function for discarded untrusted packets.";
              }
    
              leaf alarm-reply-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "The alarm threshold is configured for discarded untrusted packets.";
              }
    
              leaf check-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable consistency check on MAC addresses.";
              }
    
              leaf alarm-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable consistency check on MAC addresses.";
              }
    
              leaf alarm-mac-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "The alarm threshold for the consistency check on MAC addresses.";
              }
    
              leaf check-user-bind-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the check on DHCP snooping binding table.";
              }
    
              leaf alarm-user-bind-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the alarm function for discarded packets that do not match entries in the DHCP snooping binding table.";
              }
    
              leaf alarm-user-bind-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "The alarm threshold is configured for the DHCP snooping binding table.";
              }
    
              leaf max-user-number {
                type uint32 {
                  range "1..16384";
                }
                description
                  "Maximum number of users allowed on a DHCP snooping-enabled interface.";
              }
    
              leaf alarm-user-limit-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the alarm function for the maximum number of users.";
              }
    
              leaf alarm-user-limit-threshold {
                type uint16 {
                  range "1..100";
                }
                default "100";
                description
                  "Alarm threshold for the maximum number of users.";
              }
            }  // container basic-attribute
    
            container static-binds {
              description
                "List of static binding table on an interface.";
              list static-bind {
                key "ip-address vlan-id cevlan-id";
                description
                  "Configure static binding table on an interface.";
                leaf ip-address {
                  type inet:ipv4-address-no-zone;
                  description "IP address.";
                }
    
                leaf vlan-id {
                  type uint16 {
                    range "0..4094";
                  }
                  must
                    "(../../../../ifm:class='main-interface' and ../vlan-id=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:dot1q-termination/ethernet:dot1q-vlans/ethernet:dot1q-vlans/ethernet:vlan-list and ../vlan-id!=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:qinq-termination/ethernet:qinq-vids/ethernet:qinq-vid and ../vlan-id!=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:vlan-type-dot1q and ../vlan-id=../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:vlan-type-dot1q/ethernet:vlan-type-vid)";
                  description
                    "VLAN ID, 0 means NULL.";
                }
    
                leaf cevlan-id {
                  type uint16 {
                    range "0..4094";
                  }
                  must
                    "(../../../../ifm:class='main-interface' and ../cevlan-id=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:dot1q-termination/ethernet:dot1q-vlans/ethernet:dot1q-vlans/ethernet:vlan-list and ../cevlan-id=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:qinq-termination/ethernet:qinq-vids/ethernet:qinq-vid and ../cevlan-id!=0) or
    (../../../../ethernet:ethernet/ethernet:l3-sub-interface/ethernet:vlan-type-dot1q and ../cevlan-id=0)";
                  description
                    "CE VLAN ID, 0 means NULL.";
                }
    
                leaf mac-address {
                  type pub-type:mac-address {
                    length "0..255";
                    pattern
                      '([0-9a-f][0|2|4|6|8|a|c|e][0-9a-f]{2}(-[0-9a-f]{4}){2})';
                  }
                  description "MAC address.";
                }
              }  // list static-bind
            }  // container static-binds
          }  // container dhcp-snooping-if
        }
    
        augment /vlan:vlan/vlan:vlans/vlan:vlan {
          description "Extend VLAN attribute.";
          container dhcp-vlan {
            description
              "Configure DHCP attributes in a VLAN.";
            container interface-option82-formats {
              description
                "List of configuring the format of the Option 82 field for an interface in the specified VLAN.";
              list interface-option82-format {
                key "if-name";
                description
                  "Configure the format of the Option 82 field for an interface in the specified VLAN.";
                leaf if-name {
                  type leafref {
                    path
                      "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
                  }
                  description
                    "Interface name. The interface must be the member interface of this VLAN.";
                }
    
                leaf option82-format {
                  type option82-format;
                  mandatory true;
                  description
                    "DHCP option82 format.";
                }
    
                leaf user-define-text {
                  when
                    "../option82-format = 'self-define' or ../option82-format = 'user-defined'";
                  type string {
                    length "1..255";
                    pattern '([^\t]{1,})';
                  }
                  mandatory true;
                  description
                    "DHCP option82 user-defined string.";
                }
              }  // list interface-option82-format
            }  // container interface-option82-formats
    
            container interface-option82-insert-settings {
              description
                "List of configuring all interfaces in a VLAN to insert or forcibly insert DHCP Option82 to DHCP packets.";
              list interface-option82-insert-setting {
                key "if-name";
                description
                  "Configure all interfaces in a VLAN to insert or forcibly insert DHCP Option82 to DHCP packets.";
                leaf if-name {
                  type leafref {
                    path
                      "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
                  }
                  description
                    "Interface name. The interface must be the member interface of this VLAN.";
                }
    
                choice option82-insert-format {
                  mandatory true;
                  description
                    "Specify DHCP option82 insertion format.";
                  case insert-format {
                    description
                      "Configure all interfaces in a VLAN to insert DHCP Option82 to DHCP packets.";
                    leaf insert {
                      type empty;
                      description
                        "Configure all interfaces in a VLAN to insert DHCP Option82 to DHCP packets.";
                    }
                  }  // case insert-format
    
                  case rebuild-format {
                    description
                      "Configure all interfaces in a VLAN to forcibly insert DHCP Option82 to DHCP packets.";
                    leaf rebuild {
                      type empty;
                      description
                        "Configure all interfaces in a VLAN to forcibly insert DHCP Option82 to DHCP packets.";
                    }
                  }  // case rebuild-format
                }  // choice option82-insert-format
              }  // list interface-option82-insert-setting
            }  // container interface-option82-insert-settings
    
            container option82-insert-setting {
              description
                "Configure all interfaces in a VLAN to insert or forcibly insert DHCP option82 to DHCP packets.";
              choice option82-insert-format {
                description
                  "Specify DHCP option82 insertion format.";
                case insert-format {
                  description
                    "Configure all interfaces in a VLAN to insert DHCP option82 to DHCP packets.";
                  leaf insert {
                    type empty;
                    description
                      "Configure all interfaces in a VLAN to insert DHCP option82 to DHCP packets.";
                  }
                }  // case insert-format
    
                case rebuild-format {
                  description
                    "Configure all interfaces in a VLAN to forcibly insert DHCP option82 to DHCP packets.";
                  leaf rebuild {
                    type empty;
                    description
                      "Configure all interfaces in a VLAN to forcibly insert DHCP option82 to DHCP packets.";
                  }
                }  // case rebuild-format
              }  // choice option82-insert-format
            }  // container option82-insert-setting
          }  // container dhcp-vlan
    
          container dhcp-snooping-vlan {
            when
              "/dhcp:dhcp/dhcp:snooping/dhcp:global/dhcp:enable='true'";
            description
              "Configure DHCP snooping VLAN attributes.";
            container basic-attribute {
              description
                "Configure basic attributes of DHCP snooping on a VLAN.";
              leaf enable {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP snooping in a VLAN. DHCP snooping cannot be enabled on both a VLANIF interface and a VLAN, DHCP snooping cannot be enabled both on a VBDIF interface and in a BD, DHCP snooping cannot be enabled on both a VBDIF interface and a Layer 2 sub-interface.";
              }
    
              leaf trust-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable configuration information of a trusted VLAN.";
              }
    
              leaf check-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable ARP check.";
              }
    
              leaf alarm-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the ARP alarm function.";
              }
    
              leaf alarm-arp-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "ARP alarm threshold.";
              }
    
              leaf check-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable IP check.";
              }
    
              leaf alarm-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the IP alarm function.";
              }
    
              leaf alarm-ip-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "IP alarm threshold.";
              }
    
              leaf alarm-reply-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the alarm function when the number of discarded untrusted packets reaches the configured threshold.";
              }
    
              leaf alarm-reply-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "Untrusted packet discarding alarm threshold.";
              }
    
              leaf check-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable consistency check on MAC address.";
              }
    
              leaf alarm-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the consistency check alarm on MAC address.";
              }
    
              leaf alarm-mac-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "Consistency check alarm threshold on MAC address.";
              }
    
              leaf check-user-bind-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the check on DHCP snooping binding table.";
              }
    
              leaf alarm-user-bind-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the user binding table alarm.";
              }
    
              leaf alarm-user-bind-threshold {
                type uint16 {
                  range "1..1000";
                }
                description
                  "User binding table alarm threshold.";
              }
    
              leaf max-user-number {
                type uint16 {
                  range "1..16384";
                }
                description
                  "Maximum number of users allowed on all DHCP snooping-enabled interfaces in a VLAN.";
              }
    
              leaf alarm-user-limit-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the user limit alarm.";
              }
    
              leaf alarm-user-limit-threshold {
                type uint16 {
                  range "1..100";
                }
                default "100";
                description
                  "User limit alarm threshold.";
              }
            }  // container basic-attribute
    
            container vlan-interfaces {
              description
                "List of configuring DHCP snooping-enabled interfaces in a VLAN.";
              list vlan-interface {
                key "if-name";
                description
                  "Configure a DHCP snooping-enabled interface in a VLAN.";
                leaf if-name {
                  type leafref {
                    path
                      "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
                  }
                  description "Interface name.";
                }
    
                leaf enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable DHCP snooping on an interface in a VLAN.";
                }
    
                leaf trust-flag {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable DHCP snooping VLAN interface trust.";
                }
    
                leaf check-arp-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable ARP check.";
                }
    
                leaf alarm-arp-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable the ARP alarm function.";
                }
    
                leaf alarm-arp-threshold {
                  type uint32 {
                    range "1..1000";
                  }
                  description
                    "ARP alarm threshold.";
                }
    
                leaf check-ip-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable IP check.";
                }
    
                leaf alarm-ip-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable the IP alarm function.";
                }
    
                leaf alarm-ip-threshold {
                  type uint32 {
                    range "1..1000";
                  }
                  description
                    "IP alarm threshold.";
                }
    
                leaf alarm-reply-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable alarm of dropping untrusted packet.";
                }
    
                leaf alarm-reply-threshold {
                  type uint32 {
                    range "1..1000";
                  }
                  description
                    "Threshold of dropping untrusted packet alarm.";
                }
    
                leaf check-mac-address-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable consistency check on MAC addresses.";
                }
    
                leaf alarm-mac-address-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable the consistency check alarm for MAC addresses.";
                }
    
                leaf alarm-mac-address-threshold {
                  type uint32 {
                    range "1..1000";
                  }
                  description
                    "Consistency check alarm threshold for MAC address.";
                }
    
                leaf check-request-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable DHCP user binding table check.";
                }
    
                leaf alarm-request-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable DHCP userbind table alarm.";
                }
    
                leaf alarm-request-threshold {
                  type uint32 {
                    range "1..1000";
                  }
                  description
                    "DHCP userbind table alarm threshold.";
                }
    
                leaf max-user-number {
                  type uint32 {
                    range "1..16384";
                  }
                  description
                    "Maximum number of users allowed on a DHCP snooping-enabled interface in a VLAN.";
                }
    
                leaf alarm-user-limit-enable {
                  type boolean;
                  default "false";
                  description
                    "Enable/disable the user limit alarm.";
                }
    
                leaf alarm-user-limit-threshold {
                  type uint32 {
                    range "1..100";
                  }
                  default "100";
                  description
                    "User limit alarm threshold.";
                }
              }  // list vlan-interface
            }  // container vlan-interfaces
    
            container static-binds {
              description
                "List of static binding tables in a VLAN.";
              list static-bind {
                must
                  "(cevlan-id=0) or (cevlan-id!=0 and if-name)";
                key "ip-address cevlan-id";
                description
                  "Configure a static binding table in a VLAN.";
                leaf ip-address {
                  type inet:ipv4-address-no-zone;
                  description "IP address.";
                }
    
                leaf cevlan-id {
                  type uint16 {
                    range "0..4094";
                  }
                  description "CE VLAN ID.";
                }
    
                leaf mac-address {
                  type pub-type:mac-address {
                    length "0..255";
                  }
                  description "MAC address.";
                }
    
                leaf if-name {
                  type leafref {
                    path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
                  }
                  description "Interface name.";
                }
              }  // list static-bind
            }  // container static-binds
          }  // container dhcp-snooping-vlan
        }
    
        augment /bd:bd/bd:instances/bd:instance {
          description "Extend BD attribute.";
          container dhcp-bd {
            description
              "Configure DHCP attributes in BDs.";
            container option82-insert-setting {
              description
                "Configure all interfaces in a BD to insert or forcibly insert DHCP option82 to DHCP packets.";
              choice option82-insert-format {
                description
                  "Specify DHCP option82 insertion format.";
                case insert-format {
                  description
                    "Configure all interfaces in a BD to insert DHCP option82 to DHCP packets.";
                  leaf insert {
                    type empty;
                    description
                      "Configure all interfaces in a BD to insert DHCP option82 to DHCP packets.";
                  }
                }  // case insert-format
    
                case rebuild-format {
                  description
                    "Configure all interfaces in a BD to forcibly insert DHCP option82 to DHCP packets.";
                  leaf rebuild {
                    type empty;
                    description
                      "Configure all interfaces in a BD to forcibly insert DHCP option82 to DHCP packets.";
                  }
                }  // case rebuild-format
              }  // choice option82-insert-format
            }  // container option82-insert-setting
          }  // container dhcp-bd
    
          container dhcp-snooping-bd {
            description
              "Configure information of DHCP snooping on a bridge-domain.";
            container basic-attribute {
              when
                "/dhcp:dhcp/dhcp:snooping/dhcp:global/dhcp:enable='true'";
              description
                "Configure basic attributes of DHCP snooping on bridge-domain.";
              leaf enable {
                type boolean;
                default "false";
                description
                  "Enable/disable DHCP snooping in a BD. DHCP snooping cannot be enabled on both a VLANIF interface and a VLAN, DHCP snooping cannot be enabled both on a VBDIF interface and in a BD, DHCP snooping cannot be enabled on both a VBDIF interface and a Layer 2 sub-interface.";
              }
    
              leaf trust-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable trusted informations on a BD.";
              }
    
              leaf nni-trust-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable trusted network node interface.";
              }
    
              leaf check-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable ARP check.";
              }
    
              leaf alarm-arp-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the ARP alarm function.";
              }
    
              leaf alarm-arp-threshold {
                type uint32 {
                  range "1..1000";
                }
                description
                  "ARP alarm threshold.";
              }
    
              leaf check-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable IP check.";
              }
    
              leaf alarm-ip-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the IP alarm function.";
              }
    
              leaf alarm-ip-threshold {
                type uint32 {
                  range "1..1000";
                }
                description
                  "IP alarm threshold.";
              }
    
              leaf alarm-reply-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable alarm of dropping untrusted packet.";
              }
    
              leaf alarm-reply-threshold {
                type uint32 {
                  range "1..1000";
                }
                description
                  "Threshold of dropping untrusted packet alarm.";
              }
    
              leaf check-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable MAC check.";
              }
    
              leaf alarm-mac-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable consistency check alarm on MAC addresses.";
              }
    
              leaf alarm-mac-threshold {
                type uint32 {
                  range "1..1000";
                }
                description
                  "Consistency check alarm threshold on MAC addresses.";
              }
    
              leaf check-request-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the user binding table check.";
              }
    
              leaf alarm-request-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the user binding table alarm function.";
              }
    
              leaf alarm-request-threshold {
                type uint32 {
                  range "1..1000";
                }
                description
                  "User bind table alarm threshold.";
              }
    
              leaf max-user-number {
                type uint32 {
                  range "1..16384";
                }
                description
                  "Maximum number of DHCP snooping users in a BD.";
              }
    
              leaf alarm-user-limit-enable {
                type boolean;
                default "false";
                description
                  "Enable/disable the user limit alarm.";
              }
    
              leaf alarm-user-limit-threshold {
                type uint32 {
                  range "1..100";
                }
                default "100";
                description
                  "User limit alarm threshold.";
              }
            }  // container basic-attribute
    
            container static-binds {
              description
                "List of static binding tables on BDs.";
              list static-bind {
                must
                  "(ce-vlan!=0 and pe-vlan!=0) or (ce-vlan=0)";
                key "ip-address pe-vlan ce-vlan";
                description
                  "Configure a static binding table of a BD.";
                leaf ip-address {
                  type inet:ipv4-address-no-zone;
                  description "IP address.";
                }
    
                leaf pe-vlan {
                  type uint16 {
                    range "0..4094";
                  }
                  description
                    "PE VLAN ID, 0 means NULL.";
                }
    
                leaf ce-vlan {
                  type uint16 {
                    range "0..4094";
                  }
                  description
                    "CE VLAN ID, 0 means NULL.";
                }
    
                leaf mac-address {
                  type pub-type:mac-address {
                    length "0..255";
                    pattern
                      '([0-9a-f][0|2|4|6|8|a|c|e][0-9a-f]{2}(-[0-9a-f]{4}){2})';
                  }
                  description "MAC address.";
                }
              }  // list static-bind
            }  // container static-binds
          }  // container dhcp-snooping-bd
        }
      }  // module huawei-dhcp
    

© 2023 YumaWorks, Inc. All rights reserved.