Add support for bidi amplifiers

This was a bit painful because we have to add this new model to two NACM
rulesets, so this patch is a wee bit noisy.

Change-Id: I23e238fa17ccd647be56b0dc0460c3be496e9f22
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/cla-sysrepo/+/7123
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/7133
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/gammarus/+/7131
diff --git a/board/czechlight/clearfog/overlay/usr/lib/systemd/system/max31780-fans.service b/board/czechlight/clearfog/overlay/usr/lib/systemd/system/max31780-fans.service
index f9a9576..c427cda 100644
--- a/board/czechlight/clearfog/overlay/usr/lib/systemd/system/max31780-fans.service
+++ b/board/czechlight/clearfog/overlay/usr/lib/systemd/system/max31780-fans.service
@@ -6,6 +6,8 @@
 ConditionKernelCommandLine=|czechlight=sdn-roadm-hires-add-drop-g2
 ConditionKernelCommandLine=|czechlight=sdn-roadm-line-g2
 ConditionKernelCommandLine=|czechlight=sdn-roadm-hires-add-drop-g2
+ConditionKernelCommandLine=|czechlight=sdn-bidi-cplus1572-g2
+ConditionKernelCommandLine=|czechlight=sdn-bidi-cplus1572-ocm-g2
 
 [Service]
 Type=oneshot
diff --git a/board/czechlight/clearfog/sdn-bidi-cplus1572-g2-clearfog.dts b/board/czechlight/clearfog/sdn-bidi-cplus1572-g2-clearfog.dts
new file mode 100644
index 0000000..8c5c60e
--- /dev/null
+++ b/board/czechlight/clearfog/sdn-bidi-cplus1572-g2-clearfog.dts
@@ -0,0 +1,5 @@
+#include "sdn-roadm-clearfog.dtsi"
+
+&lumentum_ocm {
+	status = "disabled";
+};
diff --git a/board/czechlight/clearfog/sdn-bidi-cplus1572-ocm-g2-clearfog.dts b/board/czechlight/clearfog/sdn-bidi-cplus1572-ocm-g2-clearfog.dts
new file mode 100644
index 0000000..39f5e7a
--- /dev/null
+++ b/board/czechlight/clearfog/sdn-bidi-cplus1572-ocm-g2-clearfog.dts
@@ -0,0 +1 @@
+#include "sdn-roadm-clearfog.dtsi"
diff --git a/configs/czechlight_clearfog_defconfig b/configs/czechlight_clearfog_defconfig
index 94c7948..2eceb98 100644
--- a/configs/czechlight_clearfog_defconfig
+++ b/configs/czechlight_clearfog_defconfig
@@ -33,7 +33,7 @@
 BR2_LINUX_KERNEL_DEFCONFIG="mvebu_v7"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/linux.fragment $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/common/linux.fragment"
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
-BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/czechlight-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-clearfog.dtsi $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-line-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-add-drop-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-coherent-a-d-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-inline-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-testing-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/bare-cfb-base-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/bare-cfb-pro-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/clearfog-output-voa.dtsi $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-line-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-add-drop-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-coherent-a-d-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-hires-add-drop-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-inline-g2-clearfog.dts"
+BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/czechlight-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-clearfog.dtsi $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-line-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-add-drop-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-coherent-a-d-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-inline-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-testing-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/bare-cfb-base-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/bare-cfb-pro-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/clearfog-output-voa.dtsi $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-line-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-add-drop-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-coherent-a-d-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-roadm-hires-add-drop-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-inline-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-bidi-cplus1572-g2-clearfog.dts $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/clearfog/sdn-bidi-cplus1572-ocm-g2-clearfog.dts"
 BR2_LINUX_KERNEL_INSTALL_TARGET=y
 BR2_PACKAGE_LINUX_TOOLS_GPIO=y
 BR2_PACKAGE_LINUX_TOOLS_IIO=y
diff --git a/package/cla-sysrepo/cla-sysrepo.mk b/package/cla-sysrepo/cla-sysrepo.mk
index e10d297..c2d3e50 100644
--- a/package/cla-sysrepo/cla-sysrepo.mk
+++ b/package/cla-sysrepo/cla-sysrepo.mk
@@ -24,6 +24,8 @@
 	$(call CLA_SYSREPO_PREPARE_SERVICE,sdn-roadm-coherent-a-d)
 	$(call CLA_SYSREPO_PREPARE_SERVICE,sdn-inline)
 	$(call CLA_SYSREPO_PREPARE_SERVICE,calibration-box)
+	$(call CLA_SYSREPO_PREPARE_SERVICE,sdn-bidi-cplus1572)
+	$(call CLA_SYSREPO_PREPARE_SERVICE,sdn-bidi-cplus1572-ocm)
 endef
 
 # FIXME: calibration-box really needs a drop-in file with increased timeout...
diff --git a/package/czechlight-cfg-fs/czechlight-install-yang.sh b/package/czechlight-cfg-fs/czechlight-install-yang.sh
index 0860749..a1d04cd 100755
--- a/package/czechlight-cfg-fs/czechlight-install-yang.sh
+++ b/package/czechlight-cfg-fs/czechlight-install-yang.sh
@@ -6,6 +6,7 @@
 YANG_COHERENT=0
 YANG_INLINE=0
 YANG_CALIBRATION=0
+YANG_BIDI=0
 
 CLA_YANG="${CLA_YANG:-/usr/share/cla-sysrepo/yang}"
 VELIA_YANG="${VELIA_YANG:-/usr/share/velia/yang}"
@@ -46,6 +47,15 @@
     calibration-box)
         YANG_CALIBRATION=1
         ;;
+    sdn-bidi-cplus1572-g2)
+        YANG_BIDI=1
+        BIDI_FEATURES="dualband-c-plus-1572"
+        ;;
+    sdn-bidi-cplus1572-ocm-g2)
+        YANG_BIDI=1
+        BIDI_FEATURES="dualband-c-plus-1572 c-band-ocm"
+        INITIAL_DATA=sdn-bidi-cplus1572
+        ;;
 esac
 
 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/iana-hardware@2018-03-13.yang
@@ -75,6 +85,14 @@
     sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang --permissions 0660
 fi
 
+if [[ ${YANG_BIDI} == 1 ]]; then
+    FEATURE_ARGS=""
+    for FEATURE in ${BIDI_FEATURES}; do
+        FEATURE_ARGS="${FEATURE_ARGS} --enable-feature ${FEATURE}"
+    done
+    sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-bidi-amp@2022-03-22.yang ${FEATURE_ARGS} --permissions 0660
+fi
+
 sysrepoctl --search-dirs ${ALARMS_YANG} --install ${ALARMS_YANG}/ietf-alarms@2019-09-11.yang --permissions 0660 --enable-feature alarm-shelving --enable-feature alarm-summary
 sysrepoctl --search-dirs ${ALARMS_YANG} --install ${ALARMS_YANG}/sysrepo-ietf-alarms@2022-02-17.yang --permissions 0660
 
diff --git a/package/czechlight-cfg-fs/czechlight-migration-list.sh b/package/czechlight-cfg-fs/czechlight-migration-list.sh
index 6c9faeb..fcaf04f 100644
--- a/package/czechlight-cfg-fs/czechlight-migration-list.sh
+++ b/package/czechlight-cfg-fs/czechlight-migration-list.sh
@@ -6,4 +6,5 @@
     '0005_nacm_anonymous_user.sh'
     '0006_nacm_authentication_rpcs.sh'
     '0007_nacm_anonymous_user_monitoring.sh'
+    '0008_bidi_amp_nacm.sh'
 )
diff --git a/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm.sh b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm.sh
new file mode 100644
index 0000000..b136ea4
--- /dev/null
+++ b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -ex
+
+# Configure access to the czechlight-bidi-amp module
+# --------------------------------------------------
+#
+# The rules are added right after those for the inline amplifier. Since this script only runs after "0004_nacm"
+# and "0005_nacm_anonymous_user", we can assume that if the outer rule-list is not present at all, that must be
+# a deliberate configuration. In that case, we probably should not add any rules. Similarly, if there's no rule
+# for the "czechlight-inline-amp", let's take a guess and assume that the operator does not want to allow access
+# to amplifiers -- again, it can only happen due to an explicit configuration.
+#
+# The first rule is for authenticated users, default group "dwdm".
+if RULE=$(sysrepocfg -d startup -G "/ietf-netconf-acm:nacm/rule-list[name='Allow DWDM control to the optics group']/rule[name='czechlight-inline-amp']/name") \
+    && [ "$RULE" == "czechlight-inline-amp" ]; then
+    sysrepocfg --datastore=startup --format=json --module=ietf-netconf-acm --edit="${MIGRATIONS_DIRECTORY}/0008_bidi_amp_nacm_optics.json"
+fi
+
+# The second rule allows anonymous read-only access via RESTCONF.
+if RULE=$(sysrepocfg -d startup -G "/ietf-netconf-acm:nacm/rule-list[name='Permit yangnobody user/group to read only some modules']/rule[name='czechlight-inline-amp']/name") \
+    && [ "$RULE" == "czechlight-inline-amp" ]; then
+    sysrepocfg --datastore=startup --format=json --module=ietf-netconf-acm --edit="${MIGRATIONS_DIRECTORY}/0008_bidi_amp_nacm_anonymous_user.json"
+fi
diff --git a/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_anonymous_user.json b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_anonymous_user.json
new file mode 100644
index 0000000..d72d359
--- /dev/null
+++ b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_anonymous_user.json
@@ -0,0 +1,24 @@
+{
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Permit yangnobody user/group to read only some modules",
+        "group": [
+          "yangnobody"
+        ],
+        "rule": [
+          {
+            "@": {
+              "yang:insert": "after",
+              "yang:key": "[name='czechlight-inline-amp']"
+            },
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_optics.json b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_optics.json
new file mode 100644
index 0000000..9be0846
--- /dev/null
+++ b/package/czechlight-cfg-fs/migrations/0008_bidi_amp_nacm_optics.json
@@ -0,0 +1,23 @@
+{
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Allow DWDM control to the optics group",
+        "group": [
+          "optics"
+        ],
+        "rule": [
+          {
+            "@": {
+              "yang:insert": "after",
+              "yang:key": "[name='czechlight-inline-amp']"
+            },
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/package/reset-sysrepo/reset-sysrepo.mk b/package/reset-sysrepo/reset-sysrepo.mk
index 9aecbd5..1b5b4b9 100644
--- a/package/reset-sysrepo/reset-sysrepo.mk
+++ b/package/reset-sysrepo/reset-sysrepo.mk
@@ -20,6 +20,8 @@
 		cla-sdn-roadm-coherent-a-d.service \
 		cla-sdn-roadm-hires-drop.service \
 		cla-sdn-roadm-line.service \
+		cla-sdn-bidi-cplus1572.service \
+		cla-sdn-bidi-cplus1572-ocm.service \
 		netopeer2.service \
 		sysrepo-ietf-alarms.service \
 		sysrepo-persistent-cfg.service \
diff --git a/package/velia/velia-hardware-g2.service b/package/velia/velia-hardware-g2.service
index 1186979..4880f1d 100644
--- a/package/velia/velia-hardware-g2.service
+++ b/package/velia/velia-hardware-g2.service
@@ -9,6 +9,8 @@
 ConditionKernelCommandLine=|czechlight=sdn-roadm-coherent-a-d-g2
 ConditionKernelCommandLine=|czechlight=sdn-roadm-hires-add-drop-g2
 ConditionKernelCommandLine=|czechlight=sdn-roadm-line-g2
+ConditionKernelCommandLine=|czechlight=sdn-bidi-cplus1572-g2
+ConditionKernelCommandLine=|czechlight=sdn-bidi-cplus1572-ocm-g2
 
 [Service]
 Type=simple
diff --git a/submodules/cla-sysrepo b/submodules/cla-sysrepo
index f1b5fb3..d40d571 160000
--- a/submodules/cla-sysrepo
+++ b/submodules/cla-sysrepo
@@ -1 +1 @@
-Subproject commit f1b5fb35b1055980f4fcf1aa02f0b30a1fa5c376
+Subproject commit d40d571b3ebbc6b330b4f928d681da50708b0e38
diff --git a/submodules/dependencies b/submodules/dependencies
index b28d558..5965684 160000
--- a/submodules/dependencies
+++ b/submodules/dependencies
@@ -1 +1 @@
-Subproject commit b28d558204f64359875b2de654045cb1b6f6b5eb
+Subproject commit 5965684b221e6a234ea3c538634f90aefa1af084
diff --git a/submodules/gammarus b/submodules/gammarus
index c887489..7e51ec9 160000
--- a/submodules/gammarus
+++ b/submodules/gammarus
@@ -1 +1 @@
-Subproject commit c88748953682d5d804d4489fde6f4e0f29b29d6f
+Subproject commit 7e51ec9ac586a7d93addd6b5aecea2f40ce17238
diff --git a/submodules/rousette b/submodules/rousette
index 062ceec..226a241 160000
--- a/submodules/rousette
+++ b/submodules/rousette
@@ -1 +1 @@
-Subproject commit 062ceec29ca7c8fba11cd19375af4c4e5abdd144
+Subproject commit 226a2410376e5befd0bf6dc180618a108b11b256
diff --git a/tests/czechlight-cfg-fs/data/v0_sdn-inline_empty/expected.json b/tests/czechlight-cfg-fs/data/v0_sdn-inline_empty/expected.json
index 468fe01..8502d62 100644
--- a/tests/czechlight-cfg-fs/data/v0_sdn-inline_empty/expected.json
+++ b/tests/czechlight-cfg-fs/data/v0_sdn-inline_empty/expected.json
@@ -78,6 +78,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -187,6 +193,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v0_sdn-inline_somedata/expected.json b/tests/czechlight-cfg-fs/data/v0_sdn-inline_somedata/expected.json
index f307ef3..04278c6 100644
--- a/tests/czechlight-cfg-fs/data/v0_sdn-inline_somedata/expected.json
+++ b/tests/czechlight-cfg-fs/data/v0_sdn-inline_somedata/expected.json
@@ -130,6 +130,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -239,6 +245,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-add-drop_empty/expected.json b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-add-drop_empty/expected.json
index 54117c6..f3e0043 100644
--- a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-add-drop_empty/expected.json
+++ b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-add-drop_empty/expected.json
@@ -803,6 +803,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -912,6 +918,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_empty/expected.json b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_empty/expected.json
index 06174d5..d603c13 100644
--- a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_empty/expected.json
+++ b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_empty/expected.json
@@ -803,6 +803,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -912,6 +918,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_with_altered_initial_data/expected.json b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_with_altered_initial_data/expected.json
index 06174d5..d603c13 100644
--- a/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_with_altered_initial_data/expected.json
+++ b/tests/czechlight-cfg-fs/data/v0_sdn-roadm-line_with_altered_initial_data/expected.json
@@ -803,6 +803,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -912,6 +918,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/expected.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/expected.json
index 34896b7..976b8c8 100644
--- a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/expected.json
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/expected.json
@@ -20,6 +20,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -127,6 +133,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/expected.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/expected.json
index 34896b7..976b8c8 100644
--- a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/expected.json
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/expected.json
@@ -20,6 +20,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -127,6 +133,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/expected.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/expected.json
index 34896b7..976b8c8 100644
--- a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/expected.json
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/expected.json
@@ -20,6 +20,12 @@
             "access-operations": "read"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit",
@@ -127,6 +133,11 @@
             "action": "permit"
           },
           {
+            "name": "czechlight-bidi-amp",
+            "module-name": "czechlight-bidi-amp",
+            "action": "permit"
+          },
+          {
             "name": "czechlight-coherent-add-drop",
             "module-name": "czechlight-coherent-add-drop",
             "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_default_nacm/expected.json b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_default_nacm/expected.json
index 0a75d53..4606260 100644
--- a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_default_nacm/expected.json
+++ b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_default_nacm/expected.json
@@ -20,6 +20,12 @@
                         "access-operations": "read"
                     },
                     {
+                        "name": "czechlight-bidi-amp",
+                        "module-name": "czechlight-bidi-amp",
+                        "action": "permit",
+                        "access-operations": "read"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit",
@@ -127,6 +133,11 @@
                         "action": "permit"
                     },
                     {
+                      "name": "czechlight-bidi-amp",
+                      "module-name": "czechlight-bidi-amp",
+                      "action": "permit"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_multiple_nacm_rules/expected.json b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_multiple_nacm_rules/expected.json
index 4c288d8..67f0489 100644
--- a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_multiple_nacm_rules/expected.json
+++ b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_multiple_nacm_rules/expected.json
@@ -20,6 +20,12 @@
                         "access-operations": "read"
                     },
                     {
+                        "name": "czechlight-bidi-amp",
+                        "module-name": "czechlight-bidi-amp",
+                        "action": "permit",
+                        "access-operations": "read"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit",
@@ -135,6 +141,11 @@
                         "action": "permit"
                     },
                     {
+                      "name": "czechlight-bidi-amp",
+                      "module-name": "czechlight-bidi-amp",
+                      "action": "permit"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_no_nacm/expected.json b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_no_nacm/expected.json
index 5f658af..c81f5cd 100644
--- a/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_no_nacm/expected.json
+++ b/tests/czechlight-cfg-fs/data/v4_sdn-roadm-line_no_nacm/expected.json
@@ -20,6 +20,12 @@
                         "access-operations": "read"
                     },
                     {
+                        "name": "czechlight-bidi-amp",
+                        "module-name": "czechlight-bidi-amp",
+                        "action": "permit",
+                        "access-operations": "read"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit",
diff --git a/tests/czechlight-cfg-fs/data/v5_sdn-roadm-line_multiple_nacm_rules/expected.json b/tests/czechlight-cfg-fs/data/v5_sdn-roadm-line_multiple_nacm_rules/expected.json
index eafea8b..0c95155 100644
--- a/tests/czechlight-cfg-fs/data/v5_sdn-roadm-line_multiple_nacm_rules/expected.json
+++ b/tests/czechlight-cfg-fs/data/v5_sdn-roadm-line_multiple_nacm_rules/expected.json
@@ -24,6 +24,11 @@
                         "action": "permit"
                     },
                     {
+                        "name": "czechlight-bidi-amp",
+                        "module-name": "czechlight-bidi-amp",
+                        "action": "permit"
+                    },
+                    {
                         "name": "czechlight-coherent-add-drop",
                         "module-name": "czechlight-coherent-add-drop",
                         "action": "permit"
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/cmdline b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/cmdline
new file mode 100644
index 0000000..6b1d906
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/cmdline
@@ -0,0 +1 @@
+czechlight=sdn-roadm-line
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/expected.json b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/expected.json
new file mode 100644
index 0000000..83e7f48
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/expected.json
@@ -0,0 +1,147 @@
+{
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Permit yangnobody user/group to read only some modules",
+        "group": [
+          "yangnobody"
+        ],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-coherent-add-drop",
+            "module-name": "czechlight-coherent-add-drop",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-yang-library",
+            "module-name": "ietf-yang-library",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-hardware",
+            "module-name": "ietf-hardware",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-interfaces",
+            "module-name": "ietf-interfaces",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: contact",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/contact",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: hostname",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/hostname",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: location",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/location",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: clock",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/clock",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: system-state",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system-state",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-lldp",
+            "module-name": "czechlight-lldp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-system:firmware",
+            "module-name": "czechlight-system",
+            "path": "/czechlight-system:firmware",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-system:leds",
+            "module-name": "czechlight-system",
+            "path": "/czechlight-system:leds",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-restconf-monitoring",
+            "module-name": "ietf-restconf-monitoring",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "wildcard-deny",
+            "module-name": "*",
+            "action": "deny",
+            "access-operations": "*"
+          }
+        ]
+      },
+      {
+        "name": "Allow DWDM control to the optics group",
+        "group": ["optics"],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-coherent-add-drop",
+            "module-name": "czechlight-coherent-add-drop",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-calibration-device",
+            "module-name": "czechlight-calibration-device",
+            "action": "permit"
+          }
+        ]
+      },
+      {
+        "name": "Authentication details of current user",
+        "group": [
+          "*"
+        ],
+        "rule": [
+          {
+            "name": "Allow reading and executing actions in the context of the current user",
+            "access-operations": "read exec",
+            "module-name": "czechlight-system",
+            "action": "permit",
+            "path": "/czechlight-system:authentication/users[name=$USER]"
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/startup.json b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/startup.json
new file mode 100644
index 0000000..83e7f48
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/startup.json
@@ -0,0 +1,147 @@
+{
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Permit yangnobody user/group to read only some modules",
+        "group": [
+          "yangnobody"
+        ],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-coherent-add-drop",
+            "module-name": "czechlight-coherent-add-drop",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-yang-library",
+            "module-name": "ietf-yang-library",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-hardware",
+            "module-name": "ietf-hardware",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-interfaces",
+            "module-name": "ietf-interfaces",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: contact",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/contact",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: hostname",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/hostname",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: location",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/location",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: clock",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system/clock",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-system: system-state",
+            "module-name": "ietf-system",
+            "action": "permit",
+            "path": "/ietf-system:system-state",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-lldp",
+            "module-name": "czechlight-lldp",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-system:firmware",
+            "module-name": "czechlight-system",
+            "path": "/czechlight-system:firmware",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "czechlight-system:leds",
+            "module-name": "czechlight-system",
+            "path": "/czechlight-system:leds",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "ietf-restconf-monitoring",
+            "module-name": "ietf-restconf-monitoring",
+            "action": "permit",
+            "access-operations": "read"
+          },
+          {
+            "name": "wildcard-deny",
+            "module-name": "*",
+            "action": "deny",
+            "access-operations": "*"
+          }
+        ]
+      },
+      {
+        "name": "Allow DWDM control to the optics group",
+        "group": ["optics"],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-coherent-add-drop",
+            "module-name": "czechlight-coherent-add-drop",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-calibration-device",
+            "module-name": "czechlight-calibration-device",
+            "action": "permit"
+          }
+        ]
+      },
+      {
+        "name": "Authentication details of current user",
+        "group": [
+          "*"
+        ],
+        "rule": [
+          {
+            "name": "Allow reading and executing actions in the context of the current user",
+            "access-operations": "read exec",
+            "module-name": "czechlight-system",
+            "action": "permit",
+            "path": "/czechlight-system:authentication/users[name=$USER]"
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/version b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/version
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/version
@@ -0,0 +1 @@
+7
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/xpath b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/xpath
new file mode 100644
index 0000000..8eca9fa
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_modified_nacm/xpath
@@ -0,0 +1 @@
+/ietf-netconf-acm:nacm
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/cmdline b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/cmdline
new file mode 100644
index 0000000..6b1d906
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/cmdline
@@ -0,0 +1 @@
+czechlight=sdn-roadm-line
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/expected.json b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/expected.json
new file mode 100644
index 0000000..2c63c08
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/expected.json
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/startup.json b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/startup.json
new file mode 100644
index 0000000..2c63c08
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/startup.json
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/version b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/version
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/version
@@ -0,0 +1 @@
+7
diff --git a/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/xpath b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/xpath
new file mode 100644
index 0000000..8eca9fa
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v7-sdn-roadm-line_no_nacm/xpath
@@ -0,0 +1 @@
+/ietf-netconf-acm:nacm