Commit 37a465bf authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Debug OFC24 and Optical Controller

parent 41b2089a
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.


import opticalcontroller.dijsktra
from opticalcontroller.dijkstra import Graph, shortest_path
from opticalcontroller.tools import *
from opticalcontroller.tools import *
from opticalcontroller.variables import *
from opticalcontroller.variables import *


@@ -83,7 +83,7 @@ class RSA():
        return "{},{},{}".format(self.c_slot_number, self.l_slot_number, self.s_slot_number)
        return "{},{},{}".format(self.c_slot_number, self.l_slot_number, self.s_slot_number)


    def initGraph(self):
    def initGraph(self):
        self.g = dijsktra.Graph()
        self.g = Graph()
        for n in self.nodes_dict:
        for n in self.nodes_dict:
            self.g.add_vertex(n)
            self.g.add_vertex(n)
        for l in self.links_dict["optical_links"]:
        for l in self.links_dict["optical_links"]:
@@ -100,7 +100,7 @@ class RSA():


    def initGraph2(self):
    def initGraph2(self):
     
     
        self.g = dijsktra.Graph()
        self.g = Graph()
     
     
        for n in self.nodes_dict:
        for n in self.nodes_dict:
            self.g.add_vertex(n)
            self.g.add_vertex(n)
@@ -117,7 +117,7 @@ class RSA():
            self.g.printGraph()
            self.g.printGraph()


    def compute_path(self, src, dst):
    def compute_path(self, src, dst):
        path = dijsktra.shortest_path(self.g, self.g.get_vertex(src), self.g.get_vertex(dst))
        path = shortest_path(self.g, self.g.get_vertex(src), self.g.get_vertex(dst))
        print("INFO: Path from {} to {} with distance: {}".format(src, dst, self.g.get_vertex(dst).get_distance()))
        print("INFO: Path from {} to {} with distance: {}".format(src, dst, self.g.get_vertex(dst).get_distance()))
        if debug:
        if debug:
            print(path)
            print(path)