i hope you know how rib-groups works (otherwise you must read the cfg guides).
the config will looks like:
#create rib groups
set routing-options rib-groups NFRI2GRT import-rib NFRI.inet.0
set routing-options rib-groups NFRI2GRT import-rib inet.0
set routing-options rib-groups NFRI2GRT import-policy LEAK_NFRI2GRT
set routing-options rib-groups NFRI2GRT_IPV6 import-rib NFRI.inet6.0
set routing-options rib-groups NFRI2GRT_IPV6 import-rib inet6.0
set routing-options rib-groups NFRI2GRT_IPV6 import-policy LEAK_NFRI2GRT
#create leak policy for routes from non-forwarding to grt; this is simple leaking policy
#which accepts all the routes; you can modify it as you want; for example accept only ospf routers from
#specific route-filters
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV4_ROUTES from protocol ospf
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV4_ROUTES to rib inet.0
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV4_ROUTES then tag 3
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV4_ROUTES then accept
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV6_ROUTES from protocol ospf3
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV6_ROUTES to rib inet6.0
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV6_ROUTES then tag 3
set policy-options policy-statement LEAK_NFRI2GRT term NFRI_IPV6_ROUTES then accept
set policy-options policy-statement LEAK_NFRI2GRT term DEFAULT_DENY then reject
#apply rib group to ospf's instance in this routing instance
set routing-instances NFRI instance-type no-forwarding
set routing-instances NFRI protocols ospf prefix-export-limit 1000
set routing-instances NFRI protocols ospf rib-group NFRI2GRT
set routing-instances NFRI protocols ospf database-protection maximum-lsa 20000
set routing-instances NFRI protocols ospf area 0.0.0.0 interface <intf to R2>