Skip to content

fix(server): apply SetPolicies policy assignments - #3538

Open
Ivan-Pokhabov wants to merge 1 commit into
osrg:masterfrom
Ivan-Pokhabov:fix/server
Open

fix(server): apply SetPolicies policy assignments#3538
Ivan-Pokhabov wants to merge 1 commit into
osrg:masterfrom
Ivan-Pokhabov:fix/server

Conversation

@Ivan-Pokhabov

@Ivan-Pokhabov Ivan-Pokhabov commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Now, SetPolicy ignore new Assignements

r.setPeerPolicy(id, c)
if err := r.setPeerPolicy(id, c); err != nil {
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reload() has already cleared assignmentMap at this point, so this loop is what restores it. Returning here leaves every id the loop has not reached yet with no assignment, including the global RIB. ap is a map, so which ids survive changes on every call.


func (r *RoutingPolicy) setPeerPolicy(id string, c oc.ApplyPolicy) {
func (r *RoutingPolicy) setPeerPolicy(id string, c oc.ApplyPolicy) error {
for _, dir := range []PolicyDirection{POLICY_DIRECTION_IMPORT, POLICY_DIRECTION_EXPORT} {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this returns an error, I think that it's better to update IMPORT and EXPORT atomically.

Firstly, calling r.getAssignmentFromConfig for both directions, only if both succeeds, then execute setDefaultPolicy and setPolicy for both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants