Commit fa087587 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code fixes and cleanup

parent 1de28b82
Loading
Loading
Loading
Loading
+19 −27
Original line number Diff line number Diff line
@@ -120,24 +120,21 @@ class DelFLightpath(Resource):
            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
            if flow is not None:
                

            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"]
@@ -173,27 +170,22 @@ class DelOpticalBand(Resource):
    @staticmethod
    def delete( src, dst, o_band_id):
            flow = 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 
                    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"]
                        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"]