[orchagent] Use mac address from config_db instead of from eth0 (#4166)

* Use mac address from config_db instead of eth0
This commit is contained in:
Prince Sunny 2020-02-20 19:16:14 -08:00 committed by GitHub
parent 30ef11198f
commit fbc24b4279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -4,7 +4,11 @@
# vendor specific code.
export platform=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type`
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
MAC_ADDRESS=$(sonic-cfggen -d -v 'DEVICE_METADATA.localhost.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
logger "Mac address not found in Device Metadata, Falling back to eth0"
fi
# Create a folder for SwSS record files
mkdir -p /var/log/swss

View File

@ -1,6 +1,10 @@
#!/usr/bin/env bash
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
MAC_ADDRESS=$(sonic-cfggen -d -v 'DEVICE_METADATA.localhost.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
logger "Mac address not found in Device Metadata, Falling back to eth0"
fi
# Create a folder for SsWW record files
mkdir -p /var/log/swss

View File

@ -6,7 +6,11 @@ else
export platform=$fake_platform
fi
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
MAC_ADDRESS=$(sonic-cfggen -d -v 'DEVICE_METADATA.localhost.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
logger "Mac address not found in Device Metadata, Falling back to eth0"
fi
# Create a folder for SwSS record files
mkdir -p /var/log/swss