Class: PxnxJruby::SessionDirectoryNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/pxnx_jruby/session_directory_notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#device_ip_addressObject

Returns the value of attribute device_ip_address.



9
10
11
# File 'lib/pxnx_jruby/session_directory_notification.rb', line 9

def device_ip_address
  @device_ip_address
end

#interfaceObject

Returns the value of attribute interface.



9
10
11
# File 'lib/pxnx_jruby/session_directory_notification.rb', line 9

def interface
  @interface
end

#sessionObject

Returns the value of attribute session.



9
10
11
# File 'lib/pxnx_jruby/session_directory_notification.rb', line 9

def session
  @session
end

Instance Method Details

#onChange(session) ⇒ Object

TODO: Test this method. TODO: Properly create calls to start integration with the IP received.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pxnx_jruby/session_directory_notification.rb', line 13

def onChange(session)
  # Log this session id.
  @session = session
  @interface = session.getInterface
  device_interfaces = @interface.getIpIntfIDs
  device = device_interfaces[0]
  @device_ip_address = device.get_ip_address
  connect_manager = PxnxJruby::ConnectionManager.instance
  log = LoggerFactory.getLogger(SessionDirectoryNotification.become_java!)
  log.info("Found new IP #{@device_ip_address} connecting to the network, assessing.")
  connect_manager.new_connection(@device_ip_address)
end