huawei-sflow

The sFlow sample.

  • Version: 2020-03-11

    huawei-sflow@2020-03-11


    
      module huawei-sflow {
    
        yang-version 1;
    
        namespace "urn:huawei:yang:huawei-sflow";
    
        prefix sflow;
    
        import ietf-inet-types {
          prefix inet;
        }
        import huawei-extension {
          prefix ext;
        }
        import huawei-ifm {
          prefix ifm;
        }
        import huawei-devm {
          prefix devm;
        }
        import huawei-network-instance {
          prefix ni;
        }
        import huawei-l3vpn {
          prefix l3vpn;
        }
        import huawei-ethernet {
          prefix ethernet;
        }
    
        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 "The sFlow sample.";
    
        revision "2020-03-11" {
          description "Initial revision.";
          reference
            "Huawei private.";
    
        }
    
        ext:task-name "sflow";
    
        typedef flow-direction {
          type enumeration {
            enum "inbound" {
              value 0;
              description "Inbound.";
            }
            enum "outbound" {
              value 1;
              description "Outbound.";
            }
          }
          description "Flow directions.";
        }
    
        container sflow {
          description "The sFlow feature.";
          container sflow-enable {
            presence "Enable sFlow.";
            description "Enable/disable sFlow.";
            container global {
              description
                "Configure sFlow global attribute.";
              leaf agent-ipv4-address {
                type inet:ipv4-address-no-zone;
                must
                  "../agent-ipv4-address!='0.0.0.0'";
                description
                  "Agent IPv4 address.";
              }
    
              leaf agent-ipv6-address {
                type inet:ipv6-address-no-zone;
                must
                  "../agent-ipv6-address!='::'";
                description
                  "Agent IPv6 address.";
              }
    
              leaf extended-route-data {
                type enumeration {
                  enum "disable" {
                    value 1;
                    description "Disable.";
                  }
                  enum "enable" {
                    value 0;
                    description "Enable.";
                  }
                }
                default "enable";
                description
                  "Extend route data enable.";
              }
            }  // container global
    
            container collectors {
              description
                "List of sFlow collector.";
              list collector {
                key "collector-id";
                description
                  "Configure sFlow collector.";
                leaf collector-id {
                  type uint8 {
                    range "1..2";
                  }
                  description "Collector id.";
                }
    
                leaf max-packet-length {
                  type uint16 {
                    range "1024..8100";
                  }
                  default "1400";
                  description
                    "Maximum packet length.";
                }
    
                container ip-server {
                  presence
                    "Configure sFlow IP server.";
                  description
                    "Configure sFlow IP server.";
                  choice ip-type {
                    mandatory true;
                    description "IP address.";
                    case ipv4-address {
                      description
                        "IPv4 address.";
                      leaf ipv4-address {
                        type inet:ipv4-address-no-zone;
                        must
                          "../ipv4-address!='0.0.0.0'";
                        description
                          "IPv4 address.";
                      }
                    }  // case ipv4-address
    
                    case ipv6-address {
                      description
                        "IPv6 address.";
                      leaf ipv6-address {
                        type inet:ipv6-address-no-zone;
                        must
                          "../ipv6-address!='::'";
                        description
                          "IPv6 address.";
                      }
                    }  // case ipv6-address
                  }  // choice ip-type
    
                  leaf vpn-name {
                    type leafref {
                      path "/ni:network-instance/ni:instances/ni:instance/ni:name";
                    }
                    must
                      "(../ipv4-address and /ni:network-instance/ni:instances/ni:instance[ni:name=current()]/l3vpn:afs/l3vpn:af[l3vpn:type='ipv4-unicast']) or (../ipv6-address and /ni:network-instance/ni:instances/ni:instance[ni:name=current()]/l3vpn:afs/l3vpn:af[l3vpn:type='ipv6-unicast'])";
                    default "_public_";
                    description "VPN name.";
                  }
    
                  leaf udp-port {
                    type uint16 {
                      range "1..65535";
                    }
                    default "6343";
                    description "UDP port.";
                  }
                }  // container ip-server
              }  // list collector
            }  // container collectors
          }  // container sflow-enable
    
          container slot-statistics {
            config false;
            description
              "List of sFlow packet statistics in slot.";
            list slot-statistic {
              key "slot-id collector-id";
              description
                "Statistics of sFlow packet in slot.";
              leaf slot-id {
                type leafref {
                  path "/devm:devm/devm:lpu-boards/devm:lpu-board/devm:position";
                }
                description "Slot ID.";
              }
    
              leaf collector-id {
                type uint8 {
                  range "1..2";
                }
                description "Collector id.";
              }
    
              leaf packet-count {
                type uint64;
                description "Packet count.";
              }
    
              leaf flow-sample-count {
                type uint64;
                description "Flow sample count.";
              }
            }  // list slot-statistic
          }  // container slot-statistics
    
          container interface-statistics {
            config false;
            description
              "List of sFlow packet statistics in interface.";
            list interface-statistic {
              key "interface-name direction slot-id";
              description
                "Statistics of sFlow packet in interface.";
              leaf interface-name {
                type leafref {
                  path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
                }
                description "Interface name.";
              }
    
              leaf direction {
                type flow-direction;
                description
                  "Inbound or outbound.";
              }
    
              leaf slot-id {
                type leafref {
                  path "/devm:devm/devm:lpu-boards/devm:lpu-board/devm:position";
                }
                description "Slot ID.";
              }
    
              leaf flow-sample-count {
                type uint64;
                description "Flow sample count.";
              }
            }  // list interface-statistic
          }  // container interface-statistics
        }  // container sflow
    
        rpc reset-interface-statistics {
          ext:node-ref "/sflow:sflow/sflow:interface-statistics/sflow:interface-statistic";
          description
            "Reset sFlow packet statistics in interface.";
          input {
            leaf interface-name {
              type leafref {
                path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:name";
              }
              mandatory true;
              description "Interface name.";
            }
    
            leaf slot-id {
              type leafref {
                path "/devm:devm/devm:lpu-boards/devm:lpu-board/devm:position";
              }
              description "Slot ID.";
            }
          }
        }  // rpc reset-interface-statistics
    
        rpc reset-slot-statistics {
          ext:node-ref "/sflow:sflow/sflow:slot-statistics/sflow:slot-statistic";
          description
            "Reset sFlow packet statistics in slot.";
          input {
            leaf slot-id {
              type leafref {
                path "/devm:devm/devm:lpu-boards/devm:lpu-board/devm:position";
              }
              mandatory true;
              description "Slot ID.";
            }
          }
        }  // rpc reset-slot-statistics
      }  // module huawei-sflow
    

© 2023 YumaWorks, Inc. All rights reserved.