Skip to content

[bug] bridge-vlan section is not generated when ula_prefix is present #357

@hacc1225

Description

@hacc1225

Describe the bug
When creating a network configuration from a JSON template, the config bridge-vlan section is omitted from the final UCI output if the general object in the JSON contains the ula_prefix key. This issue occurs even if the value of ula_prefix is an empty string (""). Removing the ula_prefix key from the JSON allows the bridge-vlan section to be generated correctly.

Steps To Reproduce
Generate a UCI configuration using the netjsonconfig 1.2a0 backend with the following JSON input.

{
    "interfaces": [
        {
            "type": "bridge",
            "bridge_members": [
                "wan"
            ],
            "name": "test",
            "vlan_filtering": [
                {
                    "vlan": 1,
                    "ports": [
                        {
                            "ifname": "wan",
                            "tagging": "u",
                            "primary_vid": true
                        }
                    ]
                }
            ]
        }
    ],
    "general": {
        "ula_prefix": "",
        "description": ""
    }
}

Expected behavior
The presence of the ula_prefix key in the general configuration should not prevent the bridge-vlan section from being generated. The complete and correct UCI configuration should be generated as follows:

package system

config system 'system'
	option hostname 'OpenWRT'

package network

config device 'device_test'
	option name 'br-test'
	list ports 'wan'
	option type 'bridge'
	option vlan_filtering '1'

config bridge-vlan 'test_1'
	option device 'br-test'
	list ports 'wan:u*'
	option vlan '1'

config interface 'test_1'
	option device 'br-test.1'
	option proto 'none'

config interface 'test'
	option device 'br-test'
	option proto 'none'

Actual behavior

package system

config system 'system'
	option hostname 'OpenWRT'

package network

config globals 'globals'

config device 'device_test'
	option name 'br-test'
	list ports 'wan'
	option type 'bridge'
	option vlan_filtering '1'

config interface 'test_1'
	option device 'br-test.1'
	option proto 'none'

config interface 'test'
	option device 'br-test'
	option proto 'none'

System Informatioon:

  • OS: Debian GNU/Linux 11 (bullseye) (from Docker Image)
  • Python Version: Python 3.13.5
  • Docker Image: registry.gitlab.com/openwisp/docker-openwisp/openwisp-base@sha256:7f7bf41840eaf1caa1dfd2383dfd522b501443bf2097def6f9bc8c893663856b
  • netjsonconfig Version: netjsonconfig 1.2a0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions