Beispiel #1
0
 def get_fib_route_db(self, cli_opts):
     client = fib_client.FibClient(
         cli_opts.zmq_ctx,
         "tcp://[{}]:{}".format(cli_opts.host, cli_opts.fib_rep_port),
         cli_opts.timeout,
         cli_opts.proto_factory)
     return utils.get_shortest_routes(client.get_route_db())
Beispiel #2
0
    def run(self, cli_opts):
        try:
            # fetch routes from decision module
            (decision_unicast_routes,
             decision_mpls_routes) = utils.get_shortest_routes(
                 decision_client.DecisionClient(cli_opts).get_route_db())
            # fetch routes from fib module
            (fib_unicast_routes, fib_mpls_routes) = utils.get_shortest_routes(
                fib_client.FibClient(cli_opts).get_route_db())
            # fetch route from net_agent module
            agent_unicast_routes = self.client.getRouteTableByClient(
                self.client.client_id)
            agent_mpls_routes = self.client.getMplsRouteTableByClient(
                self.client.client_id)
            # fetch link_db from link-monitor module
            lm_links = lm_client.LMClient(
                cli_opts).dump_links().interfaceDetails

        except Exception as e:
            print("Failed to validate Fib routes.")
            print("Exception: {}".format(e))
            raise e
            # return 1

        (res1_unicast, _) = utils.compare_route_db(
            decision_unicast_routes,
            fib_unicast_routes,
            "unicast",
            ["Decision:unicast", "Openr-Fib:unicast"],
            cli_opts.enable_color,
        )
        (res1_mpls, _) = utils.compare_route_db(
            decision_mpls_routes,
            fib_mpls_routes,
            "mpls",
            ["Decision:mpls", "Openr-Fib:mpls"],
            cli_opts.enable_color,
        )
        (res2_unicast, _) = utils.compare_route_db(
            fib_unicast_routes,
            agent_unicast_routes,
            "unicast",
            ["Openr-Fib:unicast", "FibAgent:unicast"],
            cli_opts.enable_color,
        )
        (res2_mpls, _) = utils.compare_route_db(
            fib_mpls_routes,
            agent_mpls_routes,
            "mpls",
            ["Openr-Fib:mpls", "FibAgent:mpls"],
            cli_opts.enable_color,
        )
        (res3, _) = utils.validate_route_nexthops(
            fib_unicast_routes,
            lm_links,
            ["Openr-Fib:unicast", "LinkMonitor"],
            cli_opts.enable_color,
        )
        return (0 if res1_unicast and res1_mpls and res2_unicast and res2_mpls
                and res3 else -1)
Beispiel #3
0
 def _fib_client():
     fib_client_inst = fib_client.FibClient(
         bunch.Bunch({
             "ctx": zmq.Context(),
             "host": "localhost",
             "fib_rep_port": 5000
         }))
     self.assertEqual(fib_client_inst.get_route_db(), route_db_cache)
Beispiel #4
0
    def __init__(self, cli_opts):
        ''' initialize the Fib client '''

        self.lm_cmd_port = cli_opts.lm_cmd_port

        self.client = fib_client.FibClient(
            cli_opts.zmq_ctx, "tcp://[{}]:{}".format(cli_opts.host,
                                                     cli_opts.fib_rep_port),
            cli_opts.timeout, cli_opts.proto_factory)
Beispiel #5
0
    def __init__(self, cli_opts):
        """ initialize the Fib client """

        self.client = fib_client.FibClient(cli_opts)
Beispiel #6
0
 def get_fib_route_db(self, cli_opts):
     client = fib_client.FibClient(cli_opts)
     return utils.get_shortest_routes(client.get_route_db())
Beispiel #7
0
 def _fib_client():
     fib_client_inst = fib_client.FibClient(zmq.Context(),
                                            "tcp://localhost:5000")
     self.assertEqual(fib_client_inst.get_route_db(), route_db_cache)