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