Cisco-IOS-XE-trace-rpc

Copyright (c) 2021 by Cisco Systems, Inc. All rights reserved.

  • Version: 2021-07-01

    Cisco-IOS-XE-trace-rpc@2021-07-01


    
      module Cisco-IOS-XE-trace-rpc {
    
        yang-version 1;
    
        namespace
          "http://cisco.com/ns/yang/Cisco-IOS-XE-trace-rpc";
    
        prefix trace-ios-xe-rpc;
    
        import ietf-inet-types {
          prefix inet;
        }
        import ietf-yang-types {
          prefix yang;
        }
        import cisco-semver {
          prefix cisco-semver;
        }
    
        organization "Cisco Systems, Inc.";
    
        contact
          "Cisco Systems, Inc.
         Customer Service
    
         Postal: 170 W Tasman Drive
         San Jose, CA 95134
    
         Tel: +1 1800 553-NETS
    
         E-mail: cs-yang@cisco.com";
    
        description
          "Copyright (c) 2021 by Cisco Systems, Inc.
         All rights reserved.";
    
        revision "2021-07-01" {
          description "Initial revision";
          reference
            "1.0.0";
    
        }
    
        cisco-semver:module-version "1.0.0";
    
        typedef trace-drive-type {
          type enumeration {
            enum "bootflash" {
              value 0;
              description
                "Use bootflash location";
            }
            enum "crashinfo" {
              value 1;
              description
                "Use crashinfo location";
            }
            enum "flash" {
              value 2;
              description "Use flash location";
            }
            enum "harddisk" {
              value 3;
              description
                "Use harddisk location";
            }
          }
          description "Drive options";
        }
    
        typedef trace-debug-option {
          type enumeration {
            enum "debug-level-none" {
              value 0;
              description
                "Do not set debug level, use default level";
            }
            enum "debug-level-error" {
              value 1;
              description
                "Sets debug level to error";
            }
            enum "debug-level-warning" {
              value 2;
              description
                "Sets debug level to warning";
            }
            enum "debug-level-notice" {
              value 3;
              description
                "Sets debug level to notice";
            }
            enum "debug-level-info" {
              value 4;
              description
                "Sets debug level to information";
            }
            enum "debug-level-debug" {
              value 5;
              description
                "Sets debug level to debug";
            }
            enum "debug-level-verbose" {
              value 6;
              description
                "Sets debug level to verbose";
            }
          }
          description
            "Debug options to set log levels";
        }
    
        typedef trace-start-marker-type {
          type enumeration {
            enum "trace-marker-start-none" {
              value 0;
              description
                "No start marker for logging";
            }
            enum "trace-marker-start" {
              value 1;
              description
                "Use start marker type for logging";
            }
            enum "trace-marker-start-last" {
              value 2;
              description
                "Use marker type start last in the list";
            }
          }
          description
            "Start or start last marker options";
        }
    
        typedef trace-end-marker-type {
          type enumeration {
            enum "trace-marker-end-none" {
              value 0;
              description
                "No end marker for logging";
            }
            enum "trace-marker-end" {
              value 1;
              description
                "Use end marker type for logging to end";
            }
            enum "trace-marker-end-last" {
              value 2;
              description
                "Use marker type end last in the list";
            }
          }
          description
            "End or end last marker options";
        }
    
        typedef trace-start-interval-type {
          type enumeration {
            enum "start-interval-none" {
              value 0;
              description
                "Start interval type none";
            }
            enum "start-interval-boot" {
              value 1;
              description
                "Start log interval from last uptime";
            }
            enum "start-interval-seconds" {
              value 2;
              description
                "Start log time interval in seconds";
            }
            enum "start-interval-minutes" {
              value 3;
              description
                "Start log time interval in minutes";
            }
            enum "start-interval-hours" {
              value 4;
              description
                "Start log time interval in hours";
            }
            enum "start-interval-days" {
              value 5;
              description
                "Start log time interval in days";
            }
            enum "start-interval-clear" {
              value 6;
              description
                "Clear logs and start logging";
            }
          }
          description
            "Start time interval  for logging options";
        }
    
        typedef trace-end-interval-type {
          type enumeration {
            enum "end-interval-none" {
              value 0;
              description
                "End interval type none";
            }
            enum "end-interval-boot" {
              value 1;
              description
                "End log interval from last uptime";
            }
            enum "end-interval-seconds" {
              value 2;
              description
                "End log time interval in seconds";
            }
            enum "end-interval-minutes" {
              value 3;
              description
                "End log time interval in minutes";
            }
            enum "end-interval-hours" {
              value 4;
              description
                "End log time interval in hours";
            }
            enum "end-interval-days" {
              value 5;
              description
                "End log time interval in days";
            }
          }
          description
            "End time interval options";
        }
    
        typedef trace-switch-type {
          type enumeration {
            enum "switch-none" {
              value 0;
              description "Switch option - None";
            }
            enum "switch-active" {
              value 1;
              description "Switch role - Active";
            }
            enum "switch-standby" {
              value 2;
              description
                "Switch role - Standby";
            }
            enum "switch-number" {
              value 3;
              description
                "Specify switch number - 1 or 2";
            }
          }
          description
            "Switch options can be active, standby or number";
        }
    
        typedef trace-consumer-type {
          type enumeration {
            enum "trace-tac" {
              value 0;
              description
                "Log consumer type will be default";
            }
            enum "trace-internal" {
              value 1;
              description
                "Log consumer type internal, selects all logs. ";
            }
          }
          description
            "Filters log  consumer type.";
        }
    
        typedef trace-filter-type {
          type enumeration {
            enum "type-none" {
              value 0;
              description
                "No filter applied on binary trace messages.";
            }
            enum "type-mac-address" {
              value 1;
              description
                "Filter logs by using MAC address";
            }
            enum "type-interface" {
              value 2;
              description
                "Filter logs by using interface name";
            }
            enum "type-ipv4-address" {
              value 3;
              description
                "Filter logs by using IPv4 address";
            }
            enum "type-ipv6-address" {
              value 4;
              description
                "Filter logs by using IPv6 address";
            }
            enum "type-uuid" {
              value 5;
              description
                "Filter logs by using UUID string";
            }
            enum "type-string" {
              value 6;
              description
                "Filter logs by using specific string";
            }
          }
          description
            "Filter logs by using different parameters";
        }
    
        typedef trace-profile-type {
          type enumeration {
            enum "trace-profile-file" {
              value 0;
              description
                "Show logs for specific profile file. If the log file
               is not generated, make sure the profile file is valid.";
            }
            enum "trace-profile-predefined" {
              value 1;
              description
                "Show logs for pre-defined profile";
            }
          }
          description
            "show logs for specific profile";
        }
    
        typedef trace-profile-name {
          type enumeration {
            enum "all-profiles" {
              value 0;
              description
                "Show logs for specific profile number";
            }
            enum "hardware-diagnostic" {
              value 1;
              description
                "Shows logs specific to hardware diagnostic";
            }
            enum "netconf-yang" {
              value 2;
              description
                "Shows logs specific to net config";
            }
            enum "restconf" {
              value 3;
              description
                "Shows logs specific to rest config";
            }
            enum "sdwan" {
              value 4;
              description
                "Shows logs specific to sdwan";
            }
            enum "wireless" {
              value 5;
              description
                "Shows logs specific to wireless";
            }
          }
          description
            "Show logs for pre defined profiles";
        }
    
        typedef trace-scope-type {
          type enumeration {
            enum "process-scope" {
              value 0;
              description
                "Show logs for a process";
            }
            enum "profile-scope" {
              value 1;
              description
                "Show logs for a profile";
            }
          }
          description "Option to show log scope";
        }
    
        grouping archive-all {
          description
            "Information for generating trace archive";
          leaf location {
            type trace-drive-type;
            mandatory true;
            description
              "Location where archive gets generated";
          }
    
          leaf file-name {
            type string {
              length "1..100";
              pattern '[A-Za-z0-9_@!-/]*';
            }
            mandatory true;
            description
              "Name of the archive. When trace bundle is generated.
             File name is limited to 100 characters";
          }
        }  // grouping archive-all
    
        grouping trace-archive {
          description "Trace operations options";
          container all {
            description "Generate trace archive";
            uses trace-ios-xe-rpc:archive-all;
          }  // container all
        }  // grouping trace-archive
    
        grouping trace-profile-scope {
          description
            "Options to specify profile type for logging";
          leaf profile-option {
            type trace-profile-type;
            default "trace-profile-predefined";
            description "Trace profile type";
          }
    
          leaf profile-location {
            when
              "../profile-option = 'trace-profile-file'";
            type trace-drive-type;
            default "bootflash";
            description
              "Location of the profile file";
          }
    
          leaf profile-file {
            when
              "../profile-option = 'trace-profile-file'";
            type string {
              length "1..100";
              pattern '[A-Za-z0-9_@!-/]*';
            }
            default "none";
            description
              "Name of the profile file.
             File name is limited to 100 characters";
          }
    
          leaf predefined-profile {
            when
              "../profile-option = 'trace-profile-predefined'";
            type trace-profile-name;
            default "all-profiles";
            description
              " Allows to select pre-defined profile name";
          }
        }  // grouping trace-profile-scope
    
        grouping out-file-info {
          description
            "File name where trace logging output will be redirected";
          leaf file-location {
            type trace-drive-type;
            mandatory true;
            description
              "Location where file will be generated";
          }
    
          leaf file-name {
            type string {
              length "1..100";
              pattern '[A-Za-z0-9_@!-/]*';
            }
            mandatory true;
            description
              "Name of the file that will be generated.
             A UTC date string will be appended to the file name and will be
             the name of trace bundle. For example, when RPC is fired with
             file name as 'trace-file' at 2021:01:01 01:01:01,
             the name of trace bundle will be  'trace-file-20210101-010101.tar.gz'.
             File name is limited to 100 characters";
          }
        }  // grouping out-file-info
    
        grouping marker-option {
          description
            "Marker options to select logs";
          leaf start-marker-type {
            type trace-start-marker-type;
            default "trace-marker-start-none";
            description
              "Marker type start or start last to select logs";
          }
    
          leaf end-marker-type {
            type trace-end-marker-type;
            default "trace-marker-end-none";
            description
              "Marker end start or end last to stop logging";
          }
    
          leaf start-marker {
            type string {
              length "1..128";
            }
            default "none";
            description
              "Display logs when a specific marker is found in file set";
          }
    
          leaf end-marker {
            type string {
              length "1..128";
            }
            default "none";
            description
              "Stop displaying logs when a specific marker
             is found in file set";
          }
        }  // grouping marker-option
    
        grouping timestamp-option {
          description
            "Timestamp options to select logs";
          leaf start-timestamp {
            type yang:date-and-time;
            default
              "1970-01-01T00:00:00.000000Z";
            description
              "Start time stamp for filtering log";
          }
    
          leaf end-timestamp {
            type yang:date-and-time;
            default
              "1970-01-01T00:00:00.000000Z";
            description
              "End time stamp for filtering log";
          }
        }  // grouping timestamp-option
    
        grouping interval-option {
          description
            "Interval options for filtering logs";
          leaf start-type {
            type trace-start-interval-type;
            default "start-interval-none";
            description
              "Type of start interval options";
          }
    
          leaf start-interval {
            type uint32 {
              range "0..4294967295";
            }
            units "seconds";
            default "0";
            description
              "Allows to fill value of start interval period";
          }
    
          leaf end-type {
            type trace-end-interval-type;
            default "end-interval-none";
            description
              "Type of end interval options";
          }
    
          leaf end-interval {
            type uint32 {
              range "0..4294967295";
            }
            units "seconds";
            default "0";
            description
              "Allows to fill value of end interval period";
          }
        }  // grouping interval-option
    
        grouping switch-option {
          description "Options to select switch";
          leaf switch-id {
            type trace-switch-type;
            default "switch-none";
            description "Switch";
          }
    
          leaf switch-num {
            type uint32 {
              range "1..2";
            }
            default "1";
            description
              "Set switch number 1 or 2 for logging";
          }
        }  // grouping switch-option
    
        grouping trace-filter-option {
          description "Filter options";
          choice filter-by-choice {
            default "type-none";
            description
              "Options for filtering logs. 'filter-by-choice' has 'type-none',
             'type-mac-address', 'type-ipv4-address' etc. options and the user
             should select one of these options. Selecting more than one
             option will result in RPC execution error (bad element error).";
            leaf filter-none {
              type boolean;
              must "current() = 'true'" {
                error-message
                  "'filter-none' must be 'true' when set";
                error-app-tag "must-violation";
              }
              default "true";
              description
                "Default option - no action needed by user.
                 [Optional]: 'filter-none' can be set to true by user,
                 though it is a default option. If the user intends to use any of the
                 'filter-by-choice' options other than 'type-none', example -
                 type-mac-address, type-ipv4-address etc. 'filter-none' will be set
                 to default value and user need not modify this value.";
            }
            leaf mac-address {
              type yang:mac-address;
              default "00:00:00:00:00:00";
              description
                "MAC address filter. Make sure it
                 is in 'aa:aa:aa:aa:aa:aa' format";
            }
            leaf integer-value {
              type string;
              default "none";
              description "Integer-based filter";
            }
            leaf ipv4-address {
              type inet:ip-address;
              default "0.0.0.0";
              description "IPv4-based filter";
            }
            leaf ipv6-address {
              type inet:ip-address;
              default "::ff";
              description "IPv6-based filter";
            }
            leaf uuid-string {
              type string;
              default "none";
              description "UUID based filter";
            }
            leaf string-value {
              type string;
              default "none";
              description "String based filter";
            }
          }  // choice filter-by-choice
        }  // grouping trace-filter-option
    
        grouping trace-action-filter-option {
          description "Trace filter options";
          leaf metadata {
            type boolean;
            default "false";
            description
              "Display meta data for every log message";
          }
    
          leaf pcap-extract {
            type boolean;
            default "false";
            description
              "Packet capture file to extract";
          }
    
          leaf debug-level-id {
            type trace-debug-option;
            default "debug-level-none";
            description
              "Debug level for logging the logs";
          }
    
          leaf consumer {
            type trace-consumer-type;
            default "trace-tac";
            description "Consumer type for logs";
          }
    
          leaf tof-flag {
            type boolean;
            default "false";
            description
              "Display trace on failure logs";
          }
    
          container marker {
            description
              "Marker for displaying logs";
            uses trace-ios-xe-rpc:marker-option;
          }  // container marker
    
          container interval {
            description
              "Interval for displaying logs";
            uses trace-ios-xe-rpc:interval-option;
          }  // container interval
    
          container timestamp {
            description
              "Use time stamp for filtering log";
            uses trace-ios-xe-rpc:timestamp-option;
          }  // container timestamp
    
          leaf module {
            type string {
              length "1..128";
            }
            default "none";
            description
              "Select logs for specific modules";
          }
    
          container filter {
            description
              "Select logs using filter";
            uses trace-ios-xe-rpc:trace-filter-option;
          }  // container filter
    
          container switch-info {
            description
              "Information about switch for logging";
            uses trace-ios-xe-rpc:switch-option;
          }  // container switch-info
        }  // grouping trace-action-filter-option
    
        grouping trace-options {
          description
            "Options required for show logging";
          container file-info {
            description
              "Location and name of file";
            uses trace-ios-xe-rpc:out-file-info;
          }  // container file-info
    
          container trace-filter-options {
            description
              "Show logs of specific file";
            uses trace-ios-xe-rpc:trace-action-filter-option;
          }  // container trace-filter-options
    
          choice scope-type-by-choice {
            mandatory true;
            description
              "Options for displaying logs";
            leaf process {
              type string {
                length "1..128";
              }
              mandatory true;
              description
                "Process name to show logs for specific process";
            }
            container profile {
              description
                "Profile name: show logs of specific profile number";
              uses trace-ios-xe-rpc:trace-profile-scope;
            }  // container profile
          }  // choice scope-type-by-choice
        }  // grouping trace-options
    
        grouping trace-message {
          description "Generate logs";
          container trace-all-options {
            description
              "Options for generating logs";
            uses trace-ios-xe-rpc:trace-options;
          }  // container trace-all-options
        }  // grouping trace-message
    
        grouping trace-archive-response {
          description
            "Response to trace archive action request.";
          leaf unique-id {
            type uint32;
            description
              "The unique identifier is a number which is generated for
             a successful trace archive rpc action.";
          }
        }  // grouping trace-archive-response
    
        grouping trace-message-response {
          description
            "Response to trace message action request.";
          leaf unique-id {
            type uint32;
            description
              "The unique identifier is a number which is generated for
             a successful trace message rpc action and can be used to
             track the progress of action via trace events.";
          }
        }  // grouping trace-message-response
    
        rpc trace-archive {
          description
            "RPC for generating trace archive";
          input {
            uses trace-ios-xe-rpc:trace-archive;
          }
    
          output {
            uses trace-ios-xe-rpc:trace-archive-response;
          }
        }  // rpc trace-archive
    
        rpc trace-message {
          description
            "RPC for trace logging operations";
          input {
            uses trace-ios-xe-rpc:trace-message;
          }
    
          output {
            uses trace-ios-xe-rpc:trace-message-response;
          }
        }  // rpc trace-message
      }  // module Cisco-IOS-XE-trace-rpc
    

© 2023 YumaWorks, Inc. All rights reserved.