Class: Junos::Ez::L1ports::Provider
- Inherits:
-
Provider::Parent
- Object
- Provider::Parent
- Junos::Ez::L1ports::Provider
- Defined in:
- lib/junos-ez/l1_ports.rb
Instance Attribute Summary
Attributes inherited from Provider::Parent
#catalog, #has, #list, #name, #ndev, #parent, #properties, #providers, #should
Instance Method Summary collapse
- #build_catalog ⇒ Object
-
#build_list ⇒ Object
————————————————————— Collection methods —————————————————————.
- #xml_change_mtu(xml) ⇒ Object
-
#xml_get_has_xml(xml) ⇒ Object
————————————————————— XML readers —————————————————————.
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, #write!, #xml_at_edit, #xml_at_top, #xml_build_change, #xml_change__active, #xml_change__exist, #xml_change_admin, #xml_change_description, #xml_config_read!, #xml_element_newname, #xml_on_create, #xml_on_delete
Constructor Details
This class inherits a constructor from Junos::Ez::Provider::Parent
Instance Method Details
#build_catalog ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/junos-ez/l1_ports.rb', line 56 def build_catalog @catalog = {} @ndev.rpc.get_configuration{|xml| xml.interfaces { list!.each do |ifs| xml.interface { xml.name ifs xml_read_filter( xml ) } end } }.xpath('interfaces/interface').each do |ifs_xml| ifs_name = ifs_xml.xpath('name').text @catalog[ifs_name] = {} xml_read_parser( ifs_xml, @catalog[ifs_name] ) end return @catalog end |
#build_list ⇒ Object
Collection methods
46 47 48 49 50 51 52 53 54 |
# File 'lib/junos-ez/l1_ports.rb', line 46 def build_list @ndev.rpc.get_interface_information({ :media => true, :terse => true, :interface_name => '[fgx]e-*' }).xpath('physical-interface/name').collect do |ifs| ifs.text.strip end end |
#xml_change_mtu(xml) ⇒ Object
38 39 40 |
# File 'lib/junos-ez/l1_ports.rb', line 38 def xml_change_mtu( xml ) xml_set_or_delete( xml, 'mtu', @should[:mtu] ) end |
#xml_get_has_xml(xml) ⇒ Object
XML readers
34 35 36 |
# File 'lib/junos-ez/l1_ports.rb', line 34 def xml_get_has_xml( xml ) xml.xpath('//interface')[0] end |