Method: Cisco::BridgeDomain#create

Defined in:
lib/cisco_node_utils/bridge_domain.rb

#createObject

This function will first add bds to the system bridge-domain and then create the bds. If bds already existing then just create. Else add the non added bds to system range first then create all. This is to avoid the idempotency issue as system add command throws error if a bd is already present in the system range.



106
107
108
109
110
111
112
113
114
115
# File 'lib/cisco_node_utils/bridge_domain.rb', line 106

def create
  sys_bds_array = BridgeDomain.bd_ids_to_array(system_bridge_domain)
  inp_bds_array = BridgeDomain.bd_ids_to_array(@bd_ids)
  if (inp_bds_array - sys_bds_array).any?
    add_bds = BridgeDomain.bd_list_to_string(inp_bds_array - sys_bds_array)
    config_set('bridge_domain', 'system_bridge_domain', oper: 'add',
                                                        bd:   add_bds)
  end
  config_set('bridge_domain', 'create', bd: @bd_ids)
end