Merge pull request #7945 from volta-networks/feat_isis_snmp

isisd: add support for read-only snmp mibs objects
This commit is contained in:
Renato Westphal 2021-03-14 22:14:27 -03:00 committed by GitHub
commit e1908ceb42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 5876 additions and 105 deletions

View File

@ -49,13 +49,21 @@
#include "isisd/fabricd.h"
#include "isisd/isis_nb.h"
static struct isis_adjacency *adj_alloc(const uint8_t *id)
static struct isis_adjacency *adj_alloc(struct isis_circuit *circuit,
const uint8_t *id)
{
struct isis_adjacency *adj;
adj = XCALLOC(MTYPE_ISIS_ADJACENCY, sizeof(struct isis_adjacency));
memcpy(adj->sysid, id, ISIS_SYS_ID_LEN);
adj->snmp_idx = ++circuit->snmp_adj_idx_gen;
if (circuit->snmp_adj_list == NULL)
circuit->snmp_adj_list = list_new();
adj->snmp_list_node = listnode_add(circuit->snmp_adj_list, adj);
return adj;
}
@ -65,7 +73,7 @@ struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa,
struct isis_adjacency *adj;
int i;
adj = adj_alloc(id); /* P2P kludge */
adj = adj_alloc(circuit, id); /* P2P kludge */
if (snpa) {
memcpy(adj->snpa, snpa, ETH_ALEN);
@ -146,6 +154,8 @@ void isis_delete_adj(void *arg)
if (!adj)
return;
/* Remove self from snmp list without walking the list*/
list_delete_node(adj->circuit->snmp_adj_list, adj->snmp_list_node);
thread_cancel(&adj->t_expire);
if (adj->adj_state != ISIS_ADJ_DOWN)
@ -292,7 +302,6 @@ void isis_adj_state_change(struct isis_adjacency **padj,
if (circuit->area->log_adj_changes)
isis_log_adj_change(adj, old_state, new_state, reason);
circuit->adj_state_changes++;
#ifndef FABRICD
/* send northbound notification */
isis_notif_adj_state_change(adj, new_state, reason);
@ -303,12 +312,14 @@ void isis_adj_state_change(struct isis_adjacency **padj,
if ((adj->level & level) == 0)
continue;
if (new_state == ISIS_ADJ_UP) {
circuit->adj_state_changes++;
circuit->upadjcount[level - 1]++;
/* update counter & timers for debugging
* purposes */
adj->last_flap = time(NULL);
adj->flaps++;
} else if (old_state == ISIS_ADJ_UP) {
circuit->adj_state_changes++;
listnode_delete(circuit->u.bc.adjdb[level - 1],
adj);

View File

@ -105,6 +105,8 @@ struct isis_adjacency {
unsigned int mt_count; /* Number of entries in mt_set */
struct bfd_session *bfd_session;
struct list *adj_sids; /* Segment Routing Adj-SIDs. */
uint32_t snmp_idx;
struct listnode *snmp_list_node;
};
struct isis_threeway_adj;

View File

@ -71,6 +71,48 @@ DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp))
int isis_if_new_hook(struct interface *);
int isis_if_delete_hook(struct interface *);
static int isis_circuit_smmp_id_gen(struct isis_circuit *circuit)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct isis *isis = NULL;
uint32_t id;
uint32_t i;
isis = isis_lookup_by_vrfid(vrf->vrf_id);
if (isis == NULL)
return 0;
id = isis->snmp_circuit_id_last;
id++;
/* find next unused entry */
for (i = 0; i < SNMP_CIRCUITS_MAX; i++) {
if (id >= SNMP_CIRCUITS_MAX) {
id = 0;
continue;
}
if (id == 0)
continue;
if (isis->snmp_circuits[id] == NULL)
break;
id++;
}
if (i == SNMP_CIRCUITS_MAX) {
zlog_warn("Could not allocate a smmp-circuit-id");
return 0;
}
isis->snmp_circuits[id] = circuit;
isis->snmp_circuit_id_last = id;
circuit->snmp_id = id;
return 1;
}
struct isis_circuit *isis_circuit_new(struct isis *isis)
{
struct isis_circuit *circuit;
@ -79,6 +121,12 @@ struct isis_circuit *isis_circuit_new(struct isis *isis)
circuit = XCALLOC(MTYPE_ISIS_CIRCUIT, sizeof(struct isis_circuit));
circuit->isis = isis;
/*
* Note: if snmp-id generation failed circuit will fail
* up operation
*/
isis_circuit_smmp_id_gen(circuit);
/*
* Default values
*/
@ -150,11 +198,18 @@ struct isis_circuit *isis_circuit_new(struct isis *isis)
void isis_circuit_del(struct isis_circuit *circuit)
{
struct isis *isis = NULL;
if (!circuit)
return;
QOBJ_UNREG(circuit);
if (circuit->interface) {
isis = isis_lookup_by_vrfid(circuit->interface->vrf_id);
isis->snmp_circuits[circuit->snmp_id] = NULL;
}
isis_circuit_if_unbind(circuit, circuit->interface);
circuit_mt_finish(circuit);
@ -609,6 +664,7 @@ int isis_circuit_up(struct isis_circuit *circuit)
return ISIS_OK;
if (circuit->is_passive) {
circuit->last_uptime = time(NULL);
/* make sure the union fields are initialized, else we
* could end with garbage values from a previous circuit
* type, which would then cause a segfault when building
@ -623,6 +679,13 @@ int isis_circuit_up(struct isis_circuit *circuit)
return ISIS_OK;
}
if (circuit->snmp_id == 0) {
/* We cannot bring circuit up if does not have snmp-id */
flog_err(EC_ISIS_CONFIG,
"No snnmp-id: there are too many circuits:");
return ISIS_ERROR;
}
if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) {
flog_err(
EC_ISIS_CONFIG,
@ -722,6 +785,8 @@ int isis_circuit_up(struct isis_circuit *circuit)
circuit->tx_queue = isis_tx_queue_new(circuit, send_lsp);
circuit->last_uptime = time(NULL);
#ifndef FABRICD
/* send northbound notification */
isis_notif_if_state_change(circuit, false);
@ -828,6 +893,15 @@ void isis_circuit_down(struct isis_circuit *circuit)
thread_cancel(&circuit->u.p2p.t_send_p2p_hello);
}
/*
* All adjacencies have to be gone, delete snmp list
* and reset snmpd idx generator
*/
if (circuit->snmp_adj_list != NULL)
list_delete(&circuit->snmp_adj_list);
circuit->snmp_adj_idx_gen = 0;
/* Cancel all active threads */
thread_cancel(&circuit->t_send_csnp[0]);
thread_cancel(&circuit->t_send_csnp[1]);

View File

@ -79,6 +79,7 @@ struct isis_circuit_arg {
struct isis_circuit {
int state;
uint8_t circuit_id; /* l1/l2 bcast CircuitID */
time_t last_uptime;
struct isis *isis;
struct isis_area *area; /* back pointer to the area */
struct interface *interface; /* interface info from z */
@ -115,6 +116,8 @@ struct isis_circuit {
int pad_hellos; /* add padding to Hello PDUs ? */
char ext_domain; /* externalDomain (boolean) */
int lsp_regenerate_pending[ISIS_LEVELS];
uint64_t lsp_error_counter;
/*
* Configurables
*/
@ -165,6 +168,12 @@ struct isis_circuit {
uint32_t auth_type_failures; /*authentication-type-fails */
uint32_t auth_failures; /* authentication-fails */
uint32_t snmp_id; /* Circuit id in snmp */
uint32_t snmp_adj_idx_gen; /* Create unique id for adjacency on creation
*/
struct list *snmp_adj_list; /* List in id order */
QOBJ_FIELDS
};
DECLARE_QOBJ_TYPE(isis_circuit)

View File

@ -97,6 +97,7 @@ static int isis_check_dr_change(struct isis_adjacency *adj, int level)
/* was there a DIS state transition ? */
{
adj->dischanges[level - 1]++;
adj->circuit->desig_changes[level - 1]++;
/* ok rotate the history list through */
for (i = DIS_RECORDS - 1; i > 0; i--) {
adj->dis_record[(i * ISIS_LEVELS) + level - 1].dis =

View File

@ -166,3 +166,38 @@ void dynhn_print_all(struct vty *vty, struct isis *isis)
cmd_hostname_get());
return;
}
struct isis_dynhn *dynhn_snmp_next(const uint8_t *id, int level)
{
struct listnode *node = NULL;
struct isis_dynhn *dyn = NULL;
struct isis_dynhn *found_dyn = NULL;
int res;
for (ALL_LIST_ELEMENTS_RO(dyn_cache, node, dyn)) {
res = memcmp(dyn->id, id, ISIS_SYS_ID_LEN);
if (res < 0)
continue;
if (res == 0 && dyn->level <= level)
continue;
if (res == 0) {
/*
* This is the best match, we can stop
* searching
*/
found_dyn = dyn;
break;
}
if (found_dyn == NULL
|| memcmp(dyn->id, found_dyn->id, ISIS_SYS_ID_LEN) < 0) {
found_dyn = dyn;
}
}
return found_dyn;
}

View File

@ -38,4 +38,7 @@ struct isis_dynhn *dynhn_find_by_id(const uint8_t *id);
struct isis_dynhn *dynhn_find_by_name(const char *hostname);
void dynhn_print_all(struct vty *vty, struct isis *isis);
/* Snmp support */
struct isis_dynhn *dynhn_snmp_next(const uint8_t *id, int level);
#endif /* _ZEBRA_ISIS_DYNHN_H */

View File

@ -324,8 +324,8 @@ void lsp_inc_seqno(struct isis_lsp *lsp, uint32_t seqno)
/* check for overflow */
if (newseq < lsp->hdr.seqno) {
/* send northbound notification */
isis_notif_lsp_exceed_max(lsp->area,
rawlspid_print(lsp->hdr.lsp_id));
lsp->area->lsp_exceeded_max_counter++;
isis_notif_lsp_exceed_max(lsp->area, lsp->hdr.lsp_id);
}
#endif /* ifndef FABRICD */
@ -1357,8 +1357,8 @@ int lsp_generate(struct isis_area *area, int level)
#ifndef FABRICD
/* send northbound notification */
isis_notif_lsp_gen(area, rawlspid_print(newlsp->hdr.lsp_id),
newlsp->hdr.seqno, newlsp->last_generated);
isis_notif_lsp_gen(area, newlsp->hdr.lsp_id, newlsp->hdr.seqno,
newlsp->last_generated);
#endif /* ifndef FABRICD */
return ISIS_OK;

View File

@ -549,40 +549,97 @@ void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty,
/* Notifications. */
void isis_notif_db_overload(const struct isis_area *area, bool overload);
void isis_notif_lsp_too_large(const struct isis_circuit *circuit,
uint32_t pdu_size, const char *lsp_id);
uint32_t pdu_size, const uint8_t *lsp_id);
void isis_notif_if_state_change(const struct isis_circuit *circuit, bool down);
void isis_notif_corrupted_lsp(const struct isis_area *area,
const char *lsp_id); /* currently unused */
const uint8_t *lsp_id); /* currently unused */
void isis_notif_lsp_exceed_max(const struct isis_area *area,
const char *lsp_id);
const uint8_t *lsp_id);
void isis_notif_max_area_addr_mismatch(const struct isis_circuit *circuit,
uint8_t max_area_addrs,
const char *raw_pdu);
const char *raw_pdu, size_t raw_pdu_len);
void isis_notif_authentication_type_failure(const struct isis_circuit *circuit,
const char *raw_pdu);
const char *raw_pdu,
size_t raw_pdu_len);
void isis_notif_authentication_failure(const struct isis_circuit *circuit,
const char *raw_pdu);
const char *raw_pdu, size_t raw_pdu_len);
void isis_notif_adj_state_change(const struct isis_adjacency *adj,
int new_state, const char *reason);
void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
const char *reason, const char *raw_pdu);
const char *reason, const char *raw_pdu,
size_t raw_pdu_len);
void isis_notif_area_mismatch(const struct isis_circuit *circuit,
const char *raw_pdu);
const char *raw_pdu, size_t raw_pdu_len);
void isis_notif_lsp_received(const struct isis_circuit *circuit,
const char *lsp_id, uint32_t seqno,
const uint8_t *lsp_id, uint32_t seqno,
uint32_t timestamp, const char *sys_id);
void isis_notif_lsp_gen(const struct isis_area *area, const char *lsp_id,
void isis_notif_lsp_gen(const struct isis_area *area, const uint8_t *lsp_id,
uint32_t seqno, uint32_t timestamp);
void isis_notif_id_len_mismatch(const struct isis_circuit *circuit,
uint8_t rcv_id_len, const char *raw_pdu);
uint8_t rcv_id_len, const char *raw_pdu,
size_t raw_pdu_len);
void isis_notif_version_skew(const struct isis_circuit *circuit,
uint8_t version, const char *raw_pdu);
uint8_t version, const char *raw_pdu,
size_t raw_pdu_len);
void isis_notif_lsp_error(const struct isis_circuit *circuit,
const char *lsp_id, const char *raw_pdu,
uint32_t offset, uint8_t tlv_type);
const uint8_t *lsp_id, const char *raw_pdu,
size_t raw_pdu_len, uint32_t offset,
uint8_t tlv_type);
void isis_notif_seqno_skipped(const struct isis_circuit *circuit,
const char *lsp_id);
const uint8_t *lsp_id);
void isis_notif_own_lsp_purge(const struct isis_circuit *circuit,
const char *lsp_id);
const uint8_t *lsp_id);
/* We also declare hook for every notification */
DECLARE_HOOK(isis_hook_db_overload, (const struct isis_area *area), (area));
DECLARE_HOOK(isis_hook_lsp_too_large,
(const struct isis_circuit *circuit, uint32_t pdu_size,
const uint8_t *lsp_id),
(circuit, pdu_size, lsp_id));
/* Note: no isis_hook_corrupted_lsp - because this notificaiton is not used */
DECLARE_HOOK(isis_hook_lsp_exceed_max,
(const struct isis_area *area, const uint8_t *lsp_id),
(area, lsp_id));
DECLARE_HOOK(isis_hook_max_area_addr_mismatch,
(const struct isis_circuit *circuit, uint8_t max_addrs,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, max_addrs, raw_pdu, raw_pdu_len));
DECLARE_HOOK(isis_hook_authentication_type_failure,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DECLARE_HOOK(isis_hook_authentication_failure,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DECLARE_HOOK(isis_hook_adj_state_change, (const struct isis_adjacency *adj),
(adj));
DECLARE_HOOK(isis_hook_reject_adjacency,
(const struct isis_circuit *circuit, const char *pdu,
size_t pdu_len),
(circuit, pdu, pdu_len));
DECLARE_HOOK(isis_hook_area_mismatch,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit));
DECLARE_HOOK(isis_hook_id_len_mismatch,
(const struct isis_circuit *circuit, uint8_t rcv_id_len,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, rcv_id_len, raw_pdu, raw_pdu_len));
DECLARE_HOOK(isis_hook_version_skew,
(const struct isis_circuit *circuit, uint8_t version,
const char *raw_pdu, size_t raw_pdu_len),
(circuit));
DECLARE_HOOK(isis_hook_lsp_error,
(const struct isis_circuit *circuit, const uint8_t *lsp_id,
const char *raw_pdu, size_t raw_pdu_len),
(circuit));
DECLARE_HOOK(isis_hook_seqno_skipped,
(const struct isis_circuit *circuit, const uint8_t *lsp_id),
(circuit, lsp_id));
DECLARE_HOOK(isis_hook_own_lsp_purge,
(const struct isis_circuit *circuit, const uint8_t *lsp_id),
(circuit, lsp_id));
#endif /* ISISD_ISIS_NB_H_ */

View File

@ -28,6 +28,56 @@
#include "isisd/isis_dynhn.h"
#include "isisd/isis_misc.h"
DEFINE_HOOK(isis_hook_lsp_too_large,
(const struct isis_circuit *circuit, uint32_t pdu_size,
const uint8_t *lsp_id),
(circuit, pdu_size, lsp_id));
DEFINE_HOOK(isis_hook_corrupted_lsp, (const struct isis_area *area), (area));
DEFINE_HOOK(isis_hook_lsp_exceed_max,
(const struct isis_area *area, const uint8_t *lsp_id),
(area, lsp_id));
DEFINE_HOOK(isis_hook_max_area_addr_mismatch,
(const struct isis_circuit *circuit, uint8_t max_addrs,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, max_addrs, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_authentication_type_failure,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_authentication_failure,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_adj_state_change, (const struct isis_adjacency *adj),
(adj));
DEFINE_HOOK(isis_hook_reject_adjacency,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_area_mismatch,
(const struct isis_circuit *circuit, const char *raw_pdu,
size_t raw_pdu_len),
(circuit, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_id_len_mismatch,
(const struct isis_circuit *circuit, uint8_t rcv_id_len,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, rcv_id_len, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_version_skew,
(const struct isis_circuit *circuit, uint8_t version,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, version, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_lsp_error,
(const struct isis_circuit *circuit, const uint8_t *lsp_id,
const char *raw_pdu, size_t raw_pdu_len),
(circuit, lsp_id, raw_pdu, raw_pdu_len));
DEFINE_HOOK(isis_hook_seqno_skipped,
(const struct isis_circuit *circuit, const uint8_t *lsp_id),
(circuit, lsp_id));
DEFINE_HOOK(isis_hook_own_lsp_purge,
(const struct isis_circuit *circuit, const uint8_t *lsp_id),
(circuit, lsp_id));
/*
* Helper functions.
*/
@ -92,7 +142,7 @@ void isis_notif_db_overload(const struct isis_area *area, bool overload)
* XPath: /frr-isisd:lsp-too-large
*/
void isis_notif_lsp_too_large(const struct isis_circuit *circuit,
uint32_t pdu_size, const char *lsp_id)
uint32_t pdu_size, const uint8_t *lsp_id)
{
const char *xpath = "/frr-isisd:lsp-too-large";
struct list *arguments = yang_data_list_new();
@ -106,9 +156,11 @@ void isis_notif_lsp_too_large(const struct isis_circuit *circuit,
data = yang_data_new_uint32(xpath_arg, pdu_size);
listnode_add(arguments, data);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
hook_call(isis_hook_lsp_too_large, circuit, pdu_size, lsp_id);
nb_notification_send(xpath, arguments);
}
@ -135,7 +187,8 @@ void isis_notif_if_state_change(const struct isis_circuit *circuit, bool down)
/*
* XPath: /frr-isisd:corrupted-lsp-detected
*/
void isis_notif_corrupted_lsp(const struct isis_area *area, const char *lsp_id)
void isis_notif_corrupted_lsp(const struct isis_area *area,
const uint8_t *lsp_id)
{
const char *xpath = "/frr-isisd:corrupted-lsp-detected";
struct list *arguments = yang_data_list_new();
@ -144,16 +197,19 @@ void isis_notif_corrupted_lsp(const struct isis_area *area, const char *lsp_id)
notif_prep_instance_hdr(xpath, area, "default", arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
hook_call(isis_hook_corrupted_lsp, area);
nb_notification_send(xpath, arguments);
}
/*
* XPath: /frr-isisd:attempt-to-exceed-max-sequence
*/
void isis_notif_lsp_exceed_max(const struct isis_area *area, const char *lsp_id)
void isis_notif_lsp_exceed_max(const struct isis_area *area,
const uint8_t *lsp_id)
{
const char *xpath = "/frr-isisd:attempt-to-exceed-max-sequence";
struct list *arguments = yang_data_list_new();
@ -162,9 +218,11 @@ void isis_notif_lsp_exceed_max(const struct isis_area *area, const char *lsp_id)
notif_prep_instance_hdr(xpath, area, "default", arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
hook_call(isis_hook_lsp_exceed_max, area, lsp_id);
nb_notification_send(xpath, arguments);
}
@ -173,7 +231,7 @@ void isis_notif_lsp_exceed_max(const struct isis_area *area, const char *lsp_id)
*/
void isis_notif_max_area_addr_mismatch(const struct isis_circuit *circuit,
uint8_t max_area_addrs,
const char *raw_pdu)
const char *raw_pdu, size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:max-area-addresses-mismatch";
struct list *arguments = yang_data_list_new();
@ -190,6 +248,9 @@ void isis_notif_max_area_addr_mismatch(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_max_area_addr_mismatch, circuit, max_area_addrs,
raw_pdu, raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -197,7 +258,8 @@ void isis_notif_max_area_addr_mismatch(const struct isis_circuit *circuit,
* XPath: /frr-isisd:authentication-type-failure
*/
void isis_notif_authentication_type_failure(const struct isis_circuit *circuit,
const char *raw_pdu)
const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:authentication-type-failure";
struct list *arguments = yang_data_list_new();
@ -211,6 +273,9 @@ void isis_notif_authentication_type_failure(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_authentication_type_failure, circuit, raw_pdu,
raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -218,7 +283,7 @@ void isis_notif_authentication_type_failure(const struct isis_circuit *circuit,
* XPath: /frr-isisd:authentication-failure
*/
void isis_notif_authentication_failure(const struct isis_circuit *circuit,
const char *raw_pdu)
const char *raw_pdu, size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:authentication-failure";
struct list *arguments = yang_data_list_new();
@ -232,6 +297,9 @@ void isis_notif_authentication_failure(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_authentication_failure, circuit, raw_pdu,
raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -269,6 +337,8 @@ void isis_notif_adj_state_change(const struct isis_adjacency *adj,
listnode_add(arguments, data);
}
hook_call(isis_hook_adj_state_change, adj);
nb_notification_send(xpath, arguments);
}
@ -276,7 +346,8 @@ void isis_notif_adj_state_change(const struct isis_adjacency *adj,
* XPath: /frr-isisd:rejected-adjacency
*/
void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
const char *reason, const char *raw_pdu)
const char *reason, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:rejected-adjacency";
struct list *arguments = yang_data_list_new();
@ -293,6 +364,8 @@ void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_reject_adjacency, circuit, raw_pdu, raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -300,7 +373,7 @@ void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
* XPath: /frr-isisd:area-mismatch
*/
void isis_notif_area_mismatch(const struct isis_circuit *circuit,
const char *raw_pdu)
const char *raw_pdu, size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:area-mismatch";
struct list *arguments = yang_data_list_new();
@ -314,6 +387,8 @@ void isis_notif_area_mismatch(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_area_mismatch, circuit, raw_pdu, raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -321,7 +396,7 @@ void isis_notif_area_mismatch(const struct isis_circuit *circuit,
* XPath: /frr-isisd:lsp-received
*/
void isis_notif_lsp_received(const struct isis_circuit *circuit,
const char *lsp_id, uint32_t seqno,
const uint8_t *lsp_id, uint32_t seqno,
uint32_t timestamp, const char *sys_id)
{
const char *xpath = "/frr-isisd:lsp-received";
@ -333,7 +408,7 @@ void isis_notif_lsp_received(const struct isis_circuit *circuit,
notif_prep_instance_hdr(xpath, area, "default", arguments);
notif_prepr_iface_hdr(xpath, circuit, arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/sequence", xpath);
data = yang_data_new_uint32(xpath_arg, seqno);
@ -351,7 +426,7 @@ void isis_notif_lsp_received(const struct isis_circuit *circuit,
/*
* XPath: /frr-isisd:lsp-generation
*/
void isis_notif_lsp_gen(const struct isis_area *area, const char *lsp_id,
void isis_notif_lsp_gen(const struct isis_area *area, const uint8_t *lsp_id,
uint32_t seqno, uint32_t timestamp)
{
const char *xpath = "/frr-isisd:lsp-generation";
@ -361,7 +436,7 @@ void isis_notif_lsp_gen(const struct isis_area *area, const char *lsp_id,
notif_prep_instance_hdr(xpath, area, "default", arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/sequence", xpath);
data = yang_data_new_uint32(xpath_arg, seqno);
@ -377,7 +452,8 @@ void isis_notif_lsp_gen(const struct isis_area *area, const char *lsp_id,
* XPath: /frr-isisd:id-len-mismatch
*/
void isis_notif_id_len_mismatch(const struct isis_circuit *circuit,
uint8_t rcv_id_len, const char *raw_pdu)
uint8_t rcv_id_len, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:id-len-mismatch";
struct list *arguments = yang_data_list_new();
@ -394,6 +470,9 @@ void isis_notif_id_len_mismatch(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_id_len_mismatch, circuit, rcv_id_len, raw_pdu,
raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -401,7 +480,8 @@ void isis_notif_id_len_mismatch(const struct isis_circuit *circuit,
* XPath: /frr-isisd:version-skew
*/
void isis_notif_version_skew(const struct isis_circuit *circuit,
uint8_t version, const char *raw_pdu)
uint8_t version, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:version-skew";
struct list *arguments = yang_data_list_new();
@ -418,6 +498,9 @@ void isis_notif_version_skew(const struct isis_circuit *circuit,
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
hook_call(isis_hook_version_skew, circuit, version, raw_pdu,
raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -425,7 +508,8 @@ void isis_notif_version_skew(const struct isis_circuit *circuit,
* XPath: /frr-isisd:lsp-error-detected
*/
void isis_notif_lsp_error(const struct isis_circuit *circuit,
const char *lsp_id, const char *raw_pdu,
const uint8_t *lsp_id, const char *raw_pdu,
size_t raw_pdu_len,
__attribute__((unused)) uint32_t offset,
__attribute__((unused)) uint8_t tlv_type)
{
@ -438,13 +522,15 @@ void isis_notif_lsp_error(const struct isis_circuit *circuit,
notif_prep_instance_hdr(xpath, area, "default", arguments);
notif_prepr_iface_hdr(xpath, circuit, arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/raw-pdu", xpath);
data = yang_data_new(xpath_arg, raw_pdu);
listnode_add(arguments, data);
/* ignore offset and tlv_type which cannot be set properly */
hook_call(isis_hook_lsp_error, circuit, lsp_id, raw_pdu, raw_pdu_len);
nb_notification_send(xpath, arguments);
}
@ -452,7 +538,7 @@ void isis_notif_lsp_error(const struct isis_circuit *circuit,
* XPath: /frr-isisd:sequence-number-skipped
*/
void isis_notif_seqno_skipped(const struct isis_circuit *circuit,
const char *lsp_id)
const uint8_t *lsp_id)
{
const char *xpath = "/frr-isisd:sequence-number-skipped";
struct list *arguments = yang_data_list_new();
@ -463,9 +549,11 @@ void isis_notif_seqno_skipped(const struct isis_circuit *circuit,
notif_prep_instance_hdr(xpath, area, "default", arguments);
notif_prepr_iface_hdr(xpath, circuit, arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
hook_call(isis_hook_seqno_skipped, circuit, lsp_id);
nb_notification_send(xpath, arguments);
}
@ -473,7 +561,7 @@ void isis_notif_seqno_skipped(const struct isis_circuit *circuit,
* XPath: /frr-isisd:own-lsp-purge
*/
void isis_notif_own_lsp_purge(const struct isis_circuit *circuit,
const char *lsp_id)
const uint8_t *lsp_id)
{
const char *xpath = "/frr-isisd:own-lsp-purge";
struct list *arguments = yang_data_list_new();
@ -484,8 +572,10 @@ void isis_notif_own_lsp_purge(const struct isis_circuit *circuit,
notif_prep_instance_hdr(xpath, area, "default", arguments);
notif_prepr_iface_hdr(xpath, circuit, arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath);
data = yang_data_new_string(xpath_arg, lsp_id);
data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id));
listnode_add(arguments, data);
hook_call(isis_hook_own_lsp_purge, circuit, lsp_id);
nb_notification_send(xpath, arguments);
}

View File

@ -549,6 +549,19 @@ static int pdu_len_validate(uint16_t pdu_len, struct isis_circuit *circuit)
return 0;
}
static void update_rej_adj_count(struct isis_circuit *circuit)
{
circuit->rej_adjacencies++;
if (circuit->is_type == IS_LEVEL_1)
circuit->area->rej_adjacencies[0]++;
else if (circuit->is_type == IS_LEVEL_2)
circuit->area->rej_adjacencies[1]++;
else {
circuit->area->rej_adjacencies[0]++;
circuit->area->rej_adjacencies[1]++;
}
}
static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
uint8_t *ssnpa)
{
@ -581,22 +594,22 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
if (p2p_hello) {
if (circuit->circ_type != CIRCUIT_T_P2P) {
zlog_warn("p2p hello on non p2p circuit");
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "p2p hello on non p2p circuit",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
} else {
if (circuit->circ_type != CIRCUIT_T_BROADCAST) {
zlog_warn("lan hello on non broadcast circuit");
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "lan hello on non broadcast circuit",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -605,12 +618,12 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
zlog_debug(
"level %d LAN Hello received over circuit with externalDomain = true",
level);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit,
"LAN Hello received over circuit with externalDomain = true",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -622,10 +635,11 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
circuit->area->area_tag,
circuit->interface->name);
}
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "Interface level mismatch", raw_pdu);
isis_notif_reject_adjacency(circuit,
"Interface level mismatch",
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -652,10 +666,10 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
"ISIS-Adj (%s): Rcvd %s from (%s) with invalid pdu length %hu",
circuit->area->area_tag, pdu_name,
circuit->interface->name, iih.pdu_len);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(circuit, "Invalid PDU length",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -664,10 +678,11 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
flog_err(EC_ISIS_PACKET,
"Level %d LAN Hello with Circuit Type %d", level,
iih.circ_type);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "LAN Hello with wrong IS-level", raw_pdu);
isis_notif_reject_adjacency(circuit,
"LAN Hello with wrong IS-level",
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_ERROR;
}
@ -678,10 +693,10 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
if (isis_unpack_tlvs(STREAM_READABLE(circuit->rcv_stream),
circuit->rcv_stream, &iih.tlvs, &error_log)) {
zlog_warn("isis_unpack_tlvs() failed: %s", error_log);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(circuit, "Failed to unpack TLVs",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
@ -690,17 +705,18 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
zlog_warn("No Area addresses TLV in %s", pdu_name);
#ifndef FABRICD
/* send northbound notification */
isis_notif_area_mismatch(circuit, raw_pdu);
isis_notif_area_mismatch(circuit, raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
if (!iih.tlvs->protocols_supported.count) {
zlog_warn("No supported protocols TLV in %s", pdu_name);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "No supported protocols TLV", raw_pdu);
isis_notif_reject_adjacency(circuit,
"No supported protocols TLV",
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
@ -716,12 +732,13 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
stream_get_from(raw_pdu, circuit->rcv_stream, pdu_start,
pdu_end - pdu_start);
if (auth_code == ISIS_AUTH_FAILURE) {
circuit->auth_failures++;
isis_notif_authentication_failure(circuit, raw_pdu);
update_rej_adj_count(circuit);
isis_notif_authentication_failure(circuit, raw_pdu,
sizeof(raw_pdu));
} else { /* AUTH_TYPE_FAILURE or NO_VALIDATOR */
circuit->auth_type_failures++;
isis_notif_authentication_type_failure(circuit,
raw_pdu);
update_rej_adj_count(circuit);
isis_notif_authentication_type_failure(circuit, raw_pdu,
sizeof(raw_pdu));
}
#endif /* ifndef FABRICD */
goto out;
@ -731,10 +748,11 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
zlog_warn(
"ISIS-Adj (%s): Received IIH with own sysid on %s - discard",
circuit->area->area_tag, circuit->interface->name);
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "Received IIH with our own sysid", raw_pdu);
isis_notif_reject_adjacency(circuit,
"Received IIH with our own sysid",
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
@ -752,7 +770,7 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
}
#ifndef FABRICD
/* send northbound notification */
isis_notif_area_mismatch(circuit, raw_pdu);
isis_notif_area_mismatch(circuit, raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
@ -769,11 +787,11 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
"ISIS-Adj (%s): Neither IPv4 nor IPv6 considered usable. Ignoring IIH",
circuit->area->area_tag);
}
circuit->rej_adjacencies++;
update_rej_adj_count(circuit);
#ifndef FABRICD
isis_notif_reject_adjacency(
circuit, "Neither IPv4 not IPv6 considered usable",
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
goto out;
}
@ -857,8 +875,8 @@ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit,
#ifndef FABRICD
/* send northbound notification */
isis_notif_lsp_received(circuit, rawlspid_print(hdr.lsp_id), hdr.seqno,
time(NULL), sysid_print(hdr.lsp_id));
isis_notif_lsp_received(circuit, hdr.lsp_id, hdr.seqno, time(NULL),
sysid_print(hdr.lsp_id));
#endif /* ifndef FABRICD */
if (pdu_len_validate(hdr.pdu_len, circuit)) {
@ -931,8 +949,18 @@ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit,
* we change the code above to return those extra fields, we
* will send dummy values which are ignored in the callback
*/
isis_notif_lsp_error(circuit, rawlspid_print(hdr.lsp_id),
raw_pdu, 0, 0);
circuit->lsp_error_counter++;
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->lsp_error_counter[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->lsp_error_counter[1]++;
} else {
circuit->area->lsp_error_counter[0]++;
circuit->area->lsp_error_counter[1]++;
}
isis_notif_lsp_error(circuit, hdr.lsp_id, raw_pdu,
sizeof(raw_pdu), 0, 0);
#endif /* ifndef FABRICD */
goto out;
}
@ -956,11 +984,28 @@ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit,
/* send northbound notification */
if (auth_code == ISIS_AUTH_FAILURE) {
circuit->auth_failures++;
isis_notif_authentication_failure(circuit, raw_pdu);
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->auth_failures[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->auth_failures[1]++;
} else {
circuit->area->auth_failures[0]++;
circuit->area->auth_failures[1]++;
}
isis_notif_authentication_failure(circuit, raw_pdu,
sizeof(raw_pdu));
} else { /* AUTH_TYPE_FAILURE or NO_VALIDATOR */
circuit->auth_type_failures++;
isis_notif_authentication_type_failure(circuit,
raw_pdu);
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->auth_type_failures[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->auth_type_failures[1]++;
} else {
circuit->area->auth_type_failures[0]++;
circuit->area->auth_type_failures[1]++;
}
isis_notif_authentication_type_failure(circuit, raw_pdu,
sizeof(raw_pdu));
}
#endif /* ifndef FABRICD */
goto out;
@ -1105,10 +1150,10 @@ dontcheckadj:
if (lsp->hdr.seqno < hdr.seqno) {
/* send northbound
* notification */
circuit->area
->lsp_seqno_skipped_counter++;
isis_notif_seqno_skipped(
circuit,
rawlspid_print(
hdr.lsp_id));
circuit, hdr.lsp_id);
}
#endif /* ifndef FABRICD */
lsp_inc_seqno(lsp, hdr.seqno);
@ -1129,8 +1174,7 @@ dontcheckadj:
/* our own LSP with 0 remaining life time */
#ifndef FABRICD
/* send northbound notification */
isis_notif_own_lsp_purge(
circuit, rawlspid_print(hdr.lsp_id));
isis_notif_own_lsp_purge(circuit, hdr.lsp_id);
#endif /* ifndef FABRICD */
}
}
@ -1158,8 +1202,8 @@ dontcheckadj:
lsp_inc_seqno(lsp, hdr.seqno);
#ifndef FABRICD
/* send northbound notification */
isis_notif_seqno_skipped(circuit,
rawlspid_print(hdr.lsp_id));
circuit->area->lsp_seqno_skipped_counter++;
isis_notif_seqno_skipped(circuit, hdr.lsp_id);
#endif /* ifndef FABRICD */
if (IS_DEBUG_UPDATE_PACKETS) {
zlog_debug(
@ -1388,12 +1432,28 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
pdu_end - pdu_start);
if (auth_code == ISIS_AUTH_FAILURE) {
circuit->auth_failures++;
isis_notif_authentication_failure(circuit,
raw_pdu);
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->auth_failures[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->auth_failures[1]++;
} else {
circuit->area->auth_failures[0]++;
circuit->area->auth_failures[1]++;
}
isis_notif_authentication_failure(
circuit, raw_pdu, sizeof(raw_pdu));
} else { /* AUTH_TYPE_FAILURE or NO_VALIDATOR */
circuit->auth_type_failures++;
isis_notif_authentication_type_failure(circuit,
raw_pdu);
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->auth_type_failures[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->auth_type_failures[1]++;
} else {
circuit->area->auth_type_failures[0]++;
circuit->area->auth_type_failures[1]++;
}
isis_notif_authentication_type_failure(
circuit, raw_pdu, sizeof(raw_pdu));
}
#endif /* ifndef FABRICD */
goto out;
@ -1620,7 +1680,8 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
zlog_warn("Unsupported ISIS version %hhu", version1);
#ifndef FABRICD
/* send northbound notification */
isis_notif_version_skew(circuit, version1, raw_pdu);
isis_notif_version_skew(circuit, version1, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -1631,9 +1692,19 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
"IDFieldLengthMismatch: ID Length field in a received PDU %hhu, while the parameter for this IS is %u",
id_len, ISIS_SYS_ID_LEN);
circuit->id_len_mismatches++;
if (circuit->is_type == IS_LEVEL_1) {
circuit->area->id_len_mismatches[0]++;
} else if (circuit->is_type == IS_LEVEL_2) {
circuit->area->id_len_mismatches[1]++;
} else {
circuit->area->id_len_mismatches[0]++;
circuit->area->id_len_mismatches[1]++;
}
#ifndef FABRICD
/* send northbound notification */
isis_notif_id_len_mismatch(circuit, id_len, raw_pdu);
isis_notif_id_len_mismatch(circuit, id_len, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_ERROR;
}
@ -1662,7 +1733,8 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
zlog_warn("Unsupported ISIS PDU version %hhu", version2);
#ifndef FABRICD
/* send northbound notification */
isis_notif_version_skew(circuit, version2, raw_pdu);
isis_notif_version_skew(circuit, version2, raw_pdu,
sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_WARNING;
}
@ -1686,7 +1758,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
#ifndef FABRICD
/* send northbound notification */
isis_notif_max_area_addr_mismatch(circuit, max_area_addrs,
raw_pdu);
raw_pdu, sizeof(raw_pdu));
#endif /* ifndef FABRICD */
return ISIS_ERROR;
}
@ -2409,7 +2481,7 @@ void send_lsp(struct isis_circuit *circuit, struct isis_lsp *lsp,
#ifndef FABRICD
/* send a northbound notification */
isis_notif_lsp_too_large(circuit, stream_get_endp(lsp->pdu),
rawlspid_print(lsp->hdr.lsp_id));
lsp->hdr.lsp_id);
#endif /* ifndef FABRICD */
if (IS_DEBUG_PACKET_DUMP)
zlog_dump_data(STREAM_DATA(lsp->pdu),

3457
isisd/isis_snmp.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1821,6 +1821,7 @@ static int isis_run_spf_cb(struct thread *thread)
struct isis_spf_run *run = THREAD_ARG(thread);
struct isis_area *area = run->area;
int level = run->level;
int have_run = 0;
XFREE(MTYPE_ISIS_SPF_RUN, run);
area->spf_timer[level - 1] = NULL;
@ -1839,15 +1840,24 @@ static int isis_run_spf_cb(struct thread *thread)
zlog_debug("ISIS-SPF (%s) L%d SPF needed, periodic SPF",
area->area_tag, level);
if (area->ip_circuits)
if (area->ip_circuits) {
isis_run_spf_with_protection(
area, area->spftree[SPFTREE_IPV4][level - 1]);
if (area->ipv6_circuits)
have_run = 1;
}
if (area->ipv6_circuits) {
isis_run_spf_with_protection(
area, area->spftree[SPFTREE_IPV6][level - 1]);
if (area->ipv6_circuits && isis_area_ipv6_dstsrc_enabled(area))
have_run = 1;
}
if (area->ipv6_circuits && isis_area_ipv6_dstsrc_enabled(area)) {
isis_run_spf_with_protection(
area, area->spftree[SPFTREE_DSTSRC][level - 1]);
have_run = 1;
}
if (have_run)
area->spf_run_count[level]++;
isis_area_verify_routes(area);

View File

@ -89,6 +89,10 @@ static struct isis_master isis_master;
/* ISIS process wide configuration pointer to export. */
struct isis_master *im;
#ifndef FABRICD
DEFINE_HOOK(isis_hook_db_overload, (const struct isis_area *area), (area));
#endif /* ifndef FABRICD */
/*
* Prototypes.
*/
@ -214,6 +218,7 @@ struct isis *isis_new(const char *vrf_name)
isis->area_list = list_new();
isis->init_circ_list = list_new();
isis->uptime = time(NULL);
isis->snmp_notifications = 1;
dyn_cache_init(isis);
return isis;
@ -2563,6 +2568,14 @@ void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit)
if (new_overload_bit != area->overload_bit) {
area->overload_bit = new_overload_bit;
if (new_overload_bit)
area->overload_counter++;
#ifndef FABRICD
hook_call(isis_hook_db_overload, area);
#endif /* ifndef FABRICD */
lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
}
#ifndef FABRICD

View File

@ -63,6 +63,8 @@ extern void isis_cli_init(void);
all_vrf = strmatch(vrf_name, "all"); \
}
#define SNMP_CIRCUITS_MAX (512)
extern struct zebra_privs_t isisd_privs;
/* uncomment if you are a developer in bug hunt */
@ -93,6 +95,9 @@ struct isis {
time_t uptime; /* when did we start */
struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */
uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 1 through 255 */
struct isis_circuit *snmp_circuits[SNMP_CIRCUITS_MAX];
uint32_t snmp_circuit_id_last;
int snmp_notifications;
struct route_table *ext_info[REDIST_PROTOCOL_COUNT];
struct ldp_sync_info_cmd ldp_sync_cmd; /* MPLS LDP-IGP Sync */
@ -168,6 +173,7 @@ struct isis_area {
char is_type; /* level-1 level-1-2 or level-2-only */
/* are we overloaded? */
char overload_bit;
uint32_t overload_counter;
/* L1/L2 router identifier for inter-area traffic */
char attached_bit_send;
char attached_bit_rcv_ignore;
@ -180,6 +186,9 @@ struct isis_area {
int lsp_frag_threshold;
uint64_t lsp_gen_count[ISIS_LEVELS];
uint64_t lsp_purge_count[ISIS_LEVELS];
uint32_t lsp_exceeded_max_counter;
uint32_t lsp_seqno_skipped_counter;
uint64_t spf_run_count[ISIS_LEVELS];
int ip_circuits;
/* logging adjacency changes? */
uint8_t log_adj_changes;
@ -220,10 +229,19 @@ struct isis_area {
pdu_counter_t pdu_rx_counters;
uint64_t lsp_rxmt_count;
/* Area counters */
uint64_t rej_adjacencies[2];
uint64_t auth_type_failures[2];
uint64_t auth_failures[2];
uint64_t id_len_mismatches[2];
uint64_t lsp_error_counter[2];
QOBJ_FIELDS
};
DECLARE_QOBJ_TYPE(isis_area)
DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area))
void isis_terminate(void);
void isis_finish(struct isis *isis);
void isis_master_init(struct thread_master *master);

View File

@ -17,6 +17,9 @@ vtysh_scan += \
isisd/isisd.c \
# end
vtysh_daemons += isisd
if SNMP
module_LTLIBRARIES += isisd/isisd_snmp.la
endif
man8 += $(MANBUILD)/frr-isisd.8
endif
@ -137,7 +140,12 @@ isisd_isisd_SOURCES = $(ISIS_SOURCES)
nodist_isisd_isisd_SOURCES = \
yang/frr-isisd.yang.c \
# end
isisd_isisd_snmp_la_SOURCES = isisd/isis_snmp.c
isisd_isisd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu99
isisd_isisd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
isisd_isisd_snmp_la_LIBADD = lib/libfrrsnmp.la
# Building fabricd
FABRICD_CPPFLAGS = -DFABRICD=1 $(AM_CPPFLAGS)

View File

@ -246,6 +246,11 @@ DEFUN (no_agentx,
return CMD_WARNING_CONFIG_FAILED;
}
int smux_enabled(void)
{
return agentx_enabled;
}
void smux_init(struct thread_master *tm)
{
agentx_tm = tm;
@ -392,4 +397,9 @@ int smux_trap_multi_index(struct variable *vp, size_t vp_len, const oid *ename,
return 1;
}
void smux_events_update(void)
{
agentx_events_update();
}
#endif /* SNMP_AGENTX */

View File

@ -103,6 +103,8 @@ struct index_oid {
#define SNMP_IP6ADDRESS(V) (*var_len = sizeof(struct in6_addr), (uint8_t *)&V)
extern int smux_enabled(void);
extern void smux_init(struct thread_master *tm);
extern void smux_agentx_enable(void);
extern void smux_register_mib(const char *, struct variable *, size_t, int,
@ -143,6 +145,8 @@ extern int smux_trap_multi_index(struct variable *vp, size_t vp_len,
struct index_oid *iname, size_t index_len,
const struct trap_object *trapobj,
size_t trapobjlen, uint8_t sptrap);
extern void smux_events_update(void);
extern int oid_compare(const oid *, int, const oid *, int);
extern void oid2in_addr(oid[], int, struct in_addr *);
extern void oid2in6_addr(oid oid[], struct in6_addr *addr);

View File

@ -0,0 +1,12 @@
log file zebra.log
!
hostname ce3
!
interface ce3-eth0
ip address 172.16.1.3/24
no link-detect
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,24 @@
hostname r1
log file isisd.log
debug isis adj-packets
debug isis events
debug isis update-packets
agentx
!
router isis 1
net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00
metric-style wide
redistribute ipv4 connected level-1
redistribute ipv6 connected level-1
!
interface r1-eth0
ip router isis 1
ipv6 router isis 1
isis circuit-type level-1
!
interface r1-eth1
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!

View File

@ -0,0 +1,26 @@
hostname r1
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
agentx
!
mpls ldp
router-id 1.1.1.1
!
address-family ipv4
discovery transport-address 1.1.1.1
label local allocate host-routes
!
ttl-security disable
!
interface r1-eth0
!
interface r1-eth1
!
!
!
line vty
!

View File

@ -0,0 +1,143 @@
{
"1.1.1.1\/32":[
{
"prefix":"1.1.1.1\/32",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":1,
"interfaceName":"lo",
"active":true
}
]
}
],
"2.2.2.2\/32":[
{
"prefix":"2.2.2.2\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.1.2",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r1-eth1",
"active":true
}
]
}
],
"3.3.3.3\/32":[
{
"prefix":"3.3.3.3\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r1-eth2",
"active":true
}
]
}
],
"10.0.1.0\/24":[
{
"prefix":"10.0.1.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.1.2",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r1-eth1"
}
]
},
{
"prefix":"10.0.1.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"r1-eth1",
"active":true
}
]
}
],
"10.0.2.0\/24":[
{
"prefix":"10.0.2.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.2.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r1-eth2"
}
]
},
{
"prefix":"10.0.2.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":4,
"interfaceName":"r1-eth2",
"active":true
}
]
}
],
"10.0.3.0\/24":[
{
"prefix":"10.0.3.0\/24",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.1.2",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r1-eth1",
"active":true
},
{
"fib":true,
"ip":"10.0.2.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r1-eth2",
"active":true
}
]
}
]
}

View File

@ -0,0 +1,42 @@
{
"frr-interface:lib": {
"interface": [
{
"name": "r1-eth0",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0004",
"neighbor-extended-circuit-id": 2,
"state": "up"
}
]
}
}
}
},
{
"name": "r1-eth1",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0003",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
}
]
}
}

View File

@ -0,0 +1,15 @@
agentAddress udp:1.1.1.1:161
com2sec public 1.1.1.1 public
group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none
view all included .1
iquerySecName frr
rouser frr
master agentx

View File

@ -0,0 +1,24 @@
log file zebra.log
!
hostname r1
!
debug zebra kernel
debug zebra rib detailed
debug zebra dplane detailed
debug zebra nht
!
interface lo
ip address 1.1.1.1/32
!
interface r1-eth0
description to rt4
ip address 14.0.0.1/24
!
interface r1-eth1
description to rt3
ip address 13.0.0.1/24
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,25 @@
hostname r2
log file isisd.log
debug isis adj-packets
debug isis events
debug isis update-packets
agentx
!
router isis 1
net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00
metric-style wide
redistribute ipv4 connected level-1
redistribute ipv6 connected level-1
!
interface r2-eth0
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!
interface r2-eth1
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!

View File

@ -0,0 +1,25 @@
hostname r2
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
!
mpls ldp
router-id 2.2.2.2
!
address-family ipv4
discovery transport-address 2.2.2.2
label local allocate host-routes
!
ttl-security disable
!
interface r2-eth0
!
interface r2-eth1
!
!
!
line vty
!

View File

@ -0,0 +1,143 @@
{
"1.1.1.1\/32":[
{
"prefix":"1.1.1.1\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.1.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r2-eth1",
"active":true
}
]
}
],
"2.2.2.2\/32":[
{
"prefix":"2.2.2.2\/32",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":1,
"interfaceName":"lo",
"active":true
}
]
}
],
"3.3.3.3\/32":[
{
"prefix":"3.3.3.3\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.3.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r2-eth2",
"active":true
}
]
}
],
"10.0.1.0\/24":[
{
"prefix":"10.0.1.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.1.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r2-eth1"
}
]
},
{
"prefix":"10.0.1.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"r2-eth1",
"active":true
}
]
}
],
"10.0.2.0\/24":[
{
"prefix":"10.0.2.0\/24",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.1.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r2-eth1",
"active":true
},
{
"fib":true,
"ip":"10.0.3.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r2-eth2",
"active":true
}
]
}
],
"10.0.3.0\/24":[
{
"prefix":"10.0.3.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.3.3",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r2-eth2"
}
]
},
{
"prefix":"10.0.3.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":4,
"interfaceName":"r2-eth2",
"active":true
}
]
}
]
}

View File

@ -0,0 +1,42 @@
{
"frr-interface:lib": {
"interface": [
{
"name": "r2-eth0",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0005",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
},
{
"name": "r2-eth1",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0003",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
}
]
}
}

View File

@ -0,0 +1,15 @@
agentAddress udp:2.2.2.2:161
com2sec public 2.2.2.2 public
group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none
view all included .1
iquerySecName frr
rouser frr
master agentx

View File

@ -0,0 +1,24 @@
log file zebra.log
!
hostname r2
!
debug zebra rib detailed
debug zebra dplane detailed
debug zebra kernel
debug zebra nht
!
interface lo
ip address 2.2.2.2/32
!
interface r2-eth0
description to rt5
ip address 25.0.0.2/24
!
interface r2-eth1
description to rt3
ip address 23.0.0.2/24
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,25 @@
hostname r3
log file isisd.log
debug isis adj-packets
debug isis events
debug isis update-packets
agentx
!
router isis 1
net 10.0000.0000.0000.0000.0000.0000.0000.0000.0003.00
metric-style wide
redistribute ipv4 connected level-1
redistribute ipv6 connected level-1
!
interface r3-eth1
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!
interface r3-eth2
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!

View File

@ -0,0 +1,25 @@
hostname r3
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
!
address-family ipv4
discovery transport-address 3.3.3.3
label local allocate host-routes
!
ttl-security disable
!
interface r3-eth1
!
interface r3-eth2
!
!
!
line vty
!

View File

@ -0,0 +1,143 @@
{
"1.1.1.1\/32":[
{
"prefix":"1.1.1.1\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"2.2.2.2\/32":[
{
"prefix":"2.2.2.2\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"3.3.3.3\/32":[
{
"prefix":"3.3.3.3\/32",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":1,
"interfaceName":"lo",
"active":true
}
]
}
],
"10.0.1.0\/24":[
{
"prefix":"10.0.1.0\/24",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
},
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"10.0.2.0\/24":[
{
"prefix":"10.0.2.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1"
}
]
},
{
"prefix":"10.0.2.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"10.0.3.0\/24":[
{
"prefix":"10.0.3.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2"
}
]
},
{
"prefix":"10.0.3.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
]
}

View File

@ -0,0 +1,42 @@
{
"frr-interface:lib": {
"interface": [
{
"name": "r3-eth1",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0001",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
},
{
"name": "r3-eth2",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0002",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
}
]
}
}

View File

@ -0,0 +1,15 @@
agentAddress udp:3.3.3.3:161
com2sec public 3.3.3.3 public
group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none
view all included .1
iquerySecName frr
rouser frr
master agentx

View File

@ -0,0 +1,28 @@
log file zebra.log
!
hostname r3
!
debug zebra rib detailed
debug zebra dplane detailed
debug zebra kernel
debug zebra nht
!
interface lo
ip address 3.3.3.3/32
!
interface r3-eth0
description to ce3
ip address 172.16.1.3/24
!
interface r3-eth1
description to rt2
ip address 13.0.0.3/24
!
interface r3-eth2
description to rt1
ip address 23.0.0.3/24
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,24 @@
hostname r4
log file isisd.log
debug isis adj-packets
debug isis events
debug isis update-packets
agentx
!
router isis 1
net 10.0000.0000.0000.0000.0000.0000.0000.0000.0004.00
metric-style wide
redistribute ipv4 connected level-1
redistribute ipv6 connected level-1
!
interface r4-eth0
ip router isis 1
ipv6 router isis 1
isis circuit-type level-1
!
interface r4-eth1
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!

View File

@ -0,0 +1,25 @@
hostname r4
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
!
mpls ldp
router-id 4.4.4.4
!
address-family ipv4
discovery transport-address 4.4.4.4
label local allocate host-routes
!
ttl-security disable
!
interface r4-eth0
!
interface r4-eth1
!
!
!
line vty
!

View File

@ -0,0 +1,143 @@
{
"1.1.1.1\/32":[
{
"prefix":"1.1.1.1\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"2.2.2.2\/32":[
{
"prefix":"2.2.2.2\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"3.3.3.3\/32":[
{
"prefix":"3.3.3.3\/32",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":1,
"interfaceName":"lo",
"active":true
}
]
}
],
"10.0.1.0\/24":[
{
"prefix":"10.0.1.0\/24",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
},
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"10.0.2.0\/24":[
{
"prefix":"10.0.2.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1"
}
]
},
{
"prefix":"10.0.2.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"10.0.3.0\/24":[
{
"prefix":"10.0.3.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2"
}
]
},
{
"prefix":"10.0.3.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
]
}

View File

@ -0,0 +1,42 @@
{
"frr-interface:lib": {
"interface": [
{
"name": "r4-eth0",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0001",
"neighbor-extended-circuit-id": 2,
"state": "up"
}
]
}
}
}
},
{
"name": "r4-eth1",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0005",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
}
]
}
}

View File

@ -0,0 +1,15 @@
agentAddress udp:4.4.4.4:161
com2sec public 4.4.4.4 public
group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none
view all included .1
iquerySecName frr
rouser frr
master agentx

View File

@ -0,0 +1,24 @@
log file zebra.log
!
hostname r4
!
debug zebra rib detailed
debug zebra dplane detailed
debug zebra kernel
debug zebra nht
!
interface lo
ip address 4.4.4.4/32
!
interface r4-eth0
description to rt1
ip address 14.0.0.4/24
!
interface r4-eth1
description to rt5
ip address 45.0.0.4/24
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,25 @@
hostname r5
log file isisd.log
debug isis adj-packets
debug isis events
debug isis update-packets
agentx
!
router isis 1
net 10.0000.0000.0000.0000.0000.0000.0000.0000.0005.00
metric-style wide
redistribute ipv4 connected level-1
redistribute ipv6 connected level-1
!
interface r5-eth0
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!
interface r5-eth1
ip router isis 1
ipv6 router isis 1
isis network point-to-point
isis circuit-type level-1
!

View File

@ -0,0 +1,25 @@
hostname r5
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
!
mpls ldp
router-id 5.5.5.5
!
address-family ipv4
discovery transport-address 5.5.5.5
label local allocate host-routes
!
ttl-security disable
!
interface r5-eth0
!
interface r5-eth1
!
!
!
line vty
!

View File

@ -0,0 +1,25 @@
hostname r5
log file ldpd.log
!
debug mpls ldp zebra
debug mpls ldp event
debug mpls ldp errors
debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
!
address-family ipv4
discovery transport-address 5.5.5.5
label local allocate host-routes
!
ttl-security disable
!
interface r5-eth0
!
interface r5-eth1
!
!
!
line vty
!

View File

@ -0,0 +1,143 @@
{
"1.1.1.1\/32":[
{
"prefix":"1.1.1.1\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"2.2.2.2\/32":[
{
"prefix":"2.2.2.2\/32",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"3.3.3.3\/32":[
{
"prefix":"3.3.3.3\/32",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":1,
"interfaceName":"lo",
"active":true
}
]
}
],
"10.0.1.0\/24":[
{
"prefix":"10.0.1.0\/24",
"protocol":"isis",
"selected":true,
"distance":115,
"metric":10,
"nexthops":[
{
"fib":true,
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
},
{
"fib":true,
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
],
"10.0.2.0\/24":[
{
"prefix":"10.0.2.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.2.1",
"afi":"ipv4",
"interfaceIndex":3,
"interfaceName":"r3-eth1"
}
]
},
{
"prefix":"10.0.2.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"r3-eth1",
"active":true
}
]
}
],
"10.0.3.0\/24":[
{
"prefix":"10.0.3.0\/24",
"protocol":"isis",
"distance":115,
"metric":10,
"nexthops":[
{
"ip":"10.0.3.2",
"afi":"ipv4",
"interfaceIndex":4,
"interfaceName":"r3-eth2"
}
]
},
{
"prefix":"10.0.3.0\/24",
"protocol":"connected",
"selected":true,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceIndex":4,
"interfaceName":"r3-eth2",
"active":true
}
]
}
]
}

View File

@ -0,0 +1,42 @@
{
"frr-interface:lib": {
"interface": [
{
"name": "r5-eth0",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0002",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
},
{
"name": "r5-eth1",
"vrf": "default",
"state": {
"frr-isisd:isis": {
"adjacencies": {
"adjacency": [
{
"neighbor-sys-type": "level-1",
"neighbor-sysid": "0000.0000.0004",
"neighbor-extended-circuit-id": 0,
"state": "up"
}
]
}
}
}
}
]
}
}

View File

@ -0,0 +1,15 @@
agentAddress udp:5.5.5.5:161
com2sec public 5.5.5.5 public
group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none
view all included .1
iquerySecName frr
rouser frr
master agentx

View File

@ -0,0 +1,24 @@
log file zebra.log
!
hostname r5
!
debug zebra rib detailed
debug zebra dplane detailed
debug zebra kernel
debug zebra nht
!
interface lo
ip address 5.5.5.5/32
!
interface r5-eth0
description to rt2
ip address 25.0.0.5/24
!
interface r5-eth1
description to rt4
ip address 45.0.0.5/24
!
ip forwarding
!
line vty
!

View File

@ -0,0 +1,114 @@
## Color coding:
#########################
## Main FRR: #f08080 red
## Switches: #d0e0d0 gray
## RIP: #19e3d9 Cyan
## RIPng: #fcb314 dark yellow
## OSPFv2: #32b835 Green
## OSPFv3: #19e3d9 Cyan
## ISIS IPv4 #fcb314 dark yellow
## ISIS IPv6 #9a81ec purple
## BGP IPv4 #eee3d3 beige
## BGP IPv6 #fdff00 yellow
##### Colors (see http://www.color-hex.com/)
graph template {
label="Test Topology - LDP-VPLS 1";
# Routers
ce3 [
shape=doubleoctagon
label="ce3",
fillcolor="#f08080",
style=filled,
];
r1 [
shape=doubleoctagon,
label="r1",
fillcolor="#f08080",
style=filled,
];
r2 [
shape=doubleoctagon
label="r2",
fillcolor="#f08080",
style=filled,
];
r3 [
shape=doubleoctagon
label="r3",
fillcolor="#f08080",
style=filled,
];
r4 [
shape=doubleoctagon
label="r4",
fillcolor="#f08080",
style=filled,
];
r5 [
shape=doubleoctagon
label="r5",
fillcolor="#f08080",
style=filled,
];
# Switches
s1 [
shape=oval,
label="s1\n14.0.0/24",
fillcolor="#d0e0d0",
style=filled,
];
s2 [
shape=oval,
label="s2\n25.0.0.0/24",
fillcolor="#d0e0d0",
style=filled,
];
s3 [
shape=oval,
label="s3\n172.16.1.0/24",
fillcolor="#d0e0d0",
style=filled,
];
s4 [
shape=oval,
label="s4\n45.0.0.0/24",
fillcolor="#d0e0d0",
style=filled,
];
s5 [
shape=oval,
label="s5\n13.0.0.0/24",
fillcolor="#d0e0d0",
style=filled,
];
s6 [
shape=oval,
label="s6\n23.0.0.0/24",
fillcolor="#d0e0d0",
style=filled,
];
# Connections
ce3 -- s3 [label="eth0\n.3"];
r1 -- s1 [label="eth1\n.1"];
r1 -- s5 [label="eth2\n.1"];
r2 -- s2 [label="eth1\n.2"];
r2 -- s6 [label="eth2\n.2"];
r3 -- s5 [label="eth1\n.3"];
r3 -- s6 [label="eth2\n.3"];
r4 -- s1 [label="eth1\n.4"];
r4 -- s4 [label="eth2\n.4"];
r5 -- s2 [label="eth1\n.5"];
r5 -- s4 [label="eth2\n.5"];
}

View File

@ -0,0 +1,373 @@
#!/usr/bin/env python
#
# test_isis_snmp.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2020 by Volta Networks
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear
# in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
"""
test_isis_snmp.py:
+---------+ 45.0.0.0/24 +---------+
| | rt4-eth1 | |
| RT4 +----------------+ RT5 |
| | rt5-eth1| |
+---------+ +---------+
rt4-eth0| |rt5-eth0
| |
14.0.0.0/24| |25.0.0.0/24
| |
rt1-eth0| |rt2-eth0
+---------+ +---------+
| | | |
| RT1 | | RT2 |
| 1.1.1.1 | | 2.2.2.2 |
| | | |
+---------+ +---------+
rt1-eth1| |rt2-eth1
| |
| |
13.0.0.0/24| +---------+ |23.0.0.0/24
| | | |
| | RT3 | |
+--------+ 3.3.3.3 +-------+
rt3-eth1| |rt3-eth2
+---------+
|rt3-eth0
|
|
ce3-eth0 (172.16.1.3/24)|
+---------+
| |
| CE3 |
| |
+---------+
"""
import os
import re
import sys
import pytest
import json
from time import sleep
from functools import partial
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Import topogen and topotest helpers
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.snmptest import SnmpTester
# Required to instantiate the topology builder class.
from mininet.topo import Topo
class TemplateTopo(Topo):
"Test topology builder"
def build(self, *_args, **_opts):
"Build function"
tgen = get_topogen(self)
#
# Define FRR Routers
#
for router in ["ce3", "r1", "r2", "r3", "r4", "r5"]:
tgen.add_router(router)
#
# Define connections
#
switch = tgen.add_switch("s1")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r4"])
switch = tgen.add_switch("s2")
switch.add_link(tgen.gears["r5"])
switch.add_link(tgen.gears["r2"])
switch = tgen.add_switch("s3")
switch.add_link(tgen.gears["ce3"])
switch.add_link(tgen.gears["r3"])
switch = tgen.add_switch("s4")
switch.add_link(tgen.gears["r4"])
switch.add_link(tgen.gears["r5"])
switch = tgen.add_switch("s5")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r3"])
switch = tgen.add_switch("s6")
switch.add_link(tgen.gears["r2"])
switch.add_link(tgen.gears["r3"])
def setup_module(mod):
"Sets up the pytest environment"
# skip tests is SNMP not installed
if not os.path.isfile("/usr/sbin/snmpd"):
error_msg = "SNMP not installed - skipping"
pytest.skip(error_msg)
# This function initiates the topology build with Topogen...
tgen = Topogen(TemplateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
tgen.start_topology()
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
for rname, router in router_list.iteritems():
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
# Don't start the following in the CE nodes
if router.name[0] == "r":
router.load_config(
TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname)),
"-M snmp",
)
router.load_config(
TopoRouter.RD_LDP, os.path.join(CWD, "{}/ldpd.conf".format(rname)),
)
router.load_config(
TopoRouter.RD_SNMP, os.path.join(CWD, "{}/snmpd.conf".format(rname)),
"-Le -Ivacm_conf,usmConf,iquery -V -DAgentX,trap",
)
# After loading the configurations, this function loads configured daemons.
tgen.start_router()
def teardown_module(mod):
"Teardown the pytest environment"
tgen = get_topogen()
# This function tears down the whole topology.
tgen.stop_topology()
def router_compare_json_output(rname, command, reference):
"Compare router JSON output"
logger.info('Comparing router "%s" "%s" output', rname, command)
tgen = get_topogen()
filename = "{}/{}/{}".format(CWD, rname, reference)
expected = json.loads(open(filename).read())
# Run test function until we get an result. Wait at most 80 seconds.
test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected)
_, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
assert diff is None, assertmsg
def generate_oid(numoids, index1, index2):
if numoids == 1:
oid = "{}".format(index1)
else:
oid = "{}.{}".format(index1, index2)
return oid
def test_isis_convergence():
logger.info("Test: check ISIS adjacencies")
tgen = get_topogen()
for rname in ["r1", "r2", "r3", "r4", "r5"]:
router_compare_json_output(
rname,
"show yang operational-data /frr-interface:lib isisd",
"show_yang_interface_isis_adjacencies.ref")
def test_r1_scalar_snmp():
"Wait for protocol convergence"
tgen = get_topogen()
# Skip if previous fatal error condition is raised
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.net.get("r1")
r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
assert r1_snmp.test_oid('isisSysVersion', "one(1)")
assert r1_snmp.test_oid('isisSysLevelType', "level1and2(3)")
assert r1_snmp.test_oid('isisSysID',"00 00 00 00 00 01")
assert r1_snmp.test_oid('isisSysMaxPathSplits',"32")
assert r1_snmp.test_oid('isisSysMaxLSPGenInt',"900 seconds")
assert r1_snmp.test_oid('isisSysAdminState',"on(1)")
assert r1_snmp.test_oid('isisSysMaxAge',"1200 seconds")
assert r1_snmp.test_oid('isisSysProtSupported',"07 5 6 7")
r2 = tgen.net.get("r2")
r2_snmp = SnmpTester(r2, "2.2.2.2", "public", "2c")
assert r2_snmp.test_oid('isisSysVersion', "one(1)")
assert r2_snmp.test_oid('isisSysLevelType', "level1and2(3)")
assert r2_snmp.test_oid('isisSysID',"00 00 00 00 00 02")
assert r2_snmp.test_oid('isisSysMaxPathSplits',"32")
assert r2_snmp.test_oid('isisSysMaxLSPGenInt',"900 seconds")
assert r2_snmp.test_oid('isisSysAdminState',"on(1)")
assert r2_snmp.test_oid('isisSysMaxAge',"1200 seconds")
assert r2_snmp.test_oid('isisSysProtSupported',"07 5 6 7")
circtable_test = {
"isisCircIfIndex": ["2", "3", "1"],
"isisCircAdminState": ["on(1)", "on(1)", "on(1)"],
"isisCircExistState": ["active(1)", "active(1)", "active(1)"],
"isisCircType": ["broadcast(1)", "ptToPt(2)", "staticIn(3)"],
"isisCircExtDomain": ["false(2)", "false(2)", "false(2)"],
"isisCircLevelType": ["level1(1)", "level1(1)", "level1and2(3)"],
"isisCircPassiveCircuit": ["false(2)", "false(2)", "true(1)"],
"isisCircMeshGroupEnabled": ["inactive(1)", "inactive(1)", "inactive(1)"],
"isisCircSmallHellos": ["false(2)", "false(2)", "false(2)"],
"isisCirc3WayEnabled": ["false(2)", "false(2)", "false(2)"],
}
def test_r1_isisCircTable():
tgen = get_topogen()
r1 = tgen.net.get("r1")
r1r = tgen.gears["r1"]
r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
oids = []
oids.append(generate_oid(1,1,0))
oids.append(generate_oid(1,2,0))
oids.append(generate_oid(1,3,0))
# check items
for item in circtable_test.keys():
assertmsg = "{} should be {} oids {} full dict {}:".format(
item, circtable_test[item], oids, r1_snmp.walk(item)
)
assert r1_snmp.test_oid_walk(item, circtable_test[item], oids), assertmsg
circleveltable_test = {
"isisCircLevelMetric": ["10", "10", "10", "10"],
"isisCircLevelWideMetric": ["10", "10", "0", "0"],
"isisCircLevelISPriority": ["64", "64", "64", "64"],
"isisCircLevelIDOctet": ["2", "0", "0", "0"],
"isisCircLevelHelloMultiplier": ["10", "10", "10", "10"],
"isisCircLevelHelloTimer": ["3000 milliseconds", "3000 milliseconds", "3000 milliseconds", "3000 milliseconds"],
"isisCircLevelMinLSPRetransInt": ["1 seconds", "1 seconds", "0 seconds", "0 seconds"],
}
def test_r1_isislevelCircTable():
tgen = get_topogen()
r1 = tgen.net.get("r1")
r1r = tgen.gears["r1"]
r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
oids = []
oids.append(generate_oid(2,1,"area"))
oids.append(generate_oid(2,2,"area"))
oids.append(generate_oid(2,3,"area"))
oids.append(generate_oid(2,3,"domain"))
# check items
for item in circleveltable_test.keys():
assertmsg = "{} should be {} oids {} full dict {}:".format(
item, circleveltable_test[item], oids, r1_snmp.walk(item)
)
assert r1_snmp.test_oid_walk(item, circleveltable_test[item], oids), assertmsg
adjtable_test = {
"isisISAdjState": ["up(3)", "up(3)"],
"isisISAdj3WayState": ["down(2)", "up(0)"],
"isisISAdjNeighSysType": ["l1IntermediateSystem(1)", "l1IntermediateSystem(1)"],
"isisISAdjNeighSysID": ["00 00 00 00 00 04", "00 00 00 00 00 03"],
"isisISAdjNbrExtendedCircID": ["0", "0"],
"isisISAdjUsage": ["0", "level1(1)"],
"isisISAdjNeighPriority": ["64", "0"],
}
adjtable_down_test = {
"isisISAdjState": ["up(3)"],
"isisISAdj3WayState": ["down(2)"],
"isisISAdjNeighSysType": ["l1IntermediateSystem(1)"],
"isisISAdjNeighSysID": ["00 00 00 00 00 04"],
"isisISAdjNbrExtendedCircID": ["0"],
"isisISAdjUsage": ["0"],
"isisISAdjNeighPriority": ["64"],
}
def test_r1_isisAdjTable():
"check ISIS Adjacency Table"
tgen = get_topogen()
r1 = tgen.net.get("r1")
r1_cmd = tgen.gears["r1"]
r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
oids = []
oids.append(generate_oid(2,1,1))
oids.append(generate_oid(2,2,1))
oids_down = []
oids_down.append(generate_oid(2,1,1))
# check items
for item in adjtable_test.keys():
assertmsg = "{} should be {} oids {} full dict {}:".format(
item, adjtable_test[item], oids, r1_snmp.walk(item)
)
assert r1_snmp.test_oid_walk(item, adjtable_test[item], oids), assertmsg
# shutdown interface and one adjacency should be removed
"check ISIS adjacency is removed when interface is shutdown"
r1_cmd.vtysh_cmd("conf t\ninterface r1-eth1\nshutdown")
r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
for item in adjtable_down_test.keys():
assertmsg = "{} should be {} oids {} full dict {}:".format(
item, adjtable_down_test[item], oids_down, r1_snmp.walk(item)
)
assert r1_snmp.test_oid_walk(item, adjtable_down_test[item], oids_down), assertmsg
# no shutdown interface and adjacency should be restored
r1_cmd.vtysh_cmd("conf t\ninterface r1-eth1\nno shutdown")
# Memory leak test template
# disabling memory leak
def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()
if not tgen.is_memleak_enabled():
pytest.skip("Memory leak test/report is disabled")
tgen.report_memory_leaks()
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))

View File

@ -107,7 +107,7 @@ sub scan_file {
$protocol = "VTYSH_ALL";
}
elsif ($file =~ /lib\/agentx\.c$/) {
$protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
$protocol = "VTYSH_ISISD|VTYSH_RIPD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
}
elsif ($file =~ /lib\/nexthop_group\.c$/) {
$protocol = "VTYSH_NH_GROUP";