mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 11:45:06 +00:00 
			
		
		
		
	yang, lib: add 'frr-interface.yang' and associated stub callbacks
Introduce frr-interface.yang, which defines a model for managing FRR interfaces. Update the 'frr_yang_module_info' array of all daemons that will implement this module. Add automatically generated stub callbacks in if.c. These callbacks will be implemented in the following commit. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
		
							parent
							
								
									a7ca2199b7
								
							
						
					
					
						commit
						a4bed468f9
					
				@ -138,6 +138,7 @@ struct option longopts[] =
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *babeld_yang_modules[] =
 | 
			
		||||
  {
 | 
			
		||||
    &frr_interface_info,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(babeld, BABELD,
 | 
			
		||||
 | 
			
		||||
@ -131,6 +131,7 @@ struct quagga_signal_t eigrp_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *eigrpd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(eigrpd, EIGRP, .vty_port = EIGRP_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -151,6 +151,7 @@ struct quagga_signal_t isisd_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *isisd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef FABRICD
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										58
									
								
								lib/if.c
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								lib/if.c
									
									
									
									
									
								
							@ -1211,3 +1211,61 @@ void if_link_params_free(struct interface *ifp)
 | 
			
		||||
	XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params);
 | 
			
		||||
	ifp->link_params = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ------- Northbound callbacks ------- */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * XPath: /frr-interface:lib/interface
 | 
			
		||||
 */
 | 
			
		||||
static int lib_interface_create(enum nb_event event,
 | 
			
		||||
				const struct lyd_node *dnode,
 | 
			
		||||
				union nb_resource *resource)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO: implement me. */
 | 
			
		||||
	return NB_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int lib_interface_delete(enum nb_event event,
 | 
			
		||||
				const struct lyd_node *dnode)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO: implement me. */
 | 
			
		||||
	return NB_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * XPath: /frr-interface:lib/interface/description
 | 
			
		||||
 */
 | 
			
		||||
static int lib_interface_description_modify(enum nb_event event,
 | 
			
		||||
					    const struct lyd_node *dnode,
 | 
			
		||||
					    union nb_resource *resource)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO: implement me. */
 | 
			
		||||
	return NB_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int lib_interface_description_delete(enum nb_event event,
 | 
			
		||||
					    const struct lyd_node *dnode)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO: implement me. */
 | 
			
		||||
	return NB_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* clang-format off */
 | 
			
		||||
const struct frr_yang_module_info frr_interface_info = {
 | 
			
		||||
	.name = "frr-interface",
 | 
			
		||||
	.nodes = {
 | 
			
		||||
		{
 | 
			
		||||
			.xpath = "/frr-interface:lib/interface",
 | 
			
		||||
			.cbs.create = lib_interface_create,
 | 
			
		||||
			.cbs.delete = lib_interface_delete,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			.xpath = "/frr-interface:lib/interface/description",
 | 
			
		||||
			.cbs.modify = lib_interface_description_modify,
 | 
			
		||||
			.cbs.delete = lib_interface_description_delete,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			.xpath = NULL,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								lib/if.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								lib/if.h
									
									
									
									
									
								
							@ -497,7 +497,6 @@ extern bool if_is_loopback_or_vrf(struct interface *ifp);
 | 
			
		||||
extern int if_is_broadcast(struct interface *);
 | 
			
		||||
extern int if_is_pointopoint(struct interface *);
 | 
			
		||||
extern int if_is_multicast(struct interface *);
 | 
			
		||||
extern void if_cmd_init(void);
 | 
			
		||||
struct vrf;
 | 
			
		||||
extern void if_terminate(struct vrf *vrf);
 | 
			
		||||
extern void if_dump_all(void);
 | 
			
		||||
@ -534,4 +533,8 @@ struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *);
 | 
			
		||||
struct if_link_params *if_link_params_get(struct interface *);
 | 
			
		||||
void if_link_params_free(struct interface *);
 | 
			
		||||
 | 
			
		||||
/* Northbound. */
 | 
			
		||||
extern void if_cmd_init(void);
 | 
			
		||||
extern const struct frr_yang_module_info frr_interface_info;
 | 
			
		||||
 | 
			
		||||
#endif /* _ZEBRA_IF_H */
 | 
			
		||||
 | 
			
		||||
@ -117,6 +117,7 @@ static struct quagga_signal_t sighandlers[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *nhrpd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(nhrpd, NHRP, .vty_port = NHRP_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -163,6 +163,7 @@ struct quagga_signal_t ospf6_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *ospf6d_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(ospf6d, OSPF6, .vty_port = OSPF6_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -124,6 +124,7 @@ struct quagga_signal_t ospf_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *ospfd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(ospfd, OSPF, .vty_port = OSPF_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -112,6 +112,7 @@ struct quagga_signal_t pbr_signals[] = {
 | 
			
		||||
#define PBR_VTY_PORT 2615
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *pbrd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(pbrd, PBR, .vty_port = PBR_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -72,6 +72,7 @@ struct zebra_privs_t pimd_privs = {
 | 
			
		||||
	.cap_num_i = 0};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *pimd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(pimd, PIM, .vty_port = PIMD_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -120,6 +120,7 @@ static struct quagga_signal_t ripd_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *ripd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(ripd, RIP, .vty_port = RIP_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
@ -119,6 +119,7 @@ struct quagga_signal_t ripng_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *ripngd_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(ripngd, RIPNG, .vty_port = RIPNG_VTY_PORT,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										46
									
								
								yang/frr-interface.yang
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								yang/frr-interface.yang
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,46 @@
 | 
			
		||||
module frr-interface {
 | 
			
		||||
  yang-version 1.1;
 | 
			
		||||
  namespace "http://frrouting.org/yang/interface";
 | 
			
		||||
  prefix frr-interface;
 | 
			
		||||
 | 
			
		||||
  organization
 | 
			
		||||
    "Free Range Routing";
 | 
			
		||||
  contact
 | 
			
		||||
    "FRR Users List:       <mailto:frog@lists.frrouting.org>
 | 
			
		||||
     FRR Development List: <mailto:dev@lists.frrouting.org>";
 | 
			
		||||
  description
 | 
			
		||||
    "This module defines a model for managing FRR interfaces.";
 | 
			
		||||
 | 
			
		||||
  revision 2018-03-28 {
 | 
			
		||||
    description
 | 
			
		||||
      "Initial revision.";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  container lib {
 | 
			
		||||
    list interface {
 | 
			
		||||
      key "name vrf";
 | 
			
		||||
      description
 | 
			
		||||
        "Interface.";
 | 
			
		||||
 | 
			
		||||
      leaf name {
 | 
			
		||||
        type string {
 | 
			
		||||
          length "1..16";
 | 
			
		||||
        }
 | 
			
		||||
        description
 | 
			
		||||
          "Interface name.";
 | 
			
		||||
      }
 | 
			
		||||
      leaf vrf {
 | 
			
		||||
        type string {
 | 
			
		||||
          length "1..36";
 | 
			
		||||
        }
 | 
			
		||||
        description
 | 
			
		||||
          "VRF this interface is associated with.";
 | 
			
		||||
      }
 | 
			
		||||
      leaf description {
 | 
			
		||||
        type string;
 | 
			
		||||
        description
 | 
			
		||||
          "Interface description.";
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1 +1,2 @@
 | 
			
		||||
dist_yangmodels_DATA += yang/frr-module-translator.yang
 | 
			
		||||
dist_yangmodels_DATA += yang/frr-interface.yang
 | 
			
		||||
 | 
			
		||||
@ -207,6 +207,7 @@ struct quagga_signal_t zebra_signals[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct frr_yang_module_info *zebra_yang_modules[] = {
 | 
			
		||||
	&frr_interface_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
FRR_DAEMON_INFO(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user