* Default values
*/
#ifndef FABRICD
- circuit->is_type = yang_get_default_enum(
+ circuit->is_type_config = yang_get_default_enum(
"/frr-interface:lib/interface/frr-isisd:isis/circuit-type");
circuit->flags = 0;
circuit->level_arg[i].circuit = circuit;
}
#else
- circuit->is_type = IS_LEVEL_1_AND_2;
+ circuit->is_type_config = IS_LEVEL_1_AND_2;
circuit->flags = 0;
circuit->pad_hellos = 1;
for (i = 0; i < 2; i++) {
}
#endif /* ifndef FABRICD */
+ circuit->is_type = circuit->is_type_config;
+
circuit_mt_init(circuit);
isis_lfa_excluded_ifaces_init(circuit, ISIS_LEVEL1);
isis_lfa_excluded_ifaces_init(circuit, ISIS_LEVEL2);
/* Free the index of SRM and SSN flags */
flags_free_index(&area->flags, circuit->idx);
circuit->idx = 0;
+
+ /* Reset IS type to configured */
+ circuit->is_type = circuit->is_type_config;
+
/* Remove circuit from area */
assert(circuit->area == area);
listnode_delete(area->circuit_list, circuit);
"IS-IS routing protocol\n"
"Routing process tag\n")
{
- char inst_xpath[XPATH_MAXLEN];
- const struct lyd_node *if_dnode, *inst_dnode;
- const char *circ_type = NULL;
- const char *vrf_name;
-
- if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
- if (!if_dnode) {
- vty_out(vty, "%% Failed to get iface dnode in candidate DB\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- vrf_name = yang_dnode_get_string(if_dnode, "vrf");
-
- snprintf(inst_xpath, XPATH_MAXLEN,
- "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag,
- vrf_name);
-
- /* if instance exists then inherit its type, create it otherwise */
- inst_dnode = yang_dnode_get(vty->candidate_config->dnode, inst_xpath);
- if (inst_dnode)
- circ_type = yang_dnode_get_string(inst_dnode, "is-type");
- else
- nb_cli_enqueue_change(vty, inst_xpath, NB_OP_CREATE, NULL);
-
nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY,
tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",
NB_OP_MODIFY, "true");
- if (circ_type)
- nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
- NB_OP_MODIFY, circ_type);
return nb_cli_apply_changes(vty, NULL);
}
"IS-IS routing protocol\n"
"Routing process tag\n")
{
- char inst_xpath[XPATH_MAXLEN];
- const struct lyd_node *if_dnode, *inst_dnode;
- const char *circ_type = NULL;
- const char *vrf_name;
-
- if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
- if (!if_dnode) {
- vty_out(vty, "%% Failed to get iface dnode in candidate DB\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- vrf_name = yang_dnode_get_string(if_dnode, "vrf");
-
- snprintf(inst_xpath, XPATH_MAXLEN,
- "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag,
- vrf_name);
-
- /* if instance exists then inherit its type, create it otherwise */
- inst_dnode = yang_dnode_get(vty->candidate_config->dnode, inst_xpath);
- if (inst_dnode)
- circ_type = yang_dnode_get_string(inst_dnode, "is-type");
- else
- nb_cli_enqueue_change(vty, inst_xpath, NB_OP_CREATE, NULL);
-
nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY,
tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",
NB_OP_MODIFY, "true");
- if (circ_type)
- nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
- NB_OP_MODIFY, circ_type);
return nb_cli_apply_changes(vty, NULL);
}
"Level-1-2 adjacencies are formed\n"
"Level-2 only adjacencies are formed\n")
{
- char inst_xpath[XPATH_MAXLEN];
- const struct lyd_node *if_dnode, *inst_dnode;
- const char *vrf_name;
- const char *tag;
- const char *circ_type = NULL;
-
- /*
- * Default value depends on whether the circuit is part of an area,
- * and the is-type of the area if there is one. So we need to do this
- * here.
- */
- if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
- if (!if_dnode) {
- vty_out(vty, "%% Failed to get iface dnode in candidate DB\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- if (!yang_dnode_exists(if_dnode, "frr-isisd:isis/area-tag")) {
- vty_out(vty, "%% ISIS is not configured on the interface\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- vrf_name = yang_dnode_get_string(if_dnode, "vrf");
- tag = yang_dnode_get_string(if_dnode, "frr-isisd:isis/area-tag");
-
- snprintf(inst_xpath, XPATH_MAXLEN,
- "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag,
- vrf_name);
-
- inst_dnode = yang_dnode_get(vty->candidate_config->dnode, inst_xpath);
- if (inst_dnode)
- circ_type = yang_dnode_get_string(inst_dnode, "is-type");
-
nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
- NB_OP_MODIFY, circ_type);
+ NB_OP_MODIFY, NULL);
return nb_cli_apply_changes(vty, NULL);
}
{
int circ_type = yang_dnode_get_enum(args->dnode, NULL);
struct isis_circuit *circuit;
- struct interface *ifp;
- struct vrf *vrf;
- const char *ifname, *vrfname;
switch (args->event) {
case NB_EV_VALIDATE:
- /* libyang doesn't like relative paths across module boundaries
- */
- ifname = yang_dnode_get_string(
- lyd_parent(lyd_parent(args->dnode)), "./name");
- vrfname = yang_dnode_get_string(
- lyd_parent(lyd_parent(args->dnode)), "./vrf");
- vrf = vrf_lookup_by_name(vrfname);
- assert(vrf);
- ifp = if_lookup_by_name(ifname, vrf->vrf_id);
- if (!ifp)
- break;
-
- circuit = circuit_scan_by_ifp(ifp);
- if (circuit && circuit->state == C_STATE_UP
- && circuit->area->is_type != IS_LEVEL_1_AND_2
- && circuit->area->is_type != circ_type) {
- snprintf(args->errmsg, args->errmsg_len,
- "Invalid circuit level for area %s",
- circuit->area->area_tag);
- return NB_ERR_VALIDATION;
- }
- break;
case NB_EV_PREPARE:
case NB_EV_ABORT:
break;
case NB_EV_APPLY:
circuit = nb_running_get_entry(args->dnode, NULL, true);
+ circuit->is_type_config = circ_type;
isis_circuit_is_type_set(circuit, circ_type);
break;
}