@@ -0,0 +1,3070 @@
+#!/usr/bin/python%0A# -- Content-Encoding: UTF-8 --%0A%22%22%22%0AHerald Routing service%0A%0A:author: Luc Libralesso%0A:copyright: Copyright 2014, isandlaTech%0A:license: Apache License 2.0%0A:version: 0.0.3%0A:status: Alpha%0A%0A..%0A%0A    Copyright 2014 isandlaTech%0A%0A    Licensed under the Apache License, Version 2.0 (the %22License%22);%0A    you may not use this file except in compliance with the License.%0A    You may obtain a copy of the License at%0A%0A        http://www.apache.org/licenses/LICENSE-2.0%0A%0A    Unless required by applicable law or agreed to in writing, software%0A    distributed under the License is distributed on an %22AS IS%22 BASIS,%0A    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A    See the License for the specific language governing permissions and%0A    limitations under the License.%0A%22%22%22%0A%0A# Module version%0A__version_info__ = (0, 0, 3)%0A__version__ = %22.%22.join(str(x) for x in __version_info__)%0A%0A# Documentation strings format%0A__docformat__ = %22restructuredtext en%22%0A%0A# ------------------------------------------------------------------------------%0A%0Afrom pelix.ipopo.decorators import ComponentFactory, Provides, %5C%0A    Validate, Invalidate, Instantiate, Requires%0Aimport herald%0Aimport logging%0Aimport herald.routing_constants%0A%0A# ------------------------------------------------------------------------------%0A%0A_logger = logging.getLogger(__name__)%0A%0A# ------------------------------------------------------------------------------%0A%0A%0A@ComponentFactory(%22herald-routing-info-factory%22)%0A@Provides(herald.routing_constants.ROUTING_JSON)  # for getting messages of type reply%0A@Requires('_routing', herald.routing_constants.ROUTING_INFO)  # for sending messages%0A@Requires('_hellos', herald.routing_constants.GET_NEIGHBOURS_AVAILABLE)  # for metrics%0A@Instantiate('herald-routing-info')%0Aclass RoutingJson:%0A    %22%22%22%0A    Herald routing JSON.%0A%0A    It's purpose is to send JSON information to a debug interface%0A    from the routing algorithm.%0A%0A    For instance, getting the routing table metric and next_hop.%0A    And also known neighbours with metrics%0A    %22%22%22%0A%0A    def __init__(self):%0A        %22%22%22%0A        sets up members%0A        :return: nothing%0A        %22%22%22%0A        # remote objects%0A        self._routing = None%0A%0A    @Validate%0A    def validate(self, context):%0A        %22%22%22%0A        :param context:%0A        :return: nothing%0A        %22%22%22%0A        pass%0A%0A    @Invalidate%0A    def invalidate(self, context):%0A        %22%22%22%0A        :param context:%0A        :return: nothing%0A        %22%22%22%0A        pass%0A%0A    def get_json_routing(self):%0A        %22%22%22%0A        :return: a JSON object (dict) that contains the routing table with metrics.%0A        %22%22%22%0A        return self._routing.get_accessible_pairs()%0A%0A    def get_json_next_hop(self):%0A        %22%22%22%0A        :return: a JSON object (dict) that contains the next hops%0A        %22%22%22%0A%0A    def get_json_neighbours(self):%0A        %22%22%22%0A        :return: a JSON object (dict) that contains neighbours with metrics.%0A        %22%22%22%0A        res = %7B%7D%0A        for i in self._hellos.get_neighbours():%0A            res%5Bi%5D = self._hellos.get_neighbour_metric(i)%0A        return res

add a routing table viewer component