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

Optical Controller component:

- Enhance RSA computation to support optical spectrum reservation for flex-grid lightpaths
parent 72ecbf07
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -70,7 +70,18 @@ class AddLightpath(Resource):
            rsa.g.printGraph()

        if rsa is not None:
            flow_id = rsa.rsa_computation(src, dst, bitrate, bidir)
            reservation = request.args.get("reservation")
            if reservation is None and request.args.get("reservation_band") is not None:
                reservation = {
                    "band": request.args.get("reservation_band"),
                    "n_start": request.args.get("reservation_start"),
                    "n_end": request.args.get("reservation_end"),
                }
            try:
                flow_id = rsa.rsa_computation(src, dst, bitrate, bidir, reservation=reservation)
            except ValueError as exc:
                LOGGER.warning("Invalid optical spectrum reservation: %s", str(exc))
                return str(exc), 400
            if rsa.db_flows[flow_id]["op-mode"] == 0:
                return 'No path found', 404
            t1 = time.time() * 1000.0
+4 −3
Original line number Diff line number Diff line
@@ -904,7 +904,7 @@ class RSA():

        return t_flows, band, slots, {}, {}

    def rsa_computation(self, src, dst, rate, bidir):
    def rsa_computation(self, src, dst, rate, bidir, reservation=None):
        if self.flow_id == 0:
            self.flow_id += 1
        else:
@@ -934,8 +934,9 @@ class RSA():
            print(s_slots)
        #@Chafy
        if len(c_slots) > 0 or len(l_slots) > 0 or len(s_slots) > 0:
            flow_list, band_range, slots, fiber_f, fiber_b = self.select_slots_and_ports(links, num_slots, c_slots,
                                                                                         l_slots, s_slots, bidir)
            flow_list, band_range, slots, fiber_f, fiber_b = self.select_slots_and_ports(
                links, num_slots, c_slots, l_slots, s_slots, bidir, reservation=reservation
            )
            f0, band = frequency_converter(band_range, slots)
            if debug:
                print(f0, band)