OcNOS-SP : Ansible Guide : Ansible User Guide : Jinja2 Templates for configuring OcNOS
Jinja2 Templates for configuring OcNOS
In this section, we will provide a few Jinja2 templates which can be used to configure a few protocols in OcNOS. Also a sample yaml parameter file is provided for each j2 template with explanations of the parameters. While creating the Jinja2 template, only the commonly used configuration is considered. Customers can use these templates as such, if it meets their configuration needs or can modify them accordingly.
Template File for LDP
ocnos_ldp.j2
{%if ldp is defined%}
router ldp
{% for peer in ldp.peers -%}
targeted-peer ipv4 {{ peer.address }}
exit
{% endfor %}
{% if ldp.advertise_label_prefix is defined %}
advertise-labels for only_lo to any
{%endif%}
 
{% for interface in ldp.interfaces -%}
interface {{ interface.name }}
enable-ldp {{ interface.protocol }}
label-switching
exit
{% endfor %}
{%endif%}
Sample Parameter File for LDP
sw2.yml
 
ldp:
Router LDP configurations
peers:
Peer Details
- address: 1.1.1.1
Configures the targeted-peer IPv4 address as <1.1.1.1> under router LDP
- address: 3.3.3.3
Configures the targeted-peer IPv4 address as <3.3.3.3> under router LDP
advertise_label_prefix: only_lo
If defined it will Configure the advertise label command for "ony_lo" prefix_list under router ldp
interfaces:
LDP Interface configurations
- interface: eth1
Enables LDP on interface <eth1> for protocol <ipv4>
protocol: ipv4
Enables LDP for ipv4 protocol under interface eth1
Last modified date: 06/08/2023