@@ -2960,8 +2960,8 @@ int lib_interface_pim_address_family_mroute_destroy(
29602960/*
29612961 * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family/mroute/oif
29622962 */
2963- int lib_interface_pim_address_family_mroute_oif_modify (
2964- struct nb_cb_modify_args * args )
2963+ int lib_interface_pim_address_family_mroute_oif_create (
2964+ struct nb_cb_create_args * args )
29652965{
29662966 struct pim_instance * pim ;
29672967 struct pim_interface * pim_iifp ;
@@ -3004,7 +3004,16 @@ int lib_interface_pim_address_family_mroute_oif_modify(
30043004 case NB_EV_ABORT :
30053005 break ;
30063006 case NB_EV_APPLY :
3007- iif = nb_running_get_entry (args -> dnode , NULL , true);
3007+ if_dnode = yang_dnode_get_parent (args -> dnode , "interface" );
3008+ if (!if_dnode ) {
3009+ snprintf (args -> errmsg , args -> errmsg_len ,
3010+ "%% Enable PIM and/or IGMP on this interface first" );
3011+ return NB_ERR_INCONSISTENCY ;
3012+ }
3013+ iif = nb_running_get_entry (if_dnode , NULL , true);
3014+ if (!iif )
3015+ return NB_ERR_INCONSISTENCY ;
3016+
30083017 pim_iifp = iif -> info ;
30093018 pim = pim_iifp -> pim ;
30103019
@@ -3035,11 +3044,59 @@ int lib_interface_pim_address_family_mroute_oif_modify(
30353044int lib_interface_pim_address_family_mroute_oif_destroy (
30363045 struct nb_cb_destroy_args * args )
30373046{
3047+ struct pim_instance * pim ;
3048+ struct pim_interface * pim_iifp ;
3049+ struct interface * iif ;
3050+ struct interface * oif ;
3051+ const char * oifname ;
3052+ pim_addr source_addr ;
3053+ pim_addr group_addr ;
3054+ const struct lyd_node * if_dnode ;
3055+
30383056 switch (args -> event ) {
30393057 case NB_EV_VALIDATE :
3058+ if_dnode = yang_dnode_get_parent (args -> dnode , "interface" );
3059+ if (!is_pim_interface (if_dnode )) {
3060+ snprintf (args -> errmsg , args -> errmsg_len ,
3061+ "%% Enable PIM and/or IGMP on this interface first" );
3062+ return NB_ERR_VALIDATION ;
3063+ }
3064+ break ;
30403065 case NB_EV_PREPARE :
30413066 case NB_EV_ABORT :
3067+ break ;
30423068 case NB_EV_APPLY :
3069+ if_dnode = yang_dnode_get_parent (args -> dnode , "interface" );
3070+ if (!if_dnode ) {
3071+ snprintf (args -> errmsg , args -> errmsg_len ,
3072+ "%% Enable PIM and/or IGMP on this interface first" );
3073+ return NB_ERR_INCONSISTENCY ;
3074+ }
3075+ iif = nb_running_get_entry (if_dnode , NULL , true);
3076+ if (!iif )
3077+ return NB_ERR_INCONSISTENCY ;
3078+
3079+
3080+ pim_iifp = iif -> info ;
3081+ pim = pim_iifp -> pim ;
3082+
3083+ oifname = yang_dnode_get_string (args -> dnode , NULL );
3084+ oif = if_lookup_by_name (oifname , pim -> vrf -> vrf_id );
3085+ if (!oif ) {
3086+ snprintf (args -> errmsg , args -> errmsg_len ,
3087+ "No such interface name %s" ,
3088+ oifname );
3089+ return NB_ERR_INCONSISTENCY ;
3090+ }
3091+
3092+ yang_dnode_get_pimaddr (& source_addr , args -> dnode , "../source-addr" );
3093+ yang_dnode_get_pimaddr (& group_addr , args -> dnode , "../group-addr" );
3094+
3095+ if (pim_static_del (pim , iif , oif , group_addr , source_addr )) {
3096+ snprintf (args -> errmsg , args -> errmsg_len ,
3097+ "Failed to del static mroute" );
3098+ return NB_ERR_INCONSISTENCY ;
3099+ }
30433100 break ;
30443101 }
30453102
0 commit comments