Nathan Knuth | 418fdc8 | 2016-09-16 22:51:15 -0700 | [diff] [blame] | 1 | # 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. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | # Automatically generated by LOXI from template toplevel_init.py |
| 6 | # Do not modify |
| 7 | |
| 8 | version_names = { |
| 9 | 1: "1.0", |
| 10 | 2: "1.1", |
| 11 | 3: "1.2", |
| 12 | 4: "1.3", |
| 13 | 5: "1.4", |
| 14 | } |
| 15 | |
| 16 | def protocol(ver): |
| 17 | """ |
| 18 | Import and return the protocol module for the given wire version. |
| 19 | """ |
| 20 | if ver == 1: |
| 21 | import of10 |
| 22 | return of10 |
| 23 | |
| 24 | if ver == 2: |
| 25 | import of11 |
| 26 | return of11 |
| 27 | |
| 28 | if ver == 3: |
| 29 | import of12 |
| 30 | return of12 |
| 31 | |
| 32 | if ver == 4: |
| 33 | import of13 |
| 34 | return of13 |
| 35 | |
| 36 | if ver == 5: |
| 37 | import of14 |
| 38 | return of14 |
| 39 | |
| 40 | raise ValueError |
| 41 | |
| 42 | class ProtocolError(Exception): |
| 43 | """ |
| 44 | Raised when failing to deserialize an invalid OpenFlow message. |
| 45 | """ |
| 46 | pass |
| 47 | |
| 48 | class Unimplemented(Exception): |
| 49 | """ |
| 50 | Raised when an OpenFlow feature is not yet implemented in PyLoxi. |
| 51 | """ |
| 52 | pass |
| 53 | |
| 54 | def unimplemented(msg): |
| 55 | raise Unimplemented(msg) |
| 56 | |
| 57 | class OFObject(object): |
| 58 | """ |
| 59 | Superclass of all OpenFlow classes |
| 60 | """ |
| 61 | def __init__(self, *args): |
| 62 | raise NotImplementedError("cannot instantiate abstract class") |
| 63 | |
| 64 | def __ne__(self, other): |
| 65 | return not self.__eq__(other) |
| 66 | |
| 67 | def show(self): |
| 68 | import loxi.pp |
| 69 | return loxi.pp.pp(self) |