OcNOS-SP : Ansible Guide : Ansible User Guide : Interface Configuration
Interface Configuration
Template File for Interface Configuration
ocnos_interface.j2
{% for interface in interfaces.ifnames -%}
interface {{ interface.ifname }}
{%if interface.loadinterval is defined %}
load-interval {{ interface.loadinterval }}
{%endif%}
{% if "lo" in interface.ifname %}
ipv6 address {{ interface.address1 }}
bfd session {{ interface.bfdsession }} multihop
{%else%}
{%endif%}
{%if interface.switch is defined %}
{{ interface.switch }}
{%endif%}
{%if interface.speed is defined %}
speed {{ interface.speed }}
{%endif%}
{% if interface.bridge is defined %}
bridge-group {{ interface.bridge }}
{%endif%}
{% if interface.mode is defined %}
switchport mode {{ interface.mode }}
{%endif%}
{% if interface.vlan is defined %}
switchport trunk allowed vlan {{ interface.vlan }}
{%endif%}
{% if interface.address is defined %}
ip address {{ interface.address }}
{%endif%}
{% if interface.mtu is defined %}
mtu {{ interface.mtu }}
{%endif%}
{% if interface.groupid is defined %}
channel-group {{ interface.groupid }} mode {{ interface.state }}
exit
{% endif %}
{% endfor %}
 
Parameter File for Interface configuration
sw2.yml
l
interfaces:
Interface configuration
ifnames:
Interface configuration details
- ifname: xe4
Configure interface xe4
address:10.110.140.20/31
Configure ip address 10.110.140.20/31 command under xe4
mtu: 9216
Configure mtu 9216 under xe4
- ifname: xe2
Configure interface xe2
loadinterval: 30
Configure load interval 30 under interface xe4
address: 10.110.140.61/31
Configure ip address 10.110.140.61/31 command under xe2
mtu: 9216
Configure mtu 9216 under xe2
- ifname: vlan1.1001
Configure interface vlan1.1001 command
address: 192.168.21.212/24
Configure ip address 192.168.21.212/24 command under interface vlan1.1001
- ifname: vlan1.101
Configure interface vlan1.101 command
address: 101.101.101.5/30
Configure ip address 101.101.101.5/30 command under interface vlan1.101
- ifname: lo
Configure interface loopback
address: 36.0.0.8/32
Configure ip address 36.0.0.8/32 command under lopback interfaces
address1: ::1/128
Configure ipv6 address ::1/128 command under loopback interface
bfdsession: 36.0.0.8 36.0.0.1
Configure bfdsession: 36.0.0.8 36.0.0.1 command under loopback interface
- ifname: xe0
Configure interface xe0
switch: switchport
Configure switchport under xe0 interface
bridge: 1
Configure bridge-group 1 under xe0 interface
mode: trunk
Configure switch mode as trunk under xe0 interfaces
vlan: all
Configure switchport trunk allowed vlan all command under int xe0
loadinterval: 30
Configure load-interval 30 under xe0 interfaces
- ifname: xe22
Configure interface xe22 command
switch: switchport
Configure switchport command under xe22 command
bridge: 1
Configure bridge-group 1 under xe22 interface
mode: trunk
Configure switch mode as trunk under xe22 interfaces
vlan: add 101,1001
Configure switchport trunk allowed vlan add 101,1001 command under int xe22
loadinterval: 30
Configure load-interval 30 under xe22 interfaces
mtu: 9216
Configute mtu 9216 under xe22 interface
- ifname: xe6
Configure interface xe6 command
switch: switchport
Configure switchport command under xe6 command
bridge: 1
Configure bridge-group 1 under xe6 interface
mode: access
Configure switch mode as access under xe6 interfaces
- ifname: xe10
Configure interface xe10 command
speed: 1g
Configure speed 1g under interface xe10
- ifname: xe11
Configure interface xe11 command
speed: 1g
Configure speed 1g under interface xe11
- ifname: ce0
Configure interface ce0 command
speed: 40g
Configure speed 40g under interface ce0
Last modified date: 06/08/2023