Committed by
Gerrit Code Review
Use higher priorites for longer prefixes
Change-Id: I208e6be5c46041e8019dec7940e28dad1f08f3ed
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -85,7 +85,8 @@ public class BgpRouter { | ... | @@ -85,7 +85,8 @@ public class BgpRouter { |
85 | 85 | ||
86 | private static final String BGP_ROUTER_APP = "org.onosproject.bgprouter"; | 86 | private static final String BGP_ROUTER_APP = "org.onosproject.bgprouter"; |
87 | 87 | ||
88 | - private static final int PRIORITY = 1; | 88 | + private static final int PRIORITY_OFFSET = 100; |
89 | + private static final int PRIORITY_MULTIPLIER = 5; | ||
89 | 90 | ||
90 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 91 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
91 | protected CoreService coreService; | 92 | protected CoreService coreService; |
... | @@ -269,8 +270,11 @@ public class BgpRouter { | ... | @@ -269,8 +270,11 @@ public class BgpRouter { |
269 | .group(group.id()) | 270 | .group(group.id()) |
270 | .build(); | 271 | .build(); |
271 | 272 | ||
273 | + | ||
274 | + int priority = prefix.prefixLength() * PRIORITY_MULTIPLIER + PRIORITY_OFFSET; | ||
275 | + | ||
272 | return new DefaultFlowRule(deviceId, selector, treatment, | 276 | return new DefaultFlowRule(deviceId, selector, treatment, |
273 | - PRIORITY, appId, 0, true, | 277 | + priority, appId, 0, true, |
274 | FlowRule.Type.IP); | 278 | FlowRule.Type.IP); |
275 | } | 279 | } |
276 | 280 | ... | ... |
-
Please register or login to post a comment