]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: bgpevpn APIs to get l3vni/rmac and import/export RT list
authorMitesh Kanjariya <mitesh@cumulusnetworks.com>
Mon, 9 Oct 2017 08:29:04 +0000 (01:29 -0700)
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Thu, 14 Dec 2017 18:57:05 +0000 (10:57 -0800)
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_evpn_private.h

index ca59c8ba425152d19ee85a87bad617f34762597c..e11f99f099da875c982a19ec485f1a9346472343 100644 (file)
@@ -101,6 +101,50 @@ struct irt_node {
 #define RT_TYPE_EXPORT 2
 #define RT_TYPE_BOTH   3
 
+static inline vni_t bgpevpn_get_l3vni(struct bgpevpn *vpn)
+{
+       struct bgp *bgp_vrf = NULL;
+
+       bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
+       if (!bgp_vrf)
+               return 0;
+
+       return bgp_vrf->l3vni;
+}
+
+static inline void bgpevpn_get_rmac(struct bgpevpn *vpn, struct ethaddr *rmac)
+{
+       struct bgp *bgp_vrf = NULL;
+
+       memset(rmac, 0, sizeof(struct ethaddr));
+       bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
+       if (!bgp_vrf)
+               return;
+       memcpy(rmac, &bgp_vrf->rmac, sizeof(struct ethaddr));
+}
+
+static inline struct list *bgpevpn_get_vrf_export_rtl(struct bgpevpn *vpn)
+{
+       struct bgp *bgp_vrf = NULL;
+
+       bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
+       if (!bgp_vrf)
+               return NULL;
+
+       return bgp_vrf->vrf_export_rtl;
+}
+
+static inline struct list *bgpevpn_get_vrf_import_rtl(struct bgpevpn *vpn)
+{
+       struct bgp *bgp_vrf = NULL;
+
+       bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
+       if (!bgp_vrf)
+               return NULL;
+
+       return bgp_vrf->vrf_import_rtl;
+}
+
 static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn)
 {
        struct bgp *bgp_vrf = NULL;