status update: control event passing done

martin f krafft madduck at debian.org
Wed Jun 13 13:02:54 UTC 2007


Dear colleagues,

the control event passing now works and it's moderately
well-implemented, although all of netconf is very much a prototype
(it's in Python after all) for now. Right now, a client can connect,
issue a request and end it with EOF. The sending socket is then
closed and thread handling the client creates an event object and
places it in the daemon's event queue.

An event is parsed into command, arguments, and parameters:

  IFUP eth0
  nameserver: 1.2.3.4
  search: my.domain.org

This would result in an event storing

  cmd='IFUP'
  args=['eth0']
  params={'nameserver':'1.2.3.4', 'search','my.domain.org']

the event also brings along a write-only File object bound to the
client socket, as well as a function pointer which is used to
communicate to the thread that the response is complete, which
causes the thread then to clean up and exit. It's a simple
request-response protocol without keep-alive. I shall investigate
whether I can use EOF instead of requiring a function call.

My next step is the configuration broker. I shall implement this as
a broker where handlers can register in a sorted list. After
checking whether the interface exists (using the kernel, rather than
state), the daemon can then ask the broker for configuration details
for an interface, and the broker iterates the handlers until one
returns success.

Comments always welcome.

Here is an example run:

Client:

  lapse:..etconf/master.git/src> ./netconfd-ctlsock.py
  connected to socket from PID 22223                  
  IFUP eth0
  nameserver: 1.2.3.4
  EOF received, closing sending socket...
  received command: IFUP
  remote side closed connection.

Daemon:

  lapse:..etconf/master.git/src> ./netconfd.py -df
  MainThread: INFO: netconfd.py daemon initialised (version 0.1~WIP)
  MainThread: DEBUG: parsed command-line options: {'foreground': True, 'verbose': False, 'debug': True, 'interface': None, 'controlsocket': './netconfd-ctl.sock', 'logfile': './netconfd.log', 'pidfile': './netconfd.pid'}
  MainThread: DEBUG: parsed command-line arguments: []
  MainThread: DEBUG: not daemonising as requested
  MainThread: INFO: starting main loop...
  CtlSockListener: INFO: successfully spawned control socket listener thread
  CtlSockListener: INFO: accepted connection from PID 22223 (uid:1000 gid:1000)
  CtlSockHander_22223: DEBUG: successfully spawned control socket handler
  CtlSockHander_22223: DEBUG: received: IFUP eth0\n
  CtlSockHander_22223: DEBUG: received: nameserver: 1.2.3.4\n
  CtlSockHander_22223: DEBUG: processing request...
  CtlSockHander_22223: DEBUG: created event: <CtlSockEvent cmd=IFUP args=['eth0'] peer=22223 uid=1000>
  CtlSockHander_22223: DEBUG: waiting for end-of-response...
  MainThread: DEBUG: received event: <CtlSockEvent cmd=IFUP args=['eth0'] peer=22223 uid=1000>
  [the MainThread/Daemon now simply echoes 'received command $cmd']
  CtlSockHander_22223: DEBUG: end-of-response received, exiting...

-- 
 .''`.   martin f. krafft <madduck at debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
there are lies, statistics, and benchmarks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (GPG/PGP)
Url : http://lists.alioth.debian.org/pipermail/netconf-devel/attachments/20070613/aa78b60f/attachment.pgp 


More information about the netconf-devel mailing list