Commit 0cd1a983 authored by Andrea Sgambelluri's avatar Andrea Sgambelluri
Browse files

not working bidir

parent b2eeea80
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"

# Set the list of components, separated by spaces, you want to build images for, and deploy.
export TFS_COMPONENTS="context device pathcomp service nbi webui"
export TFS_COMPONENTS="context device pathcomp opticalcontroller service nbi webui"

# Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
@@ -140,7 +140,7 @@ export CRDB_PASSWORD="tfs123"
export CRDB_DEPLOY_MODE="single"

# Disable flag for dropping database, if it exists.
export CRDB_DROP_DATABASE_IF_EXISTS=""
export CRDB_DROP_DATABASE_IF_EXISTS="YES"

# Disable flag for re-deploying CockroachDB from scratch.
export CRDB_REDEPLOY=""
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ ENV PYTHONUNBUFFERED=0
#     chmod +x /bin/grpc_health_probe

# Get generic Python packages
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade 'pip==25.2'
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools

+21 −9
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@ import logging
from opticalcontroller.dijkstra import *
from opticalcontroller.tools import *
from opticalcontroller.variables import *

'''
LOGGER = logging.getLogger(__name__)

def print(*args) -> None:
    LOGGER.info(' '.join([str(a) for a in args]))
'''

class RSA():
    def __init__(self, nodes, links):
@@ -470,9 +473,9 @@ class RSA():
                print(f"del_flow_fib {fib } and band {band}")
                print(f"del_flow { str_list_to_int(fib[band].keys())}")
            
                print(f"invoking restore_link_2 fib: {fib} , slots {slots} , band {band} ")
                #self.restore_link(fib, slots, band)
                self.restore_link_2(fib, slots, band, link = link)
                print(f"invoking restore_link fib: {fib} , slots {slots} , band {band} ")
                self.restore_link(fib, slots, band)
                #self.restore_link_2(fib, slots, band, link = link)
                
                self.optical_bands[o_b_id]["is_active"]=False
            
@@ -492,7 +495,8 @@ class RSA():
                    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_2(fib, slots, band, link=rlink)
                        self.restore_link(fib, slots, band)
                        #self.restore_link_2(fib, slots, band, link=rlink)
                        if debug:
                            print(fib[band])
                #changed according to TFS development
@@ -1261,8 +1265,8 @@ class RSA():
        for l in links:
            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)
            #self.restore_link_2(fib, slots, band, link=link)
        if o_b_id is not None: 
            if debug:
                print("restoring OB")
@@ -1282,8 +1286,8 @@ class RSA():
                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)
                    #self.restore_link_2(fib, slots, band, link=rlink)
                    if debug:
                        print(fib[band])

@@ -1291,7 +1295,7 @@ class RSA():

    def rsa_fs_recomputation(self, flow_idy):
        flow_idx = int(flow_idy)
        print(f"INFO: Reconifguring connection {flow_idx}")
        print(f"INFO: Reconfiguring connection {flow_idx}")
        if flow_idx not in self.db_flows.keys():
            print(f"ERROR: key not present {flow_idx}")
        else:
@@ -1336,15 +1340,23 @@ class RSA():
                
                c_slots, l_slots, s_slots = self.get_slots(links, num_slots, ob_id)
                if debug:
                    print("OFC26 available slots pre")
                    print(c_slots)
                    print(l_slots)
                    print(s_slots)
                if band_type == "c_slots":
                    c_slots = []
                    l_slots =[]
                elif band_type == "l_slots":
                    c_slots = []
                    l_slots = []
                elif band_type == "s_slots":
                    s_slots = []
                if debug:
                    print("OFC26 available slots after reset due to band")
                    print(c_slots)
                    print(l_slots)
                    print(s_slots)
                if len(c_slots) >= num_slots or len(l_slots) >= num_slots or len(s_slots) >= num_slots:
                    flow_list, band_range, slots, fiber_f, fiber_b = self.select_slots_and_ports_fs(links, num_slots,
                                                                                                            c_slots,
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ ENV PYTHONUNBUFFERED=0
#     chmod +x /bin/grpc_health_probe

# Get generic Python packages
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade 'pip==25.2'
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools

+6 −25
Original line number Diff line number Diff line
@@ -454,6 +454,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
            '''
            #multi-granular
            if oc_type == 1:
                LOGGER.info(f"DEVELOP: deleting multi-granular service")
                if len(service.service_config.config_rules) > 0:
                    c_rules_dict = json.loads(
                        service.service_config.config_rules[0].custom.resource_value
@@ -472,37 +473,14 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
                    params['ob_id'  ] = ob_id
                    params['flow_id'] = flow_id
                    params['bidir'  ] = bidir


                    LOGGER.info(f"DEVELOP mg: {params}")
                tasks_scheduler = TasksScheduler(self.service_handler_factory)
                tasks_scheduler.compose_from_optical_service(service, params=params, is_delete=True)
                tasks_scheduler.execute_all()
                return Empty()
            #flexigrid
            elif oc_type ==2 :

                if len(service.service_config.config_rules) > 0:
                    c_rules_dict = json.loads(
                    service.service_config.config_rules[0].custom.resource_value)
                    ob_id=None
                    flow_id=None

                    if ("flow_id" in c_rules_dict):
                        flow_id = c_rules_dict["flow_id"]
                        #if ("ob_id" in c_rules_dict):
                        #    ob_id = c_rules_dict["ob_id"]
                    params['bitrate']=bitrate
                    params['dst']=dst
                    params['src']=src
                    params['ob_id']=ob_id
                    params['flow_id']=flow_id
                    params['bidir'] = bidir


                tasks_scheduler = TasksScheduler(self.service_handler_factory)
                tasks_scheduler.compose_from_optical_service(service, params=params, is_delete=True)
                tasks_scheduler.execute_all()
                return Empty()
            elif oc_type ==2 : 
                if len(service.service_config.config_rules) > 0:
                    c_rules_dict = json.loads(
                    service.service_config.config_rules[0].custom.resource_value)
@@ -518,6 +496,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
                    params['src']=src
                    params['flow_id']=flow_id
                    params['bidir'] = bidir
                    LOGGER.info(f"DEVELOP flexgrid: {params}")
                tasks_scheduler = TasksScheduler(self.service_handler_factory)
                tasks_scheduler.compose_from_optical_service(service, params=params, is_delete=True)
                tasks_scheduler.execute_all()
@@ -656,6 +635,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
                        new_connection = optical_reply.connections[0]
                        #for candidate_new_connection in pathcomp_reply.connections:
                        str_candidate_new_connection = connection_to_string(new_connection)
                        LOGGER.info('QQQQ_old:{}'.format(str_old_connection))
                        LOGGER.info('QQQQ_new:{}'.format(str_candidate_new_connection))
                        # Change UUID of new connection to prevent collisions
                        tmp_connection = Connection()
                        tmp_connection.CopyFrom(new_connection)
Loading