Skip to content

Commit

Permalink
staticd : Configuration northbound implementation
Browse files Browse the repository at this point in the history
1. Modifies the data structs to make the distance, tag and table-id
   property of a route, i.e created a hireachical data struct to save
   route and nexthop information.
2. Backend northbound implementation

Signed-off-by: VishalDhingra <vdhingra@vmware.com>
  • Loading branch information
vishaldhingra committed Apr 24, 2020
1 parent e357fa3 commit 44c01a5
Show file tree
Hide file tree
Showing 16 changed files with 2,861 additions and 1,088 deletions.
5 changes: 4 additions & 1 deletion staticd/static_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
#include "vrf.h"
#include "nexthop.h"
#include "filter.h"
#include "routing_nb.h"

#include "static_vrf.h"
#include "static_vty.h"
#include "static_routes.h"
#include "static_zebra.h"
#include "static_debug.h"
#include "static_nb.h"

char backup_config_file[256];

Expand Down Expand Up @@ -104,7 +106,8 @@ struct quagga_signal_t static_signals[] = {
};

static const struct frr_yang_module_info *const staticd_yang_modules[] = {
&frr_vrf_info,
&frr_interface_info, &frr_vrf_info, &frr_routing_info,
&frr_staticd_info,
};

#define STATIC_VTY_PORT 2616
Expand Down
2 changes: 2 additions & 0 deletions staticd/static_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@
DEFINE_MGROUP(STATIC, "staticd")

DEFINE_MTYPE(STATIC, STATIC_ROUTE, "Static Route");

DEFINE_MTYPE(STATIC, STATIC_ROUTE_INFO, "Static Route Info");
1 change: 1 addition & 0 deletions staticd/static_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
DECLARE_MGROUP(STATIC)

DECLARE_MTYPE(STATIC_ROUTE);
DECLARE_MTYPE(STATIC_ROUTE_INFO);

#endif
140 changes: 140 additions & 0 deletions staticd/static_nb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#include "northbound.h"
#include "libfrr.h"
#include "static_nb.h"


/* clang-format off */
const struct frr_yang_module_info frr_staticd_info = {
.name = "frr-staticd",
.nodes = {
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/bh-type",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_bh_type_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_bh_type_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/onlink",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_onlink_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_onlink_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/label",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/ttl",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/traffic-class",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/bh-type",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_bh_type_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_bh_type_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/onlink",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_onlink_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_onlink_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/label",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/ttl",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy,
}
},
{
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-staticd-next-hop/frr-nexthops/nexthop/mpls-label-stack/entry/traffic-class",
.cbs = {
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_staticd_next_hop_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy,
}
},
{
.xpath = NULL,
},
}
};
Loading

0 comments on commit 44c01a5

Please sign in to comment.