Class: Puppet::Provider::Comware::Vsi
- Inherits:
-
Puppet::Provider::Comware
- Object
- Puppet::Provider::Comware
- Puppet::Provider::Comware::Vsi
- Defined in:
- lib/puppet/provider/comware/comware_vsi.rb
Instance Method Summary collapse
- #default_description ⇒ Object
- #init_resource ⇒ Object
- #netdev_res_exists? ⇒ Boolean
- #netdev_resxml_create_top(xml) ⇒ Object
- #netdev_resxml_delete(xml) ⇒ Object
-
#netdev_resxml_top(xml) ⇒ Object
override the method.
-
#xml_change_description(xml) ⇒ Object
————————————————————- XML builder methods ————————————————————-.
Instance Method Details
#default_description ⇒ Object
48 49 50 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 48 def default_description "Puppet created vsi: #{resource[:name]}" end |
#init_resource ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 15 def init_resource resource[:description] ||= default_description @ndev_res ||= NetdevComware::Resource.new( self, "L2VPN/VSIs/VSI" ) ndev_config = @ndev_res.getconfig return false unless (ifd = ndev_config.xpath('////VSI')[0]) #update index here resource[:name] = resource[:vsiname] @ndev_res.set_active_state( ifd ) return ifd end |
#netdev_res_exists? ⇒ Boolean
5 6 7 8 9 10 11 12 13 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 5 def netdev_res_exists? return false unless (ifd = init_resource) @ndev_res[:vsiname] = ifd.xpath('VsiName').text.chomp @ndev_res[:description] = ifd.xpath('Description').text.chomp return true end |
#netdev_resxml_create_top(xml) ⇒ Object
29 30 31 32 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 29 def netdev_resxml_create_top( xml ) xml.VsiName resource[:vsiname] xml.Description resource[:description] if resource[:description] end |
#netdev_resxml_delete(xml) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 40 def netdev_resxml_delete( xml ) if mod = xml.doc.at('VSI') mod['xc:operation'] = 'delete' end xml.VsiName resource[:vsiname] end |
#netdev_resxml_top(xml) ⇒ Object
override the method
35 36 37 38 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 35 def netdev_resxml_top( xml ) xml.VsiName resource[:vsiname] return xml end |
#xml_change_description(xml) ⇒ Object
XML builder methods
55 56 57 |
# File 'lib/puppet/provider/comware/comware_vsi.rb', line 55 def xml_change_description( xml ) xml.send(:'Description', resource[:description]) end |