adjRibIn and LocRIB question
vladsker opened this issue · 2 comments
Dear Tim,
my BMP reporting routers are Junipers and they are sending both pre-policy (which is adj-RIB-In) and post-policy (which is Loc-RIB) routers:
route-monitoring {
pre-policy;
post-policy;
}
Am I correctly assuming that view v_all_routes contains all routes before filtering and v_routes is Loc-RIB routes? If not - can you please give me an idea how to create select to get this?
Thanks.
Hi Vald,
Actually post-policy is supposed to be post inbound filters and changes, which is just before insert into local-rib. This means that post-policy should see all prefixes after inbound policies have been applied, but may not actually be inserted into the RIB due to best path selection.
Local-RIB was changed in the RFC to be post-policy, but the RFC still has some references to Loc-RIB, which is really post-policy Adj-RIB-In. We are doing a draft update to add the real local-rib, which has best-path/installed prefixes being taken into account and includes, as you would expect, all prefixes installed in the RIB regardless of which peer the prefix was received from. This will give you a true router view of best-paths (installed prefixes), where as post policy only gives you policy validation of received prefixes per-peer.
No to your question. v_routes contains both pre and post-policy. isPrePolicy column indicates if it's pre-policy (true) or post-policy (false). v_all_routes includes withdrawn prefixes whereas v_routes only shows active/advertised prefixes. We don't actually delete the withdrawn prefixes, they are just marked withdrawn isWithdrawn = True
. This allows you to see what was there, even if it was removed from the active RIB.
# VIEW
drop view v_routes;
CREATE VIEW v_routes AS
SELECT if (length(rtr.name) > 0, rtr.name, rtr.ip_address) AS RouterName,
if(length(p.name) > 0, p.name, p.peer_addr) AS PeerName,
r.prefix AS Prefix,r.prefix_len AS PrefixLen,
path.origin AS Origin,r.origin_as AS Origin_AS,path.med AS MED,
path.local_pref AS LocalPref,path.next_hop AS NH,path.as_path AS AS_Path,
path.as_path_count AS ASPath_Count,path.community_list AS Communities,
path.ext_community_list AS ExtCommunities,path.cluster_list AS ClusterList,
path.aggregator AS Aggregator,p.peer_addr AS PeerAddress, p.peer_as AS PeerASN,r.isIPv4 as isIPv4,
p.isIPv4 as isPeerIPv4, p.isL3VPNpeer as isPeerVPN,
r.timestamp AS LastModified, r.first_added_timestamp as FirstAddedTimestamp,r.prefix_bin as prefix_bin,
r.path_id, r.labels,
r.hash_id as rib_hash_id,
r.path_attr_hash_id as path_hash_id, r.peer_hash_id, rtr.hash_id as router_hash_id,r.isWithdrawn,
r.prefix_bits,r.isPrePolicy,r.isAdjRibIn
FROM bgp_peers p JOIN rib r ON (r.peer_hash_id = p.hash_id)
JOIN path_attrs path ON (path.hash_id = r.path_attr_hash_id and path.peer_hash_id = r.peer_hash_id)
JOIN routers rtr ON (p.router_hash_id = rtr.hash_id)
WHERE r.isWithdrawn = False;
Did the above help?