net-netconf 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/netconf/jnpr/ioproc.rb +1 -1
- data/lib/net/netconf/jnpr/junos_config.rb +22 -24
- data/lib/net/netconf/jnpr/rpc.rb +4 -3
- data/lib/net/netconf/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53effcba8e5c743c307614f8844e07b1c811547d
|
4
|
+
data.tar.gz: e667da4cb15637e7d7af810a3a57790bc29257e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4abcdb45b1284a982f92e84754b036a5ded782496ebffebb91dcbb5d559d3e50a8de354ec42f9e41044dddffb87ff23c251954d2febe3cdf2e780cee444ab24f
|
7
|
+
data.tar.gz: f3c2c7382f5cc0f02ebda694d07e05c86039191d0d1454bd51062f1133e865b3f4ee1b457aa81075099773d4f5b6c4b3f6d171571444afbf30daf3fc5f98e7c3
|
@@ -5,26 +5,24 @@
|
|
5
5
|
# JUNIPER PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
6
6
|
|
7
7
|
module Netconf
|
8
|
-
|
9
8
|
class JunosConfig
|
10
|
-
|
11
|
-
|
12
|
-
REPLACE = { :replace => 'replace' }
|
9
|
+
DELETE = { delete: 'delete' }
|
10
|
+
REPLACE = { replace: 'replace' }
|
13
11
|
|
14
12
|
attr_reader :doc
|
15
13
|
attr_reader :collection
|
16
14
|
|
17
|
-
def initialize(
|
18
|
-
@doc_ele =
|
15
|
+
def initialize(options)
|
16
|
+
@doc_ele = 'configuration'
|
19
17
|
|
20
18
|
if options == :TOP
|
21
|
-
@doc = Nokogiri::XML(
|
19
|
+
@doc = Nokogiri::XML('<#{@doc_ele}/>')
|
22
20
|
return
|
23
21
|
end
|
24
22
|
|
25
23
|
unless options[:TOP].nil?
|
26
24
|
@doc_ele = options[:TOP]
|
27
|
-
@doc = Nokogiri::XML(
|
25
|
+
@doc = Nokogiri::XML('<#{@doc_ele}/>')
|
28
26
|
return
|
29
27
|
end
|
30
28
|
|
@@ -37,27 +35,27 @@ module Netconf
|
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
|
-
def <<(
|
38
|
+
def <<(obj)
|
41
39
|
if defined? @collection
|
42
40
|
@collection[obj[:name]] = obj
|
43
41
|
elsif defined? @doc
|
44
|
-
obj.build_xml(
|
42
|
+
obj.build_xml(@doc)
|
45
43
|
else
|
46
44
|
# TBD:error
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
|
-
def build_xml(
|
51
|
-
at_ele = ng_xml.at(
|
48
|
+
def build_xml(ng_xml, &block)
|
49
|
+
at_ele = ng_xml.at(@edit_path)
|
52
50
|
if at_ele.nil?
|
53
51
|
# no xpath anchor point, so we need to create it
|
54
|
-
at_ele = edit_path(
|
52
|
+
at_ele = edit_path(ng_xml, @edit_path)
|
55
53
|
end
|
56
54
|
build_proc = (block_given?) ? block : @to_xml
|
57
55
|
|
58
|
-
@collection.each do |
|
59
|
-
with(
|
60
|
-
build_proc.call(
|
56
|
+
@collection.each do |_k, v|
|
57
|
+
with(at_ele) do |e|
|
58
|
+
build_proc.call(e, v)
|
61
59
|
end
|
62
60
|
end
|
63
61
|
end
|
@@ -68,7 +66,7 @@ module Netconf
|
|
68
66
|
# the user enter it all the time
|
69
67
|
|
70
68
|
cfg_xpath = xpath
|
71
|
-
dot = ng_xml.at(
|
69
|
+
dot = ng_xml.at(cfg_xpath)
|
72
70
|
return dot if dot
|
73
71
|
|
74
72
|
# we need to determine how much of the xpath
|
@@ -78,7 +76,7 @@ module Netconf
|
|
78
76
|
|
79
77
|
xpath_a = cfg_xpath.split('/')
|
80
78
|
need_a = []
|
81
|
-
until xpath_a.empty?
|
79
|
+
until xpath_a.empty? || dot
|
82
80
|
need_a.unshift xpath_a.pop
|
83
81
|
check_xpath = xpath_a.join('/')
|
84
82
|
dot = ng_xml.at( check_xpath )
|
@@ -90,15 +88,15 @@ module Netconf
|
|
90
88
|
|
91
89
|
dot = ng_xml.at(xpath_a.join('/'))
|
92
90
|
need_a.each do |ele|
|
93
|
-
dot = dot.add_child(
|
91
|
+
dot = dot.add_child(Nokogiri::XML::Node.new(ele, ng_xml))
|
94
92
|
end
|
95
|
-
|
93
|
+
|
94
|
+
dot
|
96
95
|
end
|
97
96
|
|
98
|
-
def with(
|
99
|
-
Nokogiri::XML::Builder.with(
|
97
|
+
def with(ng_xml, &block)
|
98
|
+
Nokogiri::XML::Builder.with(ng_xml, &block)
|
100
99
|
end
|
101
100
|
end
|
102
|
-
|
101
|
+
#-- class end
|
103
102
|
end
|
104
|
-
|
data/lib/net/netconf/jnpr/rpc.rb
CHANGED
data/lib/net/netconf/version.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-netconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Kirsche
|
8
|
+
- Jeremy Schulman
|
9
|
+
- Ankit Jain
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|