diff --git a/delete0.xml b/delete0.xml
index 4acbc5173c4c4b154f878ad12517eb07e2332d14..a8af1dca66d9a1492891121d7fb2d0c049a9fc00 100644
--- a/delete0.xml
+++ b/delete0.xml
@@ -1176,66 +1176,129 @@
OTS-DEG4-TTP-TX
- MC-TTP-DEG1-AMPRX-IN-186131250
- Media-channel-186131250THz
+ MC-TTP-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
openROADM-if:mediaChannelTrailTerminationPoint
inService
DEG1-AMPRX
DEG1-AMPRX-IN
OMS-DEG1-TTP-RX
- 186206250.0
- 186056250.0
+ 192156250.0
+ 192006250.0
- NMC-DEG1-AMPRX-IN-186131250
- Media-channel-186131250THz
+ NMC-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
DEG1-AMPRX
DEG1-AMPRX-IN
OMS-DEG1-TTP-RX
- 186131250
+ 192081250
150000
- MC-TTP-DEG2-AMPTX-OUT-186131250
- Media-channel-186131250THz
+ MC-TTP-DEG2-AMPTX-OUT-192081250
+ Media-channel-192081250THz
openROADM-if:mediaChannelTrailTerminationPoint
inService
DEG2-AMPTX
DEG2-AMPTX-OUT
OMS-DEG2-TTP-TX
- 186206250.0
- 186056250.0
+ 192156250.0
+ 192006250.0
- NMC-DEG2-AMPTX-OUT-186131250
- Media-channel-186131250THz
+ NMC-DEG2-AMPTX-OUT-192081250
+ Media-channel-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
DEG2-AMPTX
DEG2-AMPTX-OUT
OMS-DEG2-TTP-TX
- 186131250
+ 192081250
150000
- NMC-DEG1-AMPRX-IN-186131250 to NMC-DEG2-AMPTX-OUT-186131250
+ NMC-DEG1-AMPRX-IN-192081250 to NMC-DEG2-AMPTX-OUT-192081250
off
0
- NMC-DEG1-AMPRX-IN-186131250
+ NMC-DEG1-AMPRX-IN-192081250
- NMC-DEG2-AMPTX-OUT-186131250
+ NMC-DEG2-AMPTX-OUT-192081250
+
+
+
+ MC-TTP-DEG2-AMPRX-IN-192081250
+ Media-channel-192081250THz
+ openROADM-if:mediaChannelTrailTerminationPoint
+ inService
+ DEG2-AMPRX
+ DEG2-AMPRX-IN
+ OMS-DEG2-TTP-RX
+
+ 192156250.0
+ 192006250.0
+
+
+
+ NMC-DEG2-AMPRX-IN-192081250
+ Media-channel-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ DEG2-AMPRX
+ DEG2-AMPRX-IN
+ OMS-DEG2-TTP-RX
+
+ 192081250
+ 150000
+
+
+
+ MC-TTP-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
+ openROADM-if:mediaChannelTrailTerminationPoint
+ inService
+ DEG1-AMPTX
+ DEG1-AMPTX-OUT
+ OMS-DEG1-TTP-TX
+
+ 192156250.0
+ 192006250.0
+
+
+
+ NMC-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ DEG1-AMPTX
+ DEG1-AMPTX-OUT
+ OMS-DEG1-TTP-TX
+
+ 192081250
+ 150000
+
+
+
+ NMC-DEG2-AMPRX-IN-192081250 to NMC-DEG1-AMPTX-OUT-192081250
+ off
+ 0
+
+ NMC-DEG2-AMPRX-IN-192081250
+
+
+ NMC-DEG1-AMPTX-OUT-192081250
diff --git a/delete1.xml b/delete1.xml
index 7ce366a2c306a3b2e8e1ab3492461cee5bde0bac..d45faa083db6550637b54c5491098279ba91efb4 100644
--- a/delete1.xml
+++ b/delete1.xml
@@ -1176,52 +1176,101 @@
OTS-DEG4-TTP-TX
- NMC-SRG-SRG1-IN3-186131250
- Network-Media-Channel-CTP-186131250THz
+ NMC-SRG-SRG1-IN3-192081250
+ Network-Media-Channel-CTP-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
SRG1-WSS
SRG1-IN3
- 186131250
+ 192081250
150000
- MC-TTP-DEG1-AMPTX-OUT-186131250
- Media-channel-186131250THz
+ MC-TTP-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
openROADM-if:mediaChannelTrailTerminationPoint
inService
DEG1-AMPTX
DEG1-AMPTX-OUT
OMS-DEG1-TTP-TX
- 186206250.0
- 186056250.0
+ 192156250.0
+ 192006250.0
- NMC-DEG1-AMPTX-OUT-186131250
- Media-channel-186131250THz
+ NMC-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
DEG1-AMPTX
DEG1-AMPTX-OUT
OMS-DEG1-TTP-TX
- 186131250
+ 192081250
150000
- NMC-SRG-SRG1-IN3-186131250 to NMC-DEG1-AMPTX-OUT-186131250
+ NMC-SRG-SRG1-IN3-192081250 to NMC-DEG1-AMPTX-OUT-192081250
off
0
- NMC-SRG-SRG1-IN3-186131250
+ NMC-SRG-SRG1-IN3-192081250
- NMC-DEG1-AMPTX-OUT-186131250
+ NMC-DEG1-AMPTX-OUT-192081250
+
+
+
+ MC-TTP-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
+ openROADM-if:mediaChannelTrailTerminationPoint
+ inService
+ DEG1-AMPRX
+ DEG1-AMPRX-IN
+ OMS-DEG1-TTP-RX
+
+ 192156250.0
+ 192006250.0
+
+
+
+ NMC-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ DEG1-AMPRX
+ DEG1-AMPRX-IN
+ OMS-DEG1-TTP-RX
+
+ 192081250
+ 150000
+
+
+
+ NMC-SRG-SRG1-OUT3-192081250
+ Network-Media-Channel-CTP-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ SRG1-WSS
+ SRG1-OUT3
+
+ 192081250
+ 150000
+
+
+
+ NMC-DEG1-AMPRX-IN-192081250 to NMC-SRG-SRG1-OUT3-192081250
+ off
+ 0
+
+ NMC-DEG1-AMPRX-IN-192081250
+
+
+ NMC-SRG-SRG1-OUT3-192081250
diff --git a/delete2.xml b/delete2.xml
index 6fbeb333f0d4eed1ade4ff7eaacf0c2ebbce18b1..9a66243aeda8cf4f3f031dd590ce75d24e98ee51 100644
--- a/delete2.xml
+++ b/delete2.xml
@@ -1176,52 +1176,101 @@
OTS-DEG4-TTP-TX
- MC-TTP-DEG1-AMPRX-IN-186131250
- Media-channel-186131250THz
+ MC-TTP-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
openROADM-if:mediaChannelTrailTerminationPoint
inService
DEG1-AMPRX
DEG1-AMPRX-IN
OMS-DEG1-TTP-RX
- 186206250.0
- 186056250.0
+ 192156250.0
+ 192006250.0
- NMC-DEG1-AMPRX-IN-186131250
- Media-channel-186131250THz
+ NMC-DEG1-AMPRX-IN-192081250
+ Media-channel-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
DEG1-AMPRX
DEG1-AMPRX-IN
OMS-DEG1-TTP-RX
- 186131250
+ 192081250
150000
- NMC-SRG-SRG1-OUT1-186131250
- Network-Media-Channel-CTP-186131250THz
+ NMC-SRG-SRG1-OUT1-192081250
+ Network-Media-Channel-CTP-192081250THz
openROADM-if:networkMediaChannelConnectionTerminationPoint
inService
SRG1-WSS
SRG1-OUT1
- 186131250
+ 192081250
150000
- NMC-DEG1-AMPRX-IN-186131250 to NMC-SRG-SRG1-OUT1-186131250
+ NMC-DEG1-AMPRX-IN-192081250 to NMC-SRG-SRG1-OUT1-192081250
off
0
- NMC-DEG1-AMPRX-IN-186131250
+ NMC-DEG1-AMPRX-IN-192081250
- NMC-SRG-SRG1-OUT1-186131250
+ NMC-SRG-SRG1-OUT1-192081250
+
+
+
+ NMC-SRG-SRG1-IN1-192081250
+ Network-Media-Channel-CTP-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ SRG1-WSS
+ SRG1-IN1
+
+ 192081250
+ 150000
+
+
+
+ MC-TTP-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
+ openROADM-if:mediaChannelTrailTerminationPoint
+ inService
+ DEG1-AMPTX
+ DEG1-AMPTX-OUT
+ OMS-DEG1-TTP-TX
+
+ 192156250.0
+ 192006250.0
+
+
+
+ NMC-DEG1-AMPTX-OUT-192081250
+ Media-channel-192081250THz
+ openROADM-if:networkMediaChannelConnectionTerminationPoint
+ inService
+ DEG1-AMPTX
+ DEG1-AMPTX-OUT
+ OMS-DEG1-TTP-TX
+
+ 192081250
+ 150000
+
+
+
+ NMC-SRG-SRG1-IN1-192081250 to NMC-DEG1-AMPTX-OUT-192081250
+ off
+ 0
+
+ NMC-SRG-SRG1-IN1-192081250
+
+
+ NMC-DEG1-AMPTX-OUT-192081250
diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py
index fe6376514a79476d5644f64152634de989ed59ec..7c20a4de5bd268f76baf02666fec93d37ad92d03 100644
--- a/src/opticalcontroller/OpticalController.py
+++ b/src/opticalcontroller/OpticalController.py
@@ -125,10 +125,7 @@ class DelFLightpath(Resource):
ob_id = flow["parent_opt_band"] if 'parent_opt_band' in flow else None
flow['is_active']=False
if flow is not None:
-
-
- bidir = flow["bidir"]
-
+ bidir = flow["bidir"]
if bidir:
match2 = flow["src"] == dst and flow["dst"] == src and flow["bitrate"] == bitrate
if match1 or match2:
@@ -161,8 +158,10 @@ class DelFLightpath(Resource):
rsa.del_flow(flow,flow_id,ob_id)
if debug:
- print(f"vor ob_id {ob_id} rsa.optical_bands {rsa.optical_bands[ob_id]}")
- print(f"rsa.links_dict {rsa.links_dict}")
+ print(f"rsa.links_dict {rsa.links_dict}")
+ if ob_id:
+ print(f"vor ob_id {ob_id} rsa.optical_bands {rsa.optical_bands[ob_id]}")
+
return "flow {} deleted".format(flow_id), 200
else:
return "flow {} not matching".format(flow_id), 404
@@ -272,7 +271,7 @@ class DelOpticalBandSimple(Resource):
-@optical.route('/DelLightpath////')
+@optical.route('/DelLightpath////')
@optical.response(200, 'Success')
@optical.response(404, 'Error, not found')
class DelLightpath(Resource):
@@ -283,7 +282,7 @@ class DelLightpath(Resource):
match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"] == bitrate
match2 = flow["src"] == dst and flow["dst"] == src and flow["bitrate"] == bitrate
if match1 or match2:
- rsa.del_flow(flow)
+ rsa.del_flow(flow,flow_id)
rsa.db_flows[flow_id]["is_active"] = False
if debug:
print(rsa.links_dict)
diff --git a/src/opticalcontroller/RSA.py b/src/opticalcontroller/RSA.py
index 95a49113e1b96496ecace189bfc2cfcd42805897..e0a8154ed4421b7cf003e80fca0f70defcf766ff 100644
--- a/src/opticalcontroller/RSA.py
+++ b/src/opticalcontroller/RSA.py
@@ -128,7 +128,7 @@ class RSA():
path = shortest_path(self.g, self.g.get_vertex(src), self.g.get_vertex(dst))
print("INFO: Path from {} to {} with distance: {}".format(src, dst, self.g.get_vertex(dst).get_distance()))
if debug:
- print(path)
+ print(f"compute_path shortest_path {path}")
links = []
for i in range(0, len(path) - 1):
s = path[i]
@@ -304,14 +304,14 @@ class RSA():
fib['used'] = False
#fib[band].sort()
- def restore_link_2(self, fib, slots, band, link):
- print("start restoring link")
- for i in slots:
- fib[band][str(i)] = 1
- if 'used' in fib:
- fib['used'] = False
- #fib[band].keys().sort()
- #set_link_update(fib,link,test="restoration")
+ # def restore_link_2(self, fib, slots, band, link):
+ # print("start restoring link")
+ # for i in slots:
+ # fib[band][str(i)] = 1
+ # if 'used' in fib:
+ # fib['used'] = False
+ # #fib[band].keys().sort()
+ # #set_link_update(fib,link,test="restoration")
def restore_optical_band(self, optical_band_id, slots, band):
@@ -357,9 +357,9 @@ class RSA():
link = self.get_link_by_name(l)
fib = link["optical_details"]
#self.restore_link(fib, slots, band)
- self.restore_link_2(fib, slots, band, link=link)
+ self.restore_link(fib, slots, band)
if debug:
- print(fib[band])
+ print(f"fib[band] {fib[band]}")
if o_b_id is not None:
if debug:
print("restoring OB")
@@ -374,13 +374,13 @@ class RSA():
for l in links:
r_l = reverse_link(l)
if debug:
- print(r_l)
+ print(f"reverse_link {r_l}")
rlink = self.get_link_by_name(r_l)
fib = rlink["optical_details"]
#fib = self.get_link_by_name(r_l)["optical_details"]
if list_in_list(slots, str_list_to_int(fib[band].keys())):
#self.restore_link(fib, slots, band, link=l)
- self.restore_link_2(fib, slots, band, link=rlink)
+ self.restore_link(fib, slots, band)
if debug:
print(fib[band])
'''
diff --git a/src/service/service/task_scheduler/TaskScheduler.py b/src/service/service/task_scheduler/TaskScheduler.py
index d1b85e55019f84ba3f8fa58b63ebf7eda6f44a62..bfff1fa3a4ac7a76a17da759af7acce4a99480ba 100644
--- a/src/service/service/task_scheduler/TaskScheduler.py
+++ b/src/service/service/task_scheduler/TaskScheduler.py
@@ -34,8 +34,8 @@ from .tasks.Task_ServiceDelete import Task_ServiceDelete
from .tasks.Task_ServiceSetStatus import Task_ServiceSetStatus
from .TaskExecutor import CacheableObjectType, TaskExecutor
from .tasks.Task_OpticalServiceConfigDelete import Task_OpticalServiceConfigDelete
-from service.service.tools.OpticalTools import delete_lightpath
-
+from service.service.tools.OpticalTools import delete_lightpath ,DelFlexLightpath
+from common.Constants import OpticalServiceType
if TYPE_CHECKING:
from service.service.service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory
@@ -396,19 +396,29 @@ class TasksScheduler:
if str_item_key in explored_items: continue
connections = self._context_client.ListConnections(item.service_id)
has_media_channel,has_optical_band=self.check_service_for_media_channel(connections=connections,item=item.service_id)
-
+ oc_type = 1
if len(service.service_config.config_rules) > 0:
-
-
- reply,code = delete_lightpath(
+ for constraint in service.service_constraints:
+ if "type" in constraint.custom.constraint_type:
+ oc_type = OpticalServiceType(str(constraint.custom.constraint_value))
+ if oc_type == 2 :
+ reply,code = delete_lightpath(
params['src']
,params ['dst']
, params['bitrate']
- , params['ob_id']
- ,delete_band=not has_media_channel
, flow_id= params['flow_id']
)
+ else :
+ reply,code = DelFlexLightpath(
+ params['src']
+ ,params ['dst']
+ , params['bitrate']
+ , params['ob_id']
+ ,delete_band=not has_media_channel
+ , flow_id= params['flow_id']
+ )
+
logging.info(f'DelFlexpath reply {reply} and code {code}')
if code == 400 and reply_not_allowed in reply :
MSG = 'Deleteion for the service is not Allowed , Served Lightpaths is not empty'
diff --git a/src/service/service/tools/OpticalTools.py b/src/service/service/tools/OpticalTools.py
index 9f543cbe84b28a8d6def53dfdc84ec759a94e42a..5eb622317afd2570eec592268fc899d1b78f6462 100644
--- a/src/service/service/tools/OpticalTools.py
+++ b/src/service/service/tools/OpticalTools.py
@@ -177,7 +177,7 @@ def get_optical_band(idx) -> str:
return optical_band_uni_txt
-def delete_lightpath( src, dst, bitrate, ob_id, delete_band, flow_id=None) -> str:
+def DelFlexLightpath( src, dst, bitrate, ob_id, delete_band, flow_id=None) -> str:
reply = "200"
delete_band = 1 if delete_band else 0
base_url = get_optical_controller_base_url()
@@ -185,8 +185,7 @@ def delete_lightpath( src, dst, bitrate, ob_id, delete_band, flow_id=None) -> st
if flow_id is not None:
if ob_id is not None :
urlx = "{:s}/DelFlexLightpath/{}/{}/{}/{}/{}".format(base_url, src, dst, bitrate, flow_id,ob_id)
- else :
- urlx = "{:s}/DelFlexLightpath/{}/{}/{}/{}".format(base_url, src, dst, bitrate, flow_id)
+
else :
#urlx = "http://{}:{}/OpticalTFS/DelOpticalBand/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, ob_id)
urlx = "{:s}/DelOpticalBandSimple/{}".format(base_url, ob_id)
@@ -197,15 +196,16 @@ def delete_lightpath( src, dst, bitrate, ob_id, delete_band, flow_id=None) -> st
code = r.status_code
return (reply, code)
-def DelFlexLightpath (flow_id, src, dst, bitrate, o_band_id):
+def delete_lightpath ( src, dst, bitrate, flow_id):
reply = "200"
base_url = get_optical_controller_base_url()
if not TESTING:
- urlx = "{:s}/DelFlexLightpath/{}/{}/{}/{}/{}".format(base_url, flow_id, src, dst, bitrate, o_band_id)
+ urlx = "{:s}/DelLightpath/{}/{}/{}/{}".format(base_url, src, dst, bitrate, flow_id)
headers = {"Content-Type": "application/json"}
r = requests.delete(urlx, headers=headers)
- reply = r.text
- return reply
+ reply = r.text
+ code = r.status_code
+ return (reply, code)
def get_lightpaths() -> str:
base_url = get_optical_controller_base_url()