Method: Rbeapi::Api::Bgp#create
- Defined in:
- lib/rbeapi/api/bgp.rb
#create(bgp_as, opts = {}) ⇒ Boolean
create will create a new instance of BGP routing on the node. Optional parameters can be passed in to initialize BGP specific settings.
Commands
router bgp <bgp_as>
paths.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/rbeapi/api/bgp.rb', line 227 def create(bgp_as, opts = {}) if opts[:maximum_ecmp_paths] && !opts[:maximum_paths] = 'maximum_paths must be set if maximum_ecmp_paths is set' raise ArgumentError, end cmds = ["router bgp #{bgp_as}"] if opts.key?(:enable) cmds << (opts[:enable] == true ? 'no shutdown' : 'shutdown') end cmds << "router-id #{opts[:router_id]}" if opts.key?(:router_id) if opts.key?(:maximum_paths) cmd = "maximum-paths #{opts[:maximum_paths]}" if opts.key?(:maximum_ecmp_paths) cmd << " ecmp #{opts[:maximum_ecmp_paths]}" end cmds << cmd end configure(cmds) end |