예제 #1
0
파일: lm_client.py 프로젝트: nitinics/openr
    def send_link_monitor_cmd(self, command, interface="", metric=0, node=""):

        req_msg = lm_types.LinkMonitorRequest(command, interface, metric, node)

        self.send_and_recv_thrift_obj(req_msg, str)

        return self.dump_links()
예제 #2
0
    def get_build_info(self):

        command = lm_types.LinkMonitorCommand.GET_BUILD_INFO
        req_msg = lm_types.LinkMonitorRequest(command)
        self._lm_cmd_socket.send_thrift_obj(req_msg)

        return self._lm_cmd_socket.recv_thrift_obj(lm_types.BuildInfo)
예제 #3
0
    def get_openr_version(self):

        command = lm_types.LinkMonitorCommand.GET_VERSION

        req_msg = lm_types.LinkMonitorRequest(command)
        self._lm_cmd_socket.send_thrift_obj(req_msg)

        return self._lm_cmd_socket.recv_thrift_obj(lm_types.OpenrVersions)
예제 #4
0
    def dump_links(self, all=True):
        '''
        @param all: If set to false then links with no addresses will be
                    filtered out.
        '''

        req_msg = lm_types.LinkMonitorRequest()
        req_msg.cmd = lm_types.LinkMonitorCommand.DUMP_LINKS
        req_msg.interfaceName = ''

        self._lm_cmd_socket.send_thrift_obj(req_msg)
        links = self._lm_cmd_socket.recv_thrift_obj(lm_types.DumpLinksReply)

        # filter out link with no addresses
        if not all:
            links.interfaceDetails = {
                k: v for k, v in links.interfaceDetails.items()
                if len(v.info.v6LinkLocalAddrs + v.info.v4Addrs) != 0}

        return links
예제 #5
0
파일: lm_client.py 프로젝트: nitinics/openr
    def dump_links(self, all=True):
        """
        @param all: If set to false then links with no addresses will be
                    filtered out.
        """

        req_msg = lm_types.LinkMonitorRequest()
        req_msg.cmd = lm_types.LinkMonitorCommand.DUMP_LINKS

        links = self.send_and_recv_thrift_obj(req_msg, lm_types.DumpLinksReply)

        # filter out link with no addresses
        if not all:
            links.interfaceDetails = {
                k: v
                for k, v in links.interfaceDetails.items()
                if len(v.info.networks) != 0
            }

        return links
예제 #6
0
    def send_link_monitor_cmd(self, command, interface='', metric=0, node=''):

        req_msg = lm_types.LinkMonitorRequest(command, interface, metric, node)
        self._lm_cmd_socket.send_thrift_obj(req_msg)

        return self.dump_links()
예제 #7
0
파일: lm_client.py 프로젝트: nitinics/openr
 def get_build_info(self):
     return self.send_and_recv_thrift_obj(
         lm_types.LinkMonitorRequest(
             lm_types.LinkMonitorCommand.GET_BUILD_INFO),
         lm_types.BuildInfo,
     )
예제 #8
0
파일: lm_client.py 프로젝트: nitinics/openr
 def get_openr_version(self):
     return self.send_and_recv_thrift_obj(
         lm_types.LinkMonitorRequest(
             lm_types.LinkMonitorCommand.GET_VERSION),
         lm_types.OpenrVersions,
     )