Segment Routing v6 Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

PDF

Segment Routing v6 Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

Configure SRv6 traffic accounting

Want to summarize with AI?

Log in

Provides instructions for enabling locator accounting, exporting statistics through model-driven telemetry, and verifying identifiers, packet counters, and byte counters.


Before you begin

Ensure that you enable SRv6 and its services.

Follow these steps to configure SRv6 traffic accounting on the router.

Procedure

  1. Enable SRv6 traffic accounting

    Example:

    
    Router#configure
    Router(config)#accounting
    Router(config-acct)#prefixes ipv6 mode per-prefix per-nexthop srv6-locators 
    Router(config-acct)#commit 
  2. Verify the Stats ID allocated for remote locator. The following example shows the SRv6 locator ID and the stats ID allocated for the prefixes with the locator ID.

    Example:

    Router#show route ipv6  fccc:cc00:1:: detail 
     
    Routing entry for fccc:cc00:1::/48
      Known via "isis 100", distance 115, metric 101, SRv6-locator, type level-1  <=========  locator flag
      Installed Jun  1 11:59:10.941 for 00:00:04
      Routing Descriptor Blocks
        fe80::1, from 1::1, via Bundle-Ether1201, Protected, ECMP-Backup (Local-LFA)
          Route metric is 101
          Label: None
          Tunnel ID: None
          Binding Label: None
          Extended communities count: 0
          Path id:2       Path ref count:1
          NHID: 0x2001b (Ref: 79)
          Stats-NHID: 0x2001c (Ref: 6)
          Backup path id:1
        fe80::1, from 1::1, via TenGigE0/1/0/5/2, Protected, ECMP-Backup (Local-LFA)
          Route metric is 101
          Label: None
          Tunnel ID: None
          Binding Label: None
          Extended communities count: 0
          Path id:1       Path ref count:1
          NHID: 0x2001a (Ref: 79)
          Stats-NHID: 0x2001d (Ref: 6)    <=========  Stats-NHID is allocated for prefixes with locator flag
          Backup path id:2
      Route version is 0x68 (104)
      No local label
      IP Precedence: Not Set
      QoS Group ID: Not Set
      Flow-tag: Not Set
      Fwd-class: Not Set
      Route Priority: RIB_PRIORITY_NON_RECURSIVE_LOW (8) SVD Type RIB_SVD_TYPE_LOCAL
      Download Priority 2, Download Version 39779
      No advertising protos. 
  3. Configure the sensory path to retrieve the accounting data using telemetry:

    Example:

    Router#configure
    Router(config)#grpc 
    Router(config-grpc)#port 57400
    Router(config-grpc)#no-tls
    Router(config-grpc)#commit
    Router(config-grpc)#exit 
    Router(config)#telemetry model-driven 
    Router(config-model-driven)#sensor-group s1
    Router(config-model-driven-snsr-grp)#sensor-path Cisco-IOS-XR-fib-common-oper:cef-accounting/vrfs/vrf[vrf-name='default']/af$
    Router(config-model-driven-snsr-grp)#exit
    Router(config-model-driven)#subscription sub1
    Router(config-model-driven-subs)#sensor-group-id s1 sample-interval 30000
    Router(config-model-driven-subs)#commit
    Router(config-model-driven-subs)#root
    Router(config)#exit
    Router#
  4. Verify the counters using the telemetry data. The following example shows the accounting data with the number of packets and the bytes transmitted through the interface.

    Example:

    
     
    {
    "Cisco-IOS-XR-fib-common-oper:cef-accounting": {
      "vrfs": {
       "vrf": [
        {
         "vrf-name": "default",
         "afis": {
          "afi": [
           {
            "afi-type": "ipv6",
            "pfx": {
             "srv6locs": {
              "srv6loc": [
               {
                "ipv6-address": " fccc:cc00:1::",
                "prefix-length": 48,
                "ipv6-prefix": " fccc:cc00:1::",
                "ipv6-prefix-length": 48,
                "accounting-information": [
                 {
                  "number-of-tx-packets": "1500000",           <=========  Accounting data
                  "number-of-tx-bytes": "378000000",          <=========  Accounting data
                  "path-index": 0,
                  "outgoing-interface": "Bundle-Ether1201",
                  "nexthop-addr": "fe80::2/128"
                 },
                 {
                  "number-of-tx-packets": "1000000",           <=========  Accounting data
                  "number-of-tx-bytes": "252000000",          <=========  Accounting data
                  "path-index": 1,
                  "outgoing-interface": "TenGigE0/0/0/22",
                  "nexthop-addr": "fe80::2/128"
                 }
                ],
                "total-number-of-packets-switched": "2500000",
                "total-number-of-bytes-switched": "630000000"
               }
              ]
             }
            }
           }
          ]
         }
        }
       ]
      }
    }
    }
     
  5. Run showcef ipv6 accounting command to display the packets per bytes:

    Example:

    Router#sh cef ipv6 accounting
    fccc:cc00:33::/48
    Accounting: 0/0 packets/bytes output (per-prefix-per-path mode)
     via fe80::2/128, Bundle-Ether1201
      path-idx 0
      next hop fe80::2/128
      Accounting: 0/0 packets/bytes output
    fccc:cc05:2::/48
    Accounting: 0/0 packets/bytes output (per-prefix-per-path mode)
     via fe80::2/128, Bundle-Ether1201
      path-idx 0
      next hop fe80::2/128
      Accounting: 0/0 packets/bytes output
    fccc:cc3e:2::/48
    Accounting: 0/0 packets/bytes output (per-prefix-per-path mode)
     via fe80::2/128, Bundle-Ether1201
      path-idx 0
      next hop fe80::2/128
      Accounting: 0/0 packets/bytes output
    fccc:cc3e:3::/48
    Accounting: 0/0 packets/bytes output (per-prefix-per-path mode)
     via fe80::2/128, Bundle-Ether1201
      path-idx 0
      next hop fe80::2/128
      Accounting: 200000/58400000 packets/bytes output  <<< for prefix fccc:cc3e:3:: we can see 2lac packets count