58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/puppet/provider/ce/api/interface/interface_api.rb', line 58
def set_interface(resource)
session = Puppet::NetDev::CE::Device.session
set_interface_xml = '<rpc><edit-config><target><running/></target><default-operation>merge</default-operation><error-option>rollback-on-error</error-option><config><ifm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0"><interfaces><interface operation="merge"><ifName>' + (resource[:name]).to_s + '</ifName>'
if resource[:description]
set_interface_xml += '<ifDescr>' + (resource[:description]).to_s + '</ifDescr>'
end
if resource[:enable] == :true
set_interface_xml += '<ifAdminStatus>up</ifAdminStatus>'
end
if resource[:enable] == :false
set_interface_xml += '<ifAdminStatus>down</ifAdminStatus>'
end
set_interface_xml += '</interface></interfaces></ifm></config></edit-config></rpc>'
session.rpc.do_config(set_interface_xml)
end
|