O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Server application

The server application is a multi-protocol Node.js application, written in a single file for convenience and ease of illustration here. It has two major I/O functions:

  • Speaking HTTP and the WebSocket overlay (for real-time sockets communication) to web clients
  • Communicating NETCONF over SSH to JUNOS OS routers

The asynchronous I/O model of Node.js allows us to implement this quite efficiently within a single application. An event loop polls for I/O from the operating system and dispatches prescribed event handlers as required.

Steps 1 through 3 see us setup the beginning of a Node.js application, download the necessary library modules and reference the namespace of our application. Notice also that in step 2, we identify ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required