netconf 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/examples/confd/get-running.rb +27 -27
- data/examples/jnpr/edit-config-jnpr-set.rb +55 -55
- data/examples/jnpr/edit-config-jnpr-text.rb +64 -64
- data/examples/jnpr/edit-config-jnpr.rb +73 -73
- data/examples/jnpr/edit-config-std.rb +64 -64
- data/examples/jnpr/edit-config-text-std.rb +68 -68
- data/examples/jnpr/get-config-jnpr.rb +62 -62
- data/examples/jnpr/get-config-matching.rb +20 -20
- data/examples/jnpr/get-config-std.rb +49 -49
- data/examples/jnpr/get-inventory-serial-explicit.rb +27 -27
- data/examples/jnpr/get-inventory-serial.rb +25 -25
- data/examples/jnpr/get-inventory-telnet.rb +14 -14
- data/examples/jnpr/get-inventory.rb +16 -16
- data/examples/jnpr/scp.rb +22 -22
- data/lib/net/netconf.rb +11 -1
- data/lib/net/netconf/exception.rb +38 -38
- data/lib/net/netconf/ioproc.rb +88 -88
- data/lib/net/netconf/jnpr.rb +9 -9
- data/lib/net/netconf/jnpr/ioproc.rb +14 -14
- data/lib/net/netconf/jnpr/rpc.rb +162 -140
- data/lib/net/netconf/jnpr/serial.rb +15 -15
- data/lib/net/netconf/jnpr/telnet.rb +23 -23
- data/lib/net/netconf/rpc.rb +71 -71
- data/lib/net/netconf/rpc_std.rb +133 -134
- data/lib/net/netconf/serial.rb +135 -135
- data/lib/net/netconf/ssh.rb +78 -77
- data/lib/net/netconf/telnet.rb +52 -52
- data/lib/net/netconf/transport.rb +28 -5
- data/lib/net/netconf/version.rb +3 -0
- metadata +21 -12
@@ -1,64 +1,64 @@
|
|
1
|
-
require 'net/netconf'
|
2
|
-
|
3
|
-
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
-
|
5
|
-
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
-
|
7
|
-
new_host_name = "vsrx-abc"
|
8
|
-
|
9
|
-
puts "Connecting to device: #{login[:target]}"
|
10
|
-
|
11
|
-
Netconf::SSH.new( login ){ |dev|
|
12
|
-
puts "Connected!"
|
13
|
-
|
14
|
-
target = 'candidate'
|
15
|
-
|
16
|
-
location = Nokogiri::XML::Builder.new{ |x| x.configuration {
|
17
|
-
x.system {
|
18
|
-
x.location {
|
19
|
-
x.building "Main Campus, A"
|
20
|
-
x.floor 5
|
21
|
-
x.rack 27
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}}
|
25
|
-
|
26
|
-
begin
|
27
|
-
|
28
|
-
rsp = dev.rpc.lock target
|
29
|
-
|
30
|
-
# --------------------------------------------------------------------
|
31
|
-
# configuration as BLOCK
|
32
|
-
|
33
|
-
rsp = dev.rpc.edit_config{ |x| x.configuration {
|
34
|
-
x.system {
|
35
|
-
x.send(:'host-name', new_host_name )
|
36
|
-
}
|
37
|
-
}}
|
38
|
-
|
39
|
-
# --------------------------------------------------------------------
|
40
|
-
# configuration as PARAM
|
41
|
-
|
42
|
-
rsp = dev.rpc.edit_config( location )
|
43
|
-
|
44
|
-
rsp = dev.rpc.validate target
|
45
|
-
rpc = dev.rpc.commit
|
46
|
-
rpc = dev.rpc.unlock target
|
47
|
-
|
48
|
-
rescue Netconf::LockError => e
|
49
|
-
puts "Lock error"
|
50
|
-
rescue Netconf::EditError => e
|
51
|
-
puts "Edit error"
|
52
|
-
rescue Netconf::ValidateError => e
|
53
|
-
puts "Validate error"
|
54
|
-
rescue Netconf::CommitError => e
|
55
|
-
puts "Commit error"
|
56
|
-
rescue Netconf::RpcError => e
|
57
|
-
puts "General RPC error"
|
58
|
-
else
|
59
|
-
puts "Configuration Committed."
|
60
|
-
end
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
|
1
|
+
require 'net/netconf'
|
2
|
+
|
3
|
+
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
+
|
5
|
+
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
+
|
7
|
+
new_host_name = "vsrx-abc"
|
8
|
+
|
9
|
+
puts "Connecting to device: #{login[:target]}"
|
10
|
+
|
11
|
+
Netconf::SSH.new( login ){ |dev|
|
12
|
+
puts "Connected!"
|
13
|
+
|
14
|
+
target = 'candidate'
|
15
|
+
|
16
|
+
location = Nokogiri::XML::Builder.new{ |x| x.configuration {
|
17
|
+
x.system {
|
18
|
+
x.location {
|
19
|
+
x.building "Main Campus, A"
|
20
|
+
x.floor 5
|
21
|
+
x.rack 27
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}}
|
25
|
+
|
26
|
+
begin
|
27
|
+
|
28
|
+
rsp = dev.rpc.lock target
|
29
|
+
|
30
|
+
# --------------------------------------------------------------------
|
31
|
+
# configuration as BLOCK
|
32
|
+
|
33
|
+
rsp = dev.rpc.edit_config{ |x| x.configuration {
|
34
|
+
x.system {
|
35
|
+
x.send(:'host-name', new_host_name )
|
36
|
+
}
|
37
|
+
}}
|
38
|
+
|
39
|
+
# --------------------------------------------------------------------
|
40
|
+
# configuration as PARAM
|
41
|
+
|
42
|
+
rsp = dev.rpc.edit_config( location )
|
43
|
+
|
44
|
+
rsp = dev.rpc.validate target
|
45
|
+
rpc = dev.rpc.commit
|
46
|
+
rpc = dev.rpc.unlock target
|
47
|
+
|
48
|
+
rescue Netconf::LockError => e
|
49
|
+
puts "Lock error"
|
50
|
+
rescue Netconf::EditError => e
|
51
|
+
puts "Edit error"
|
52
|
+
rescue Netconf::ValidateError => e
|
53
|
+
puts "Validate error"
|
54
|
+
rescue Netconf::CommitError => e
|
55
|
+
puts "Commit error"
|
56
|
+
rescue Netconf::RpcError => e
|
57
|
+
puts "General RPC error"
|
58
|
+
else
|
59
|
+
puts "Configuration Committed."
|
60
|
+
end
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
@@ -1,68 +1,68 @@
|
|
1
|
-
require 'net/netconf'
|
2
|
-
|
3
|
-
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
-
|
5
|
-
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
-
|
7
|
-
new_host_name = "vsrx"
|
8
|
-
|
9
|
-
puts "Connecting to device: #{login[:target]}"
|
10
|
-
|
11
|
-
Netconf::SSH.new( login ){ |dev|
|
12
|
-
puts "Connected!"
|
13
|
-
|
14
|
-
target = 'candidate'
|
15
|
-
|
16
|
-
location = Nokogiri::XML::Builder.new{ |x| x.send(:'configuration-text', <<-EOCONF
|
17
|
-
system {
|
18
|
-
location {
|
19
|
-
building "Main Campus, ABC123"
|
20
|
-
floor 5
|
21
|
-
rack 27
|
22
|
-
}
|
23
|
-
}
|
24
|
-
EOCONF
|
25
|
-
)}
|
26
|
-
|
27
|
-
|
28
|
-
begin
|
29
|
-
|
30
|
-
rsp = dev.rpc.lock target
|
31
|
-
|
32
|
-
# --------------------------------------------------------------------
|
33
|
-
# configuration as BLOCK
|
34
|
-
|
35
|
-
rsp = dev.rpc.edit_config(:toplevel => 'config-text'){
|
36
|
-
|x| x.send(:'configuration-text', <<EOCONF
|
37
|
-
system {
|
38
|
-
host-name #{new_host_name};
|
39
|
-
}
|
40
|
-
EOCONF
|
41
|
-
)}
|
42
|
-
|
43
|
-
# --------------------------------------------------------------------
|
44
|
-
# configuration as PARAM
|
45
|
-
|
46
|
-
rsp = dev.rpc.edit_config( location, :toplevel => 'config-text' )
|
47
|
-
|
48
|
-
rsp = dev.rpc.validate target
|
49
|
-
rpc = dev.rpc.commit
|
50
|
-
rpc = dev.rpc.unlock target
|
51
|
-
|
52
|
-
rescue Netconf::LockError => e
|
53
|
-
puts "Lock error"
|
54
|
-
rescue Netconf::EditError => e
|
55
|
-
puts "Edit error"
|
56
|
-
rescue Netconf::ValidateError => e
|
57
|
-
puts "Validate error"
|
58
|
-
rescue Netconf::CommitError => e
|
59
|
-
puts "Commit error"
|
60
|
-
rescue Netconf::RpcError => e
|
61
|
-
puts "General RPC error"
|
62
|
-
else
|
63
|
-
puts "Configuration Committed."
|
64
|
-
end
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
|
-
|
1
|
+
require 'net/netconf'
|
2
|
+
|
3
|
+
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
+
|
5
|
+
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
+
|
7
|
+
new_host_name = "vsrx"
|
8
|
+
|
9
|
+
puts "Connecting to device: #{login[:target]}"
|
10
|
+
|
11
|
+
Netconf::SSH.new( login ){ |dev|
|
12
|
+
puts "Connected!"
|
13
|
+
|
14
|
+
target = 'candidate'
|
15
|
+
|
16
|
+
location = Nokogiri::XML::Builder.new{ |x| x.send(:'configuration-text', <<-EOCONF
|
17
|
+
system {
|
18
|
+
location {
|
19
|
+
building "Main Campus, ABC123"
|
20
|
+
floor 5
|
21
|
+
rack 27
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOCONF
|
25
|
+
)}
|
26
|
+
|
27
|
+
|
28
|
+
begin
|
29
|
+
|
30
|
+
rsp = dev.rpc.lock target
|
31
|
+
|
32
|
+
# --------------------------------------------------------------------
|
33
|
+
# configuration as BLOCK
|
34
|
+
|
35
|
+
rsp = dev.rpc.edit_config(:toplevel => 'config-text'){
|
36
|
+
|x| x.send(:'configuration-text', <<EOCONF
|
37
|
+
system {
|
38
|
+
host-name #{new_host_name};
|
39
|
+
}
|
40
|
+
EOCONF
|
41
|
+
)}
|
42
|
+
|
43
|
+
# --------------------------------------------------------------------
|
44
|
+
# configuration as PARAM
|
45
|
+
|
46
|
+
rsp = dev.rpc.edit_config( location, :toplevel => 'config-text' )
|
47
|
+
|
48
|
+
rsp = dev.rpc.validate target
|
49
|
+
rpc = dev.rpc.commit
|
50
|
+
rpc = dev.rpc.unlock target
|
51
|
+
|
52
|
+
rescue Netconf::LockError => e
|
53
|
+
puts "Lock error"
|
54
|
+
rescue Netconf::EditError => e
|
55
|
+
puts "Edit error"
|
56
|
+
rescue Netconf::ValidateError => e
|
57
|
+
puts "Validate error"
|
58
|
+
rescue Netconf::CommitError => e
|
59
|
+
puts "Commit error"
|
60
|
+
rescue Netconf::RpcError => e
|
61
|
+
puts "General RPC error"
|
62
|
+
else
|
63
|
+
puts "Configuration Committed."
|
64
|
+
end
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
|
@@ -1,62 +1,62 @@
|
|
1
|
-
require 'net/netconf/jnpr' # note: including Juniper specific extension
|
2
|
-
|
3
|
-
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
-
|
5
|
-
login = { :target => 'ex4', :username => "jeremy", :password => "jeremy1" }
|
6
|
-
|
7
|
-
puts "Connecting to device: #{login[:target]}"
|
8
|
-
|
9
|
-
Netconf::SSH.new( login ){ |dev|
|
10
|
-
puts "Connected."
|
11
|
-
|
12
|
-
puts "Retrieving full config, please wait ... "
|
13
|
-
cfgall = dev.rpc.get_configuration # Junos specific RPC
|
14
|
-
puts "Showing 'system' hierarchy ..."
|
15
|
-
puts cfgall.xpath('system') # Root is <configuration>, so don't need to include it in XPath
|
16
|
-
|
17
|
-
# ----------------------------------------------------------------------
|
18
|
-
# specifying a filter as a block to get_configuration
|
19
|
-
# Junos extension does the proper toplevel wrapping
|
20
|
-
|
21
|
-
puts "Retrieved services from BLOCK, as XML:"
|
22
|
-
|
23
|
-
cfgsvc1_1 = dev.rpc.get_configuration{ |x|
|
24
|
-
x.system { x.services }
|
25
|
-
x.system { x.login }
|
26
|
-
}
|
27
|
-
|
28
|
-
cfgsvc1_1.xpath('system/services/*').each{|s| puts s.name }
|
29
|
-
|
30
|
-
puts "Retrieved services from BLOCK, as TEXT:"
|
31
|
-
|
32
|
-
cfgsvc1_2 = dev.rpc.get_configuration( :format => 'text' ){ |x|
|
33
|
-
x.system { x.services }
|
34
|
-
}
|
35
|
-
|
36
|
-
puts cfgsvc1_2.text
|
37
|
-
|
38
|
-
# ----------------------------------------------------------------------
|
39
|
-
# specifying a filter as a parameter to get_configuration
|
40
|
-
# you must wrap the config in a toplevel <configuration> element
|
41
|
-
|
42
|
-
filter = Nokogiri::XML::Builder.new{ |x| x.configuration {
|
43
|
-
x.system { x.services }
|
44
|
-
x.system { x.login }
|
45
|
-
}}
|
46
|
-
|
47
|
-
puts "Retrieved services by PARAM, as XML"
|
48
|
-
|
49
|
-
cfgsvc2 = dev.rpc.get_configuration( filter )
|
50
|
-
cfgsvc2.xpath('system/services/*').each{|s| puts s.name }
|
51
|
-
|
52
|
-
# ----------------------------------------------------------------------
|
53
|
-
# specifying a filter as a parameter to get_configuration,
|
54
|
-
# get response back in "text" format
|
55
|
-
|
56
|
-
puts "Retrieved services by PARAM, as TEXT:"
|
57
|
-
cfgsvc3 = dev.rpc.get_configuration( filter, :format => 'text' )
|
58
|
-
puts cfgsvc3.text
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
|
1
|
+
require 'net/netconf/jnpr' # note: including Juniper specific extension
|
2
|
+
|
3
|
+
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
+
|
5
|
+
login = { :target => 'ex4', :username => "jeremy", :password => "jeremy1" }
|
6
|
+
|
7
|
+
puts "Connecting to device: #{login[:target]}"
|
8
|
+
|
9
|
+
Netconf::SSH.new( login ){ |dev|
|
10
|
+
puts "Connected."
|
11
|
+
|
12
|
+
puts "Retrieving full config, please wait ... "
|
13
|
+
cfgall = dev.rpc.get_configuration # Junos specific RPC
|
14
|
+
puts "Showing 'system' hierarchy ..."
|
15
|
+
puts cfgall.xpath('system') # Root is <configuration>, so don't need to include it in XPath
|
16
|
+
|
17
|
+
# ----------------------------------------------------------------------
|
18
|
+
# specifying a filter as a block to get_configuration
|
19
|
+
# Junos extension does the proper toplevel wrapping
|
20
|
+
|
21
|
+
puts "Retrieved services from BLOCK, as XML:"
|
22
|
+
|
23
|
+
cfgsvc1_1 = dev.rpc.get_configuration{ |x|
|
24
|
+
x.system { x.services }
|
25
|
+
x.system { x.login }
|
26
|
+
}
|
27
|
+
|
28
|
+
cfgsvc1_1.xpath('system/services/*').each{|s| puts s.name }
|
29
|
+
|
30
|
+
puts "Retrieved services from BLOCK, as TEXT:"
|
31
|
+
|
32
|
+
cfgsvc1_2 = dev.rpc.get_configuration( :format => 'text' ){ |x|
|
33
|
+
x.system { x.services }
|
34
|
+
}
|
35
|
+
|
36
|
+
puts cfgsvc1_2.text
|
37
|
+
|
38
|
+
# ----------------------------------------------------------------------
|
39
|
+
# specifying a filter as a parameter to get_configuration
|
40
|
+
# you must wrap the config in a toplevel <configuration> element
|
41
|
+
|
42
|
+
filter = Nokogiri::XML::Builder.new{ |x| x.configuration {
|
43
|
+
x.system { x.services }
|
44
|
+
x.system { x.login }
|
45
|
+
}}
|
46
|
+
|
47
|
+
puts "Retrieved services by PARAM, as XML"
|
48
|
+
|
49
|
+
cfgsvc2 = dev.rpc.get_configuration( filter )
|
50
|
+
cfgsvc2.xpath('system/services/*').each{|s| puts s.name }
|
51
|
+
|
52
|
+
# ----------------------------------------------------------------------
|
53
|
+
# specifying a filter as a parameter to get_configuration,
|
54
|
+
# get response back in "text" format
|
55
|
+
|
56
|
+
puts "Retrieved services by PARAM, as TEXT:"
|
57
|
+
cfgsvc3 = dev.rpc.get_configuration( filter, :format => 'text' )
|
58
|
+
puts cfgsvc3.text
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require 'net/netconf/jnpr'
|
2
|
-
|
3
|
-
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
-
|
5
|
-
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
-
|
7
|
-
Netconf::SSH.new( login ){ |dev|
|
8
|
-
|
9
|
-
configs = dev.rpc.get_configuration{ |x|
|
10
|
-
x.interfaces( :matching => 'interface[name="ge-*"]' )
|
11
|
-
}
|
12
|
-
|
13
|
-
ge_cfgs = configs.xpath('interfaces/interface')
|
14
|
-
|
15
|
-
puts "There are #{ge_cfgs.count} GE interfaces:"
|
16
|
-
ge_cfgs.each{|ifd|
|
17
|
-
units = ifd.xpath('unit').count
|
18
|
-
puts " " + ifd.xpath('name')[0].text + " with #{units} unit" + ((units>1) ? "s" : '')
|
19
|
-
}
|
20
|
-
}
|
1
|
+
require 'net/netconf/jnpr'
|
2
|
+
|
3
|
+
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
+
|
5
|
+
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
+
|
7
|
+
Netconf::SSH.new( login ){ |dev|
|
8
|
+
|
9
|
+
configs = dev.rpc.get_configuration{ |x|
|
10
|
+
x.interfaces( :matching => 'interface[name="ge-*"]' )
|
11
|
+
}
|
12
|
+
|
13
|
+
ge_cfgs = configs.xpath('interfaces/interface')
|
14
|
+
|
15
|
+
puts "There are #{ge_cfgs.count} GE interfaces:"
|
16
|
+
ge_cfgs.each{|ifd|
|
17
|
+
units = ifd.xpath('unit').count
|
18
|
+
puts " " + ifd.xpath('name')[0].text + " with #{units} unit" + ((units>1) ? "s" : '')
|
19
|
+
}
|
20
|
+
}
|
@@ -1,49 +1,49 @@
|
|
1
|
-
require 'net/netconf'
|
2
|
-
|
3
|
-
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
-
|
5
|
-
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
-
|
7
|
-
puts "Connecting to device: #{login[:target]}"
|
8
|
-
|
9
|
-
Netconf::SSH.new( login ){ |dev|
|
10
|
-
puts "Connected."
|
11
|
-
|
12
|
-
# ----------------------------------------------------------------------
|
13
|
-
# retrieve the full config. Default source is 'running'
|
14
|
-
# Alternatively you can pass the source name as a string parameter
|
15
|
-
# to #get_config
|
16
|
-
|
17
|
-
puts "Retrieving full config, please wait ... "
|
18
|
-
cfgall = dev.rpc.get_config
|
19
|
-
puts "Showing 'system' hierarchy ..."
|
20
|
-
puts cfgall.xpath('configuration/system') # JUNOS toplevel config element is <configuration>
|
21
|
-
|
22
|
-
# ----------------------------------------------------------------------
|
23
|
-
# specifying a filter as a block to get_config
|
24
|
-
|
25
|
-
cfgsvc1 = dev.rpc.get_config{ |x|
|
26
|
-
x.configuration { x.system { x.services }}
|
27
|
-
}
|
28
|
-
|
29
|
-
puts "Retrieved services as BLOCK:"
|
30
|
-
cfgsvc1.xpath('//services/*').each{|s| puts s.name }
|
31
|
-
|
32
|
-
# ----------------------------------------------------------------------
|
33
|
-
# specifying a filter as a parameter to get_config
|
34
|
-
|
35
|
-
filter = Nokogiri::XML::Builder.new{ |x|
|
36
|
-
x.configuration { x.system { x.services }}
|
37
|
-
}
|
38
|
-
|
39
|
-
cfgsvc2 = dev.rpc.get_config( filter )
|
40
|
-
puts "Retrieved services as PARAM:"
|
41
|
-
cfgsvc2.xpath('//services/*').each{|s| puts s.name }
|
42
|
-
|
43
|
-
cfgsvc3 = dev.rpc.get_config( filter )
|
44
|
-
puts "Retrieved services as PARAM, re-used filter"
|
45
|
-
cfgsvc3.xpath('//services/*').each{|s| puts s.name }
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
require 'net/netconf'
|
2
|
+
|
3
|
+
puts "NETCONF v.#{Netconf::VERSION}"
|
4
|
+
|
5
|
+
login = { :target => 'vsrx', :username => "jeremy", :password => "jeremy1" }
|
6
|
+
|
7
|
+
puts "Connecting to device: #{login[:target]}"
|
8
|
+
|
9
|
+
Netconf::SSH.new( login ){ |dev|
|
10
|
+
puts "Connected."
|
11
|
+
|
12
|
+
# ----------------------------------------------------------------------
|
13
|
+
# retrieve the full config. Default source is 'running'
|
14
|
+
# Alternatively you can pass the source name as a string parameter
|
15
|
+
# to #get_config
|
16
|
+
|
17
|
+
puts "Retrieving full config, please wait ... "
|
18
|
+
cfgall = dev.rpc.get_config
|
19
|
+
puts "Showing 'system' hierarchy ..."
|
20
|
+
puts cfgall.xpath('configuration/system') # JUNOS toplevel config element is <configuration>
|
21
|
+
|
22
|
+
# ----------------------------------------------------------------------
|
23
|
+
# specifying a filter as a block to get_config
|
24
|
+
|
25
|
+
cfgsvc1 = dev.rpc.get_config{ |x|
|
26
|
+
x.configuration { x.system { x.services }}
|
27
|
+
}
|
28
|
+
|
29
|
+
puts "Retrieved services as BLOCK:"
|
30
|
+
cfgsvc1.xpath('//services/*').each{|s| puts s.name }
|
31
|
+
|
32
|
+
# ----------------------------------------------------------------------
|
33
|
+
# specifying a filter as a parameter to get_config
|
34
|
+
|
35
|
+
filter = Nokogiri::XML::Builder.new{ |x|
|
36
|
+
x.configuration { x.system { x.services }}
|
37
|
+
}
|
38
|
+
|
39
|
+
cfgsvc2 = dev.rpc.get_config( filter )
|
40
|
+
puts "Retrieved services as PARAM:"
|
41
|
+
cfgsvc2.xpath('//services/*').each{|s| puts s.name }
|
42
|
+
|
43
|
+
cfgsvc3 = dev.rpc.get_config( filter )
|
44
|
+
puts "Retrieved services as PARAM, re-used filter"
|
45
|
+
cfgsvc3.xpath('//services/*').each{|s| puts s.name }
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
|