Class: Junos::Ez::L2ports::Provider

Inherits:
Provider::Parent show all
Defined in:
lib/junos-ez/l2_ports.rb

Direct Known Subclasses

BRIDGE_DOMAIN, VLAN, VLAN_L2NG

Defined Under Namespace

Classes: BRIDGE_DOMAIN, VLAN, VLAN_L2NG

Instance Attribute Summary

Attributes inherited from Provider::Parent

#catalog, #has, #list, #name, #ndev, #parent, #properties, #providers, #should

Instance Method Summary collapse

Methods inherited from Provider::Parent

#[], #[]=, #activate!, #active?, #catalog!, #create, #create!, #create_from_hash!, #create_from_yaml!, #deactivate!, #delete!, #each, #exists?, #init_has, #initialize, #is_new?, #is_provider?, #list!, #name_decorated, #need_write?, #read!, #rename!, #reorder!, #select, #to_h, #to_h_expanded, #to_yaml, #with, #write!, #xml_at_edit, #xml_at_top, #xml_build_change, #xml_change__exist, #xml_change_admin, #xml_change_description, #xml_config_read!, #xml_element_newname, #xml_get_has_xml, #xml_on_create, #xml_on_delete

Constructor Details

This class inherits a constructor from Junos::Ez::Provider::Parent

Instance Method Details

#is_trunk?Boolean

common parenting …

Returns:

  • (Boolean)


33
34
35
# File 'lib/junos-ez/l2_ports.rb', line 33

def is_trunk?
  @has[:vlan_tagging] == true
end

#mode_changed?Boolean

Returns:

  • (Boolean)


41
42
43
44
45
# File 'lib/junos-ez/l2_ports.rb', line 41

def mode_changed?
  return true if is_new?
  return false if @should[:vlan_tagging].nil?      
  @should[:vlan_tagging] != @has[:vlan_tagging]      
end

#should_trunk?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/junos-ez/l2_ports.rb', line 37

def should_trunk?
  (@should[:vlan_tagging].nil?) ? @has[:vlan_tagging] : @should[:vlan_tagging]
end

#xml_change__active(xml) ⇒ Object


XML overload ‘activate/deactivate’ since we need to modify this at the ‘unit’ level and not at the ‘family’ level




52
53
54
55
56
# File 'lib/junos-ez/l2_ports.rb', line 52

def xml_change__active( xml )
  par = xml.instance_variable_get(:@parent).at_xpath('ancestor::interface')
  value = @should[:_active]  ? 'active' : 'inactive'
  par[value] = value # attribute name is same as value
end