Skip to content
Snippets Groups Projects
Commit fa087587 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code fixes and cleanup

parent 1de28b82
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!285Resolve: "(CNIT) New SBI Driver based on OpenROADM for ROADMs"
......@@ -115,29 +115,26 @@ class AddFlexLightpath(Resource):
@optical.response(404, 'Error, not found')
class DelFLightpath(Resource):
@staticmethod
def delete( src, dst, bitrate, o_band_id,flow_id=None):
flow = None
match1=False
ob_id=None
def delete( src, dst, bitrate, o_band_id, flow_id=None):
flow = None
match1 = False
ob_id = None
if flow_id is not None:
if flow_id in rsa.db_flows.keys():
flow = rsa.db_flows[flow_id]
match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"] == bitrate
ob_id = flow["parent_opt_band"]
flow['is_active']=False
flow = rsa.db_flows[flow_id]
match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"] == bitrate
ob_id = flow["parent_opt_band"]
flow['is_active'] = False
if flow is not None:
bidir = flow["bidir"]
if bidir:
match2 = flow["src"] == dst and flow["dst"] == src and flow["bitrate"] == bitrate
if match1 or match2:
ob_id = flow["parent_opt_band"]
rsa.del_flow(flow, ob_id)
rsa.db_flows[flow_id]["is_active"] = False
if flow_id in rsa.optical_bands[ob_id]["served_lightpaths"].remove:
if flow_id in rsa.optical_bands[ob_id]["served_lightpaths"]:
rsa.optical_bands[ob_id]["served_lightpaths"].remove(flow_id)
#if rsa.optical_bands[ob_id]["reverse_optical_band_id"] != 0:
# rev_ob_id = rsa.optical_bands[ob_id]["reverse_optical_band_id"]
......@@ -166,34 +163,29 @@ class DelFLightpath(Resource):
return "flow id {} does not exist".format(flow_id), 404
@optical.route('/DelOpticalBand/<string:src>/<string:dst>/<int:o_band_id>',methods=['DELETE'])
@optical.route('/DelOpticalBand/<string:src>/<string:dst>/<int:o_band_id>', methods=['DELETE'])
@optical.response(200, 'Success')
@optical.response(404, 'Error, not found')
class DelOpticalBand(Resource):
@staticmethod
def delete( src, dst, o_band_id):
flow = None
ob_id=None
if o_band_id is not None :
ob_id = None
if o_band_id is not None:
if o_band_id in rsa.optical_bands.keys():
flow=rsa.optical_bands[o_band_id]
#match1 = flow["src"] == src and flow["dst"] == dst
ob_id=o_band_id
flow = rsa.optical_bands[o_band_id]
match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"]
ob_id = o_band_id
if flow is not None:
bidir = flow["bidir"]
if bidir:
match2 = flow["src"] == dst and flow["dst"] == src and flow["bitrate"]
match2 = flow["src"] == dst and flow["dst"] == src and flow["bitrate"]
if match1 or match2:
ob_id = flow["parent_opt_band"]
#rsa.del_flow(flow, ob_id)
rsa.optical_bands[ob_id]["is_active"] = False
# if flow_id in rsa.optical_bands[ob_id]["served_lightpaths"].remove:
# if flow_id in rsa.optical_bands[ob_id]["served_lightpaths"]:
# rsa.optical_bands[ob_id]["served_lightpaths"].remove(flow_id)
#if rsa.optical_bands[ob_id]["reverse_optical_band_id"] != 0:
# rev_ob_id = rsa.optical_bands[ob_id]["reverse_optical_band_id"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment