diff options
| author | Christian Hopps <chopps@gmail.com> | 2021-05-04 10:41:58 -0400 | 
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2021-05-13 16:24:48 -0400 | 
| commit | 3bb513c399c2e7c8dd597b7399dd7c0f064842d0 (patch) | |
| tree | 14f3e677c49fce272946788f8a8b8f3f8a3e26b5 /isisd | |
| parent | 17daea8a184c0e85b9788329f3c808ceab916ad5 (diff) | |
lib: adapt to version 2 of libyang
Compile with v2.0.0 tag of `libyang2` branch of:
https://github.com/CESNET/libyang
staticd init load time of 10k routes now 6s vs ly1 time of 150s
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'isisd')
| -rw-r--r-- | isisd/isis_circuit.c | 2 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 26 | ||||
| -rw-r--r-- | isisd/isis_nb_config.c | 32 | 
3 files changed, 32 insertions, 28 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 2c51f21d77..2a197ab2b7 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -1306,7 +1306,7 @@ static int isis_interface_config_write(struct vty *vty)  		FOR_ALL_INTERFACES (vrf, ifp) {  			struct lyd_node *dnode; -			dnode = yang_dnode_get( +			dnode = yang_dnode_getf(  				running_config->dnode,  				"/frr-interface:lib/interface[name='%s'][vrf='%s']",  				ifp->name, vrf->name); diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 14fa414c52..5aea9f25d9 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -110,7 +110,7 @@ DEFPY_YANG(no_router_isis, no_router_isis_cmd,  	if (!vrf_name)  		vrf_name = VRF_DEFAULT_NAME; -	if (!yang_dnode_exists( +	if (!yang_dnode_existsf(  		    vty->candidate_config->dnode,  		    "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag,  		    vrf_name)) { @@ -277,8 +277,8 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (!dnode)  		return CMD_SUCCESS; @@ -345,8 +345,8 @@ DEFPY_YANG(isis_bfd,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (dnode == NULL) {  		vty_out(vty, "ISIS is not enabled on this circuit\n");  		return CMD_SUCCESS; @@ -371,8 +371,8 @@ DEFPY_YANG(isis_bfd_profile,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (dnode == NULL) {  		vty_out(vty, "ISIS is not enabled on this circuit\n");  		return CMD_SUCCESS; @@ -3092,8 +3092,8 @@ DEFPY(isis_mpls_if_ldp_sync, isis_mpls_if_ldp_sync_cmd,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (dnode == NULL) {  		vty_out(vty, "ISIS is not enabled on this circuit\n");  		return CMD_SUCCESS; @@ -3123,8 +3123,8 @@ DEFPY(isis_mpls_if_ldp_sync_holddown, isis_mpls_if_ldp_sync_holddown_cmd,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (dnode == NULL) {  		vty_out(vty, "ISIS is not enabled on this circuit\n");  		return CMD_SUCCESS; @@ -3143,8 +3143,8 @@ DEFPY(no_isis_mpls_if_ldp_sync_holddown, no_isis_mpls_if_ldp_sync_holddown_cmd,  {  	const struct lyd_node *dnode; -	dnode = yang_dnode_get(vty->candidate_config->dnode, -			       "%s/frr-isisd:isis", VTY_CURR_XPATH); +	dnode = yang_dnode_getf(vty->candidate_config->dnode, +				"%s/frr-isisd:isis", VTY_CURR_XPATH);  	if (dnode == NULL) {  		vty_out(vty, "ISIS is not enabled on this circuit\n");  		return CMD_SUCCESS; diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 87cd732e0b..68a4581a46 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2509,10 +2509,10 @@ int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args)  	if (args->event == NB_EV_VALIDATE) {  		/* libyang doesn't like relative paths across module boundaries  		 */ -		ifname = yang_dnode_get_string(args->dnode->parent->parent, -					       "./name"); -		vrfname = yang_dnode_get_string(args->dnode->parent->parent, -						"./vrf"); +		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); @@ -2549,10 +2549,10 @@ int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args *args)  	case NB_EV_VALIDATE:  		/* libyang doesn't like relative paths across module boundaries  		 */ -		ifname = yang_dnode_get_string(args->dnode->parent->parent, -					       "./name"); -		vrfname = yang_dnode_get_string(args->dnode->parent->parent, -						"./vrf"); +		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); @@ -3184,8 +3184,9 @@ int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args *args)  	switch (args->event) {  	case NB_EV_VALIDATE: -		ifp = nb_running_get_entry(args->dnode->parent->parent->parent, -					   NULL, false); +		ifp = nb_running_get_entry( +			lyd_parent(lyd_parent(lyd_parent(args->dnode))), NULL, +			false);  		if (ifp == NULL)  			return NB_ERR_VALIDATION;  		if (if_is_loopback(ifp)) { @@ -3239,8 +3240,10 @@ int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args *args)  	switch (args->event) {  	case NB_EV_VALIDATE: -		ifp = nb_running_get_entry(args->dnode->parent->parent->parent, -					   NULL, false); + +		ifp = nb_running_get_entry( +			lyd_parent(lyd_parent(lyd_parent(args->dnode))), NULL, +			false);  		if (ifp == NULL)  			return NB_ERR_VALIDATION;  		if (if_is_loopback(ifp)) { @@ -3283,8 +3286,9 @@ int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args *args)  	switch (args->event) {  	case NB_EV_VALIDATE: -		ifp = nb_running_get_entry(args->dnode->parent->parent->parent, -					   NULL, false); +		ifp = nb_running_get_entry( +			lyd_parent(lyd_parent(lyd_parent(args->dnode))), NULL, +			false);  		if (ifp == NULL)  			return NB_ERR_VALIDATION;  		if (if_is_loopback(ifp)) {  | 
