cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

84
Views
0
Helpful
2
Replies

Iteration in the template level

Hi All,

To generate the list of the static routes from the filled service model, we are currently using the following, to be able to get right prefix for the right next-hop value:

                <static>

                  <route tags="merge">

                    <name>{/endpoint[pe-device=$DEVICE]/static-routes/static-route[1]/ip-prefix}</name>

                    <next-hop>{/endpoint[pe-device=$DEVICE]/static-routes/static-route[1]/next-hop}</next-hop>

                  </route> 

                   <route tags="merge">

                    <name>{/endpoint[pe-device=$DEVICE]/static-routes/static-route[2]/ip-prefix}</name>

                    <next-hop>{/endpoint[pe-device=$DEVICE]/static-routes/static-route[2]/next-hop}</next-hop>

                  </route>   

                </static>

to get the contract like this:

  +                routing-options {

  +                    static {

  +                        route 11.11.11.1/32 {

  +                            next-hop [ 10.10.10.1 ];

  +                        }

  +                        route 11.11.12.0/24 {

  +                            next-hop [ 10.10.10.2 ];

  +                        }

  +                    }

, but in this case we are limited with number of the static reference we have filled in the template.

So just wondering are there any methods to make iteration for the linked key=value on the template level ?

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Iteration in the template level

Hi,

Yes, you can use a combination of Java + Template.

Define the template on how would be a single static route entry.

On Java (or Python) CREATE callback you can have multiple interactions and call this template several times.

You can reference the mpls-vpn example under examples.ncs/service-provider and also the development documentation (under docs).

Cheers, Gustavo

View solution in original post

2 REPLIES 2
Highlighted

Re: Iteration in the template level

Hi,

Yes, you can use a combination of Java + Template.

Define the template on how would be a single static route entry.

On Java (or Python) CREATE callback you can have multiple interactions and call this template several times.

You can reference the mpls-vpn example under examples.ncs/service-provider and also the development documentation (under docs).

Cheers, Gustavo

View solution in original post

Re: Iteration in the template level

Hi,

Thank you for showing the direction, how to do this. I've made the separate template for the statics and apply it in java iteration for the all statics in the service. It works ;-)

Content for Community-Ad
FusionCharts will render here