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): ...

Get Python Network Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.