Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L3VPN Prefix History marks all AdjRIB-IN/OUT and Pre/Post-policy routes as Pre-Policy + RIB-IN only #10

Open
v1shnya opened this issue Jan 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@v1shnya
Copy link

v1shnya commented Jan 20, 2023

Base table in the file "10_l3vpn.sql"

CREATE TABLE l3vpn_rib (
.....
	                       isPrePolicy             boolean             NOT NULL DEFAULT true,
	                       isAdjRibIn              boolean             NOT NULL DEFAULT true,
);

Dependent table (correct)

CREATE TABLE l3vpn_rib_log (
.....
	                           isPrePolicy             boolean             NOT NULL DEFAULT true,
	                           isAdjRibIn              boolean             NOT NULL DEFAULT true,
) TABLESPACE timeseries;

PostgreSQL function for the insertion into l3vpn_rib_log misses new.isPrePolicy and new.isAdjRibIn values!

CREATE OR REPLACE FUNCTION t_l3vpn_rib_update()
	RETURNS trigger AS $$
BEGIN
	IF (new.isWithdrawn) THEN
		INSERT INTO l3vpn_rib_log (isWithdrawn,prefix,prefix_len,base_attr_hash_id,peer_hash_id,origin_as,timestamp,
		                           rd,ext_community_list)
		VALUES (true,new.prefix,new.prefix_len,old.base_attr_hash_id,new.peer_hash_id,
		        old.origin_as,new.timestamp,old.rd,old.ext_community_list);
	ELSE
		INSERT INTO l3vpn_rib_log (isWithdrawn,prefix,prefix_len,base_attr_hash_id,peer_hash_id,origin_as,timestamp,
		                           rd,ext_community_list)
		VALUES (false,new.prefix,new.prefix_len,new.base_attr_hash_id,new.peer_hash_id,
		        new.origin_as,new.timestamp,new.rd,new.ext_community_list);
	END IF;

	RETURN NEW;
END;
$$ LANGUAGE plpgsql;
@TimEvens TimEvens self-assigned this Feb 1, 2023
@TimEvens TimEvens added the bug Something isn't working label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants