[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:
parent
30ef11198f
commit
fbc24b4279
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user