czechlight-cfg-fs: replace NACM restore service with a migration

Currently we reinitialize ietf-netconf-acm module after each boot by
importing a set of rules. This means that after each boot the NACM
configuration was overwritten with "our" configuration.
This is not what we want. Admin of our box might want to adjust the
NACM rules as he see fit.

Therefore it makes sense to create a migration that sets the default
NACM rules by us and other people can modify them.
When migrating to this OS version (config version 4) we overwrite any
existing NACM rules for the last time as a part of the migration.
Starting from this version users are free to adjust the NACM rules
as they see fit. These rules *will not* be reset at boot time anymore.

We scanned the git and gerrit history for the reason why NACM rules
were not moved to one of the first migrations but we found nothing on
that. So this is probably just one of the skeletons in the cupboard that
is being removed with this commit.

Change-Id: I084d6eb81fc340c09abc2edf2995ff40b219e807
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 59f7990..e3b8174 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
@@ -56,5 +56,35 @@
         "type": "iana-if-type:ethernetCsmacd"
       }
     ]
+  },
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Allow DWDM control to the optics group",
+        "group": ["optics"],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-inline-amp",
+            "module-name": "czechlight-inline-amp",
+            "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"
+          }
+        ]
+      }
+    ]
   }
 }
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 edc8766..6ccd852 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
@@ -781,5 +781,35 @@
       "channel": "C-band",
       "description": "Whole-band overview"
     }
-  ]
+  ],
+  "ietf-netconf-acm:nacm": {
+    "rule-list": [
+      {
+        "name": "Allow DWDM control to the optics group",
+        "group": ["optics"],
+        "rule": [
+          {
+            "name": "czechlight-roadm-device",
+            "module-name": "czechlight-roadm-device",
+            "action": "permit"
+          },
+          {
+            "name": "czechlight-inline-amp",
+            "module-name": "czechlight-inline-amp",
+            "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"
+          }
+        ]
+      }
+    ]
+  }
 }
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 edc8766..def9bac 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
@@ -781,5 +781,35 @@
       "channel": "C-band",
       "description": "Whole-band overview"
     }
-  ]
+  ],
+  "ietf-netconf-acm:nacm": {
+      "rule-list": [
+          {
+              "name": "Allow DWDM control to the optics group",
+              "group": ["optics"],
+              "rule": [
+                  {
+                      "name": "czechlight-roadm-device",
+                      "module-name": "czechlight-roadm-device",
+                      "action": "permit"
+                  },
+                  {
+                      "name": "czechlight-inline-amp",
+                      "module-name": "czechlight-inline-amp",
+                      "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"
+                  }
+              ]
+          }
+      ]
+  }
 }
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/cmdline b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/cmdline
new file mode 100644
index 0000000..6b1d906
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/cmdline
@@ -0,0 +1 @@
+czechlight=sdn-roadm-line
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
new file mode 100644
index 0000000..59d413b
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/expected.json
@@ -0,0 +1,32 @@
+{
+    "ietf-netconf-acm:nacm": {
+        "rule-list": [
+            {
+                "name": "Allow DWDM control to the optics group",
+                "group": ["optics"],
+                "rule": [
+                    {
+                        "name": "czechlight-roadm-device",
+                        "module-name": "czechlight-roadm-device",
+                        "action": "permit"
+                    },
+                    {
+                        "name": "czechlight-inline-amp",
+                        "module-name": "czechlight-inline-amp",
+                        "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"
+                    }
+                ]
+            }
+        ]
+    }
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/startup.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/startup.json
new file mode 100644
index 0000000..59d413b
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/startup.json
@@ -0,0 +1,32 @@
+{
+    "ietf-netconf-acm:nacm": {
+        "rule-list": [
+            {
+                "name": "Allow DWDM control to the optics group",
+                "group": ["optics"],
+                "rule": [
+                    {
+                        "name": "czechlight-roadm-device",
+                        "module-name": "czechlight-roadm-device",
+                        "action": "permit"
+                    },
+                    {
+                        "name": "czechlight-inline-amp",
+                        "module-name": "czechlight-inline-amp",
+                        "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"
+                    }
+                ]
+            }
+        ]
+    }
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/version b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/version
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/version
@@ -0,0 +1 @@
+3
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/xpath b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/xpath
new file mode 100644
index 0000000..8eca9fa
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_default_nacm/xpath
@@ -0,0 +1 @@
+/ietf-netconf-acm:nacm
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/cmdline b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/cmdline
new file mode 100644
index 0000000..6b1d906
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/cmdline
@@ -0,0 +1 @@
+czechlight=sdn-roadm-line
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
new file mode 100644
index 0000000..59d413b
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/expected.json
@@ -0,0 +1,32 @@
+{
+    "ietf-netconf-acm:nacm": {
+        "rule-list": [
+            {
+                "name": "Allow DWDM control to the optics group",
+                "group": ["optics"],
+                "rule": [
+                    {
+                        "name": "czechlight-roadm-device",
+                        "module-name": "czechlight-roadm-device",
+                        "action": "permit"
+                    },
+                    {
+                        "name": "czechlight-inline-amp",
+                        "module-name": "czechlight-inline-amp",
+                        "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"
+                    }
+                ]
+            }
+        ]
+    }
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/startup.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/startup.json
new file mode 100644
index 0000000..a56c909
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/startup.json
@@ -0,0 +1,47 @@
+{
+    "ietf-netconf-acm:nacm": {
+        "rule-list": [
+            {
+                "name": "Some rule list",
+                "group": ["optics"],
+                "rule": []
+            },
+            {
+                "name": "Another rule list",
+                "group": ["optics"],
+                "rule": []
+            },
+            {
+                "name": "Allow DWDM control to the optics group",
+                "group": ["optics"],
+                "rule": [
+                    {
+                        "name": "czechlight-roadm-device",
+                        "module-name": "czechlight-roadm-device",
+                        "action": "permit"
+                    },
+                    {
+                        "name": "czechlight-inline-amp",
+                        "module-name": "czechlight-inline-amp",
+                        "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": "Yet another rule list (YARL)",
+                "group": ["optics"],
+                "rule": []
+            }
+        ]
+    }
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/version b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/version
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/version
@@ -0,0 +1 @@
+3
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/xpath b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/xpath
new file mode 100644
index 0000000..8eca9fa
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_multiple_nacm_rules/xpath
@@ -0,0 +1 @@
+/ietf-netconf-acm:nacm
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/cmdline b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/cmdline
new file mode 100644
index 0000000..6b1d906
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/cmdline
@@ -0,0 +1 @@
+czechlight=sdn-roadm-line
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
new file mode 100644
index 0000000..59d413b
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/expected.json
@@ -0,0 +1,32 @@
+{
+    "ietf-netconf-acm:nacm": {
+        "rule-list": [
+            {
+                "name": "Allow DWDM control to the optics group",
+                "group": ["optics"],
+                "rule": [
+                    {
+                        "name": "czechlight-roadm-device",
+                        "module-name": "czechlight-roadm-device",
+                        "action": "permit"
+                    },
+                    {
+                        "name": "czechlight-inline-amp",
+                        "module-name": "czechlight-inline-amp",
+                        "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"
+                    }
+                ]
+            }
+        ]
+    }
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/startup.json b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/startup.json
new file mode 100644
index 0000000..2c63c08
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/startup.json
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/version b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/version
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/version
@@ -0,0 +1 @@
+3
diff --git a/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/xpath b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/xpath
new file mode 100644
index 0000000..8eca9fa
--- /dev/null
+++ b/tests/czechlight-cfg-fs/data/v3_sdn-roadm-line_no_nacm/xpath
@@ -0,0 +1 @@
+/ietf-netconf-acm:nacm