Skip to content

Commit

Permalink
Fix no standalone lo_v6 entry which break YANG validation (#19514)
Browse files Browse the repository at this point in the history
### Why I did it
The load_mgmt_config generated lo_v6 is missing standalone entry which fail YANG validation

##### Work item tracking
- Microsoft ADO **(number only)**:28665800

#### How I did it
Add the standalone entry
#### How to verify it
Manual test in DUT

Before change:
```
admin@str-msn2700a1-03:~$ sonic-cfggen -M /etc/sonic/device_desc.xml --print-data 
{
    "DEVICE_METADATA": {
        "localhost": {
            "hostname": "CPQ21-0101-0509-04T0",
            "hwsku": "Arista-7260CX3-D108C8"
        }
    },
    "LOOPBACK_INTERFACE": {
        "lo_v6|2603:10d0:e:5eb::/128": {}         <==== missing standalone entry which fail YANG
    },
    "MGMT_INTERFACE": {
        "eth0|100.84.101.139/26": {
            "gwaddr": "100.84.101.129"
        },
        "eth0|2603:10e2:f0:7478::b/64": {
            "gwaddr": "2603:10e2:f0:7478::1"
        }
    }
}
```
After change:
```
admin@str-msn2700a1-03:~$ sonic-cfggen -M /etc/sonic/device_desc.xml --print-data 
{
    "DEVICE_METADATA": {
        "localhost": {
            "hostname": "CPQ21-0101-0509-04T0",
            "hwsku": "Arista-7260CX3-D108C8"
        }
    },
    "LOOPBACK_INTERFACE": {
        "lo_v6": {},                                          <=== added standalone entry
        "lo_v6|2603:10d0:e:5eb::/128": {}
    },
    "MGMT_INTERFACE": {
        "eth0|100.84.101.139/26": {
            "gwaddr": "100.84.101.129"
        },
        "eth0|2603:10e2:f0:7478::b/64": {
            "gwaddr": "2603:10e2:f0:7478::1"
        }
    }
}
```
  • Loading branch information
wen587 authored Jul 11, 2024
1 parent 1c35c62 commit c2055ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2831,9 +2831,9 @@ def parse_device_desc_xml(filename):
'hwsku': hwsku,
}}

results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}}
results['LOOPBACK_INTERFACE'] = {'lo': {}, ('lo', lo_prefix): {}}
if lo_prefix_v6:
results['LOOPBACK_INTERFACE'] = {('lo_v6', lo_prefix_v6): {}}
results['LOOPBACK_INTERFACE'] = {'lo_v6': {}, ('lo_v6', lo_prefix_v6): {}}

results['MGMT_INTERFACE'] = {}
if mgmt_prefix:
Expand Down

0 comments on commit c2055ab

Please sign in to comment.