Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlate/openconfig: disable client-signal-mapping-type configuration #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/xlate/openconfig/goldstone/xlate/openconfig/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,11 @@ def _set_item(self, user, value):
self._set(user, self.fec_type_xpath, value[2])
else:
self._delete(user, self.fec_type_xpath)
if value[3] is not None:
self._set(user, self.client_signal_mapping_type_xpath, value[3])
else:
self._delete(user, self.client_signal_mapping_type_xpath)
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# if value[3] is not None:
# self._set(user, self.client_signal_mapping_type_xpath, value[3])
# else:
# self._delete(user, self.client_signal_mapping_type_xpath)

def _delete_item(self, user):
if self.module_created:
Expand All @@ -619,7 +620,8 @@ def _delete_item(self, user):
self._delete(user, self.line_rate_xpath)
self._delete(user, self.modulation_format_xpath)
self._delete(user, self.fec_type_xpath)
self._delete(user, self.client_signal_mapping_type_xpath)
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# self._delete(user, self.client_signal_mapping_type_xpath)

def _translate(self, user, value):
return self._tranmission_mode(value)
Expand Down Expand Up @@ -1131,9 +1133,12 @@ def _operational_mode(
line_rate == mode["line-rate"]
and modulation_format == mode["modulation-format"]
and fec_type == mode["fec-type"]
and client_signal_mapping_type == mode["client-signal-mapping-type"]
):
return id_
if (
client_signal_mapping_type == mode["client-signal-mapping-type"]
or client_signal_mapping_type is None
):
return id_

def translate(self):
if self.network_interface:
Expand Down Expand Up @@ -1195,7 +1200,8 @@ def translate(self):
line_rate
and modulation_format
and fec_type
and client_signal_mapping_type
# NOTE: Current implementation may not return clinet-signal-mapping-type.
# and client_signal_mapping_type
):
self.data["optical-channel"]["state"][
"operational-mode"
Expand Down
179 changes: 99 additions & 80 deletions src/xlate/openconfig/tests/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4531,12 +4531,13 @@ def test_set_module_not_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "ofec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "flexo-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "flexo-lr")

handler.revert(user)
self.sess["running"].apply()
Expand Down Expand Up @@ -4610,12 +4611,13 @@ def test_set_module_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "ofec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "flexo-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "flexo-lr")

handler.revert(user)
self.sess["running"].apply()
Expand Down Expand Up @@ -4695,12 +4697,13 @@ def test_set_netif_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "ofec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "flexo-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "flexo-lr")

handler.revert(user)
self.sess["running"].apply()
Expand Down Expand Up @@ -4745,11 +4748,12 @@ def test_set_items_configured(self):
"network-interface[name='1']/config/fec-type",
"sc-fec",
)
self.conn.set(
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type",
"otu4-lr",
)
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# self.conn.set(
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type",
# "otu4-lr",
# )
self.conn.apply()

server = PlatformServer(self.conn, operational_modes)
Expand All @@ -4769,7 +4773,10 @@ def test_set_items_configured(self):

handler.validate(user)
self.assertEqual(
handler.original_value, ("100g", "dp-qpsk", "sc-fec", "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# handler.original_value, ("100g", "dp-qpsk", "sc-fec", "otu4-lr")
handler.original_value,
("100g", "dp-qpsk", "sc-fec", None),
)
self.assertFalse(handler.module_created)
self.assertFalse(handler.netif_created)
Expand Down Expand Up @@ -4803,12 +4810,13 @@ def test_set_items_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "ofec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "flexo-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "flexo-lr")

handler.revert(user)
self.sess["running"].apply()
Expand All @@ -4830,12 +4838,13 @@ def test_set_items_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "sc-fec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "otu4-lr")
xpath = "/goldstone-transponder:modules/module[name='piu1']/name"
self.conn.get(xpath)
xpath = "/goldstone-transponder:modules/module[name='piu1']/network-interface[name='1']/name"
Expand Down Expand Up @@ -5034,11 +5043,12 @@ def test_delete_items_configured(self):
"network-interface[name='1']/config/fec-type",
"sc-fec",
)
self.conn.set(
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type",
"otu4-lr",
)
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# self.conn.set(
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type",
# "otu4-lr",
# )
self.conn.apply()

server = PlatformServer(self.conn, operational_modes)
Expand All @@ -5057,7 +5067,10 @@ def test_delete_items_configured(self):

handler.validate(user)
self.assertEqual(
handler.original_value, ("100g", "dp-qpsk", "sc-fec", "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# handler.original_value, ("100g", "dp-qpsk", "sc-fec", "otu4-lr")
handler.original_value,
("100g", "dp-qpsk", "sc-fec", None),
)
self.assertFalse(handler.module_created)
self.assertFalse(handler.netif_created)
Expand Down Expand Up @@ -5095,12 +5108,13 @@ def test_delete_items_configured(self):
)
data = self.conn.get(xpath)
self.assertEqual(data, "sc-fec")
xpath = (
"/goldstone-transponder:modules/module[name='piu1']/"
"network-interface[name='1']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# "/goldstone-transponder:modules/module[name='piu1']/"
# "network-interface[name='1']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "otu4-lr")
xpath = "/goldstone-transponder:modules/module[name='piu1']/name"
self.conn.get(xpath)
xpath = "/goldstone-transponder:modules/module[name='piu1']/network-interface[name='1']/name"
Expand Down Expand Up @@ -6402,12 +6416,13 @@ def test():
data = self.conn.get(xpath)
self.assertEqual(data, "sc-fec")

xpath = (
f"/goldstone-transponder:modules/module[name='{module_name}']/"
f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# f"/goldstone-transponder:modules/module[name='{module_name}']/"
# f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "otu4-lr")

# Set 400.
module_name = "piu1"
Expand Down Expand Up @@ -6441,12 +6456,13 @@ def test():
data = self.conn.get(xpath)
self.assertEqual(data, "ofec")

xpath = (
f"/goldstone-transponder:modules/module[name='{module_name}']/"
f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "flexo-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# f"/goldstone-transponder:modules/module[name='{module_name}']/"
# f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "flexo-lr")

# Delete.
module_name = "piu1"
Expand Down Expand Up @@ -6479,12 +6495,13 @@ def test():
data = self.conn.get(xpath)
self.assertEqual(data, None)

xpath = (
f"/goldstone-transponder:modules/module[name='{module_name}']/"
f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, None)
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# f"/goldstone-transponder:modules/module[name='{module_name}']/"
# f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, None)

await self.run_xlate_test(test)

Expand Down Expand Up @@ -6540,7 +6557,7 @@ def test():
)
self.set_mock_change_handler(
"goldstone-transponder",
"/modules/module/network-interface/config/client-signal-mapping-type",
"/modules/module/network-interface/config/fec-type",
FailApplyChangeHandler,
)
time.sleep(1)
Expand Down Expand Up @@ -6641,12 +6658,13 @@ def test():
data = self.conn.get(xpath)
self.assertEqual(data, "sc-fec")

xpath = (
f"/goldstone-transponder:modules/module[name='{module_name}']/"
f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# f"/goldstone-transponder:modules/module[name='{module_name}']/"
# f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "otu4-lr")

# Update configuration.
self.conn.set(
Expand All @@ -6667,7 +6685,7 @@ def test():
# But failed.
self.set_mock_change_handler(
"goldstone-transponder",
"/modules/module/network-interface/config/client-signal-mapping-type",
"/modules/module/network-interface/config/fec-type",
FailApplyChangeHandler,
)
time.sleep(1)
Expand Down Expand Up @@ -6710,12 +6728,13 @@ def test():
data = self.conn.get(xpath)
self.assertEqual(data, "sc-fec")

xpath = (
f"/goldstone-transponder:modules/module[name='{module_name}']/"
f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
)
data = self.conn.get(xpath)
self.assertEqual(data, "otu4-lr")
# NOTE: Current implementation doesn't allow to configure client-signal-mapping-type.
# xpath = (
# f"/goldstone-transponder:modules/module[name='{module_name}']/"
# f"network-interface[name='{netif_name}']/config/client-signal-mapping-type"
# )
# data = self.conn.get(xpath)
# self.assertEqual(data, "otu4-lr")

await self.run_xlate_test(test)

Expand Down