O'Reilly logo

Python Network Programming Cookbook - Second Edition by Dr. M. O. Faruque Sarker, Pradeeban Kathiravelu

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

How to do it...

In this recipe, we will monitor and notify when new links are added to the network. Listing 10.5 gives a simple monitoring for link changes:

 #!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 10 # This program is optimized for Python 2.7.12. # It may run on any other version with/without modifications. # Adopted from https://github.com/osrg/ryu/blob/master/ryu/app/ws_topology.py from socket import error as SocketError from tinyrpc.exc import InvalidReplyError from ryu.app.wsgi import ( ControllerBase, WSGIApplication, websocket, WebSocketRPCClient ) from ryu.base import app_manager from ryu.topology import event, switches from ryu.controller.handler import set_ev_cls class WebSocketTopology(app_manager.RyuApp): ...

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