Fetches a list of all routes advertised by BGP speaker.
436398
def list_route_advertised_from_bgp_speaker(self, speaker_id, **_params):
        """"""
        return self.get((self.bgp_speaker_path % speaker_id) +
                        "/get_advertised_routes", params=_params)
1236897
def get_bgp_neighbors_detail(self, neighbor_address=""):
        """"""
        bgp_neighbors = {}
        default_neighbor_details = {
            "up": False,
            "local_as": 0,
            "remote_as": 0,
            "router_id": "",
            "local_address": "",
            "routing_table": "",
            "local_address_configured": False,
            "local_port": 0,
            "remote_address": "",
            "remote_port": 0,
            "multihop": False,
            "multipath": False,
            "remove_private_as": False,
            "import_policy": "",
            "export_policy": "",
            "input_messages": -1,
            "output_messages": -1,
            "input_updates": -1,
            "output_updates": -1,
            "messages_queued_out": -1,
            "connection_state": "",
            "previous_connection_state": "",
            "last_event": "",
            "suppress_4byte_as": False,
            "local_as_prepend": False,
            "holdtime": 0,
            "configured_holdtime": 0,
            "keepalive": 0,
            "configured_keepalive": 0,
            "active_prefix_count": -1,
            "received_prefix_count": -1,
            "accepted_prefix_count": -1,
            "suppressed_prefix_count": -1,
            "advertised_prefix_count": -1,
            "flap_count": 0,
        }
        OPTION_KEY_MAP = {
            "RemovePrivateAS": "remove_private_as",
            "Multipath": "multipath",
            "Multihop": "multihop",
            "AddressFamily": "local_address_configured"
            # 'AuthKey'        : 'authentication_key_set'
            # but other vendors do not specify if auth key is set
            # other options:
            # Preference, HoldTime, Ttl, LogUpDown, Refresh
        }

        def _bgp_iter_core(neighbor_data, instance=None):
            """
            Iterate over a list of neighbors.
            For older junos, the routing instance is not specified inside the
            BGP neighbors XML, therefore we need to use a super sub-optimal structure
            as in get_bgp_neighbors: iterate through the list of network instances
            then execute one request for each and every routing instance.
            For newer junos, this is not necessary as the routing instance is available
            and we can get everything solve in a single request.
            """
            for bgp_neighbor in neighbor_data:
                remote_as = int(bgp_neighbor[0])
                neighbor_details = deepcopy(default_neighbor_details)
                neighbor_details.update(
                    {
                        elem[0]: elem[1]
                        for elem in bgp_neighbor[1]
                        if elem[1] is not None
                    }
                )
                if not instance:
                    peer_fwd_rti = neighbor_details.pop("peer_fwd_rti")
                    instance = peer_fwd_rti
                else:
                    peer_fwd_rti = neighbor_details.pop("peer_fwd_rti", "")
                instance_name = "global" if instance == "master" else instance
                options = neighbor_details.pop("options", "")
                if isinstance(options, str):
                    options_list = options.split()
                    for option in options_list:
                        key = OPTION_KEY_MAP.get(option)
                        if key is not None:
                            neighbor_details[key] = True
                four_byte_as = neighbor_details.pop("4byte_as", 0)
                local_address = neighbor_details.pop("local_address", "")
                local_details = local_address.split("+")
                neighbor_details["local_address"] = napalm.base.helpers.convert(
                    napalm.base.helpers.ip, local_details[0], local_details[0]
                )
                if len(local_details) == 2:
                    neighbor_details["local_port"] = int(local_details[1])
                else:
                    neighbor_details["local_port"] = 179
                neighbor_details["suppress_4byte_as"] = remote_as != four_byte_as
                peer_address = neighbor_details.pop("peer_address", "")
                remote_details = peer_address.split("+")
                neighbor_details["remote_address"] = napalm.base.helpers.convert(
                    napalm.base.helpers.ip, remote_details[0], remote_details[0]
                )
                if len(remote_details) == 2:
                    neighbor_details["remote_port"] = int(remote_details[1])
                else:
                    neighbor_details["remote_port"] = 179
                neighbor_details["routing_table"] = instance_name
                neighbor_details["local_as"] = napalm.base.helpers.as_number(
                    neighbor_details["local_as"]
                )
                neighbor_details["remote_as"] = napalm.base.helpers.as_number(
                    neighbor_details["remote_as"]
                )
                neighbors_rib = neighbor_details.pop("rib")
                neighbors_queue = neighbor_details.pop("queue")
                messages_queued_out = 0
                for queue_entry in neighbors_queue.items():
                    messages_queued_out += queue_entry[1][0][1]
                neighbor_details["messages_queued_out"] = messages_queued_out
                if instance_name not in bgp_neighbors.keys():
                    bgp_neighbors[instance_name] = {}
                if remote_as not in bgp_neighbors[instance_name].keys():
                    bgp_neighbors[instance_name][remote_as] = []
                neighbor_rib_stats = neighbors_rib.items()
                if not neighbor_rib_stats:
                    bgp_neighbors[instance_name][remote_as].append(neighbor_details)
                    continue  # no RIBs available, pass default details
                neighbor_rib_details = {
                    "active_prefix_count": 0,
                    "received_prefix_count": 0,
                    "accepted_prefix_count": 0,
                    "suppressed_prefix_count": 0,
                    "advertised_prefix_count": 0,
                }
                for rib_entry in neighbor_rib_stats:
                    for elem in rib_entry[1]:
                        if elem[1] is None:
                            neighbor_rib_details[elem[0]] += 0
                        else:
                            neighbor_rib_details[elem[0]] += elem[1]
                neighbor_details.update(neighbor_rib_details)
                bgp_neighbors[instance_name][remote_as].append(neighbor_details)

        # old_junos = napalm.base.helpers.convert(
        #     int, self.device.facts.get('version', '0.0').split('.')[0], 0) < 15
        bgp_neighbors_table = junos_views.junos_bgp_neighbors_table(self.device)

        # if old_junos:
        instances = junos_views.junos_route_instance_table(self.device)
        for instance, instance_data in instances.get().items():
            if instance.startswith("__"):
                # junos internal instances
                continue
            neighbor_data = bgp_neighbors_table.get(
                instance=instance, neighbor_address=str(neighbor_address)
            ).items()
            _bgp_iter_core(neighbor_data, instance=instance)
        # else:
        #     bgp_neighbors_table = junos_views.junos_bgp_neighbors_table(self.device)
        #     neighbor_data = bgp_neighbors_table.get(neighbor_address=neighbor_address).items()
        #     _bgp_iter_core(neighbor_data)
        return bgp_neighbors
668730
def routes(cls, application=None):
        
        if application:
            for route in cls._routes:
                application.add_handlers(route['host'], route['spec'])
        else:
            return [route['spec'] for route in cls._routes]
384567
def get_subscriptions(self):
        
        # Example: {'subscriptions': ['subscriptions/TripDistance~sub', 'subscriptions/FuelRate~sub', ]}
        subscriptions = []
        for uri in self.get_http_client().get("subscriptions").get('subscriptions'):
            subscriptions.append(self.get_subscription(uri.split("/")[-1]))
        return subscriptions
1319119
public function getList()
    {
        $routes = &gplcart_static('route.list');

        if (isset($routes)) {
            return $routes;
        }

        $routes = (array) gplcart_config_get(GC_FILE_CONFIG_ROUTE);
        $this->hook->attach('route.list', $routes, $this);
        return $routes;
    }
1169739
public function getRoutes() : Array {

		$return = array();
		foreach($this->routes as $route) {
			array_push($return, [$route->getPath(), $route->getMethod()]);
		}
		return $return;

	}
743518
def announce_urls(self):
        
        urls = self._struct.get('announce-list')

        if not urls:
            urls = self._struct.get('announce')
            if not urls:
                return []
            urls = [[urls]]

        return urls
670012
def trips(self):
    """"""
    trips = set()
    for route in self.routes():
      trips |= route.trips()
    return trips
860969
protected function getRoutes()
    {
        $results = array();

        foreach($this->routes as $route) {
            $results[] = $this->getRouteInformation($route);
        }

        return array_filter($results);
    }
943708
def get_available_routers(self, dc=None):
        
        mask = "mask[locations]"
        # Step 1, get the package id
        package = self.ordering_manager.get_package_by_key(self.capacity_package, mask="id")

        # Step 2, get the regions this package is orderable in
        regions = self.client.call('Product_Package', 'getRegions', id=package['id'], mask=mask, iter=True)
        _filter = None
        routers = {}
        if dc is not None:
            _filter = {'datacenterName': {'operation': dc}}

        # Step 3, for each location in each region, get the pod details, which contains the router id
        pods = self.client.call('Network_Pod', 'getAllObjects', filter=_filter, iter=True)
        for region in regions:
            routers[region['keyname']] = []
            for location in region['locations']:
                location['location']['pods'] = list()
                for pod in pods:
                    if pod['datacenterName'] == location['location']['name']:
                        location['location']['pods'].append(pod)

        # Step 4, return the data.
        return regions
978025
def list(self, environment_vip=None):
        

        uri = 'api/networkv6/?'
        if environment_vip:
            uri += 'environment_vip=%s' % environment_vip

        return super(ApiNetworkIPv6, self).get(uri)
7701
public static lbroute[] get_filtered(nitro_service service, String filter) throws Exception{
		lbroute obj = new lbroute();
		options option = new options();
		option.set_filter(filter);
		lbroute[] response = (lbroute[]) obj.getfiltered(service, option);
		return response;
	}
296765
def getRoutes(self):
        
        routes = []
        try:
            out = subprocess.Popen([routeCmd, "-n"], 
                                   stdout=subprocess.PIPE).communicate()[0]
        except:
            raise Exception('Execution of command %s failed.' % ipCmd)
        lines = out.splitlines()
        if len(lines) > 1:
            headers = [col.lower() for col in lines[1].split()]
            for line in lines[2:]:
                routes.append(dict(zip(headers, line.split())))
        return routes
1337117
function getAllRoutes (router) {
  assert.equal(typeof router, 'function', 'wayfarer.getAllRoutes: router should be an function')

  var trie = router._trie
  assert.equal(typeof trie, 'object', 'wayfarer.getAllRoutes: trie should be an object')

  var tree = trie.trie
  return transform(tree)
}
888318
def get_all_incomings(self, params=None):
        
        if not params:
            params = {}
        return self._iterate_through_pages(self.get_incomings_per_page, resource=INCOMINGS, **{'params': params})
1191672
public function findRoutes(): array
    {
        /** @var array[] $routes */
        $routes = [];

        $modules = $this->packageRepository->findModules();
        foreach ($modules as $module) {
            $extra = $module->getExtra();
            $this->validateRoutesSectionInExtra($extra);
            if (empty($extra['phplist/core']['routes'])) {
                continue;
            }

            /** @var array $moduleRoutes */
            $moduleRoutes = $extra['phplist/core']['routes'];
            foreach ($moduleRoutes as $name => $route) {
                $prefixedRouteName = $module->getName() . '.' . $name;
                $routes[$prefixedRouteName] = $route;
            }
        }

        return $routes;
    }
119570
def getNeighbouringRouters(self):
        
        print '%s call getNeighbouringRouters' % self.port
        try:
            routerInfo = []
            routerList = []
            routerList = self.__sendCommand('router list')[0].split()
            print routerList

            if 'Done' in routerList:
                print 'no neighbouring routers'
                return None

            for index in routerList:
                router = []
                cmd = 'router %s' % index
                router = self.__sendCommand(cmd)

                for line in router:
                    if 'Done' in line:
                        break
                    #elif 'Rloc' in line:
                    #    rloc16 = line.split()[1]
                    elif 'Ext Addr' in line:
                        eui = line.split()[2]
                        routerInfo.append(int(eui, 16))
                    #elif 'LQI In' in line:
                    #    lqi_in = line.split()[1]
                    #elif 'LQI Out' in line:
                    #    lqi_out = line.split()[1]
                    else:
                        pass

            print routerInfo
            return routerInfo
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("getNeighbouringDevice() Error: " + str(e))