diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py
index 4e573cd22a..d267c24976 100644
--- a/src/sonic-config-engine/minigraph.py
+++ b/src/sonic-config-engine/minigraph.py
@@ -973,7 +973,8 @@ def parse_linkmeta(meta, hname):
lower_tor_hostname = ''
auto_negotiation = None
macsec_enabled = False
-
+ tx_power = None
+ laser_freq = None
properties = linkmeta.find(str(QName(ns1, "Properties")))
for device_property in properties.findall(str(QName(ns1, "DeviceProperty"))):
name = device_property.find(str(QName(ns1, "Name"))).text
@@ -990,6 +991,10 @@ def parse_linkmeta(meta, hname):
auto_negotiation = value
elif name == "MacSecEnabled":
macsec_enabled = value
+ elif name == "TxPower":
+ tx_power = value
+ elif name == "Frequency":
+ laser_freq = value
linkmetas[port] = {}
if fec_disabled:
@@ -1003,6 +1008,11 @@ def parse_linkmeta(meta, hname):
linkmetas[port]["AutoNegotiation"] = auto_negotiation
if macsec_enabled:
linkmetas[port]["MacSecEnabled"] = macsec_enabled
+ if tx_power:
+ linkmetas[port]["tx_power"] = tx_power
+ # Convert the freq in GHz
+ if laser_freq:
+ linkmetas[port]["laser_freq"] = int(float(laser_freq)*1000)
return linkmetas
def parse_macsec_profile(val_string):
@@ -1615,6 +1625,14 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if macsec_enabled and 'PrimaryKey' in macsec_profile:
port['macsec'] = macsec_profile['PrimaryKey']
+ tx_power = linkmetas.get(alias, {}).get('tx_power')
+ if tx_power:
+ port['tx_power'] = tx_power
+
+ laser_freq = linkmetas.get(alias, {}).get('laser_freq')
+ if laser_freq:
+ port['laser_freq'] = laser_freq
+
# set port description if parsed from deviceinfo
for port_name in port_descriptions:
# ignore port not in port_config.ini
diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml
index ac83d87b96..6b22d30336 100644
--- a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml
+++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml
@@ -222,6 +222,25 @@
+
+
+
+
+
+
+ Frequency
+ 131
+
+
+ TxPower
+ 7.5
+
+
+ str2-8808-lc2-1:Eth1/1/13;ARISTA01-RH:Ethernet1/1
+
+
+
+
diff --git a/src/sonic-config-engine/tests/sample-voq-graph.xml b/src/sonic-config-engine/tests/sample-voq-graph.xml
index f1fa436203..a43e64cf65 100644
--- a/src/sonic-config-engine/tests/sample-voq-graph.xml
+++ b/src/sonic-config-engine/tests/sample-voq-graph.xml
@@ -79,6 +79,20 @@
linecard-1:Ethernet1/1;ARISTA01-RH:Ethernet1/1
+
+
+
+
+ Frequency
+ 195.875
+
+
+ TxPower
+ -10
+
+
+ linecard-1:Ethernet2/1;ARISTA01-RH:Ethernet1/1
+
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py
index 232fded47e..1190ef9680 100644
--- a/src/sonic-config-engine/tests/test_cfggen.py
+++ b/src/sonic-config-engine/tests/test_cfggen.py
@@ -1008,3 +1008,17 @@ class TestCfgGen(TestCase):
utils.to_dict(output.strip()),
utils.to_dict("{('PortChannel32.2', '192.168.1.4/24'): {}, 'PortChannel32.2': {'admin_status': 'up'}, ('PortChannel33.2', '192.168.2.4/24'): {}, 'PortChannel33.2': {'admin_status': 'up'}}")
)
+
+ def test_minigraph_voq_400g_zr_port_config(self):
+ argument = "-j {} -m {} -p {} -v \"PORT[\'Ethernet4\']\"".format(self.macsec_profile, self.sample_graph_voq, self.voq_port_config)
+ output = self.run_script(argument)
+ output_dict = utils.to_dict(output.strip())
+ self.assertEqual(output_dict['tx_power'], '-10')
+ self.assertEqual(output_dict['laser_freq'], 195875)
+
+ def test_minigraph_packet_chassis_400g_zr_port_config(self):
+ argument = "-m {} -p {} -n asic1 -v \"PORT[\'Ethernet13\']\"".format(self.packet_chassis_graph, self.packet_chassis_port_ini)
+ output = self.run_script(argument)
+ output_dict = utils.to_dict(output.strip())
+ self.assertEqual(output_dict['tx_power'], '7.5')
+ self.assertEqual(output_dict['laser_freq'], 131000)
\ No newline at end of file