isisd: Add PDU drop counter to "show isis summary"

Adding a new drop counters section to "show isis summary".

New output:

Drop counters per PDU type:
  P2P IIH: <count>
  L2 LSP: <count>
  L2 CSNP: <count>
  L2 PSNP: <count>
  ...

Before:
r1# show isis summary
vrf             : default
Process Id      : 972
System Id       : 0000.0000.0001
Up time         : 00:00:48 ago
Number of areas : 1
Area TE:
  Net: 49.0000.0000.0000.0001.00
  TX counters per PDU type:
    P2P IIH: 36
     L2 LSP: 8
    L2 CSNP: 12
    L2 PSNP: 11
  RX counters per PDU type:
    P2P IIH: 37
     L2 LSP: 17
    L2 CSNP: 12
    L2 PSNP: 6
Advertise high metrics: Disabled
...

After:
r1# show isis summary
vrf             : default
Process Id      : 972
System Id       : 0000.0000.0001
Up time         : 00:00:19 ago
Number of areas : 1
Area TE:
  Net: 49.0000.0000.0000.0001.00
  TX counters per PDU type:
    P2P IIH: 16
     L2 LSP: 2
    L2 CSNP: 4
    L2 PSNP: 6
   LSP RXMT: 0
  RX counters per PDU type:
    P2P IIH: 16
     L2 LSP: 5
    L2 CSNP: 4
    L2 PSNP: 2
  Drop counters per PDU type:
    P2P IIH: 2
  Advertise high metrics: Disabled
...

Signed-off-by: Isabella de Leon <ideleon@microsoft.com>
This commit is contained in:
Isabella de Leon 2023-03-28 16:18:59 -07:00
parent 9b00c0a165
commit f64adebdee
3 changed files with 29 additions and 4 deletions

View File

@ -1654,12 +1654,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
if (idrp == ISO9542_ESIS) {
flog_err(EC_LIB_DEVELOPMENT,
"No support for ES-IS packet IDRP=%hhx", idrp);
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
if (idrp != ISO10589_ISIS) {
flog_err(EC_ISIS_PACKET, "Not an IS-IS packet IDRP=%hhx",
idrp);
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
@ -1670,6 +1672,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
isis_notif_version_skew(circuit, version1, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_WARNING;
}
@ -1693,12 +1696,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
isis_notif_id_len_mismatch(circuit, id_len, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
uint8_t expected_length;
if (pdu_size(pdu_type, &expected_length)) {
zlog_warn("Unsupported ISIS PDU %hhu", pdu_type);
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_WARNING;
}
@ -1706,6 +1711,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
flog_err(EC_ISIS_PACKET,
"Expected fixed header length = %hhu but got %hhu",
expected_length, length);
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
@ -1713,6 +1719,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
flog_err(
EC_ISIS_PACKET,
"PDU is too short to contain fixed header of given PDU type.");
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
@ -1723,12 +1730,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
isis_notif_version_skew(circuit, version2, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_WARNING;
}
if (circuit->is_passive) {
zlog_warn("Received ISIS PDU on passive circuit %s",
circuit->interface->name);
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_WARNING;
}
@ -1747,6 +1756,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
isis_notif_max_area_addr_mismatch(circuit, max_area_addrs,
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
@ -1754,17 +1764,24 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
case L1_LAN_HELLO:
case L2_LAN_HELLO:
case P2P_HELLO:
if (fabricd && pdu_type != P2P_HELLO)
if (fabricd && pdu_type != P2P_HELLO) {
pdu_counter_count(circuit->area->pdu_drop_counters,
pdu_type);
return ISIS_ERROR;
}
retval = process_hello(pdu_type, circuit, ssnpa);
break;
case L1_LINK_STATE:
case L2_LINK_STATE:
case FS_LINK_STATE:
if (fabricd
&& pdu_type != L2_LINK_STATE
&& pdu_type != FS_LINK_STATE)
if (fabricd && pdu_type != L2_LINK_STATE &&
pdu_type != FS_LINK_STATE) {
pdu_counter_count(circuit->area->pdu_drop_counters,
pdu_type);
return ISIS_ERROR;
}
retval = process_lsp(pdu_type, circuit, ssnpa, max_area_addrs);
break;
case L1_COMPLETE_SEQ_NUM:
@ -1774,9 +1791,13 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
retval = process_snp(pdu_type, circuit, ssnpa);
break;
default:
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return ISIS_ERROR;
}
if (retval != ISIS_OK)
pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type);
return retval;
}

View File

@ -2503,6 +2503,9 @@ static void common_isis_summary_vty(struct vty *vty, struct isis *isis)
vty_out(vty, " RX counters per PDU type:\n");
pdu_counter_print(vty, " ", area->pdu_rx_counters);
vty_out(vty, " Drop counters per PDU type:\n");
pdu_counter_print(vty, " ", area->pdu_drop_counters);
vty_out(vty, " Advertise high metrics: %s\n",
area->advertise_high_metrics ? "Enabled" : "Disabled");

View File

@ -232,6 +232,7 @@ struct isis_area {
pdu_counter_t pdu_tx_counters;
pdu_counter_t pdu_rx_counters;
pdu_counter_t pdu_drop_counters;
uint64_t lsp_rxmt_count;
/* Area counters */