What is OpenPnPy?

OpenPnPy is a python package implementing Cisco’s Network PnP protocol. It provides a server class, as well as utility functions to easily build PnP XML service messages.

To understand what Cisco Network PnP is all about, see

Basic Usage

A PnP server with custom behavior can be defined by subclassing the openpnpy.server.PnpServer class, and implementing the handler methods.

Service messages to be returned by the handler methods can be built using functions provided by the openpnpy.messages module.

A very basic server implementation could look like this:


#!/usr/bin/env python3

from openpnpy.server import PnpServer
from openpnpy.messages import device_info, backoff, bye

class MyServer(PnpServer):

    def handle_work_request(self, work_request):
        return device_info(type='all')

    def handle_work_response(self, work_response):
        if work_response.success:
            return bye()
            return backoff(seconds=30)

server = MyServer(__name__)

if __name__ == '__main__':'', port='1234')

Which can then be run like so: