Chuck Anderson writes: >On Thu, Jan 28, 2016 at 02:16:52PM -0500, Chuck Anderson wrote: >> Does anyone know why Junos doesn't accept named communities for static >> routes? This doesn't work: >> >> set routing-options static route 192.0.2.0/24 community TEST >> set policy-options community TEST members 65000:100 >> >> Instead we are forced to put the value directly: >> >> set routing-options static route 192.0.2.0/24 community 65000:100 > >Does anyone have any ideas on how to use a commit script to implement >named communities on static routes? Maybe with apply-macro? I would >love to see suggestions on how this might be implemented... Thanks!
Something like: ----------- version 1.2; ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; import "../import/junos.xsl"; match configuration { var $top = .; for-each (routing-options/static/route/apply-macro[name == "community"]) { var $delta := { for-each (data/name) { var $name = .; for-each ($top/policy-options/community[name == $name]/members) { <community> .; } } } if ($delta/community) { call jcs:emit-change($dot = .., $content = $delta, $tag = "transient-change"); } } } ------------ With this content: [edit routing-options static route 192.0.2.0/24] phil@dent# show apply-macro community { TEST; } next-hop 1.1.1.1; --------- adds this transient change: [edit routing-options static route 192.0.2.0/24] + community [ 65000:100 100:200 ]; -------------- Thanks, Phil _______________________________________________ juniper-nsp mailing list juniper-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/juniper-nsp