O'Reilly logo

Python Testing Cookbook. by Bhaskar N. Das, Greg L. Turnquist

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

With the following steps, we will build a simple network management application:

  1. Create a file called network.py to store the network application.
  2. Create a class definition to represent a network event:
class Event(object):   def init  (self, hostname, condition, severity, event_time):       self.hostname = hostname       self.condition = condition       self.severity = severity       self.id = -1   def str(self):       return "(ID:%s) %s:%s - %s" % (self.id, self.hostname,\                self.condition,self.severity)

Let's have a look at few properties of self:

  • hostname: It is assumed that all network alarms originate from pieces of equipment that have a hostname.
  • condition: This indicates the type of alarm being generated. Two different alarm conditions can come from ...

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