netconf 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmUzYzM2NDEyMGJjMzE0NDljYmYzNjIxOGE0ZTE5YWNiMDg0ZDNmMQ==
4
+ MTQ4MDNlZWZjODQ4ODM5ZTY4YWI3Y2RlMzVkYmE3MWQyNGI4MjI0Mg==
5
5
  data.tar.gz: !binary |-
6
- MjRiMTk0ZWJkMWUyZjRkNTFlNDJhZDBhMjU1M2I5NDI5MTgwODZiMg==
6
+ NWE2M2Y1YWM0MGZmNWQ0Zjg0MTY3NTRmNjBlYWEwMmNkYmU1ZDEwMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Njg1NzU5NDZhY2ZiYWZkMGRmYTdjOTRjZWE1OWFjNmRhMzI0NjY4MzRjMzBl
10
- NGQ0YWVmNWI0NjA0ZDU2ODY1OWI1NjQ0ZWJiNjhjM2MyMDg2ZjJmMjE5NWIy
11
- ZDEzZGI0NzI1ZmM2NTZkNzhhNjlhNDI0NzhmY2NmNmI1NDk4ZGU=
9
+ MTg0YjRmY2VlNzkzMWU5ODliYzQ1NjI4NGVkNjZkZTcxYzY1MWQ3OWI3N2Q2
10
+ MDlhNTQ2NDA0YmVmMDA3ZWNmM2UwMDUzZGVhYmYyMGY2ZmIzN2UzN2E4NTVj
11
+ NzcwZDQ3NDEyYTgzNWFkMzVjOGE3MGJhZGU5MTA3MzNjNDhkY2Q=
12
12
  data.tar.gz: !binary |-
13
- MGNhYjE4NzdmOGFlMGJjNTI4YTZkNjYyMWNlOWZmZTBjNTZiNzM1ZTkyNjIw
14
- YjYxMTVmMmExYzBkNTJkODg3MzFiMTU3ZmZhYWM5YmRhZWNjYzc1OWY1ODY5
15
- MWNmZjdlNTAzNDBmNWVlMTAxM2RkMTliYjQ4OWU2NDQ4Y2IwNmE=
13
+ YWM1YjFlZjNjZWY3ODUwNjNhYTRjZWIwZjUzMWJmMGJiYzk0NjYxZTM0MWRm
14
+ NzdmZmYyZjg1ZGY4YTQ5ZjVlMmQ1MGIyZTFjZGM1MGRmNDM2OWU4Y2FmZDYx
15
+ MjM1M2JiNGFjOTEwMmM5NzZmMjkyZDI4MjdjNzNmMjZhYTNlZjA=
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ require 'net/netconf'
2
+ require 'net/netconf/jnpr'
3
+
4
+ module Netconf
5
+ module Junos
6
+ module TransSSH
7
+
8
+ ##
9
+ ## this is used to handle the case where NETCONF (port 830) is disabled. We can still access
10
+ ## the NETCONF subsystem from the CLI using a hidden command 'netconf'
11
+ ##
12
+
13
+ def trans_on_connect_refused( start_args )
14
+ start_args[:port] = 22
15
+ @trans[:conn] = Net::SSH.start( @args[:target], @args[:username], start_args )
16
+ do_once = true
17
+ @trans[:conn].exec( NETCONF_CLI ) do |chan, success|
18
+ @trans[:chan] = chan
19
+ do_once = false
20
+ end
21
+ @trans[:conn].loop { do_once }
22
+ @trans[:chan]
23
+ end
24
+
25
+ end
26
+ end
27
+ end
File without changes
File without changes
File without changes
File without changes
@@ -8,8 +8,16 @@ module Netconf
8
8
 
9
9
  def initialize( args_h, &block )
10
10
  @args = args_h.clone
11
- @trans = Hash.new
11
+ @args[:os_type] = args_h[:os_type] || Netconf::DEFAULT_OS_TYPE
12
+
13
+ # extend this instance with the capabilities of the specific os_type
14
+ begin
15
+ extend Netconf::const_get( @args[:os_type] )::TransSSH
16
+ rescue NameError
17
+ # no extensions available ...
18
+ end
12
19
 
20
+ @trans = Hash.new
13
21
  super( &block )
14
22
  end
15
23
 
@@ -20,9 +28,17 @@ module Netconf
20
28
  start_args[:passphrase] = @args[:passphrase] || nil
21
29
  start_args[:port] = @args[:port] || NETCONF_PORT
22
30
  start_args.merge!(@args[:ssh_args]) if @args[:ssh_args]
23
-
24
- @trans[:conn] = Net::SSH.start( @args[:target], @args[:username], start_args )
25
- @trans[:chan] = @trans[:conn].open_channel{ |ch| ch.subsystem( NETCONF_SUBSYSTEM ) }
31
+
32
+ begin
33
+ @trans[:conn] = Net::SSH.start( @args[:target], @args[:username], start_args )
34
+ @trans[:chan] = @trans[:conn].open_channel{ |ch| ch.subsystem( NETCONF_SUBSYSTEM ) }
35
+ rescue Errno::ECONNREFUSED => e
36
+ if self.respond_to? 'trans_on_connect_refused'
37
+ return trans_on_connect_refused( start_args )
38
+ end
39
+ return nil
40
+ end
41
+ @trans[:chan]
26
42
  end
27
43
 
28
44
  def trans_close
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Netconf
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Schulman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-24 00:00:00.000000000 Z
12
+ date: 2013-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -45,50 +45,51 @@ dependencies:
45
45
  requirements:
46
46
  - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.1
48
+ version: '0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.1.1
55
+ version: '0'
56
56
  description: Extensible Ruby-based NETCONF client
57
57
  email: jschulman@juniper.net
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - lib/net/netconf/exception.rb
62
+ - lib/net/netconf.rb
63
63
  - lib/net/netconf/ioproc.rb
64
+ - lib/net/netconf/transport.rb
65
+ - lib/net/netconf/exception.rb
64
66
  - lib/net/netconf/jnpr/ioproc.rb
65
- - lib/net/netconf/jnpr/junos_config.rb
67
+ - lib/net/netconf/jnpr/telnet.rb
66
68
  - lib/net/netconf/jnpr/rpc.rb
67
69
  - lib/net/netconf/jnpr/serial.rb
68
- - lib/net/netconf/jnpr/telnet.rb
69
- - lib/net/netconf/jnpr.rb
70
+ - lib/net/netconf/jnpr/junos_config.rb
71
+ - lib/net/netconf/jnpr/ssh.rb
72
+ - lib/net/netconf/version.rb
73
+ - lib/net/netconf/telnet.rb
70
74
  - lib/net/netconf/rpc.rb
71
75
  - lib/net/netconf/rpc_std.rb
76
+ - lib/net/netconf/jnpr.rb
72
77
  - lib/net/netconf/serial.rb
73
78
  - lib/net/netconf/ssh.rb
74
- - lib/net/netconf/telnet.rb
75
- - lib/net/netconf/transport.rb
76
- - lib/net/netconf/version.rb
77
- - lib/net/netconf.rb
78
- - examples/confd/get-running.rb
79
79
  - examples/jnpr/edit-config-jnpr-set.rb
80
- - examples/jnpr/edit-config-jnpr-text.rb
81
- - examples/jnpr/edit-config-jnpr.rb
82
- - examples/jnpr/edit-config-std.rb
83
- - examples/jnpr/edit-config-text-std.rb
84
- - examples/jnpr/get-config-jnpr.rb
85
- - examples/jnpr/get-config-matching.rb
86
- - examples/jnpr/get-config-std.rb
87
- - examples/jnpr/get-inventory-serial-explicit.rb
88
80
  - examples/jnpr/get-inventory-serial.rb
89
- - examples/jnpr/get-inventory-telnet.rb
81
+ - examples/jnpr/get-config-matching.rb
90
82
  - examples/jnpr/get-inventory.rb
83
+ - examples/jnpr/get-config-std.rb
91
84
  - examples/jnpr/scp.rb
85
+ - examples/jnpr/get-config-jnpr.rb
86
+ - examples/jnpr/edit-config-std.rb
87
+ - examples/jnpr/edit-config-text-std.rb
88
+ - examples/jnpr/edit-config-jnpr.rb
89
+ - examples/jnpr/get-inventory-telnet.rb
90
+ - examples/jnpr/get-inventory-serial-explicit.rb
91
+ - examples/jnpr/edit-config-jnpr-text.rb
92
+ - examples/confd/get-running.rb
92
93
  homepage: https://github.com/Juniper/net-netconf
93
94
  licenses: []
94
95
  metadata: {}
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  version: '0'
109
110
  requirements: []
110
111
  rubyforge_project:
111
- rubygems_version: 2.0.4
112
+ rubygems_version: 2.0.3
112
113
  signing_key:
113
114
  specification_version: 4
114
115
  summary: NETCONF client