Method: Rbeapi::Api::Bgp#add_network

Defined in:
lib/rbeapi/api/bgp.rb

#add_network(prefix, masklen, route_map = nil) ⇒ Boolean

add_network creates a new instance of a BGP network on the node.

Commands

router bgp <bgp_as>
  network <prefix>/<masklen>
  route-map <route_map>

Parameters:

  • prefix (String)

    The IPv4 prefix to configure as part of the network statement. The value must be a valid IPv4 prefix.

  • masklen (String)

    The IPv4 subnet mask length in bits. The masklen must be in the valid range of 1 to 32.

  • route_map (String) (defaults to: nil)

    The route-map name to apply to the network statement when configured.

Returns:

  • (Boolean)

    Returns true if the command complete successfully.



409
410
411
412
413
# File 'lib/rbeapi/api/bgp.rb', line 409

def add_network(prefix, masklen, route_map = nil)
  cmd = "network #{prefix}/#{masklen}"
  cmd << " route-map #{route_map}" if route_map
  configure_bgp(cmd)
end