Add communities on direct routes in Juniper

Dear all,

Is there a way to add BGP communities on direct (interface) routes in Junipers? The task looks to be simple but the solution eludes me.
In Cisco/Arista, for example, I could use "network 192.0.2.0/24 route-map <SOME_MAP_THAT_ADDS_COMMUNITIES>".

In Juniper it seems to be impossible. I even tried putting interface-routes into rib-group with an import policy.
But it seems the import policy only works on importing routes into Secondary routing tables (e.g. inet.50), and not into the Primary one (inet.0).

I know it's possible to add communities on later stage while announcing networks to peers, in [protocols bgp group <name> export]. But I'd better slap the community on the routes right when they're imported into RIB, not when they announced to peers.

Thanks in advance.

Unfortunately not yet, as far as I know. Long time ago I gave this to
my account team

Title: Direct routes must support tag and or community
Platform: Trio, priority MX80, MPC2
JunOS: 12.4Rx
Command: 'set interfaxe ge-4/2.0 family inet address 10.42.42.1/24
tag>community X'
JTAC: n/a
ER:
  - Router must be able to add tags communities to direct routes directly, like
    it does for static routes

Usage Case:
  Trivial way to signal route information to BGP. Often tag/community is used
  by service providers to singal 'this is PI/PA prefix, leak it to internet' or
  'this is backup route, reduce its MED'. However for some reason it is only
  supported for static routes, while usage scenario and benefits are exactly the
  same for direct routes.

Hi Stanislav,
I believe this is what you are looking for:

[edit]
jcluser@Lothlorien-MX1# show | compare
[edit interfaces lo0 unit 0 family inet]
        address 10.0.0.0/32 { ... }
+ address 5.5.5.5/32;
[edit protocols bgp]
- export IPV4-STATIC;
+ export [ IPV4-STATIC TAG-DIRECT ];
[edit policy-options]
+ policy-statement TAG-DIRECT {
+ from {
+ protocol direct;
+ route-filter 5.5.5.5/32 exact;
+ }
+ then {
+ community set MYCOMMUNITY;
+ accept;
+ }
+ }
[edit policy-options]
+ community MYCOMMUNITY members 5:5;

[edit]
jcluser@Lothlorien-MX1# commit
commit complete

[edit]
jcluser@Lothlorien-MX1# run show route advertising-protocol bgp 172.19.0.2 detail | find 5.5.5.5
* 5.5.5.5/32 (1 entry, 1 announced)
BGP group RR-LOADBALANCER type External
     Nexthop: Self
     AS path: [65000] I
     Communities: 5:5

Regards,
Jason R. Rokeach

I believe you need to add the communities either on the import policy which pulls in the direct route or the export policy to the neighbor(s) you want to feed the communities to.

Owen

Junos doesn't maintain an intermediate BGP table / RIB as you would see on
other Cisco-like platforms. Therefore you need to build comm-string actions
into your neighborship policies.