Method: Cisco::BridgeDomain.bd_ids_to_array

Defined in:
lib/cisco_node_utils/bridge_domain.rb

.bd_ids_to_array(bdid_string) ⇒ Object

This will expand the string to a list of bds as integers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cisco_node_utils/bridge_domain.rb', line 41

def self.bd_ids_to_array(bdid_string)
  list = []
  narray = bdid_string.split(',')
  narray.each do |elem|
    if elem.include?('-')
      es = elem.gsub('-', '..')
      ea = es.split('..').map { |d| Integer(d) }
      er = ea[0]..ea[1]
      list << er.to_a
    else
      list << elem.to_i
    end
  end
  list.flatten
end