Introduce the asic_subtype field for adding the sub platform variants. (#10235)

* Introduce the asic_subtype field for adding the sub platform variants. 
   It uses the value of TARGET_MACHINE variable in slave.mk.
This commit is contained in:
judyjoseph 2022-03-28 11:22:32 -07:00 committed by GitHub
parent cc938e73a3
commit 8e642848c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -492,6 +492,7 @@ export build_version="${SONIC_IMAGE_VERSION}"
export debian_version="$(cat $FILESYSTEM_ROOT/etc/debian_version)"
export kernel_version="${kversion}"
export asic_type="${sonic_asic_platform}"
export asic_subtype="${TARGET_MACHINE}"
export commit_id="$(git rev-parse --short HEAD)"
export branch="$(git rev-parse --abbrev-ref HEAD)"
export release="$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $FILESYSTEM_ROOT/etc/sonic/sonic_release; fi)"

View File

@ -5,6 +5,7 @@ SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
# Retrieve SWSS vars from sonic-cfggen
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
export platform=$(echo $SWSS_VARS | jq -r '.asic_type')
export sub_platform=$(echo $SWSS_VARS | jq -r '.asic_subtype')
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then

View File

@ -7,6 +7,9 @@ debian_version: '{{ debian_version }}'
kernel_version: '{{ kernel_version }}'
{% endif -%}
asic_type: {{ asic_type }}
{% if asic_subtype is defined and asic_subtype != '' -%}
asic_subtype: '{{ asic_subtype }}'
{% endif -%}
commit_id: '{{ commit_id }}'
branch: '{{ branch }}'
{% if release is defined and release != '' -%}

View File

@ -1,5 +1,8 @@
{
"asic_type": "{{ asic_type }}",
{% if asic_subtype is defined and asic_subtype != '' -%}
"asic_subtype": "{{ asic_subtype }}",
{% endif -%}
"asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}",
"mac": "{{ DEVICE_METADATA.localhost.mac }}",
"resource_type": "{{ DEVICE_METADATA.localhost.resource_type }}",