Skip to content

Commit d62ef08

Browse files
thomas-manginclaude
andcommitted
fix: Add RD parameter support to CLI flow route command (issue #1015)
The CLI `announce flow route` command was missing support for the `rd` (route-distinguisher) parameter, while the config file parser already supported it. Changes: - Add ParseFlowRoute.known to ParseFlow.known dict for rd/route-distinguisher parsers - Add rd schema entries to _route_schema_children for action lookup - Fix route() to handle ActionOperation.SET for direct field assignment This enables flow-vpn routes with RD via CLI: announce flow route source-ipv4 10.0.0.1/32 rd 65535:65536 discard Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2d4d8e1 commit d62ef08

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/exabgp/configuration/flow/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,17 @@ class ParseFlow(Section):
5959
known: dict[str | tuple[Any, ...], object] = dict(ParseFlowMatch.known)
6060
known.update(ParseFlowThen.known)
6161
known.update(ParseFlowScope.known)
62+
known.update(ParseFlowRoute.known)
6263

6364
# Route schema children for action lookup in route() function
65+
# Note: Only include rd/route-distinguisher from ParseFlowRoute, not next-hop
66+
# (next-hop has target=NEXTHOP which isn't handled by route())
6467
_route_schema_children = {
6568
**ParseFlowMatch.schema.children,
6669
**ParseFlowThen.schema.children,
6770
**ParseFlowScope.schema.children,
71+
'rd': ParseFlowRoute.schema.children['rd'],
72+
'route-distinguisher': ParseFlowRoute.schema.children['route-distinguisher'],
6873
}
6974

7075
@classmethod
@@ -118,8 +123,13 @@ def route(tokeniser: Any) -> list[Route]:
118123

119124
if target == ActionTarget.NLRI:
120125
handler = cast(Callable[[Any], Any], ParseFlow.known[command])
121-
for adding in handler(tokeniser):
122-
flow_nlri.add(adding)
126+
if operation == ActionOperation.SET:
127+
# Direct field assignment (e.g., rd/route-distinguisher)
128+
setattr(flow_nlri, field_name or command, handler(tokeniser))
129+
else:
130+
# Flow rules that need iteration and add()
131+
for adding in handler(tokeniser):
132+
flow_nlri.add(adding)
123133
elif target == ActionTarget.ATTRIBUTE:
124134
handler = cast(Callable[[Any], Any], ParseFlow.known[command])
125135
attributes.add(handler(tokeniser))

0 commit comments

Comments
 (0)