blob: f0a7c25ec6c905934c8fb36b6fc911332a4b840c [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Laneb658ddd2013-03-12 10:15:10 -07005# Automatically generated by LOXI from template toplevel_init.py
6# Do not modify
7
Rich Lane7b0f2012013-11-22 14:15:26 -08008version_names = {
9 1: "1.0",
10 2: "1.1",
11 3: "1.2",
12 4: "1.3",
13}
Rich Lanec2ee4b82013-04-24 17:12:38 -070014
Rich Laneb658ddd2013-03-12 10:15:10 -070015def protocol(ver):
16 """
17 Import and return the protocol module for the given wire version.
18 """
19 if ver == 1:
20 import of10
21 return of10
Rich Lanec2ee4b82013-04-24 17:12:38 -070022 elif ver == 2:
23 import of11
24 return of11
25 elif ver == 3:
26 import of12
27 return of12
28 elif ver == 4:
29 import of13
30 return of13
Rich Laneb658ddd2013-03-12 10:15:10 -070031 else:
32 raise ValueError
33
34class ProtocolError(Exception):
35 """
36 Raised when failing to deserialize an invalid OpenFlow message.
37 """
38 pass
Rich Lanec2ee4b82013-04-24 17:12:38 -070039
40class Unimplemented(Exception):
41 """
42 Raised when an OpenFlow feature is not yet implemented in PyLoxi.
43 """
44 pass
45
46def unimplemented(msg):
47 raise Unimplemented(msg)
Rich Lane7dcdf022013-12-11 14:45:27 -080048
49class OFObject(object):
50 """
51 Superclass of all OpenFlow classes
52 """
53 def __init__(self, *args):
54 raise NotImplementedError("cannot instantiate abstract class")
55
56 def __ne__(self, other):
57 return not self.__eq__(other)
58
59 def show(self):
60 import loxi.pp
61 return loxi.pp.pp(self)