ASR9000 NP Packet Counter Capture

References:
https://supportforums.cisco.com/document/122386/asr9000xr-how-capture-dropped-or-lost-packets

Set up a packet counter capture that logs the number of packets passing through the Network Processor that match a specific counter. Packets that match the given counter are dropped because they are punted to increase the counter and are not recirculated. If the counter being monitored is not a drop counter then genuine traffic that matches the counter will be dropped for the duration of the counter packet capture.

Note Before: After the captures have been made up to the number of packets specified, or when exiting the capture mode, the NPU needs to reset. This is a simple internal reset operation of the NPU to free used resources for the capture but during this fast reset operation the NPU will not be forwarding. One should expect a forwarding loss of about 50 msec.

This is regardless of whether packets have been captured or not, every time one quits or exits the capture mode, this reset is immediate.

This is only supported on Typhoon line cards and not all NP counters are supported.

The maximum number of captured packets is 100. For slow speed interfaces (eg 1G) it is recommend to not capture more than 20 because the capture buffers are shared packet buffers which are in turn shared by multiple interfaces.

 

Locate the NP the PHY port is connected to:

RP/0/RSP0/CPU0:ASR9K1#show controller np ports all location 0/0/CPU0
Tue Dec 22 03:25:17.158 UTC

                Node: 0/0/CPU0:
----------------------------------------------------------------

NP Bridge Fia                       Ports
-- ------ --- ---------------------------------------------------
0  0      0
0  0      0   TenGigE0/0/2/0, TenGigE0/0/2/1
1  1      1
1  1      1   TenGigE0/0/2/2, TenGigE0/0/2/3

Look at the NP counters that are non-zero and choose which one is required to run a capture against:

RP/0/RSP0/CPU0:ASR9K1#show controllers np counters np0 location 0/0/CPU0
Tue Dec 22 03:26:04.714 UTC

                Node: 0/0/CPU0:
----------------------------------------------------------------

Show global stats counters for NP0, revision v2

Read 11 non-zero NP counters:
Offset  Counter                                         FrameValue   Rate (pps)
-------------------------------------------------------------------------------
  16  MDF_TX_LC_CPU                                         906985           3
  37  PARSE_INTR_RECEIVE_CNT                             166617858         513
  41  PARSE_INJ_RECEIVE_CNT                                   5406           0
  49  PARSE_TM_LOOP_RECEIVE_CNT                            1566664           5
  67  PRS_HEALTH_MON                                       1566664           5
  76  INTR_FRAME_TYPE_7                                     901581           3
 121  PARSE_LC_INJ_DIAGS_CNT                                  5406           0
 291  DBG_RSV_EP_L_RSV_ING_PUNT                             906986           3
 790  DIAGS                                                   5406           0
 902  PUNT_STATISTICS                                       901579           3
1219  MODIFY_PUNT_REASON_MISS_DROP                               3           0

Run the capture

RP/0/RSP0/CPU0:ASR9K1#monitor np counter MODIFY_PUNT_REASON_MISS_DROP np0 location 0/0/CPU0
Tue Dec 22 03:29:41.111 UTC

Warning: Every packet captured will be dropped! If you use the 'count'
         option to capture multiple protocol packets, this could disrupt
         protocol sessions (eg, OSPF session flap). So if capturing protocol
         packets, capture only 1 at a time.


Warning: A mandatory NP reset will be done after monitor to clean up.
         This will cause ~50ms traffic outage. Links will stay Up.
 Proceed y/n [y] > y
 Monitor MODIFY_PUNT_REASON_MISS_DROP on NP0 ... (Ctrl-C to quit)

(Ctrl-C: quit)

 NP reset now.

The meaning of drop counters can be viewed with "show controllers np descriptions location 0/0/CPU0".