@@ -1562,63 +1562,35 @@ def reload():
1562
1562
click .secho (
1563
1563
"Command 'qos reload' failed with invalid namespace '{}'" .
1564
1564
format (ns ),
1565
- fg = ' yellow'
1565
+ fg = " yellow"
1566
1566
)
1567
1567
raise click .Abort ()
1568
1568
asic_id_suffix = str (asic_id )
1569
1569
1570
- buffer_template_file = os .path .join (
1571
- hwsku_path ,
1572
- asic_id_suffix ,
1573
- 'buffers.json.j2'
1574
- )
1575
- buffer_output_file = "/tmp/buffers{}.json" .format (asic_id_suffix )
1576
- qos_output_file = "/tmp/qos{}.json" .format (asic_id_suffix )
1577
-
1578
- cmd_ns = "" if ns is DEFAULT_NAMESPACE else "-n {}" .format (ns )
1570
+ buffer_template_file = os .path .join (hwsku_path , asic_id_suffix , "buffers.json.j2" )
1579
1571
if os .path .isfile (buffer_template_file ):
1580
- command = "{} {} -d -t {} > {}" .format (
1581
- SONIC_CFGGEN_PATH ,
1582
- cmd_ns ,
1583
- buffer_template_file ,
1584
- buffer_output_file
1585
- )
1586
- clicommon .run_command (command , display_cmd = True )
1587
- qos_template_file = os .path .join (
1588
- hwsku_path ,
1589
- asic_id_suffix ,
1590
- 'qos.json.j2'
1591
- )
1592
- sonic_version_file = os .path .join (
1593
- '/etc/sonic/' , 'sonic_version.yml'
1594
- )
1572
+ qos_template_file = os .path .join (hwsku_path , asic_id_suffix , "qos.json.j2" )
1595
1573
if os .path .isfile (qos_template_file ):
1596
- command = "{} {} -d -t {} -y {} > {}" .format (
1574
+ cmd_ns = "" if ns is DEFAULT_NAMESPACE else "-n {}" .format (ns )
1575
+ sonic_version_file = os .path .join ('/' , "etc" , "sonic" , "sonic_version.yml" )
1576
+ command = "{} {} -d -t {},config-db -t {},config-db -y {} --write-to-db" .format (
1597
1577
SONIC_CFGGEN_PATH ,
1598
1578
cmd_ns ,
1579
+ buffer_template_file ,
1599
1580
qos_template_file ,
1600
- sonic_version_file ,
1601
- qos_output_file
1581
+ sonic_version_file
1602
1582
)
1603
- clicommon .run_command (command , display_cmd = True )
1604
1583
# Apply the configurations only when both buffer and qos
1605
- # configuration files are presented
1606
- command = "{} {} -j {} --write-to-db" .format (
1607
- SONIC_CFGGEN_PATH , cmd_ns , buffer_output_file
1608
- )
1609
- clicommon .run_command (command , display_cmd = True )
1610
- command = "{} {} -j {} --write-to-db" .format (
1611
- SONIC_CFGGEN_PATH , cmd_ns , qos_output_file
1612
- )
1584
+ # configuration files are present
1613
1585
clicommon .run_command (command , display_cmd = True )
1614
1586
else :
1615
- click .secho (' QoS definition template not found at {}' .format (
1587
+ click .secho (" QoS definition template not found at {}" .format (
1616
1588
qos_template_file
1617
- ), fg = ' yellow' )
1589
+ ), fg = " yellow" )
1618
1590
else :
1619
- click .secho (' Buffer definition template not found at {}' .format (
1591
+ click .secho (" Buffer definition template not found at {}" .format (
1620
1592
buffer_template_file
1621
- ), fg = ' yellow' )
1593
+ ), fg = " yellow" )
1622
1594
1623
1595
#
1624
1596
# 'warm_restart' group ('config warm_restart ...')
0 commit comments