Skip to content

Commit

Permalink
Fix the reference in docker-snmp-sv2 to deprecated alias_map.json (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyl-ms authored Feb 22, 2017
1 parent f087f13 commit 95ad5c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions dockers/docker-snmp-sv2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ mkdir -p /etc/snmp

sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf

hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/
sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json

mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-config-engine/sonic-cfggen
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def main():
parser.add_argument("-a", "--additional-data", help="addition data, in json string")
group = parser.add_mutually_exclusive_group()
group.add_argument("-t", "--template", help="render the data with the template file")
group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true')
group.add_argument("-v", "--var", help="print the value of a variable")
group.add_argument("--var-json", help="print the value of a variable, in json format")
group.add_argument("--var-keys", help="print all keys of a map variable")
Expand Down Expand Up @@ -101,6 +102,13 @@ def main():
if args.var_keys != None:
for key in data[args.var_keys].keys():
print key

if args.alias_mapping != None:
mapping = {}
if data.has_key('alias_map'):
for item in data['alias_map']:
mapping[item['sonic']] = item['origin']
print json.dumps(mapping)

if args.print_data:
print data
Expand Down

0 comments on commit 95ad5c7

Please sign in to comment.