From 91b6fbe154094b561c20b2b64e119866d0951032 Mon Sep 17 00:00:00 2001
From: sgambelluri <andrea.sgambelluri@cnit.it>
Date: Thu, 25 Apr 2024 20:08:15 +0200
Subject: [PATCH] added terminal-device to enable the port and bug fix for
 connection delete

---
 .../service/drivers/oc_driver/templates/VPN/physical.py    | 7 +++++++
 src/opticalcontroller/OpticalController.py                 | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/device/service/drivers/oc_driver/templates/VPN/physical.py b/src/device/service/drivers/oc_driver/templates/VPN/physical.py
index f368ca10e..9c894b160 100644
--- a/src/device/service/drivers/oc_driver/templates/VPN/physical.py
+++ b/src/device/service/drivers/oc_driver/templates/VPN/physical.py
@@ -61,6 +61,13 @@ def create_optical_channel(resources):
                     with tag('config'):
                         for resource in config:
                             with tag(resource['resource_key']):text(resource['value'])
+        with tag('terminal-device', xmlns="http://openconfig.net/yang/terminal-device"):
+            with tag('logical-channels'):
+                with tag('channel'):
+                    with tag('index'):text("{}".format(port_val))
+                    with tag('config'):
+                        with tag('index'):text("{}".format(port_val))
+                        with tag('admin-state'):text("ENABLED")
     result = indent(
         doc.getvalue(),
         indentation = ' '*2,
diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py
index 0a8a56264..5a31441c1 100644
--- a/src/opticalcontroller/OpticalController.py
+++ b/src/opticalcontroller/OpticalController.py
@@ -113,7 +113,7 @@ class DelFLightpath(Resource):
                     #    rsa.optical_bands[rev_ob_id]["served_lightpaths"].remove(flow_id)
 
                     if debug:
-                        print(links_dict)
+                        print(rsa.links_dict)
                     return "flow {} deleted".format(flow_id), 200
                 else:
                     return "flow {} not matching".format(flow_id), 404
@@ -147,7 +147,7 @@ class DelLightpath(Resource):
                 rsa.del_flow(flow)
                 rsa.db_flows[flow_id]["is_active"] = False
                 if debug:
-                    print(links_dict)
+                    print(rsa.links_dict)
                 return "flow {} deleted".format(flow_id), 200
             else:
                 return "flow {} not matching".format(flow_id), 404
-- 
GitLab