@@ -247,15 +247,16 @@ static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *paren
247247int ietf_routing_change (sr_session_ctx_t * session , struct lyd_node * config , struct lyd_node * diff , sr_event_t event , struct confd * confd )
248248{
249249 int staticd_enabled = 0 , ospfd_enabled = 0 , bfdd_enabled = 0 ;
250+ struct lyd_node * cplane , * cplanes ;
250251 bool ospfd_running , bfdd_running ;
251- struct lyd_node * cplane , * tmp ;
252252 bool restart_zebra = false;
253253 int rc = SR_ERR_OK ;
254254 FILE * fp ;
255255
256- if (!lydx_get_xpathf (diff , "/ietf-routing:routing/control-plane-protocols " ))
256+ if (!lydx_get_xpathf (diff , "/ietf-routing:routing" ))
257257 return SR_ERR_OK ;
258258
259+ ERROR ("Now setting up routing" );
259260 switch (event ) {
260261 case SR_EV_ENABLED : /* first time, on register. */
261262 case SR_EV_CHANGE : /* regular change (copy cand running) */
@@ -352,16 +353,15 @@ int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, stru
352353 return SR_ERR_OK ;
353354 }
354355
355- LY_LIST_FOR ( lyd_child ( config ), tmp ) {
356- LY_LIST_FOR ( lyd_child ( tmp ) , cplane ) {
357- const char * type ;
356+ cplanes = lydx_get_descendant ( config , "routing" , "control-plane-protocols" , "control-plane-protocol" , NULL );
357+ LYX_LIST_FOR_EACH ( cplanes , cplane , "control-plane-protocol" ) {
358+ const char * type ;
358359
359- type = lydx_get_cattr (cplane , "type" );
360- if (!strcmp (type , "infix-routing:static" )) {
361- staticd_enabled = parse_static_routes (session , lydx_get_child (cplane , "static-routes" ), fp );
362- } else if (!strcmp (type , "infix-routing:ospfv2" )) {
363- parse_ospf (session , lydx_get_child (cplane , "ospf" ));
364- }
360+ type = lydx_get_cattr (cplane , "type" );
361+ if (!strcmp (type , "infix-routing:static" )) {
362+ staticd_enabled = parse_static_routes (session , lydx_get_child (cplane , "static-routes" ), fp );
363+ } else if (!strcmp (type , "infix-routing:ospfv2" )) {
364+ parse_ospf (session , lydx_get_child (cplane , "ospf" ));
365365 }
366366 }
367367
0 commit comments