Class: NetconfNode

Inherits:
Node
  • Object
show all
Defined in:
lib/controller/netconf_node.rb

Overview

Class that represents a NetconfNode

Direct Known Subclasses

VRouter5600

Instance Attribute Summary collapse

Attributes inherited from Node

#name

Instance Method Summary collapse

Constructor Details

#initialize(controller: nil, name: nil, ip_addr: nil, port_number: nil, admin_name: nil, admin_password: nil, tcp_only: false) ⇒ NetconfNode

  • controller

    Controller : The controller object through which NETCONF device is to be accessed.

  • name

    String : The name of the NETCONF node. e.g. vrouter

  • ip_addr

    String : IP address for NETCONF protocol of NETCONF device. e.g. 172.22.11.44

  • port_number

    String : Port number of the NETCONF protocol. e.g. 830

  • admin_name

    String : Admin userid for logon to NETCONF device. e.g. vyatta

  • admin_password

    String : Admin password for logon NETCONF device. e.g. vyatta

  • tcp_only

    Boolean : True if only TCP is used to communicate with NETCONF device.

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/controller/netconf_node.rb', line 59

def initialize(controller: nil, name: nil, ip_addr: nil,
    port_number: nil, admin_name: nil, admin_password: nil,
    tcp_only: false)
  super(controller: controller, name: name)
  raise ArgumentError, "IP Address (ip_addr) required" unless ip_addr
  raise ArgumentError, "Port Number (port_number) required" unless port_number
  raise ArgumentError, "Admin Username (admin_name) required" unless admin_name
  raise ArgumentError, "Admin Password (admin_password) required" unless admin_password
  
  @ip = ip_addr
  @port = port_number
  @username = admin_name
  @password = admin_password
  @tcp_only = tcp_only
end

Instance Attribute Details

#ipObject (readonly)

String : IP address for NETCONF protocol of NETCONF device. e.g. 172.22.11.44



40
41
42
# File 'lib/controller/netconf_node.rb', line 40

def ip
  @ip
end

#passwordObject (readonly)

String : Admin password for logon NETCONF device. e.g. vyatta



46
47
48
# File 'lib/controller/netconf_node.rb', line 46

def password
  @password
end

#portObject (readonly)

String : Port number of the NETCONF protocol. e.g. 830



42
43
44
# File 'lib/controller/netconf_node.rb', line 42

def port
  @port
end

#tcp_onlyObject (readonly)

Boolean : True if only TCP is used to communicate with NETCONF device.



48
49
50
# File 'lib/controller/netconf_node.rb', line 48

def tcp_only
  @tcp_only
end

#usernameObject (readonly)

String : Admin userid for logon to NETCONF device. e.g. vyatta



44
45
46
# File 'lib/controller/netconf_node.rb', line 44

def username
  @username
end

Instance Method Details

#to_hashObject

:nodoc:



75
76
77
78
# File 'lib/controller/netconf_node.rb', line 75

def to_hash #:nodoc:
  {:controller => @controller.to_hash, :name => @name, :ip_addr => @ip,
    :port_num => @port, :admin_name => @username, :admin_password => @password}
end