Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -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. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5 | |
| 6 | # Automatically generated by LOXI from template toplevel_init.py |
| 7 | # Do not modify |
| 8 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9 | version_names = {1: '1.0', 2: '1.1', 3: '1.2', 4: '1.3'} |
| 10 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 11 | def protocol(ver): |
| 12 | """ |
| 13 | Import and return the protocol module for the given wire version. |
| 14 | """ |
| 15 | if ver == 1: |
| 16 | import of10 |
| 17 | return of10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 18 | elif ver == 2: |
| 19 | import of11 |
| 20 | return of11 |
| 21 | elif ver == 3: |
| 22 | import of12 |
| 23 | return of12 |
| 24 | elif ver == 4: |
| 25 | import of13 |
| 26 | return of13 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 27 | else: |
| 28 | raise ValueError |
| 29 | |
| 30 | class ProtocolError(Exception): |
| 31 | """ |
| 32 | Raised when failing to deserialize an invalid OpenFlow message. |
| 33 | """ |
| 34 | pass |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 35 | |
| 36 | class Unimplemented(Exception): |
| 37 | """ |
| 38 | Raised when an OpenFlow feature is not yet implemented in PyLoxi. |
| 39 | """ |
| 40 | pass |
| 41 | |
| 42 | def unimplemented(msg): |
| 43 | raise Unimplemented(msg) |