示例#1
0
 def _retrieve_global_tables_view(self, addr_family, route_family):
     core_service = self.api.get_core_service()
     core_sv = CoreServiceDetailView(core_service)
     table_manager_view = core_sv.rel('table_manager')
     global_tables_view = table_manager_view.rel('global_tables')
     global_tables_view.apply_filter(
         lambda k, v: addr_family == 'all' or k == route_family)
     return global_tables_view
示例#2
0
文件: neighbor.py 项目: Aminiok/ryu
 def _retrieve_global_tables_view(self, addr_family, route_family):
     core_service = self.api.get_core_service()
     core_sv = CoreServiceDetailView(core_service)
     table_manager_view = core_sv.rel('table_manager')
     global_tables_view = table_manager_view.rel('global_tables')
     global_tables_view.apply_filter(
         lambda k, v: addr_family == 'all' or k == route_family
     )
     return global_tables_view
示例#3
0
文件: neighbor.py 项目: AkiraSuu/ryu
    def action(self, params):
        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        peers_view = core_service_view.rel('peer_manager').rel('peers')

        ret = peers_view.encode()
        return CommandsResponse(STATUS_OK,
                                [{'ip_addr': k,
                                  'as_num': str(v['remote_as']),
                                  'bgp_state': v['stats']['bgp_state']}
                                 for k, v in ret.iteritems()])
示例#4
0
    def action(self, params):
        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        peers_view = core_service_view.rel('peer_manager').rel('peers')

        ret = peers_view.encode()
        return CommandsResponse(STATUS_OK,
                                [{'ip_addr': k,
                                  'as_num': str(v['remote_as']),
                                  'bgp_state': v['stats']['bgp_state']}
                                 for k, v in ret.iteritems()])
示例#5
0
文件: neighbor.py 项目: hedi02/ryu-1
    def action(self, params):
        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        peers_view = core_service_view.rel("peer_manager").rel("peers")

        ret = peers_view.encode()
        return CommandsResponse(
            STATUS_OK,
            [
                {"ip_addr": k, "as_num": str(v["remote_as"]), "bgp_state": v["stats"]["bgp_state"]}
                for k, v in ret.iteritems()
            ],
        )
示例#6
0
文件: neighbor.py 项目: AkiraSuu/ryu
    def action(self, params):
        requested_peers = []
        if len(params) > 0:
            requested_peers = [str(p) for p in params]

        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        peers_view = core_service_view.rel('peer_manager').rel('peers_summary')

        def filter_requested(peer_id, peer_obj):
            return not requested_peers or peer_id in requested_peers

        peers_view.apply_filter(filter_requested)
        ret = peers_view.encode()
        return CommandsResponse(STATUS_OK, ret)
示例#7
0
    def action(self, params):
        requested_peers = []
        if len(params) > 0:
            requested_peers = [str(p) for p in params]

        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        peers_view = core_service_view.rel('peer_manager').rel('peers_summary')

        def filter_requested(peer_id, peer_obj):
            return not requested_peers or peer_id in requested_peers

        peers_view.apply_filter(filter_requested)
        ret = peers_view.encode()
        return CommandsResponse(STATUS_OK, ret)
示例#8
0
    def action(self, params):
        if len(params) != 1:
            return WrongParamResp()

        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        importmap_manager = core_service_view.rel('importmap_manager')
        importmaps_view = importmap_manager.rel('importmaps')

        importmap_name = params[0]
        if importmap_name == 'all':
            encoded = importmaps_view.encode()
        else:
            encoded = importmaps_view.encode().get(importmap_name)
            if encoded is None:
                return CommandsResponse(STATUS_ERROR, 'Wrong importmap name.')

        return CommandsResponse(STATUS_OK, encoded)
示例#9
0
    def action(self, params):
        if len(params) != 1:
            return WrongParamResp()

        core_service = self.api.get_core_service()
        core_service_view = CoreServiceDetailView(core_service)
        importmap_manager = core_service_view.rel('importmap_manager')
        importmaps_view = importmap_manager.rel('importmaps')

        importmap_name = params[0]
        if importmap_name == 'all':
            encoded = importmaps_view.encode()
        else:
            encoded = importmaps_view.encode().get(importmap_name)
            if encoded is None:
                return CommandsResponse(
                    STATUS_ERROR,
                    'Wrong importmap name.'
                )

        return CommandsResponse(
            STATUS_OK,
            encoded
        )
示例#10
0
文件: neighbor.py 项目: AkiraSuu/ryu
 def _retrieve_peer_view(self, ip_addr):
     core_service = self.api.get_core_service()
     core_sv = CoreServiceDetailView(core_service)
     peers_view = core_sv.rel('peer_manager').rel('peers')
     peers_view.apply_filter(lambda k, v: v.ip_address == ip_addr)
     return peers_view
示例#11
0
 def _retrieve_peer_view(self, ip_addr):
     core_service = self.api.get_core_service()
     core_sv = CoreServiceDetailView(core_service)
     peers_view = core_sv.rel('peer_manager').rel('peers')
     peers_view.apply_filter(lambda k, v: v.ip_address == ip_addr)
     return peers_view