+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2020 Cumulus Networks, Inc.
* Chirag Shah
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "zebra/zebra_router.h"
#include "zebra/debug.h"
#include "printfrr.h"
+#include "zebra/zebra_vxlan.h"
+#include "zebra/zebra_vxlan_if.h"
/*
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/state/up-count
{
const struct interface *ifp = args->list_entry;
struct zebra_if *zebra_if;
- struct zebra_l2info_vxlan *vxlan_info;
+ struct zebra_vxlan_vni *vni;
if (!IS_ZEBRA_IF_VXLAN(ifp))
return NULL;
zebra_if = ifp->info;
- vxlan_info = &zebra_if->l2info.vxl;
- return yang_data_new_uint32(args->xpath, vxlan_info->vni);
+ if (!IS_ZEBRA_VXLAN_IF_VNI(zebra_if))
+ return NULL;
+
+ vni = zebra_vxlan_if_vni_find(zebra_if, 0);
+ return yang_data_new_uint32(args->xpath, vni->vni);
}
/*
{
const struct interface *ifp = args->list_entry;
struct zebra_if *zebra_if;
- struct zebra_l2info_vxlan *vxlan_info;
+ struct zebra_vxlan_vni *vni;
if (!IS_ZEBRA_IF_VXLAN(ifp))
return NULL;
zebra_if = ifp->info;
- vxlan_info = &zebra_if->l2info.vxl;
- return yang_data_new_ipv4(args->xpath, &vxlan_info->mcast_grp);
+ if (!IS_ZEBRA_VXLAN_IF_VNI(zebra_if))
+ return NULL;
+
+ vni = zebra_vxlan_if_vni_find(zebra_if, 0);
+ return yang_data_new_ipv4(args->xpath, &vni->mcast_grp);
}
const void *lib_vrf_zebra_ribs_rib_get_next(struct nb_cb_get_next_args *args)
return zebra_router_find_zrt(zvrf, table_id, afi, safi);
}
+/*
+ * XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/afi-safi-name
+ */
+struct yang_data *
+lib_vrf_zebra_ribs_rib_afi_safi_name_get_elem(struct nb_cb_get_elem_args *args)
+{
+ const struct zebra_router_table *zrt = args->list_entry;
+
+ return yang_data_new_string(args->xpath,
+ yang_afi_safi_value2identity(zrt->afi, zrt->safi));
+}
+
+/*
+ * XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/table-id
+ */
+struct yang_data *
+lib_vrf_zebra_ribs_rib_table_id_get_elem(struct nb_cb_get_elem_args *args)
+{
+ const struct zebra_router_table *zrt = args->list_entry;
+
+ return yang_data_new_uint32(args->xpath, zrt->tableid);
+}
+
/*
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route
*/
if (args->list_entry == NULL)
rn = route_top(zrt->table);
else
- rn = srcdest_route_next((struct route_node *)rn);
+ rn = srcdest_route_next(rn);
/* Optimization: skip empty route nodes. */
while (rn && rn->info == NULL)
rn = route_next(rn);
case NEXTHOP_TYPE_IPV6_IFINDEX:
return yang_data_new_string(args->xpath, "ip6-ifindex");
break;
- default:
+ case NEXTHOP_TYPE_BLACKHOLE:
break;
}
return NULL;
}
+/*
+ * XPath:
+ * /frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route/route-entry/nexthop-group/nexthop/srte-color
+ */
+struct yang_data *
+lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_nexthop_color_get_elem(
+ struct nb_cb_get_elem_args *args)
+{
+ struct nexthop *nexthop = (struct nexthop *)args->list_entry;
+
+ if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_SRTE))
+ return yang_data_new_uint32(args->xpath, nexthop->srte_color);
+
+ return NULL;
+}
+
/*
* XPath:
* /frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route/route-entry/nexthop-group/nexthop/mpls-label-stack/entry