Skip to content

[BUG] juniper.device.junos_l3_interfaces Cannot Configure IPv4/IPv6 on Non-Zero Logical Units Without VLAN Tagging #859

Description

@praanjala2409

Category

  • Bug
  • Feature
  • Task

Collection Namespace & Version

Field Value
Collection namespace juniper.device
Collection version 2.0.3
Collection install path ~/.ansible/collections/ansible_collections/juniper/device
# How to find it:
ansible-galaxy collection list | grep -E 'juniper|junipernetworks'

Module / Plugin Details

Field Value
Module / plugin name juniper.device.junos_l3_interfaces
Module version (if shown in output)
Plugin type module
# How to inspect module documentation:
ansible-doc juniper.device.junos_l3_interfaces

Description

While testing L3 logical-interface provisioning using juniper.device.junos_l3_interfaces, we observed that the module can configure IPv4 and IPv6 addresses on unit 0, but configuration on a non-zero logical unit fails


Hosts File

# hosts.yml (sanitized)
---
all:
  hosts:
    qfx:
      ansible_host: 100.123.24.2

  vars:
    ansible_connection: ansible.netcommon.netconf
    ansible_network_os: juniper.device.junos
    ansible_user: jcluser
    ansible_password: <password>
    ansible_port: 830

Playbook Details

#playbook.yml
---
- name: Reproduce junos_l3_interfaces non-zero unit issue
  hosts: qfx
  gather_facts: false

  vars_files:
    - inventory.yml

  tasks:
    - name: Configure Junos L3 interfaces
      juniper.device.junos_l3_interfaces:
        config: "{{ network_service_config['l3_interfaces'] }}"
        state: "{{ network_service_config['state'] }}"
      loop: "{{ yeti_network_services[0]['configs'] }}"
      loop_control:
        loop_var: network_service_config
      when:
        - network_service_config['l3_interfaces'] is defined

Inventory Details

# inventory.yml
yeti_network_services:
  - configs:
      - l3_interfaces:
          - name: xe-0/0/4
            unit: 10
            ipv4:
              - address: 10.220.10.64/31
        state: merged
ansible-playbook -i hosts.yml playbook.yml -vvv

Steps to Reproduce

  1. Install the collection: ansible-galaxy collection install juniper.device==2.0.3
  2. Set up the inventory file as shown above.
  3. ansible-playbook -i hosts.yml playbook_new.yml -vvv
  4. Observe the error / unexpected behaviour.

Expected Behavior

juniper.device.junos_l3_interfaces should support IPv4 and IPv6 address configuration on non-zero logical units through the existing unit parameter.

for example:

config:
  - name: xe-0/0/4
    unit: 10
    ipv4:
      - address: 10.220.10.64/31
state: merged

and:

config:
  - name: xe-0/0/4
    unit: 10
    ipv6:
      - address: fd00:976a::8/127
state: merged

For a tagged L3 logical interface, the module should provide a way to configure the required VLAN-tagging prerequisites, equivalent to:

set interfaces xe-0/0/4 vlan-tagging
set interfaces xe-0/0/4 unit 10 vlan-id <vlan-id>
set interfaces xe-0/0/4 unit 10 family inet address 10.220.10.64/31

and:

set interfaces xe-0/0/4 vlan-tagging
set interfaces xe-0/0/4 unit 10 vlan-id <vlan-id>
set interfaces xe-0/0/4 unit 10 family inet6 address fd00:976a::8/127

This should allow IPv4/IPv6 addresses to be provisioned on non-zero logical units without requiring the VLAN-tagging configuration to be manually configured beforehand.


Actual Behavior

juniper.device.junos_l3_interfaces successfully configures IPv4/IPv6 addresses on unit 0
for example:

config:
  - name: xe-0/0/10
    ipv4:
      - address: 10.220.10.64/31
state: merged

However, when the same configuration is attempted with a non-zero unit such as:

config:
  - name: xe-0/0/4
    unit: 10
    ipv4:
      - address: 10.220.10.64/31
state: merged

the configuration fails with:

Only unit 0 is valid for this encapsulation
error: configuration check-out failed

The same limitation applies when attempting to configure IPv6 on a non-zero logical unit.

The failure occurs because the parent Ethernet interface has not been configured with vlan-tagging, and the non-zero logical unit does not have an associated vlan-id

If the following prerequisites are configured separately:

set interfaces xe-0/0/4 vlan-tagging
set interfaces xe-0/0/4 unit 10 vlan-id <vlan-id>

the module can then configure the IPv4/IPv6 address on unit 10.

Error summary:

While junos_l3_interfaces provides the unit parameter and can target non-zero units, it cannot currently provision the required VLAN-tagging/VLAN-ID configuration needed to create and configure a tagged L3 logical interface independently.


Environment

Ansible & Python

Item Version
ansible-core 2.15.3
Python 3.9.19
OS Linux nita 5.14.0-503.14.1.el9_5.x86_64

Collection & Python Package Versions

ansible-galaxy collection list | grep -E 'juniper|junipernetworks'
pip show junos-eznc ncclient paramiko lxml
# ansible-galaxy collection list output:

# pip show output:
junos-eznc    : 2.8.2
ncclient      : 0.7.0
paramiko      : 5.0.0
lxml          : 6.1.1

Junos Device

Item Value
Junos version Junos: 18.1R3-S5.3 limited
Junos platform / model Model: vqfx-10000
Transport NETCONF over SSH
NETCONF port 830

Junos RPC / XML (if applicable)

<!-- RPC request -->

<!-- RPC response / error -->

Additional Context


Support

As Red Hat Ansible Certified Content, this collection is entitled to support through the Ansible Automation Platform (AAP) using the Create issue button on the top right corner of the AAP support portal.

If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there may be community help available on the Ansible Forum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions