-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic routing northbound callbacks vrf northbound callbacks staticd northbound callbacks tag, distance, tableid is the property of route Signed-off-by: VishalDhingra <vdhingra@vmware.com>
- Loading branch information
1 parent
3e31357
commit 059410d
Showing
25 changed files
with
1,636 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "northbound.h" | ||
#include "libfrr.h" | ||
#include "vrf.h" | ||
#include "routing_nb.h" | ||
|
||
|
||
static int lib_routing_cp_create(enum nb_event event, | ||
const struct lyd_node *dnode, | ||
union nb_resource *resource) | ||
{ | ||
struct vrf *vrf; | ||
const char *vrfname; | ||
|
||
switch (event) { | ||
case NB_EV_VALIDATE: | ||
vrfname = yang_dnode_get_string(dnode, "./vrf"); | ||
vrf = vrf_lookup_by_name(vrfname); | ||
if (!vrf) { | ||
zlog_warn( | ||
"vrf is not configured\n"); | ||
return NB_ERR_VALIDATION; | ||
} | ||
|
||
break; | ||
case NB_EV_PREPARE: | ||
case NB_EV_ABORT: | ||
break; | ||
case NB_EV_APPLY: | ||
vrfname = yang_dnode_get_string(dnode, "./vrf"); | ||
vrf = vrf_lookup_by_name(vrfname); | ||
nb_running_set_entry(dnode, vrf); | ||
break; | ||
}; | ||
|
||
return NB_OK; | ||
} | ||
|
||
static int lib_routing_cp_destroy(enum nb_event event, | ||
const struct lyd_node *dnode) | ||
{ | ||
struct vrf *vrf; | ||
|
||
if (event != NB_EV_APPLY) | ||
return NB_OK; | ||
|
||
vrf = nb_running_unset_entry(dnode); | ||
(void)vrf; | ||
return NB_OK; | ||
} | ||
|
||
const struct frr_yang_module_info frr_routing_info = { | ||
.name = "frr-routing", | ||
.nodes = { | ||
{ | ||
.xpath = FRR_ROUTING_XPATH, | ||
.cbs = { | ||
.create = lib_routing_cp_create, | ||
.destroy = lib_routing_cp_destroy, | ||
}, | ||
}, | ||
{ | ||
.xpath = NULL, | ||
}, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef _FRR_ROUTING_NB_H_ | ||
#define _FRR_ROUTING_NB_H_ | ||
|
||
|
||
#define FRR_ROUTING_XPATH \ | ||
"/frr-routing:routing/control-plane-protocols/control-plane-protocol" | ||
|
||
#define FRR_ROUTING_KEY_XPATH \ | ||
"/frr-routing:routing/control-plane-protocols/control-plane-protocol[type='%s'][name='%s'][vrf='%s']" | ||
|
||
extern const struct frr_yang_module_info frr_routing_info; | ||
|
||
/* Mandatory callbacks. */ | ||
|
||
|
||
|
||
#endif /* _FRR_ROUTING_NB_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.