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

Optical Controller component:

- Reduced amount of logs
parent 89773c8d
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
@@ -85,8 +85,8 @@ class RSA():
                self.c_slot_number = initialize_band_slots(fib, "c_slots", Nc)
                self.l_slot_number = initialize_band_slots(fib, "l_slots", Nl)
                self.s_slot_number = initialize_band_slots(fib, "s_slots", Ns)
                if debug:
                    print(fib)
                #if debug:
                #    print(fib)

        if self.c_slot_number == 0 and self.l_slot_number == 0 and self.s_slot_number == 0:
            for l1 in self.links_dict["optical_links"]:
@@ -102,8 +102,8 @@ class RSA():
        for n in self.nodes_dict:
            self.g.add_vertex(n)
        for l in self.links_dict["optical_links"]:
            if debug:
                print(l)
            #if debug:
            #    print(l)
            [s, d] = l["optical_link"]["name"].split('-')
            ps = l["optical_link"]["details"]["source"]
            pd = l["optical_link"]["details"]["target"]
@@ -120,8 +120,8 @@ class RSA():
        for n in self.nodes_dict:
            self.g.add_vertex(n)
        for l in self.links_dict["optical_links"]:
            if debug:
                print(l)
            #if debug:
            #    print(l)
            [s, d] = l["name"].split('-')
            ps = l["optical_details"]["src_port"]
            pd = l["optical_details"]["dst_port"]
@@ -139,21 +139,21 @@ class RSA():
        links = []
        for i in range(0, len(path) - 1):
            s = path[i]
            if debug:
                print(s)
            #if debug:
            #    print(s)
            if i < len(path) - 1:
                d = path[i + 1]
                link_id = "{}-{}".format(s, d)
                if debug:
                    #print(link_id, self.links_dict[link_id])
                    print(link_id, self.get_link_by_name(link_id))
                #if debug:
                #    #print(link_id, self.links_dict[link_id])
                #    print(link_id, self.get_link_by_name(link_id))

                links.append(link_id)
        self.g.reset_graph()
        return links, path

    def compute_disjoint_path(self, src, dst, path1=None):
        if path1 == None:
        if path1 is None:
            path1 = shortest_path(self.g, self.g.get_vertex(src), self.g.get_vertex(dst))
        path = disjoint_path(self.g, src, dst, path1, False)      
        print("INFO: Path from {} to {} with distance: {}".format(src, dst, self.g.get_vertex(dst).get_distance()))
@@ -162,14 +162,14 @@ class RSA():
        links = []
        for i in range(0, len(path) - 1):
            s = path[i]
            if debug:
                print(s)
            #if debug:
            #    print(s)
            if i < len(path) - 1:
                d = path[i + 1]
                link_id = "{}-{}".format(s, d)
                if debug:
                    #print(link_id, self.links_dict[link_id])
                    print(link_id, self.get_link_by_name(link_id))
                #if debug:
                #    #print(link_id, self.links_dict[link_id])
                #    print(link_id, self.get_link_by_name(link_id))

                links.append(link_id)
        self.g.reset_graph()
@@ -361,12 +361,12 @@ class RSA():
            #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}")
        print(f"example of self.optical_bands_before { self.optical_bands}")
        #print(f"example of  band { band}")
        #print(f"example of slots {slots}")
        #print(f"example of self.optical_bands_before { self.optical_bands}")
        for i in slots:
            self.optical_bands[optical_band_id][band][str(i)] = 1
        print(f"example of self.optical_bands_after { self.optical_bands}")    
        #print(f"example of self.optical_bands_after { self.optical_bands}")    
       
        #link_name=    self.optical_bands[optical_band_id]['links'][0] 
        #link = self.get_link_by_name(link_name)