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

Pre-merge code cleanup

parent 5ae8521d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -34,8 +34,7 @@ RUN python3 -m pip install --upgrade pip-tools

# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
WORKDIR /var/teraflow/

WORKDIR /var/teraflow
COPY common_requirements.in common_requirements.in
RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in
RUN python3 -m pip install -r common_requirements.txt
@@ -62,7 +61,7 @@ RUN pip-compile --quiet --output-file=requirements.txt requirements.in
RUN python3 -m pip install -r requirements.txt

# Add component files into working directory
WORKDIR /var/teraflow/
WORKDIR /var/teraflow
COPY src/context/__init__.py context/__init__.py
COPY src/context/client/. context/client/
COPY src/opticalcontroller/. opticalcontroller/
+11 −8
Original line number Diff line number Diff line
# optical-controller
This a framework to implement the optical controller for the RMSA algorithm.
# Optical Controller

This is a framework to test the optical controller for the RMSA algorithm in an isolated manner.

![Reference Architecture](images/topo.png)

```bash
#create a venv
python -m venv venv

in linux
# in linux
source venv/Scripts/activate

in windows
# in windows
venv\Scripts\activate

pip install -r requirements_opt.txt
pip install -r requirements_optical_ctrl_test.txt

python OpticalController.py
![Reference Architecture](images/topo.png)

```
+6 −23
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ class RSA():
        self.s_slot_number = 0
        self.optical_bands = {}

        
    def init_link_slots(self, testing):
        if full_links:
            for l in self.links_dict["optical_links"]:
@@ -304,20 +303,13 @@ class RSA():
        #fib[band].keys().sort()    
        set_link_update(fib,link,test="restoration") 


    def restore_optical_band(self, optical_band_id, slots, band):

        for i in slots:
            self.optical_bands[optical_band_id][band][str(i)] = 1
            
            #self.optical_bands[optical_band_id][band].append(int(i))
        #self.optical_bands[optical_band_id][band].sort()


            
            
        
  
    def restore_optical_band_2(self, optical_band_id, slots, band ,links):
        print(f"example of  band { band}")
        print(f"example of slots {slots}")
@@ -330,7 +322,6 @@ class RSA():
        #link = self.get_link_by_name(link_name)    
        #update_optical_band(optical_bands=self.optical_bands,optical_band_id=optical_band_id,band=band,link=link)

            
    def del_flow(self, flow,flow_id, o_b_id = None):
        flows = flow["flows"]
        band = flow["band_type"]
@@ -344,7 +335,6 @@ class RSA():
        bidir = flow["bidir"]
        flow_id = flow["flow_id"]

       
        for l in links:
            if debug:
                print(l)
@@ -357,10 +347,7 @@ class RSA():
            if debug:
                print(fib[band])

    
            
        if o_b_id is not None:
            
            if debug:
                print("restoring OB")
            print(f"invoking restore_optical_band o_b_id: {o_b_id} , slots {slots} , band {band} ")    
@@ -370,6 +357,7 @@ class RSA():
                    self.optical_bands[o_b_id]["served_lightpaths"].remove(flow_id)

            #self.restore_optical_band_2(o_b_id, slots, band,links)

        if bidir:
            for l in links:
                r_l = reverse_link(l)
@@ -405,10 +393,8 @@ class RSA():
    
    
    def del_band(self, flow, o_b_id = None):
        
        print(f"delete band {flow} ")


        flows = flow["flows"]
        band = None
        #slots = flow["slots"]
@@ -483,7 +469,6 @@ class RSA():
            #    self.restore_optical_band(rev_o_band_id, slots, band)
        return True

    
    def del_handler(self, flow,flow_id, o_b_id = None,delete_band=0):
        print(f" del_handler flow {flow} flow_id {flow_id}  o_b_id {o_b_id} delete_band {delete_band}")
        if delete_band != 0:
@@ -492,8 +477,6 @@ class RSA():
        else :
            self.del_flow(flow,flow_id=flow_id,o_b_id=o_b_id)   

            
             
    def get_fibers_forward(self, links, slots, band):
        fiber_list = {}
        add = links[0]
+0 −1
Original line number Diff line number Diff line

# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
+0 −7
Original line number Diff line number Diff line
Flask==1.1.2
flask-restplus==0.13.0
itsdangerous==1.1.0
Jinja2==2.11.3
MarkupSafe==1.1.1
numpy==1.23.0
Werkzeug==0.16.1
Loading