class Junos::Ez::Vlans::Provider::BRIDGE_DOMAIN


Provider collection methods


Public Instance Methods

build_catalog() click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 77
def build_catalog
  @catalog = {}    
  bd_cfgs = @ndev.rpc.get_configuration{ |x| x.send :'bridge-domains' }    
  bd_cfgs.xpath('bridge-domains/domain').collect do |domain|
    name = domain.xpath('name').text
    @catalog[name] = {}
    xml_read_parser( domain, @catalog[name] )
  end          
  return @catalog
end
build_list() click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 70
def build_list    
  bd_cfgs = @ndev.rpc.get_configuration{ |x| x.send :'bridge-domains' }
  bd_cfgs.xpath('bridge-domains/domain').collect do |domain|
    domain.xpath('name').text
  end    
end
xml_at_top() click to toggle source

XML top placement


# File lib/junos-ez/vlans/bridge_domain.rb, line 7
def xml_at_top
  Nokogiri::XML::Builder.new{|x| x.configuration{ 
    x.send( :'bridge-domains' ) { x.domain { x.name @name
      return x
    }}
  }}
end
xml_change_description( xml ) click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 57
def xml_change_description( xml )
  xml.description @should[:description]
end
xml_change_no_mac_learning( xml ) click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 45
def xml_change_no_mac_learning( xml )
  no_ml = @should[:no_mac_learning]     
  return unless ( exists? and no_ml )    
  xml.send(:'bridge-options') {
    xml.send(:'no-mac-learning', (no_ml == :enable) ? nil : Netconf::JunosConfig::DELETE )
  }    
end
xml_change_vlan_id( xml ) click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 53
def xml_change_vlan_id( xml )
  xml.send( :'vlan-id', @should[:vlan_id] )
end
xml_get_has_xml( xml ) click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 25
def xml_get_has_xml( xml )
  xml.xpath('//domain')[0]    
end
xml_on_create( xml ) click to toggle source

XML writers


# File lib/junos-ez/vlans/bridge_domain.rb, line 41
def xml_on_create( xml )
  xml.send( :'domain-type', 'bridge' )
end
xml_read!() click to toggle source

XML readers


# File lib/junos-ez/vlans/bridge_domain.rb, line 19
def xml_read!    
  cfg_xml = @ndev.rpc.get_configuration( xml_at_top )    
  return nil unless (@has_xml = cfg_xml.xpath('//domain')[0])      
  xml_read_parser( @has_xml, @has )    
end
xml_read_parser( as_xml, as_hash ) click to toggle source
# File lib/junos-ez/vlans/bridge_domain.rb, line 29
def xml_read_parser( as_xml, as_hash )
  set_has_status( as_xml, as_hash )        
  as_hash[:vlan_id] = as_xml.xpath('vlan-id').text.to_i
  as_hash[:description] = as_xml.xpath('description').text
  as_hash[:no_mac_learning] = as_xml.xpath('bridge-options/no-mac-learning').empty? ? :disable : :enable    
  return true    
end