remove of11 and of12 modules
OF 1.1+ support is broken until we add it to PyLoxi.
diff --git a/src/python/of11/__init__.py b/src/python/of11/__init__.py
deleted file mode 100644
index c4407ee..0000000
--- a/src/python/of11/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-"""
-Python OpenFlow 1.0 library
-
-Most of the files in this package are automatically generated by tools/munger.
-They are checked in to simplify running OFTest.
-"""
-
-__all__ = ["action_list", "action", "cstruct", "error", "message", "parse"]
diff --git a/src/python/of11/action.py b/src/python/of11/action.py
deleted file mode 100644
index 447cd17..0000000
--- a/src/python/of11/action.py
+++ /dev/null
@@ -1,550 +0,0 @@
-
-# Python OpenFlow action wrapper classes
-
-from cstruct import *
-
-
-
-class action_set_nw_src(ofp_action_nw_addr):
- """
- Wrapper class for set_nw_src action object
-
- Data members inherited from ofp_action_nw_addr:
- @arg type
- @arg len
- @arg nw_addr
-
- """
- def __init__(self):
- ofp_action_nw_addr.__init__(self)
- self.type = OFPAT_SET_NW_SRC
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_src\n"
- outstr += ofp_action_nw_addr.show(self, prefix)
- return outstr
-
-
-class action_set_mpls_tc(ofp_action_mpls_tc):
- """
- Wrapper class for set_mpls_tc action object
-
- Data members inherited from ofp_action_mpls_tc:
- @arg type
- @arg len
- @arg mpls_tc
-
- """
- def __init__(self):
- ofp_action_mpls_tc.__init__(self)
- self.type = OFPAT_SET_MPLS_TC
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_mpls_tc\n"
- outstr += ofp_action_mpls_tc.show(self, prefix)
- return outstr
-
-
-class action_set_nw_tos(ofp_action_nw_tos):
- """
- Wrapper class for set_nw_tos action object
-
- Data members inherited from ofp_action_nw_tos:
- @arg type
- @arg len
- @arg nw_tos
-
- """
- def __init__(self):
- ofp_action_nw_tos.__init__(self)
- self.type = OFPAT_SET_NW_TOS
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_tos\n"
- outstr += ofp_action_nw_tos.show(self, prefix)
- return outstr
-
-
-class action_dec_mpls_ttl(ofp_action_header):
- """
- Wrapper class for dec_mpls_ttl action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_action_header.__init__(self)
- self.type = OFPAT_DEC_MPLS_TTL
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_dec_mpls_ttl\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class action_set_nw_dst(ofp_action_nw_addr):
- """
- Wrapper class for set_nw_dst action object
-
- Data members inherited from ofp_action_nw_addr:
- @arg type
- @arg len
- @arg nw_addr
-
- """
- def __init__(self):
- ofp_action_nw_addr.__init__(self)
- self.type = OFPAT_SET_NW_DST
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_dst\n"
- outstr += ofp_action_nw_addr.show(self, prefix)
- return outstr
-
-
-class action_set_mpls_label(ofp_action_mpls_label):
- """
- Wrapper class for set_mpls_label action object
-
- Data members inherited from ofp_action_mpls_label:
- @arg type
- @arg len
- @arg mpls_label
-
- """
- def __init__(self):
- ofp_action_mpls_label.__init__(self)
- self.type = OFPAT_SET_MPLS_LABEL
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_mpls_label\n"
- outstr += ofp_action_mpls_label.show(self, prefix)
- return outstr
-
-
-class action_group(ofp_action_group):
- """
- Wrapper class for group action object
-
- Data members inherited from ofp_action_group:
- @arg type
- @arg len
- @arg group_id
-
- """
- def __init__(self):
- ofp_action_group.__init__(self)
- self.type = OFPAT_GROUP
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_group\n"
- outstr += ofp_action_group.show(self, prefix)
- return outstr
-
-
-class action_copy_ttl_out(ofp_action_header):
- """
- Wrapper class for copy_ttl_out action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_action_header.__init__(self)
- self.type = OFPAT_COPY_TTL_OUT
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_copy_ttl_out\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class action_set_vlan_vid(ofp_action_vlan_vid):
- """
- Wrapper class for set_vlan_vid action object
-
- Data members inherited from ofp_action_vlan_vid:
- @arg type
- @arg len
- @arg vlan_vid
-
- """
- def __init__(self):
- ofp_action_vlan_vid.__init__(self)
- self.type = OFPAT_SET_VLAN_VID
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_vlan_vid\n"
- outstr += ofp_action_vlan_vid.show(self, prefix)
- return outstr
-
-
-class action_set_mpls_ttl(ofp_action_mpls_ttl):
- """
- Wrapper class for set_mpls_ttl action object
-
- Data members inherited from ofp_action_mpls_ttl:
- @arg type
- @arg len
- @arg mpls_ttl
-
- """
- def __init__(self):
- ofp_action_mpls_ttl.__init__(self)
- self.type = OFPAT_SET_MPLS_TTL
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_mpls_ttl\n"
- outstr += ofp_action_mpls_ttl.show(self, prefix)
- return outstr
-
-
-class action_pop_vlan(ofp_action_header):
- """
- Wrapper class for pop_vlan action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_action_header.__init__(self)
- self.type = OFPAT_POP_VLAN
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_pop_vlan\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class action_set_tp_dst(ofp_action_tp_port):
- """
- Wrapper class for set_tp_dst action object
-
- Data members inherited from ofp_action_tp_port:
- @arg type
- @arg len
- @arg tp_port
-
- """
- def __init__(self):
- ofp_action_tp_port.__init__(self)
- self.type = OFPAT_SET_TP_DST
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_tp_dst\n"
- outstr += ofp_action_tp_port.show(self, prefix)
- return outstr
-
-
-class action_pop_mpls(ofp_action_pop_mpls):
- """
- Wrapper class for pop_mpls action object
-
- Data members inherited from ofp_action_pop_mpls:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self):
- ofp_action_pop_mpls.__init__(self)
- self.type = OFPAT_POP_MPLS
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_pop_mpls\n"
- outstr += ofp_action_pop_mpls.show(self, prefix)
- return outstr
-
-
-class action_push_vlan(ofp_action_push):
- """
- Wrapper class for push_vlan action object
-
- Data members inherited from ofp_action_push:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self):
- ofp_action_push.__init__(self)
- self.type = OFPAT_PUSH_VLAN
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_push_vlan\n"
- outstr += ofp_action_push.show(self, prefix)
- return outstr
-
-
-class action_set_vlan_pcp(ofp_action_vlan_pcp):
- """
- Wrapper class for set_vlan_pcp action object
-
- Data members inherited from ofp_action_vlan_pcp:
- @arg type
- @arg len
- @arg vlan_pcp
-
- """
- def __init__(self):
- ofp_action_vlan_pcp.__init__(self)
- self.type = OFPAT_SET_VLAN_PCP
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_vlan_pcp\n"
- outstr += ofp_action_vlan_pcp.show(self, prefix)
- return outstr
-
-
-class action_set_tp_src(ofp_action_tp_port):
- """
- Wrapper class for set_tp_src action object
-
- Data members inherited from ofp_action_tp_port:
- @arg type
- @arg len
- @arg tp_port
-
- """
- def __init__(self):
- ofp_action_tp_port.__init__(self)
- self.type = OFPAT_SET_TP_SRC
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_tp_src\n"
- outstr += ofp_action_tp_port.show(self, prefix)
- return outstr
-
-
-class action_experimenter(ofp_action_experimenter_header):
- """
- Wrapper class for experimenter action object
-
- Data members inherited from ofp_action_experimenter_header:
- @arg type
- @arg len
- @arg experimenter
-
- """
- def __init__(self):
- ofp_action_experimenter_header.__init__(self)
- self.type = OFPAT_EXPERIMENTER
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_experimenter\n"
- outstr += ofp_action_experimenter_header.show(self, prefix)
- return outstr
-
-
-class action_set_nw_ttl(ofp_action_nw_ttl):
- """
- Wrapper class for set_nw_ttl action object
-
- Data members inherited from ofp_action_nw_ttl:
- @arg type
- @arg len
- @arg nw_ttl
-
- """
- def __init__(self):
- ofp_action_nw_ttl.__init__(self)
- self.type = OFPAT_SET_NW_TTL
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_ttl\n"
- outstr += ofp_action_nw_ttl.show(self, prefix)
- return outstr
-
-
-class action_copy_ttl_in(ofp_action_header):
- """
- Wrapper class for copy_ttl_in action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_action_header.__init__(self)
- self.type = OFPAT_COPY_TTL_IN
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_copy_ttl_in\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class action_set_nw_ecn(ofp_action_nw_ecn):
- """
- Wrapper class for set_nw_ecn action object
-
- Data members inherited from ofp_action_nw_ecn:
- @arg type
- @arg len
- @arg nw_ecn
-
- """
- def __init__(self):
- ofp_action_nw_ecn.__init__(self)
- self.type = OFPAT_SET_NW_ECN
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_ecn\n"
- outstr += ofp_action_nw_ecn.show(self, prefix)
- return outstr
-
-
-class action_set_dl_dst(ofp_action_dl_addr):
- """
- Wrapper class for set_dl_dst action object
-
- Data members inherited from ofp_action_dl_addr:
- @arg type
- @arg len
- @arg dl_addr
-
- """
- def __init__(self):
- ofp_action_dl_addr.__init__(self)
- self.type = OFPAT_SET_DL_DST
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_dl_dst\n"
- outstr += ofp_action_dl_addr.show(self, prefix)
- return outstr
-
-
-class action_push_mpls(ofp_action_push):
- """
- Wrapper class for push_mpls action object
-
- Data members inherited from ofp_action_push:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self):
- ofp_action_push.__init__(self)
- self.type = OFPAT_PUSH_MPLS
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_push_mpls\n"
- outstr += ofp_action_push.show(self, prefix)
- return outstr
-
-
-class action_dec_nw_ttl(ofp_action_header):
- """
- Wrapper class for dec_nw_ttl action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_action_header.__init__(self)
- self.type = OFPAT_DEC_NW_TTL
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_dec_nw_ttl\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class action_set_dl_src(ofp_action_dl_addr):
- """
- Wrapper class for set_dl_src action object
-
- Data members inherited from ofp_action_dl_addr:
- @arg type
- @arg len
- @arg dl_addr
-
- """
- def __init__(self):
- ofp_action_dl_addr.__init__(self)
- self.type = OFPAT_SET_DL_SRC
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_dl_src\n"
- outstr += ofp_action_dl_addr.show(self, prefix)
- return outstr
-
-
-class action_set_queue(ofp_action_set_queue):
- """
- Wrapper class for set_queue action object
-
- Data members inherited from ofp_action_set_queue:
- @arg type
- @arg len
- @arg queue_id
-
- """
- def __init__(self):
- ofp_action_set_queue.__init__(self)
- self.type = OFPAT_SET_QUEUE
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_set_queue\n"
- outstr += ofp_action_set_queue.show(self, prefix)
- return outstr
-
-
-class action_output(ofp_action_output):
- """
- Wrapper class for output action object
-
- Data members inherited from ofp_action_output:
- @arg type
- @arg len
- @arg port
- @arg max_len
-
- """
- def __init__(self):
- ofp_action_output.__init__(self)
- self.type = OFPAT_OUTPUT
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "action_output\n"
- outstr += ofp_action_output.show(self, prefix)
- return outstr
-
-action_class_list = (
- action_copy_ttl_in,
- action_copy_ttl_out,
- action_dec_mpls_ttl,
- action_dec_nw_ttl,
- action_experimenter,
- action_group,
- action_output,
- action_pop_mpls,
- action_pop_vlan,
- action_push_mpls,
- action_push_vlan,
- action_set_dl_dst,
- action_set_dl_src,
- action_set_mpls_label,
- action_set_mpls_tc,
- action_set_mpls_ttl,
- action_set_nw_dst,
- action_set_nw_ecn,
- action_set_nw_src,
- action_set_nw_tos,
- action_set_nw_ttl,
- action_set_queue,
- action_set_tp_dst,
- action_set_tp_src,
- action_set_vlan_pcp,
- action_set_vlan_vid)
-
diff --git a/src/python/of11/action_list.py b/src/python/of11/action_list.py
deleted file mode 100644
index 878050b..0000000
--- a/src/python/of11/action_list.py
+++ /dev/null
@@ -1,97 +0,0 @@
-"""
-OpenFlow action, instruction and bucket list classes
-"""
-
-from action import *
-from cstruct import ofp_header
-from base_list import ofp_base_list
-import copy
-
-action_object_map = {
- OFPAT_OUTPUT : action_output,
- OFPAT_SET_VLAN_VID : action_set_vlan_vid,
- OFPAT_SET_VLAN_PCP : action_set_vlan_pcp,
- OFPAT_SET_DL_SRC : action_set_dl_src,
- OFPAT_SET_DL_DST : action_set_dl_dst,
- OFPAT_SET_NW_SRC : action_set_nw_src,
- OFPAT_SET_NW_DST : action_set_nw_dst,
- OFPAT_SET_NW_TOS : action_set_nw_tos,
- OFPAT_SET_NW_ECN : action_set_nw_ecn,
- OFPAT_SET_TP_SRC : action_set_tp_src,
- OFPAT_SET_TP_DST : action_set_tp_dst,
- OFPAT_COPY_TTL_OUT : action_copy_ttl_out,
- OFPAT_COPY_TTL_IN : action_copy_ttl_in,
- OFPAT_SET_MPLS_LABEL : action_set_mpls_label,
- OFPAT_SET_MPLS_TC : action_set_mpls_tc,
- OFPAT_SET_MPLS_TTL : action_set_mpls_ttl,
- OFPAT_DEC_MPLS_TTL : action_dec_mpls_ttl,
- OFPAT_PUSH_VLAN : action_push_vlan,
- OFPAT_POP_VLAN : action_pop_vlan,
- OFPAT_PUSH_MPLS : action_push_mpls,
- OFPAT_POP_MPLS : action_pop_mpls,
- OFPAT_SET_QUEUE : action_set_queue,
- OFPAT_GROUP : action_group,
- OFPAT_SET_NW_TTL : action_set_nw_ttl,
- OFPAT_DEC_NW_TTL : action_dec_nw_ttl,
- OFPAT_EXPERIMENTER : action_experimenter
-}
-
-class action_list(ofp_base_list):
- """
- Maintain a list of actions
-
- Data members:
- @arg actions: An array of action objects such as action_output, etc.
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.actions = self.items
- self.name = "action"
- self.class_list = action_class_list
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of actions
-
- Unpack actions from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the action list in bytes.
- Ignored if decode is True. If None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- count = 0
- cur_string = binary_string
- while bytes_done < bytes:
- hdr = ofp_action_header()
- hdr.unpack(cur_string)
- if hdr.len < OFP_ACTION_HEADER_BYTES:
- print "ERROR: Action too short"
- break
- if not hdr.type in action_object_map.keys():
- print "WARNING: Skipping unknown action ", hdr.type, hdr.len
- else:
- self.actions.append(action_object_map[hdr.type]())
- self.actions[count].unpack(cur_string)
- count += 1
- cur_string = cur_string[hdr.len:]
- bytes_done += hdr.len
- return cur_string
-
diff --git a/src/python/of11/base_list.py b/src/python/of11/base_list.py
deleted file mode 100644
index 938c68e..0000000
--- a/src/python/of11/base_list.py
+++ /dev/null
@@ -1,158 +0,0 @@
-
-"""
-Base list class for inheritance.
-Most of the list stuff is common; unpacking is the only thing that
-is left pure virtual.
-"""
-
-import copy
-
-class ofp_base_list(object):
- """
- Container type to maintain a list of ofp objects
-
- Data members:
- @arg items An array of objects
- @arg class_list A tuple of classes that may be added to the list;
- If None, no checking is done
- @arg name The name to use when displaying the list
-
- Methods:
- @arg pack Pack the structure into a string
- @arg unpack Unpack a string to objects, with proper typing
- @arg add Add an item to the list; you can directly access
- the item member, but add will validate that the added object
- is of the right type.
- @arg extend Add the items for another list to this list
-
- """
-
- def __init__(self):
- self.items = []
- self.class_list = None
- self.name = "unspecified"
-
- def pack(self):
- """
- Pack a list of items
-
- Returns the packed string
- """
- packed = ""
- for obj in self.items:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string, bytes=None):
- """
- Pure virtual function for a list of items
-
- Unpack items from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the list in bytes.
- Ignored if decode is True. If None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
- """
- pass
-
- def add(self, item):
- """
- Add an item to a list
-
- @param item The item to add
- @return True if successful, False if not proper type object
-
- """
-
- # Note that the second arg of isinstance can be a list which
- # checks that the type of item is in the list
- if (self.class_list is not None) and \
- not isinstance(item, tuple(self.class_list)):
- return False
-
- tmp = copy.deepcopy(item)
- self.items.append(tmp)
- return True
-
- def remove_type(self, target):
- """
- Remove the first item on the list of the given type
-
- @param target The type of item to search
-
- @return The object removed, if any; otherwise None
-
- """
- for index in xrange(len(self.items)):
- if self.items[index].type == target:
- return self.items.pop(index)
- return None
-
- def find_type(self, target):
- """
- Find the first item on the list of the given type
-
- @param target The type of item to search
-
- @return The object with the matching type if any; otherwise None
-
- """
- for index in xrange(len(self.items)):
- if self.items[index].type == target:
- return self.items[index]
- return None
-
- def extend(self, other):
- """
- Add the items in other to this list
-
- @param other An object of the same type of list whose
- entries are to be merged into this list
-
- @return True if successful. If not successful, the list
- may have been modified.
-
- @todo Check if this is proper deep copy or not
-
- """
- for act in other.items:
- if not self.add(act):
- return False
- return True
-
- def __len__(self):
- """
- Length of the list packed as a string
- """
- length = 0
- for item in self.items:
- length += item.__len__()
- return length
-
- def __eq__(self, other):
- if type(self) != type(other):
- return False
- if self.items != other.items:
- return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- # Methods to make class iterable
- def __iter__(self):
- return self.items.__iter__()
-
- def show(self, prefix=''):
- outstr = prefix + self.name + "list with " + str(len(self.items)) + \
- " items\n"
- count = 0
- for obj in self.items:
- count += 1
- outstr += prefix + " " + self.name + " " + str(count) + ": \n"
- outstr += obj.show(prefix + ' ')
- return outstr
diff --git a/src/python/of11/bucket.py b/src/python/of11/bucket.py
deleted file mode 100644
index 64caed1..0000000
--- a/src/python/of11/bucket.py
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Python OpenFlow bucket wrapper class
-
-from cstruct import ofp_bucket
-from action_list import action_list
-
-
-
-class bucket(ofp_bucket):
- """
- Wrapper class for bucket object
-
- Data members inherited from ofp_bucket:
- @arg len
- @arg weight
- @arg watch_port
- @arg watch_group
-
- """
- def __init__(self):
- ofp_bucket.__init__(self)
- self.actions = action_list()
- self.type = None
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "bucket\n"
- outstr += ofp_bucket.show(self, prefix)
- outstr += self.actions.show()
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_bucket.unpack(self, binary_string)
- self.actions = action_list()
- return self.actions.unpack(binary_string)
- def pack(self):
- self.len = len(self)
- packed = ""
- packed += ofp_bucket.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_bucket.__len__(self) + self.actions.__len__()
-
diff --git a/src/python/of11/bucket_list.py b/src/python/of11/bucket_list.py
deleted file mode 100644
index 33d9472..0000000
--- a/src/python/of11/bucket_list.py
+++ /dev/null
@@ -1,52 +0,0 @@
-
-from base_list import ofp_base_list
-from bucket import bucket
-
-class bucket_list(ofp_base_list):
- """
- Maintain a list of instructions
-
- Data members:
- @arg instructions An array of instructions such as write_actions
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.buckets = self.items
- self.name = "buckets"
- self.class_list = (bucket,)
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of buckets
-
- Unpack buckets from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the instruction list in bytes.
- Ignored if decode is True. If bytes is None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- cur_string = binary_string
- while bytes_done < bytes:
- b = bucket()
- cur_string = b.unpack(cur_string)
- self.buckets.append(b)
- bytes_done += len(b)
- return cur_string
diff --git a/src/python/of11/class_maps.py b/src/python/of11/class_maps.py
deleted file mode 100644
index 50ff188..0000000
--- a/src/python/of11/class_maps.py
+++ /dev/null
@@ -1,375 +0,0 @@
-
-# Class to array member map
-class_to_members_map = {
- 'ofp_action_mpls_tc' : [
- 'type',
- 'len',
- 'mpls_tc'
- ],
- 'ofp_aggregate_stats_reply' : [
- 'packet_count',
- 'byte_count',
- 'flow_count'
- ],
- 'ofp_action_set_queue' : [
- 'type',
- 'len',
- 'queue_id'
- ],
- 'ofp_table_stats' : [
- 'table_id',
- 'name',
- 'wildcards',
- 'match',
- 'instructions',
- 'write_actions',
- 'apply_actions',
- 'config',
- 'max_entries',
- 'active_count',
- 'lookup_count',
- 'matched_count'
- ],
- 'ofp_table_mod' : [
- 'table_id',
- 'config'
- ],
- 'ofp_flow_removed' : [
- 'cookie',
- 'priority',
- 'reason',
- 'table_id',
- 'duration_sec',
- 'duration_nsec',
- 'idle_timeout',
- 'packet_count',
- 'byte_count',
- 'match'
- ],
- 'ofp_instruction_actions' : [
- 'type',
- 'len'
- ],
- 'ofp_queue_stats' : [
- 'port_no',
- 'queue_id',
- 'tx_bytes',
- 'tx_packets',
- 'tx_errors'
- ],
- 'ofp_action_tp_port' : [
- 'type',
- 'len',
- 'tp_port'
- ],
- 'ofp_action_nw_ecn' : [
- 'type',
- 'len',
- 'nw_ecn'
- ],
- 'ofp_group_mod' : [
- 'command',
- 'type',
- 'group_id'
- ],
- 'ofp_port_stats_request' : [
- 'port_no'
- ],
- 'ofp_stats_request' : [
- 'type',
- 'flags'
- ],
- 'ofp_instruction' : [
- 'type',
- 'len'
- ],
- 'ofp_group_stats_request' : [
- 'group_id'
- ],
- 'ofp_experimenter_header' : [
- 'experimenter'
- ],
- 'ofp_aggregate_stats_request' : [
- 'table_id',
- 'out_port',
- 'out_group',
- 'cookie',
- 'cookie_mask',
- 'match'
- ],
- 'ofp_queue_get_config_request' : [
- 'port'
- ],
- 'ofp_instruction_experimenter' : [
- 'type',
- 'len',
- 'experimenter'
- ],
- 'ofp_action_nw_ttl' : [
- 'type',
- 'len',
- 'nw_ttl'
- ],
- 'ofp_port_status' : [
- 'reason',
- 'desc'
- ],
- 'ofp_action_header' : [
- 'type',
- 'len'
- ],
- 'ofp_port_mod' : [
- 'port_no',
- 'hw_addr',
- 'config',
- 'mask',
- 'advertise'
- ],
- 'ofp_action_vlan_vid' : [
- 'type',
- 'len',
- 'vlan_vid'
- ],
- 'ofp_action_output' : [
- 'type',
- 'len',
- 'port',
- 'max_len'
- ],
- 'ofp_switch_config' : [
- 'flags',
- 'miss_send_len'
- ],
- 'ofp_action_nw_tos' : [
- 'type',
- 'len',
- 'nw_tos'
- ],
- 'ofp_action_experimenter_header' : [
- 'type',
- 'len',
- 'experimenter'
- ],
- 'ofp_queue_get_config_reply' : [
- 'port'
- ],
- 'ofp_queue_prop_header' : [
- 'property',
- 'len'
- ],
- 'ofp_packet_in' : [
- 'buffer_id',
- 'in_port',
- 'in_phy_port',
- 'total_len',
- 'reason',
- 'table_id'
- ],
- 'ofp_instruction_write_metadata' : [
- 'type',
- 'len',
- 'metadata',
- 'metadata_mask'
- ],
- 'ofp_flow_stats' : [
- 'length',
- 'table_id',
- 'duration_sec',
- 'duration_nsec',
- 'priority',
- 'idle_timeout',
- 'hard_timeout',
- 'cookie',
- 'packet_count',
- 'byte_count',
- 'match'
- ],
- 'ofp_action_mpls_label' : [
- 'type',
- 'len',
- 'mpls_label'
- ],
- 'ofp_flow_stats_request' : [
- 'table_id',
- 'out_port',
- 'out_group',
- 'cookie',
- 'cookie_mask',
- 'match'
- ],
- 'ofp_header' : [
- 'version',
- 'type',
- 'length',
- 'xid'
- ],
- 'ofp_stats_reply' : [
- 'type',
- 'flags'
- ],
- 'ofp_queue_stats_request' : [
- 'port_no',
- 'queue_id'
- ],
- 'ofp_desc_stats' : [
- 'mfr_desc',
- 'hw_desc',
- 'sw_desc',
- 'serial_num',
- 'dp_desc'
- ],
- 'ofp_match' : [
- 'type',
- 'length',
- 'in_port',
- 'wildcards',
- 'dl_src',
- 'dl_src_mask',
- 'dl_dst',
- 'dl_dst_mask',
- 'dl_vlan',
- 'dl_vlan_pcp',
- 'dl_type',
- 'nw_tos',
- 'nw_proto',
- 'nw_src',
- 'nw_src_mask',
- 'nw_dst',
- 'nw_dst_mask',
- 'tp_src',
- 'tp_dst',
- 'mpls_label',
- 'mpls_tc',
- 'metadata',
- 'metadata_mask'
- ],
- 'ofp_port_stats' : [
- 'port_no',
- 'rx_packets',
- 'tx_packets',
- 'rx_bytes',
- 'tx_bytes',
- 'rx_dropped',
- 'tx_dropped',
- 'rx_errors',
- 'tx_errors',
- 'rx_frame_err',
- 'rx_over_err',
- 'rx_crc_err',
- 'collisions'
- ],
- 'ofp_packet_queue' : [
- 'queue_id',
- 'len'
- ],
- 'ofp_port' : [
- 'port_no',
- 'hw_addr',
- 'name',
- 'config',
- 'state',
- 'curr',
- 'advertised',
- 'supported',
- 'peer',
- 'curr_speed',
- 'max_speed'
- ],
- 'ofp_action_dl_addr' : [
- 'type',
- 'len',
- 'dl_addr'
- ],
- 'ofp_bucket_counter' : [
- 'packet_count',
- 'byte_count'
- ],
- 'ofp_queue_prop_min_rate' : [
- 'prop_header',
- 'rate'
- ],
- 'ofp_bucket' : [
- 'len',
- 'weight',
- 'watch_port',
- 'watch_group'
- ],
- 'ofp_switch_features' : [
- 'datapath_id',
- 'n_buffers',
- 'n_tables',
- 'capabilities',
- 'reserved'
- ],
- 'ofp_action_pop_mpls' : [
- 'type',
- 'len',
- 'ethertype'
- ],
- 'ofp_flow_mod' : [
- 'cookie',
- 'cookie_mask',
- 'table_id',
- 'command',
- 'idle_timeout',
- 'hard_timeout',
- 'priority',
- 'buffer_id',
- 'out_port',
- 'out_group',
- 'flags',
- 'match'
- ],
- 'ofp_packet_out' : [
- 'buffer_id',
- 'in_port',
- 'actions_len'
- ],
- 'ofp_instruction_goto_table' : [
- 'type',
- 'len',
- 'table_id'
- ],
- 'ofp_action_nw_addr' : [
- 'type',
- 'len',
- 'nw_addr'
- ],
- 'ofp_action_group' : [
- 'type',
- 'len',
- 'group_id'
- ],
- 'ofp_group_stats' : [
- 'length',
- 'group_id',
- 'ref_count',
- 'packet_count',
- 'byte_count'
- ],
- 'ofp_action_vlan_pcp' : [
- 'type',
- 'len',
- 'vlan_pcp'
- ],
- 'ofp_action_push' : [
- 'type',
- 'len',
- 'ethertype'
- ],
- 'ofp_group_desc_stats' : [
- 'length',
- 'type',
- 'group_id'
- ],
- 'ofp_error_msg' : [
- 'type',
- 'code'
- ],
- 'ofp_action_mpls_ttl' : [
- 'type',
- 'len',
- 'mpls_ttl'
- ],
- '_ignore' : []
-}
diff --git a/src/python/of11/cstruct.py b/src/python/of11/cstruct.py
deleted file mode 100644
index 1db5f00..0000000
--- a/src/python/of11/cstruct.py
+++ /dev/null
@@ -1,6043 +0,0 @@
-import struct
-
-# Structure definitions
-class ofp_action_mpls_tc(object):
- """Automatically generated Python class for ofp_action_mpls_tc
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.mpls_tc = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.mpls_tc)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.mpls_tc) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.mpls_tc != other.mpls_tc: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'mpls_tc: ' + str(self.mpls_tc) + '\n'
- return outstr
-
-
-class ofp_aggregate_stats_reply(object):
- """Automatically generated Python class for ofp_aggregate_stats_reply
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.packet_count = 0
- self.byte_count = 0
- self.flow_count = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!QQL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 20
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.flow_count != other.flow_count: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n'
- return outstr
-
-
-class ofp_action_set_queue(object):
- """Automatically generated Python class for ofp_action_set_queue
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.queue_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.queue_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.queue_id != other.queue_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- return outstr
-
-
-class ofp_table_stats(object):
- """Automatically generated Python class for ofp_table_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0,0,0,0,0]
- self.name= ""
- self.wildcards = 0
- self.match = 0
- self.instructions = 0
- self.write_actions = 0
- self.apply_actions = 0
- self.config = 0
- self.max_entries = 0
- self.active_count = 0
- self.lookup_count = 0
- self.matched_count = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 7):
- return (False, "self.pad is not of size 7 as expected.")
- if(not isinstance(self.name, str)):
- return (False, "self.name is not string as expected.")
- if(len(self.name) > 32):
- return (False, "self.name is not of size 32 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
- packed += self.name.ljust(32,'\0')
- packed += struct.pack("!LLLLLLLLQQ", self.wildcards, self.match, self.instructions, self.write_actions, self.apply_actions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 88):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
- self.name = binaryString[8:40].replace("\0","")
- fmt = '!LLLLLLLLQQ'
- start = 40
- end = start + struct.calcsize(fmt)
- (self.wildcards, self.match, self.instructions, self.write_actions, self.apply_actions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[88:]
-
- def __len__(self):
- """Return length of message
- """
- l = 88
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.name != other.name: return False
- if self.wildcards != other.wildcards: return False
- if self.match != other.match: return False
- if self.instructions != other.instructions: return False
- if self.write_actions != other.write_actions: return False
- if self.apply_actions != other.apply_actions: return False
- if self.config != other.config: return False
- if self.max_entries != other.max_entries: return False
- if self.active_count != other.active_count: return False
- if self.lookup_count != other.lookup_count: return False
- if self.matched_count != other.matched_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'name: ' + str(self.name) + '\n'
- outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
- outstr += prefix + 'match: ' + str(self.match) + '\n'
- outstr += prefix + 'instructions: ' + str(self.instructions) + '\n'
- outstr += prefix + 'write_actions: ' + str(self.write_actions) + '\n'
- outstr += prefix + 'apply_actions: ' + str(self.apply_actions) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n'
- outstr += prefix + 'active_count: ' + str(self.active_count) + '\n'
- outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n'
- outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n'
- return outstr
-
-
-class ofp_table_mod(object):
- """Automatically generated Python class for ofp_table_mod
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0]
- self.config = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!L", self.config)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!L'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.config,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.config != other.config: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- return outstr
-
-
-class ofp_flow_removed(object):
- """Automatically generated Python class for ofp_flow_removed
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.cookie = 0
- self.priority = 0
- self.reason = 0
- self.table_id = 0
- self.duration_sec = 0
- self.duration_nsec = 0
- self.idle_timeout = 0
- self.pad2= [0,0]
- self.packet_count = 0
- self.byte_count = 0
- self.match = ofp_match()
- self.match.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 2):
- return (False, "self.pad2 is not of size 2 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QHBBLLH", self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout)
- packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
- packed += struct.pack("!QQ", self.packet_count, self.byte_count)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 128):
- return binaryString
- fmt = '!QHBBLLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 22
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 24
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[40:])
- return binaryString[128:]
-
- def __len__(self):
- """Return length of message
- """
- l = 128
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.cookie != other.cookie: return False
- if self.priority != other.priority: return False
- if self.reason != other.reason: return False
- if self.table_id != other.table_id: return False
- if self.duration_sec != other.duration_sec: return False
- if self.duration_nsec != other.duration_nsec: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.pad2 != other.pad2: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
- outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_instruction_actions(object):
- """Automatically generated Python class for ofp_instruction_actions
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_queue_stats(object):
- """Automatically generated Python class for ofp_queue_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.queue_id = 0
- self.tx_bytes = 0
- self.tx_packets = 0
- self.tx_errors = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLQQQ", self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!LLQQQ'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.queue_id != other.queue_id: return False
- if self.tx_bytes != other.tx_bytes: return False
- if self.tx_packets != other.tx_packets: return False
- if self.tx_errors != other.tx_errors: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
- outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
- outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
- return outstr
-
-
-class ofp_action_tp_port(object):
- """Automatically generated Python class for ofp_action_tp_port
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.tp_port = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.tp_port)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.tp_port) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.tp_port != other.tp_port: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'tp_port: ' + str(self.tp_port) + '\n'
- return outstr
-
-
-class ofp_action_nw_ecn(object):
- """Automatically generated Python class for ofp_action_nw_ecn
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.nw_ecn = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.nw_ecn)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.nw_ecn) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.nw_ecn != other.nw_ecn: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'nw_ecn: ' + str(self.nw_ecn) + '\n'
- return outstr
-
-
-class ofp_group_mod(object):
- """Automatically generated Python class for ofp_group_mod
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.command = 0
- self.type = 0
- self.pad = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBL", self.command, self.type, self.pad, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HBBL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.command, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.command != other.command: return False
- if self.type != other.type: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'command: ' + str(self.command) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_port_stats_request(object):
- """Automatically generated Python class for ofp_port_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- return outstr
-
-
-class ofp_stats_request(object):
- """Automatically generated Python class for ofp_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.flags = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.flags)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.flags != other.flags: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- return outstr
-
-
-class ofp_instruction(object):
- """Automatically generated Python class for ofp_instruction
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_hello(object):
- """Automatically generated Python class for ofp_hello
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 0):
- return binaryString
- return binaryString[0:]
-
- def __len__(self):
- """Return length of message
- """
- l = 0
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- return outstr
-
-
-class ofp_group_stats_request(object):
- """Automatically generated Python class for ofp_group_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.group_id = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.group_id)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.group_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.group_id != other.group_id: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_experimenter_header(object):
- """Automatically generated Python class for ofp_experimenter_header
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.experimenter,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_aggregate_stats_request(object):
- """Automatically generated Python class for ofp_aggregate_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0]
- self.out_port = 0
- self.out_group = 0
- self.pad2= [0,0,0,0]
- self.cookie = 0
- self.cookie_mask = 0
- self.match = ofp_match()
- self.match.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 4):
- return (False, "self.pad2 is not of size 4 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!LL", self.out_port, self.out_group)
- packed += struct.pack("!BBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3])
- packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 120):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[32:])
- return binaryString[120:]
-
- def __len__(self):
- """Return length of message
- """
- l = 120
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.pad2 != other.pad2: return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_queue_get_config_request(object):
- """Automatically generated Python class for ofp_queue_get_config_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port != other.port: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- return outstr
-
-
-class ofp_instruction_experimenter(object):
- """Automatically generated Python class for ofp_instruction_experimenter
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_action_nw_ttl(object):
- """Automatically generated Python class for ofp_action_nw_ttl
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.nw_ttl = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.nw_ttl)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.nw_ttl) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.nw_ttl != other.nw_ttl: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'nw_ttl: ' + str(self.nw_ttl) + '\n'
- return outstr
-
-
-class ofp_port_status(object):
- """Automatically generated Python class for ofp_port_status
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.reason = 0
- self.pad= [0,0,0,0,0,0,0]
- self.desc = ofp_port()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 7):
- return (False, "self.pad is not of size 7 as expected.")
- if(not isinstance(self.desc, ofp_port)):
- return (False, "self.desc is not class ofp_port as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.reason)
- packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
- packed += self.desc.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 72):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.reason,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
- self.desc.unpack(binaryString[8:])
- return binaryString[72:]
-
- def __len__(self):
- """Return length of message
- """
- l = 72
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.reason != other.reason: return False
- if self.pad != other.pad: return False
- if self.desc != other.desc: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'desc: \n'
- outstr += self.desc.show(prefix + ' ')
- return outstr
-
-
-class ofp_action_header(object):
- """Automatically generated Python class for ofp_action_header
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_port_mod(object):
- """Automatically generated Python class for ofp_port_mod
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.hw_addr= [0,0,0,0,0,0]
- self.pad2= [0,0]
- self.config = 0
- self.mask = 0
- self.advertise = 0
- self.pad3= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- if(not isinstance(self.hw_addr, list)):
- return (False, "self.hw_addr is not list as expected.")
- if(len(self.hw_addr) != 6):
- return (False, "self.hw_addr is not of size 6 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 2):
- return (False, "self.pad2 is not of size 2 as expected.")
- if(not isinstance(self.pad3, list)):
- return (False, "self.pad3 is not list as expected.")
- if(len(self.pad3) != 4):
- return (False, "self.pad3 is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
- packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
- packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
- packed += struct.pack("!BBBB", self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 14
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LLL'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 28
- end = start + struct.calcsize(fmt)
- (self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.hw_addr != other.hw_addr: return False
- if self.pad2 != other.pad2: return False
- if self.config != other.config: return False
- if self.mask != other.mask: return False
- if self.advertise != other.advertise: return False
- if self.pad3 != other.pad3: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'mask: ' + str(self.mask) + '\n'
- outstr += prefix + 'advertise: ' + str(self.advertise) + '\n'
- return outstr
-
-
-class ofp_action_vlan_vid(object):
- """Automatically generated Python class for ofp_action_vlan_vid
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.vlan_vid = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.vlan_vid)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.vlan_vid) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.vlan_vid != other.vlan_vid: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n'
- return outstr
-
-
-class ofp_action_output(object):
- """Automatically generated Python class for ofp_action_output
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.port = 0
- self.max_len = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHLH", self.type, self.len, self.port, self.max_len)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!HHLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.port != other.port: return False
- if self.max_len != other.max_len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- outstr += prefix + 'max_len: ' + str(self.max_len) + '\n'
- return outstr
-
-
-class ofp_switch_config(object):
- """Automatically generated Python class for ofp_switch_config
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.flags = 0
- self.miss_send_len = 128
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.flags, self.miss_send_len)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.flags != other.flags: return False
- if self.miss_send_len != other.miss_send_len: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
- return outstr
-
-
-class ofp_action_nw_tos(object):
- """Automatically generated Python class for ofp_action_nw_tos
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.nw_tos = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.nw_tos)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.nw_tos) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.nw_tos != other.nw_tos: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n'
- return outstr
-
-
-class ofp_action_experimenter_header(object):
- """Automatically generated Python class for ofp_action_experimenter_header
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_queue_get_config_reply(object):
- """Automatically generated Python class for ofp_queue_get_config_reply
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port != other.port: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- return outstr
-
-
-class ofp_queue_prop_header(object):
- """Automatically generated Python class for ofp_queue_prop_header
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.property = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.property, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.property, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.property != other.property: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'property: ' + str(self.property) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_packet_in(object):
- """Automatically generated Python class for ofp_packet_in
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.buffer_id = 0
- self.in_port = 0
- self.in_phy_port = 0
- self.total_len = 0
- self.reason = 0
- self.table_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLLHBB", self.buffer_id, self.in_port, self.in_phy_port, self.total_len, self.reason, self.table_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!LLLHBB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.buffer_id, self.in_port, self.in_phy_port, self.total_len, self.reason, self.table_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.buffer_id != other.buffer_id: return False
- if self.in_port != other.in_port: return False
- if self.in_phy_port != other.in_phy_port: return False
- if self.total_len != other.total_len: return False
- if self.reason != other.reason: return False
- if self.table_id != other.table_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
- outstr += prefix + 'in_phy_port: ' + str(self.in_phy_port) + '\n'
- outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- return outstr
-
-
-class ofp_instruction_write_metadata(object):
- """Automatically generated Python class for ofp_instruction_write_metadata
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
- self.metadata = 0
- self.metadata_mask = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!QQ", self.metadata, self.metadata_mask)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.metadata, self.metadata_mask) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- if self.metadata != other.metadata: return False
- if self.metadata_mask != other.metadata_mask: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'metadata: ' + str(self.metadata) + '\n'
- outstr += prefix + 'metadata_mask: ' + str(self.metadata_mask) + '\n'
- return outstr
-
-
-class ofp_flow_stats(object):
- """Automatically generated Python class for ofp_flow_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.table_id = 0
- self.pad = 0
- self.duration_sec = 0
- self.duration_nsec = 0
- self.priority = 0x8000
- self.idle_timeout = 0
- self.hard_timeout = 0
- self.pad2= [0,0,0,0,0,0]
- self.cookie = 0
- self.packet_count = 0
- self.byte_count = 0
- self.match = ofp_match()
- self.match.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 6):
- return (False, "self.pad2 is not of size 6 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBLLHHH", self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout)
- packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5])
- packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 136):
- return binaryString
- fmt = '!HBBLLHHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 18
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQQ'
- start = 24
- end = start + struct.calcsize(fmt)
- (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[48:])
- return binaryString[136:]
-
- def __len__(self):
- """Return length of message
- """
- l = 136
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.duration_sec != other.duration_sec: return False
- if self.duration_nsec != other.duration_nsec: return False
- if self.priority != other.priority: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.hard_timeout != other.hard_timeout: return False
- if self.pad2 != other.pad2: return False
- if self.cookie != other.cookie: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
- outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_action_mpls_label(object):
- """Automatically generated Python class for ofp_action_mpls_label
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.mpls_label = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.mpls_label)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.mpls_label) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.mpls_label != other.mpls_label: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'mpls_label: ' + str(self.mpls_label) + '\n'
- return outstr
-
-
-class ofp_flow_stats_request(object):
- """Automatically generated Python class for ofp_flow_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0]
- self.out_port = 0
- self.out_group = 0
- self.pad2= [0,0,0,0]
- self.cookie = 0
- self.cookie_mask = 0
- self.match = ofp_match()
- self.match.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 4):
- return (False, "self.pad2 is not of size 4 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!LL", self.out_port, self.out_group)
- packed += struct.pack("!BBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3])
- packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 120):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[32:])
- return binaryString[120:]
-
- def __len__(self):
- """Return length of message
- """
- l = 120
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.pad2 != other.pad2: return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_header(object):
- """Automatically generated Python class for ofp_header
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.version = 0x02
- self.type = 0
- self.length = 0
- self.xid = 0
-
- def __assert(self):
- """Sanity check
- """
- if (not (self.type in ofp_type_map.keys())):
- return (False, "type must have values from ofp_type_map.keys()")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!BBHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
- if self.length != other.length: return False
- if self.xid != other.xid: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'version: ' + str(self.version) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'xid: ' + str(self.xid) + '\n'
- return outstr
-
-
-class ofp_stats_reply(object):
- """Automatically generated Python class for ofp_stats_reply
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.flags = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.flags)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.flags != other.flags: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- return outstr
-
-
-class ofp_queue_stats_request(object):
- """Automatically generated Python class for ofp_queue_stats_request
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.queue_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.port_no, self.queue_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.queue_id != other.queue_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- return outstr
-
-
-class ofp_desc_stats(object):
- """Automatically generated Python class for ofp_desc_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.mfr_desc= ""
- self.hw_desc= ""
- self.sw_desc= ""
- self.serial_num= ""
- self.dp_desc= ""
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.mfr_desc, str)):
- return (False, "self.mfr_desc is not string as expected.")
- if(len(self.mfr_desc) > 256):
- return (False, "self.mfr_desc is not of size 256 as expected.")
- if(not isinstance(self.hw_desc, str)):
- return (False, "self.hw_desc is not string as expected.")
- if(len(self.hw_desc) > 256):
- return (False, "self.hw_desc is not of size 256 as expected.")
- if(not isinstance(self.sw_desc, str)):
- return (False, "self.sw_desc is not string as expected.")
- if(len(self.sw_desc) > 256):
- return (False, "self.sw_desc is not of size 256 as expected.")
- if(not isinstance(self.serial_num, str)):
- return (False, "self.serial_num is not string as expected.")
- if(len(self.serial_num) > 32):
- return (False, "self.serial_num is not of size 32 as expected.")
- if(not isinstance(self.dp_desc, str)):
- return (False, "self.dp_desc is not string as expected.")
- if(len(self.dp_desc) > 256):
- return (False, "self.dp_desc is not of size 256 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.mfr_desc.ljust(256,'\0')
- packed += self.hw_desc.ljust(256,'\0')
- packed += self.sw_desc.ljust(256,'\0')
- packed += self.serial_num.ljust(32,'\0')
- packed += self.dp_desc.ljust(256,'\0')
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 1056):
- return binaryString
- self.mfr_desc = binaryString[0:256].replace("\0","")
- self.hw_desc = binaryString[256:512].replace("\0","")
- self.sw_desc = binaryString[512:768].replace("\0","")
- self.serial_num = binaryString[768:800].replace("\0","")
- self.dp_desc = binaryString[800:1056].replace("\0","")
- return binaryString[1056:]
-
- def __len__(self):
- """Return length of message
- """
- l = 1056
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.mfr_desc != other.mfr_desc: return False
- if self.hw_desc != other.hw_desc: return False
- if self.sw_desc != other.sw_desc: return False
- if self.serial_num != other.serial_num: return False
- if self.dp_desc != other.dp_desc: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n'
- outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n'
- outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n'
- outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n'
- outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n'
- return outstr
-
-
-class ofp_match(object):
- """Automatically generated Python class for ofp_match
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.length = 0
- self.in_port = 0
- self.wildcards = 0
- self.dl_src= [0,0,0,0,0,0]
- self.dl_src_mask= [0,0,0,0,0,0]
- self.dl_dst= [0,0,0,0,0,0]
- self.dl_dst_mask= [0,0,0,0,0,0]
- self.dl_vlan = 0
- self.dl_vlan_pcp = 0
- self.pad1 = 0
- self.dl_type = 0
- self.nw_tos = 0
- self.nw_proto = 0
- self.nw_src = 0
- self.nw_src_mask = 0
- self.nw_dst = 0
- self.nw_dst_mask = 0
- self.tp_src = 0
- self.tp_dst = 0
- self.mpls_label = 0
- self.mpls_tc = 0
- self.pad2= [0,0,0]
- self.metadata = 0
- self.metadata_mask = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.dl_src, list)):
- return (False, "self.dl_src is not list as expected.")
- if(len(self.dl_src) != 6):
- return (False, "self.dl_src is not of size 6 as expected.")
- if(not isinstance(self.dl_src_mask, list)):
- return (False, "self.dl_src_mask is not list as expected.")
- if(len(self.dl_src_mask) != 6):
- return (False, "self.dl_src_mask is not of size 6 as expected.")
- if(not isinstance(self.dl_dst, list)):
- return (False, "self.dl_dst is not list as expected.")
- if(len(self.dl_dst) != 6):
- return (False, "self.dl_dst is not of size 6 as expected.")
- if(not isinstance(self.dl_dst_mask, list)):
- return (False, "self.dl_dst_mask is not list as expected.")
- if(len(self.dl_dst_mask) != 6):
- return (False, "self.dl_dst_mask is not of size 6 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 3):
- return (False, "self.pad2 is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHLL", self.type, self.length, self.in_port, self.wildcards)
- packed += struct.pack("!BBBBBB", self.dl_src[0], self.dl_src[1], self.dl_src[2], self.dl_src[3], self.dl_src[4], self.dl_src[5])
- packed += struct.pack("!BBBBBB", self.dl_src_mask[0], self.dl_src_mask[1], self.dl_src_mask[2], self.dl_src_mask[3], self.dl_src_mask[4], self.dl_src_mask[5])
- packed += struct.pack("!BBBBBB", self.dl_dst[0], self.dl_dst[1], self.dl_dst[2], self.dl_dst[3], self.dl_dst[4], self.dl_dst[5])
- packed += struct.pack("!BBBBBB", self.dl_dst_mask[0], self.dl_dst_mask[1], self.dl_dst_mask[2], self.dl_dst_mask[3], self.dl_dst_mask[4], self.dl_dst_mask[5])
- packed += struct.pack("!HBBHBBLLLLHHLB", self.dl_vlan, self.dl_vlan_pcp, self.pad1, self.dl_type, self.nw_tos, self.nw_proto, self.nw_src, self.nw_src_mask, self.nw_dst, self.nw_dst_mask, self.tp_src, self.tp_dst, self.mpls_label, self.mpls_tc)
- packed += struct.pack("!BBB", self.pad2[0], self.pad2[1], self.pad2[2])
- packed += struct.pack("!QQ", self.metadata, self.metadata_mask)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 88):
- return binaryString
- fmt = '!HHLL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.length, self.in_port, self.wildcards) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.dl_src[0], self.dl_src[1], self.dl_src[2], self.dl_src[3], self.dl_src[4], self.dl_src[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 18
- end = start + struct.calcsize(fmt)
- (self.dl_src_mask[0], self.dl_src_mask[1], self.dl_src_mask[2], self.dl_src_mask[3], self.dl_src_mask[4], self.dl_src_mask[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 24
- end = start + struct.calcsize(fmt)
- (self.dl_dst[0], self.dl_dst[1], self.dl_dst[2], self.dl_dst[3], self.dl_dst[4], self.dl_dst[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 30
- end = start + struct.calcsize(fmt)
- (self.dl_dst_mask[0], self.dl_dst_mask[1], self.dl_dst_mask[2], self.dl_dst_mask[3], self.dl_dst_mask[4], self.dl_dst_mask[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!HBBHBBLLLLHHLB'
- start = 36
- end = start + struct.calcsize(fmt)
- (self.dl_vlan, self.dl_vlan_pcp, self.pad1, self.dl_type, self.nw_tos, self.nw_proto, self.nw_src, self.nw_src_mask, self.nw_dst, self.nw_dst_mask, self.tp_src, self.tp_dst, self.mpls_label, self.mpls_tc) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 69
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 72
- end = start + struct.calcsize(fmt)
- (self.metadata, self.metadata_mask) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[88:]
-
- def __len__(self):
- """Return length of message
- """
- l = 88
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.length != other.length: return False
- if self.in_port != other.in_port: return False
- if self.wildcards != other.wildcards: return False
- if self.dl_src != other.dl_src: return False
- if self.dl_src_mask != other.dl_src_mask: return False
- if self.dl_dst != other.dl_dst: return False
- if self.dl_dst_mask != other.dl_dst_mask: return False
- if self.dl_vlan != other.dl_vlan: return False
- if self.dl_vlan_pcp != other.dl_vlan_pcp: return False
- if self.pad1 != other.pad1: return False
- if self.dl_type != other.dl_type: return False
- if self.nw_tos != other.nw_tos: return False
- if self.nw_proto != other.nw_proto: return False
- if self.nw_src != other.nw_src: return False
- if self.nw_src_mask != other.nw_src_mask: return False
- if self.nw_dst != other.nw_dst: return False
- if self.nw_dst_mask != other.nw_dst_mask: return False
- if self.tp_src != other.tp_src: return False
- if self.tp_dst != other.tp_dst: return False
- if self.mpls_label != other.mpls_label: return False
- if self.mpls_tc != other.mpls_tc: return False
- if self.pad2 != other.pad2: return False
- if self.metadata != other.metadata: return False
- if self.metadata_mask != other.metadata_mask: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
- outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
- outstr += prefix + 'dl_src: ' + str(self.dl_src) + '\n'
- outstr += prefix + 'dl_src_mask: ' + str(self.dl_src_mask) + '\n'
- outstr += prefix + 'dl_dst: ' + str(self.dl_dst) + '\n'
- outstr += prefix + 'dl_dst_mask: ' + str(self.dl_dst_mask) + '\n'
- outstr += prefix + 'dl_vlan: ' + str(self.dl_vlan) + '\n'
- outstr += prefix + 'dl_vlan_pcp: ' + str(self.dl_vlan_pcp) + '\n'
- outstr += prefix + 'dl_type: ' + str(self.dl_type) + '\n'
- outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n'
- outstr += prefix + 'nw_proto: ' + str(self.nw_proto) + '\n'
- outstr += prefix + 'nw_src: ' + str(self.nw_src) + '\n'
- outstr += prefix + 'nw_src_mask: ' + str(self.nw_src_mask) + '\n'
- outstr += prefix + 'nw_dst: ' + str(self.nw_dst) + '\n'
- outstr += prefix + 'nw_dst_mask: ' + str(self.nw_dst_mask) + '\n'
- outstr += prefix + 'tp_src: ' + str(self.tp_src) + '\n'
- outstr += prefix + 'tp_dst: ' + str(self.tp_dst) + '\n'
- outstr += prefix + 'mpls_label: ' + str(self.mpls_label) + '\n'
- outstr += prefix + 'mpls_tc: ' + str(self.mpls_tc) + '\n'
- outstr += prefix + 'metadata: ' + str(self.metadata) + '\n'
- outstr += prefix + 'metadata_mask: ' + str(self.metadata_mask) + '\n'
- return outstr
-
-
-class ofp_port_stats(object):
- """Automatically generated Python class for ofp_port_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.rx_packets = 0
- self.tx_packets = 0
- self.rx_bytes = 0
- self.tx_bytes = 0
- self.rx_dropped = 0
- self.tx_dropped = 0
- self.rx_errors = 0
- self.tx_errors = 0
- self.rx_frame_err = 0
- self.rx_over_err = 0
- self.rx_crc_err = 0
- self.collisions = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!QQQQQQQQQQQQ", self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 104):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQQQQQQQQQQQ'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[104:]
-
- def __len__(self):
- """Return length of message
- """
- l = 104
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.rx_packets != other.rx_packets: return False
- if self.tx_packets != other.tx_packets: return False
- if self.rx_bytes != other.rx_bytes: return False
- if self.tx_bytes != other.tx_bytes: return False
- if self.rx_dropped != other.rx_dropped: return False
- if self.tx_dropped != other.tx_dropped: return False
- if self.rx_errors != other.rx_errors: return False
- if self.tx_errors != other.tx_errors: return False
- if self.rx_frame_err != other.rx_frame_err: return False
- if self.rx_over_err != other.rx_over_err: return False
- if self.rx_crc_err != other.rx_crc_err: return False
- if self.collisions != other.collisions: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n'
- outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
- outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n'
- outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
- outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n'
- outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n'
- outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n'
- outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
- outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n'
- outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n'
- outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n'
- outstr += prefix + 'collisions: ' + str(self.collisions) + '\n'
- return outstr
-
-
-class ofp_packet_queue(object):
- """Automatically generated Python class for ofp_packet_queue
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.queue_id = 0
- self.len = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LH", self.queue_id, self.len)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.queue_id, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.queue_id != other.queue_id: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_port(object):
- """Automatically generated Python class for ofp_port
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.hw_addr= [0,0,0,0,0,0]
- self.pad2= [0,0]
- self.name= ""
- self.config = 0
- self.state = 0
- self.curr = 0
- self.advertised = 0
- self.supported = 0
- self.peer = 0
- self.curr_speed = 0
- self.max_speed = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- if(not isinstance(self.hw_addr, list)):
- return (False, "self.hw_addr is not list as expected.")
- if(len(self.hw_addr) != 6):
- return (False, "self.hw_addr is not of size 6 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 2):
- return (False, "self.pad2 is not of size 2 as expected.")
- if(not isinstance(self.name, str)):
- return (False, "self.name is not string as expected.")
- if(len(self.name) > 16):
- return (False, "self.name is not of size 16 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
- packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
- packed += self.name.ljust(16,'\0')
- packed += struct.pack("!LLLLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 64):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 14
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
- self.name = binaryString[16:32].replace("\0","")
- fmt = '!LLLLLLLL'
- start = 32
- end = start + struct.calcsize(fmt)
- (self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[64:]
-
- def __len__(self):
- """Return length of message
- """
- l = 64
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.hw_addr != other.hw_addr: return False
- if self.pad2 != other.pad2: return False
- if self.name != other.name: return False
- if self.config != other.config: return False
- if self.state != other.state: return False
- if self.curr != other.curr: return False
- if self.advertised != other.advertised: return False
- if self.supported != other.supported: return False
- if self.peer != other.peer: return False
- if self.curr_speed != other.curr_speed: return False
- if self.max_speed != other.max_speed: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
- outstr += prefix + 'name: ' + str(self.name) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'state: ' + str(self.state) + '\n'
- outstr += prefix + 'curr: ' + str(self.curr) + '\n'
- outstr += prefix + 'advertised: ' + str(self.advertised) + '\n'
- outstr += prefix + 'supported: ' + str(self.supported) + '\n'
- outstr += prefix + 'peer: ' + str(self.peer) + '\n'
- outstr += prefix + 'curr_speed: ' + str(self.curr_speed) + '\n'
- outstr += prefix + 'max_speed: ' + str(self.max_speed) + '\n'
- return outstr
-
-
-class ofp_action_dl_addr(object):
- """Automatically generated Python class for ofp_action_dl_addr
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.dl_addr= [0,0,0,0,0,0]
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.dl_addr, list)):
- return (False, "self.dl_addr is not list as expected.")
- if(len(self.dl_addr) != 6):
- return (False, "self.dl_addr is not of size 6 as expected.")
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBBBB", self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5])
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.dl_addr != other.dl_addr: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'dl_addr: ' + str(self.dl_addr) + '\n'
- return outstr
-
-
-class ofp_bucket_counter(object):
- """Automatically generated Python class for ofp_bucket_counter
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.packet_count = 0
- self.byte_count = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQ", self.packet_count, self.byte_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!QQ'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- return outstr
-
-
-class ofp_queue_prop_min_rate(object):
- """Automatically generated Python class for ofp_queue_prop_min_rate
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.prop_header = ofp_queue_prop_header()
- self.rate = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.prop_header, ofp_queue_prop_header)):
- return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.prop_header.pack()
- packed += struct.pack("!H", self.rate)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- self.prop_header.unpack(binaryString[0:])
- fmt = '!H'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.rate,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.prop_header != other.prop_header: return False
- if self.rate != other.rate: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'prop_header: \n'
- outstr += self.prop_header.show(prefix + ' ')
- outstr += prefix + 'rate: ' + str(self.rate) + '\n'
- return outstr
-
-
-class ofp_bucket(object):
- """Automatically generated Python class for ofp_bucket
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.len = 0
- self.weight = 0
- self.watch_port = 0
- self.watch_group = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHLL", self.len, self.weight, self.watch_port, self.watch_group)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!HHLL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.len, self.weight, self.watch_port, self.watch_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.len != other.len: return False
- if self.weight != other.weight: return False
- if self.watch_port != other.watch_port: return False
- if self.watch_group != other.watch_group: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'weight: ' + str(self.weight) + '\n'
- outstr += prefix + 'watch_port: ' + str(self.watch_port) + '\n'
- outstr += prefix + 'watch_group: ' + str(self.watch_group) + '\n'
- return outstr
-
-
-class ofp_switch_features(object):
- """Automatically generated Python class for ofp_switch_features
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.datapath_id = 0
- self.n_buffers = 0
- self.n_tables = 0
- self.pad= [0,0,0]
- self.capabilities = 0
- self.reserved = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!LL", self.capabilities, self.reserved)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!QLB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 13
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.capabilities, self.reserved) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.datapath_id != other.datapath_id: return False
- if self.n_buffers != other.n_buffers: return False
- if self.n_tables != other.n_tables: return False
- if self.pad != other.pad: return False
- if self.capabilities != other.capabilities: return False
- if self.reserved != other.reserved: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
- outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
- outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
- outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
- outstr += prefix + 'reserved: ' + str(self.reserved) + '\n'
- return outstr
-
-
-class ofp_action_pop_mpls(object):
- """Automatically generated Python class for ofp_action_pop_mpls
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.ethertype = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.ethertype != other.ethertype: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
- return outstr
-
-
-class ofp_flow_mod(object):
- """Automatically generated Python class for ofp_flow_mod
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.cookie = 0
- self.cookie_mask = 0
- self.table_id = 0
- self.command = 0
- self.idle_timeout = 0
- self.hard_timeout = 0
- self.priority = 0x8000
- self.buffer_id = 0
- self.out_port = 0
- self.out_group = 0
- self.flags = 0
- self.pad= [0,0]
- self.match = ofp_match()
- self.match.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQBBHHHLLLH", self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 128):
- return binaryString
- fmt = '!QQBBHHHLLLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 38
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[40:])
- return binaryString[128:]
-
- def __len__(self):
- """Return length of message
- """
- l = 128
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.table_id != other.table_id: return False
- if self.command != other.command: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.hard_timeout != other.hard_timeout: return False
- if self.priority != other.priority: return False
- if self.buffer_id != other.buffer_id: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.flags != other.flags: return False
- if self.pad != other.pad: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'command: ' + str(self.command) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_packet_out(object):
- """Automatically generated Python class for ofp_packet_out
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.buffer_id = 4294967295
- self.in_port = 0
- self.actions_len = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLH", self.buffer_id, self.in_port, self.actions_len)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 12):
- return binaryString
- fmt = '!LLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[12:]
-
- def __len__(self):
- """Return length of message
- """
- l = 12
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.buffer_id != other.buffer_id: return False
- if self.in_port != other.in_port: return False
- if self.actions_len != other.actions_len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
- outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
- return outstr
-
-
-class ofp_instruction_goto_table(object):
- """Automatically generated Python class for ofp_instruction_goto_table
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.table_id = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.table_id) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- return outstr
-
-
-class ofp_action_nw_addr(object):
- """Automatically generated Python class for ofp_action_nw_addr
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.nw_addr = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.nw_addr)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.nw_addr) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.nw_addr != other.nw_addr: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'nw_addr: ' + str(self.nw_addr) + '\n'
- return outstr
-
-
-class ofp_action_group(object):
- """Automatically generated Python class for ofp_action_group
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_group_stats(object):
- """Automatically generated Python class for ofp_group_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.pad= [0,0]
- self.group_id = 0
- self.ref_count = 0
- self.pad2= [0,0,0,0]
- self.packet_count = 0
- self.byte_count = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 4):
- return (False, "self.pad2 is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!H", self.length)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- packed += struct.pack("!LL", self.group_id, self.ref_count)
- packed += struct.pack("!BBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3])
- packed += struct.pack("!QQ", self.packet_count, self.byte_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!H'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 2
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.group_id, self.ref_count) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- if self.ref_count != other.ref_count: return False
- if self.pad2 != other.pad2: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- outstr += prefix + 'ref_count: ' + str(self.ref_count) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- return outstr
-
-
-class ofp_action_vlan_pcp(object):
- """Automatically generated Python class for ofp_action_vlan_pcp
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.vlan_pcp = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.vlan_pcp)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.vlan_pcp) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.vlan_pcp != other.vlan_pcp: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n'
- return outstr
-
-
-class ofp_action_push(object):
- """Automatically generated Python class for ofp_action_push
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.ethertype = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.ethertype != other.ethertype: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
- return outstr
-
-
-class ofp_group_desc_stats(object):
- """Automatically generated Python class for ofp_group_desc_stats
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.type = 0
- self.pad = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBL", self.length, self.type, self.pad, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HBBL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.type != other.type: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_error_msg(object):
- """Automatically generated Python class for ofp_error_msg
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.code = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.code)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.code) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.code != other.code: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'code: ' + str(self.code) + '\n'
- return outstr
-
-
-class ofp_action_mpls_ttl(object):
- """Automatically generated Python class for ofp_action_mpls_ttl
-
- Date 2013-01-06
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.mpls_ttl = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.mpls_ttl)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.mpls_ttl) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.mpls_ttl != other.mpls_ttl: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'mpls_ttl: ' + str(self.mpls_ttl) + '\n'
- return outstr
-
-
-# Enumerated type definitions
-ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_FLOW_MOD_FAILED', 'OFPET_GROUP_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_TABLE_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED', 'OFPET_SWITCH_CONFIG_FAILED']
-OFPET_HELLO_FAILED = 0
-OFPET_BAD_REQUEST = 1
-OFPET_BAD_ACTION = 2
-OFPET_FLOW_MOD_FAILED = 3
-OFPET_GROUP_MOD_FAILED = 4
-OFPET_PORT_MOD_FAILED = 5
-OFPET_TABLE_MOD_FAILED = 6
-OFPET_QUEUE_OP_FAILED = 7
-OFPET_SWITCH_CONFIG_FAILED = 8
-ofp_error_type_map = {
- 0 : 'OFPET_HELLO_FAILED',
- 1 : 'OFPET_BAD_REQUEST',
- 2 : 'OFPET_BAD_ACTION',
- 3 : 'OFPET_FLOW_MOD_FAILED',
- 4 : 'OFPET_GROUP_MOD_FAILED',
- 5 : 'OFPET_PORT_MOD_FAILED',
- 6 : 'OFPET_TABLE_MOD_FAILED',
- 7 : 'OFPET_QUEUE_OP_FAILED',
- 8 : 'OFPET_SWITCH_CONFIG_FAILED'
-}
-
-ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP']
-OFPFF_SEND_FLOW_REM = 1
-OFPFF_CHECK_OVERLAP = 2
-ofp_flow_mod_flags_map = {
- 1 : 'OFPFF_SEND_FLOW_REM',
- 2 : 'OFPFF_CHECK_OVERLAP'
-}
-
-ofp_stats_reply_flags = ['OFPSF_REPLY_MORE']
-OFPSF_REPLY_MORE = 1
-ofp_stats_reply_flags_map = {
- 1 : 'OFPSF_REPLY_MORE'
-}
-
-ofp_port_no = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_ANY']
-OFPP_MAX = 4294967040
-OFPP_IN_PORT = 4294967288
-OFPP_TABLE = 4294967289
-OFPP_NORMAL = 4294967290
-OFPP_FLOOD = 4294967291
-OFPP_ALL = 4294967292
-OFPP_CONTROLLER = 4294967293
-OFPP_LOCAL = 4294967294
-OFPP_ANY = 4294967295
-ofp_port_no_map = {
- 4294967040 : 'OFPP_MAX',
- 4294967288 : 'OFPP_IN_PORT',
- 4294967289 : 'OFPP_TABLE',
- 4294967290 : 'OFPP_NORMAL',
- 4294967291 : 'OFPP_FLOOD',
- 4294967292 : 'OFPP_ALL',
- 4294967293 : 'OFPP_CONTROLLER',
- 4294967294 : 'OFPP_LOCAL',
- 4294967295 : 'OFPP_ANY'
-}
-
-ofp_flow_match_fields = ['OFPFMF_IN_PORT', 'OFPFMF_DL_VLAN', 'OFPFMF_DL_VLAN_PCP', 'OFPFMF_DL_TYPE', 'OFPFMF_NW_TOS', 'OFPFMF_NW_PROTO', 'OFPFMF_TP_SRC', 'OFPFMF_TP_DST', 'OFPFMF_MPLS_LABEL', 'OFPFMF_MPLS_TC', 'OFPFMF_TYPE', 'OFPFMF_DL_SRC', 'OFPFMF_DL_DST', 'OFPFMF_NW_SRC', 'OFPFMF_NW_DST', 'OFPFMF_METADATA']
-OFPFMF_IN_PORT = 1
-OFPFMF_DL_VLAN = 2
-OFPFMF_DL_VLAN_PCP = 4
-OFPFMF_DL_TYPE = 8
-OFPFMF_NW_TOS = 16
-OFPFMF_NW_PROTO = 32
-OFPFMF_TP_SRC = 64
-OFPFMF_TP_DST = 128
-OFPFMF_MPLS_LABEL = 256
-OFPFMF_MPLS_TC = 512
-OFPFMF_TYPE = 1024
-OFPFMF_DL_SRC = 2048
-OFPFMF_DL_DST = 4096
-OFPFMF_NW_SRC = 8192
-OFPFMF_NW_DST = 16384
-OFPFMF_METADATA = 32768
-ofp_flow_match_fields_map = {
- 1 : 'OFPFMF_IN_PORT',
- 2 : 'OFPFMF_DL_VLAN',
- 4 : 'OFPFMF_DL_VLAN_PCP',
- 8 : 'OFPFMF_DL_TYPE',
- 16 : 'OFPFMF_NW_TOS',
- 32 : 'OFPFMF_NW_PROTO',
- 64 : 'OFPFMF_TP_SRC',
- 128 : 'OFPFMF_TP_DST',
- 256 : 'OFPFMF_MPLS_LABEL',
- 512 : 'OFPFMF_MPLS_TC',
- 1024 : 'OFPFMF_TYPE',
- 2048 : 'OFPFMF_DL_SRC',
- 4096 : 'OFPFMF_DL_DST',
- 8192 : 'OFPFMF_NW_SRC',
- 16384 : 'OFPFMF_NW_DST',
- 32768 : 'OFPFMF_METADATA'
-}
-
-ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_EXPERIMENTER', 'OFPBRC_BAD_SUBTYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN', 'OFPBRC_BAD_TABLE_ID']
-OFPBRC_BAD_VERSION = 0
-OFPBRC_BAD_TYPE = 1
-OFPBRC_BAD_STAT = 2
-OFPBRC_BAD_EXPERIMENTER = 3
-OFPBRC_BAD_SUBTYPE = 4
-OFPBRC_EPERM = 5
-OFPBRC_BAD_LEN = 6
-OFPBRC_BUFFER_EMPTY = 7
-OFPBRC_BUFFER_UNKNOWN = 8
-OFPBRC_BAD_TABLE_ID = 9
-ofp_bad_request_code_map = {
- 0 : 'OFPBRC_BAD_VERSION',
- 1 : 'OFPBRC_BAD_TYPE',
- 2 : 'OFPBRC_BAD_STAT',
- 3 : 'OFPBRC_BAD_EXPERIMENTER',
- 4 : 'OFPBRC_BAD_SUBTYPE',
- 5 : 'OFPBRC_EPERM',
- 6 : 'OFPBRC_BAD_LEN',
- 7 : 'OFPBRC_BUFFER_EMPTY',
- 8 : 'OFPBRC_BUFFER_UNKNOWN',
- 9 : 'OFPBRC_BAD_TABLE_ID'
-}
-
-ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_RECV', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN']
-OFPPC_PORT_DOWN = 1
-OFPPC_NO_RECV = 4
-OFPPC_NO_FWD = 32
-OFPPC_NO_PACKET_IN = 64
-ofp_port_config_map = {
- 1 : 'OFPPC_PORT_DOWN',
- 4 : 'OFPPC_NO_RECV',
- 32 : 'OFPPC_NO_FWD',
- 64 : 'OFPPC_NO_PACKET_IN'
-}
-
-ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_BLOCKED', 'OFPPS_LIVE']
-OFPPS_LINK_DOWN = 1
-OFPPS_BLOCKED = 2
-OFPPS_LIVE = 4
-ofp_port_state_map = {
- 1 : 'OFPPS_LINK_DOWN',
- 2 : 'OFPPS_BLOCKED',
- 4 : 'OFPPS_LIVE'
-}
-
-ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK', 'OFPC_INVALID_TTL_TO_CONTROLLER']
-OFPC_FRAG_NORMAL = 0
-OFPC_FRAG_DROP = 1
-OFPC_FRAG_REASM = 2
-OFPC_FRAG_MASK = 3
-OFPC_INVALID_TTL_TO_CONTROLLER = 4
-ofp_config_flags_map = {
- 0 : 'OFPC_FRAG_NORMAL',
- 1 : 'OFPC_FRAG_DROP',
- 2 : 'OFPC_FRAG_REASM',
- 3 : 'OFPC_FRAG_MASK',
- 4 : 'OFPC_INVALID_TTL_TO_CONTROLLER'
-}
-
-ofp_switch_config_failed_code = ['OFPSCFC_BAD_FLAGS', 'OFPSCFC_BAD_LEN']
-OFPSCFC_BAD_FLAGS = 0
-OFPSCFC_BAD_LEN = 1
-ofp_switch_config_failed_code_map = {
- 0 : 'OFPSCFC_BAD_FLAGS',
- 1 : 'OFPSCFC_BAD_LEN'
-}
-
-ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM']
-OFPHFC_INCOMPATIBLE = 0
-OFPHFC_EPERM = 1
-ofp_hello_failed_code_map = {
- 0 : 'OFPHFC_INCOMPATIBLE',
- 1 : 'OFPHFC_EPERM'
-}
-
-ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_GROUP_STATS', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_ARP_MATCH_IP']
-OFPC_FLOW_STATS = 1
-OFPC_TABLE_STATS = 2
-OFPC_PORT_STATS = 4
-OFPC_GROUP_STATS = 8
-OFPC_IP_REASM = 32
-OFPC_QUEUE_STATS = 64
-OFPC_ARP_MATCH_IP = 128
-ofp_capabilities_map = {
- 1 : 'OFPC_FLOW_STATS',
- 2 : 'OFPC_TABLE_STATS',
- 4 : 'OFPC_PORT_STATS',
- 8 : 'OFPC_GROUP_STATS',
- 32 : 'OFPC_IP_REASM',
- 64 : 'OFPC_QUEUE_STATS',
- 128 : 'OFPC_ARP_MATCH_IP'
-}
-
-ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE', 'OFPRR_GROUP_DELETE']
-OFPRR_IDLE_TIMEOUT = 0
-OFPRR_HARD_TIMEOUT = 1
-OFPRR_DELETE = 2
-OFPRR_GROUP_DELETE = 3
-ofp_flow_removed_reason_map = {
- 0 : 'OFPRR_IDLE_TIMEOUT',
- 1 : 'OFPRR_HARD_TIMEOUT',
- 2 : 'OFPRR_DELETE',
- 3 : 'OFPRR_GROUP_DELETE'
-}
-
-ofp_table_mod_failed_code = ['OFPTMFC_BAD_TABLE', 'OFPTMFC_BAD_CONFIG']
-OFPTMFC_BAD_TABLE = 0
-OFPTMFC_BAD_CONFIG = 1
-ofp_table_mod_failed_code_map = {
- 0 : 'OFPTMFC_BAD_TABLE',
- 1 : 'OFPTMFC_BAD_CONFIG'
-}
-
-ofp_queue_properties = ['OFPQT_NONE', 'OFPQT_MIN_RATE']
-OFPQT_NONE = 0
-OFPQT_MIN_RATE = 0
-ofp_queue_properties_map = {
- 0 : 'OFPQT_NONE',
- 0 : 'OFPQT_MIN_RATE'
-}
-
-ofp_flow_wildcards = ['OFPFW_IN_PORT', 'OFPFW_DL_VLAN', 'OFPFW_DL_VLAN_PCP', 'OFPFW_DL_TYPE', 'OFPFW_NW_TOS', 'OFPFW_NW_PROTO', 'OFPFW_TP_SRC', 'OFPFW_TP_DST', 'OFPFW_MPLS_LABEL', 'OFPFW_MPLS_TC', 'OFPFW_ALL']
-OFPFW_IN_PORT = 1
-OFPFW_DL_VLAN = 2
-OFPFW_DL_VLAN_PCP = 4
-OFPFW_DL_TYPE = 8
-OFPFW_NW_TOS = 16
-OFPFW_NW_PROTO = 32
-OFPFW_TP_SRC = 64
-OFPFW_TP_DST = 128
-OFPFW_MPLS_LABEL = 256
-OFPFW_MPLS_TC = 512
-OFPFW_ALL = 1023
-ofp_flow_wildcards_map = {
- 1 : 'OFPFW_IN_PORT',
- 2 : 'OFPFW_DL_VLAN',
- 4 : 'OFPFW_DL_VLAN_PCP',
- 8 : 'OFPFW_DL_TYPE',
- 16 : 'OFPFW_NW_TOS',
- 32 : 'OFPFW_NW_PROTO',
- 64 : 'OFPFW_TP_SRC',
- 128 : 'OFPFW_TP_DST',
- 256 : 'OFPFW_MPLS_LABEL',
- 512 : 'OFPFW_MPLS_TC',
- 1023 : 'OFPFW_ALL'
-}
-
-ofp_group = ['OFPG_MAX', 'OFPG_ALL', 'OFPG_ANY']
-OFPG_MAX = 4294967040
-OFPG_ALL = 4294967292
-OFPG_ANY = 4294967295
-ofp_group_map = {
- 4294967040 : 'OFPG_MAX',
- 4294967292 : 'OFPG_ALL',
- 4294967295 : 'OFPG_ANY'
-}
-
-ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY']
-OFPPR_ADD = 0
-OFPPR_DELETE = 1
-OFPPR_MODIFY = 2
-ofp_port_reason_map = {
- 0 : 'OFPPR_ADD',
- 1 : 'OFPPR_DELETE',
- 2 : 'OFPPR_MODIFY'
-}
-
-ofp_table_config = ['OFPTC_TABLE_MISS_CONTROLLER', 'OFPTC_TABLE_MISS_CONTINUE', 'OFPTC_TABLE_MISS_DROP', 'OFPTC_TABLE_MISS_MASK']
-OFPTC_TABLE_MISS_CONTROLLER = 0
-OFPTC_TABLE_MISS_CONTINUE = 1
-OFPTC_TABLE_MISS_DROP = 2
-OFPTC_TABLE_MISS_MASK = 3
-ofp_table_config_map = {
- 0 : 'OFPTC_TABLE_MISS_CONTROLLER',
- 1 : 'OFPTC_TABLE_MISS_CONTINUE',
- 2 : 'OFPTC_TABLE_MISS_DROP',
- 3 : 'OFPTC_TABLE_MISS_MASK'
-}
-
-ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_SET_VLAN_VID', 'OFPAT_SET_VLAN_PCP', 'OFPAT_SET_DL_SRC', 'OFPAT_SET_DL_DST', 'OFPAT_SET_NW_SRC', 'OFPAT_SET_NW_DST', 'OFPAT_SET_NW_TOS', 'OFPAT_SET_NW_ECN', 'OFPAT_SET_TP_SRC', 'OFPAT_SET_TP_DST', 'OFPAT_COPY_TTL_OUT', 'OFPAT_COPY_TTL_IN', 'OFPAT_SET_MPLS_LABEL', 'OFPAT_SET_MPLS_TC', 'OFPAT_SET_MPLS_TTL', 'OFPAT_DEC_MPLS_TTL', 'OFPAT_PUSH_VLAN', 'OFPAT_POP_VLAN', 'OFPAT_PUSH_MPLS', 'OFPAT_POP_MPLS', 'OFPAT_SET_QUEUE', 'OFPAT_GROUP', 'OFPAT_SET_NW_TTL', 'OFPAT_DEC_NW_TTL', 'OFPAT_EXPERIMENTER']
-OFPAT_OUTPUT = 0
-OFPAT_SET_VLAN_VID = 1
-OFPAT_SET_VLAN_PCP = 2
-OFPAT_SET_DL_SRC = 3
-OFPAT_SET_DL_DST = 4
-OFPAT_SET_NW_SRC = 5
-OFPAT_SET_NW_DST = 6
-OFPAT_SET_NW_TOS = 7
-OFPAT_SET_NW_ECN = 8
-OFPAT_SET_TP_SRC = 9
-OFPAT_SET_TP_DST = 10
-OFPAT_COPY_TTL_OUT = 11
-OFPAT_COPY_TTL_IN = 12
-OFPAT_SET_MPLS_LABEL = 13
-OFPAT_SET_MPLS_TC = 14
-OFPAT_SET_MPLS_TTL = 15
-OFPAT_DEC_MPLS_TTL = 16
-OFPAT_PUSH_VLAN = 17
-OFPAT_POP_VLAN = 18
-OFPAT_PUSH_MPLS = 19
-OFPAT_POP_MPLS = 20
-OFPAT_SET_QUEUE = 21
-OFPAT_GROUP = 22
-OFPAT_SET_NW_TTL = 23
-OFPAT_DEC_NW_TTL = 24
-OFPAT_EXPERIMENTER = 65535
-ofp_action_type_map = {
- 0 : 'OFPAT_OUTPUT',
- 1 : 'OFPAT_SET_VLAN_VID',
- 2 : 'OFPAT_SET_VLAN_PCP',
- 3 : 'OFPAT_SET_DL_SRC',
- 4 : 'OFPAT_SET_DL_DST',
- 5 : 'OFPAT_SET_NW_SRC',
- 6 : 'OFPAT_SET_NW_DST',
- 7 : 'OFPAT_SET_NW_TOS',
- 8 : 'OFPAT_SET_NW_ECN',
- 9 : 'OFPAT_SET_TP_SRC',
- 10 : 'OFPAT_SET_TP_DST',
- 11 : 'OFPAT_COPY_TTL_OUT',
- 12 : 'OFPAT_COPY_TTL_IN',
- 13 : 'OFPAT_SET_MPLS_LABEL',
- 14 : 'OFPAT_SET_MPLS_TC',
- 15 : 'OFPAT_SET_MPLS_TTL',
- 16 : 'OFPAT_DEC_MPLS_TTL',
- 17 : 'OFPAT_PUSH_VLAN',
- 18 : 'OFPAT_POP_VLAN',
- 19 : 'OFPAT_PUSH_MPLS',
- 20 : 'OFPAT_POP_MPLS',
- 21 : 'OFPAT_SET_QUEUE',
- 22 : 'OFPAT_GROUP',
- 23 : 'OFPAT_SET_NW_TTL',
- 24 : 'OFPAT_DEC_NW_TTL',
- 65535 : 'OFPAT_EXPERIMENTER'
-}
-
-ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT']
-OFPFC_ADD = 0
-OFPFC_MODIFY = 1
-OFPFC_MODIFY_STRICT = 2
-OFPFC_DELETE = 3
-OFPFC_DELETE_STRICT = 4
-ofp_flow_mod_command_map = {
- 0 : 'OFPFC_ADD',
- 1 : 'OFPFC_MODIFY',
- 2 : 'OFPFC_MODIFY_STRICT',
- 3 : 'OFPFC_DELETE',
- 4 : 'OFPFC_DELETE_STRICT'
-}
-
-ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM']
-OFPQOFC_BAD_PORT = 0
-OFPQOFC_BAD_QUEUE = 1
-OFPQOFC_EPERM = 2
-ofp_queue_op_failed_code_map = {
- 0 : 'OFPQOFC_BAD_PORT',
- 1 : 'OFPQOFC_BAD_QUEUE',
- 2 : 'OFPQOFC_EPERM'
-}
-
-ofp_match_type = ['OFPMT_STANDARD']
-OFPMT_STANDARD = 0
-ofp_match_type_map = {
- 0 : 'OFPMT_STANDARD'
-}
-
-ofp_vlan_id = ['OFPVID_ANY', 'OFPVID_NONE']
-OFPVID_ANY = 65534
-OFPVID_NONE = 65535
-ofp_vlan_id_map = {
- 65534 : 'OFPVID_ANY',
- 65535 : 'OFPVID_NONE'
-}
-
-ofp_group_mod_failed_code = ['OFPGMFC_GROUP_EXISTS', 'OFPGMFC_INVALID_GROUP', 'OFPGMFC_WEIGHT_UNSUPPORTED', 'OFPGMFC_OUT_OF_GROUPS', 'OFPGMFC_OUT_OF_BUCKETS', 'OFPGMFC_CHAINING_UNSUPPORTED', 'OFPGMFC_WATCH_UNSUPPORTED', 'OFPGMFC_LOOP', 'OFPGMFC_UNKNOWN_GROUP']
-OFPGMFC_GROUP_EXISTS = 0
-OFPGMFC_INVALID_GROUP = 1
-OFPGMFC_WEIGHT_UNSUPPORTED = 2
-OFPGMFC_OUT_OF_GROUPS = 3
-OFPGMFC_OUT_OF_BUCKETS = 4
-OFPGMFC_CHAINING_UNSUPPORTED = 5
-OFPGMFC_WATCH_UNSUPPORTED = 6
-OFPGMFC_LOOP = 7
-OFPGMFC_UNKNOWN_GROUP = 8
-ofp_group_mod_failed_code_map = {
- 0 : 'OFPGMFC_GROUP_EXISTS',
- 1 : 'OFPGMFC_INVALID_GROUP',
- 2 : 'OFPGMFC_WEIGHT_UNSUPPORTED',
- 3 : 'OFPGMFC_OUT_OF_GROUPS',
- 4 : 'OFPGMFC_OUT_OF_BUCKETS',
- 5 : 'OFPGMFC_CHAINING_UNSUPPORTED',
- 6 : 'OFPGMFC_WATCH_UNSUPPORTED',
- 7 : 'OFPGMFC_LOOP',
- 8 : 'OFPGMFC_UNKNOWN_GROUP'
-}
-
-ofp_group_type = ['OFPGT_ALL', 'OFPGT_SELECT', 'OFPGT_INDIRECT', 'OFPGT_FF']
-OFPGT_ALL = 0
-OFPGT_SELECT = 1
-OFPGT_INDIRECT = 2
-OFPGT_FF = 3
-ofp_group_type_map = {
- 0 : 'OFPGT_ALL',
- 1 : 'OFPGT_SELECT',
- 2 : 'OFPGT_INDIRECT',
- 3 : 'OFPGT_FF'
-}
-
-ofp_instruction_type = ['OFPIT_GOTO_TABLE', 'OFPIT_WRITE_METADATA', 'OFPIT_WRITE_ACTIONS', 'OFPIT_APPLY_ACTIONS', 'OFPIT_CLEAR_ACTIONS', 'OFPIT_EXPERIMENTER']
-OFPIT_GOTO_TABLE = 1
-OFPIT_WRITE_METADATA = 2
-OFPIT_WRITE_ACTIONS = 3
-OFPIT_APPLY_ACTIONS = 4
-OFPIT_CLEAR_ACTIONS = 5
-OFPIT_EXPERIMENTER = 65535
-ofp_instruction_type_map = {
- 1 : 'OFPIT_GOTO_TABLE',
- 2 : 'OFPIT_WRITE_METADATA',
- 3 : 'OFPIT_WRITE_ACTIONS',
- 4 : 'OFPIT_APPLY_ACTIONS',
- 5 : 'OFPIT_CLEAR_ACTIONS',
- 65535 : 'OFPIT_EXPERIMENTER'
-}
-
-ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_EXPERIMENTER', 'OFPBAC_BAD_EXPERIMENTER_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE', 'OFPBAC_BAD_OUT_GROUP', 'OFPBAC_MATCH_INCONSISTENT', 'OFPBAC_UNSUPPORTED_ORDER']
-OFPBAC_BAD_TYPE = 0
-OFPBAC_BAD_LEN = 1
-OFPBAC_BAD_EXPERIMENTER = 2
-OFPBAC_BAD_EXPERIMENTER_TYPE = 3
-OFPBAC_BAD_OUT_PORT = 4
-OFPBAC_BAD_ARGUMENT = 5
-OFPBAC_EPERM = 6
-OFPBAC_TOO_MANY = 7
-OFPBAC_BAD_QUEUE = 8
-OFPBAC_BAD_OUT_GROUP = 9
-OFPBAC_MATCH_INCONSISTENT = 10
-OFPBAC_UNSUPPORTED_ORDER = 11
-ofp_bad_action_code_map = {
- 0 : 'OFPBAC_BAD_TYPE',
- 1 : 'OFPBAC_BAD_LEN',
- 2 : 'OFPBAC_BAD_EXPERIMENTER',
- 3 : 'OFPBAC_BAD_EXPERIMENTER_TYPE',
- 4 : 'OFPBAC_BAD_OUT_PORT',
- 5 : 'OFPBAC_BAD_ARGUMENT',
- 6 : 'OFPBAC_EPERM',
- 7 : 'OFPBAC_TOO_MANY',
- 8 : 'OFPBAC_BAD_QUEUE',
- 9 : 'OFPBAC_BAD_OUT_GROUP',
- 10 : 'OFPBAC_MATCH_INCONSISTENT',
- 11 : 'OFPBAC_UNSUPPORTED_ORDER'
-}
-
-ofp_flow_mod_failed_code = ['OFPFMFC_UNKNOWN', 'OFPFMFC_TABLE_FULL', 'OFPFMFC_BAD_TABLE_ID', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_BAD_INSTRUCTION', 'OFPFMFC_BAD_MATCH', 'OFPFMFC_BAD_MATCH_TYPE', 'OFPFMFC_BAD_TAG', 'OFPFMFC_BAD_DL_ADDR_MASK', 'OFPFMFC_BAD_NW_ADDR_MASK']
-OFPFMFC_UNKNOWN = 0
-OFPFMFC_TABLE_FULL = 1
-OFPFMFC_BAD_TABLE_ID = 2
-OFPFMFC_OVERLAP = 3
-OFPFMFC_EPERM = 4
-OFPFMFC_BAD_TIMEOUT = 5
-OFPFMFC_BAD_COMMAND = 6
-OFPFMFC_BAD_INSTRUCTION = 7
-OFPFMFC_BAD_MATCH = 8
-OFPFMFC_BAD_MATCH_TYPE = 9
-OFPFMFC_BAD_TAG = 10
-OFPFMFC_BAD_DL_ADDR_MASK = 11
-OFPFMFC_BAD_NW_ADDR_MASK = 12
-ofp_flow_mod_failed_code_map = {
- 0 : 'OFPFMFC_UNKNOWN',
- 1 : 'OFPFMFC_TABLE_FULL',
- 2 : 'OFPFMFC_BAD_TABLE_ID',
- 3 : 'OFPFMFC_OVERLAP',
- 4 : 'OFPFMFC_EPERM',
- 5 : 'OFPFMFC_BAD_TIMEOUT',
- 6 : 'OFPFMFC_BAD_COMMAND',
- 7 : 'OFPFMFC_BAD_INSTRUCTION',
- 8 : 'OFPFMFC_BAD_MATCH',
- 9 : 'OFPFMFC_BAD_MATCH_TYPE',
- 10 : 'OFPFMFC_BAD_TAG',
- 11 : 'OFPFMFC_BAD_DL_ADDR_MASK',
- 12 : 'OFPFMFC_BAD_NW_ADDR_MASK'
-}
-
-ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR', 'OFPPMFC_BAD_CONFIG', 'OFPPMFC_BAD_ADVERTISE']
-OFPPMFC_BAD_PORT = 0
-OFPPMFC_BAD_HW_ADDR = 1
-OFPPMFC_BAD_CONFIG = 2
-OFPPMFC_BAD_ADVERTISE = 3
-ofp_port_mod_failed_code_map = {
- 0 : 'OFPPMFC_BAD_PORT',
- 1 : 'OFPPMFC_BAD_HW_ADDR',
- 2 : 'OFPPMFC_BAD_CONFIG',
- 3 : 'OFPPMFC_BAD_ADVERTISE'
-}
-
-ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_EXPERIMENTER', 'OFPT_FEATURES_REQUEST', 'OFPT_FEATURES_REPLY', 'OFPT_GET_CONFIG_REQUEST', 'OFPT_GET_CONFIG_REPLY', 'OFPT_SET_CONFIG', 'OFPT_PACKET_IN', 'OFPT_FLOW_REMOVED', 'OFPT_PORT_STATUS', 'OFPT_PACKET_OUT', 'OFPT_FLOW_MOD', 'OFPT_GROUP_MOD', 'OFPT_PORT_MOD', 'OFPT_TABLE_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY']
-OFPT_HELLO = 0
-OFPT_ERROR = 1
-OFPT_ECHO_REQUEST = 2
-OFPT_ECHO_REPLY = 3
-OFPT_EXPERIMENTER = 4
-OFPT_FEATURES_REQUEST = 5
-OFPT_FEATURES_REPLY = 6
-OFPT_GET_CONFIG_REQUEST = 7
-OFPT_GET_CONFIG_REPLY = 8
-OFPT_SET_CONFIG = 9
-OFPT_PACKET_IN = 10
-OFPT_FLOW_REMOVED = 11
-OFPT_PORT_STATUS = 12
-OFPT_PACKET_OUT = 13
-OFPT_FLOW_MOD = 14
-OFPT_GROUP_MOD = 15
-OFPT_PORT_MOD = 16
-OFPT_TABLE_MOD = 17
-OFPT_STATS_REQUEST = 18
-OFPT_STATS_REPLY = 19
-OFPT_BARRIER_REQUEST = 20
-OFPT_BARRIER_REPLY = 21
-OFPT_QUEUE_GET_CONFIG_REQUEST = 22
-OFPT_QUEUE_GET_CONFIG_REPLY = 23
-ofp_type_map = {
- 0 : 'OFPT_HELLO',
- 1 : 'OFPT_ERROR',
- 2 : 'OFPT_ECHO_REQUEST',
- 3 : 'OFPT_ECHO_REPLY',
- 4 : 'OFPT_EXPERIMENTER',
- 5 : 'OFPT_FEATURES_REQUEST',
- 6 : 'OFPT_FEATURES_REPLY',
- 7 : 'OFPT_GET_CONFIG_REQUEST',
- 8 : 'OFPT_GET_CONFIG_REPLY',
- 9 : 'OFPT_SET_CONFIG',
- 10 : 'OFPT_PACKET_IN',
- 11 : 'OFPT_FLOW_REMOVED',
- 12 : 'OFPT_PORT_STATUS',
- 13 : 'OFPT_PACKET_OUT',
- 14 : 'OFPT_FLOW_MOD',
- 15 : 'OFPT_GROUP_MOD',
- 16 : 'OFPT_PORT_MOD',
- 17 : 'OFPT_TABLE_MOD',
- 18 : 'OFPT_STATS_REQUEST',
- 19 : 'OFPT_STATS_REPLY',
- 20 : 'OFPT_BARRIER_REQUEST',
- 21 : 'OFPT_BARRIER_REPLY',
- 22 : 'OFPT_QUEUE_GET_CONFIG_REQUEST',
- 23 : 'OFPT_QUEUE_GET_CONFIG_REPLY'
-}
-
-ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION']
-OFPR_NO_MATCH = 0
-OFPR_ACTION = 1
-ofp_packet_in_reason_map = {
- 0 : 'OFPR_NO_MATCH',
- 1 : 'OFPR_ACTION'
-}
-
-ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_GROUP', 'OFPST_GROUP_DESC', 'OFPST_EXPERIMENTER']
-OFPST_DESC = 0
-OFPST_FLOW = 1
-OFPST_AGGREGATE = 2
-OFPST_TABLE = 3
-OFPST_PORT = 4
-OFPST_QUEUE = 5
-OFPST_GROUP = 6
-OFPST_GROUP_DESC = 7
-OFPST_EXPERIMENTER = 65535
-ofp_stats_types_map = {
- 0 : 'OFPST_DESC',
- 1 : 'OFPST_FLOW',
- 2 : 'OFPST_AGGREGATE',
- 3 : 'OFPST_TABLE',
- 4 : 'OFPST_PORT',
- 5 : 'OFPST_QUEUE',
- 6 : 'OFPST_GROUP',
- 7 : 'OFPST_GROUP_DESC',
- 65535 : 'OFPST_EXPERIMENTER'
-}
-
-ofp_group_mod_command = ['OFPGC_ADD', 'OFPGC_MODIFY', 'OFPGC_DELETE']
-OFPGC_ADD = 0
-OFPGC_MODIFY = 1
-OFPGC_DELETE = 2
-ofp_group_mod_command_map = {
- 0 : 'OFPGC_ADD',
- 1 : 'OFPGC_MODIFY',
- 2 : 'OFPGC_DELETE'
-}
-
-ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_40GB_FD', 'OFPPF_100GB_FD', 'OFPPF_1TB_FD', 'OFPPF_LUDICROUS', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM']
-OFPPF_10MB_HD = 1
-OFPPF_10MB_FD = 2
-OFPPF_100MB_HD = 4
-OFPPF_100MB_FD = 8
-OFPPF_1GB_HD = 16
-OFPPF_1GB_FD = 32
-OFPPF_10GB_FD = 64
-OFPPF_40GB_FD = 128
-OFPPF_100GB_FD = 256
-OFPPF_1TB_FD = 512
-OFPPF_LUDICROUS = 1024
-OFPPF_COPPER = 2048
-OFPPF_FIBER = 4096
-OFPPF_AUTONEG = 8192
-OFPPF_PAUSE = 16384
-OFPPF_PAUSE_ASYM = 32768
-ofp_port_features_map = {
- 1 : 'OFPPF_10MB_HD',
- 2 : 'OFPPF_10MB_FD',
- 4 : 'OFPPF_100MB_HD',
- 8 : 'OFPPF_100MB_FD',
- 16 : 'OFPPF_1GB_HD',
- 32 : 'OFPPF_1GB_FD',
- 64 : 'OFPPF_10GB_FD',
- 128 : 'OFPPF_40GB_FD',
- 256 : 'OFPPF_100GB_FD',
- 512 : 'OFPPF_1TB_FD',
- 1024 : 'OFPPF_LUDICROUS',
- 2048 : 'OFPPF_COPPER',
- 4096 : 'OFPPF_FIBER',
- 8192 : 'OFPPF_AUTONEG',
- 16384 : 'OFPPF_PAUSE',
- 32768 : 'OFPPF_PAUSE_ASYM'
-}
-
-ofp_mpls_label = ['OFPML_ANY', 'OFPML_NONE']
-OFPML_ANY = 16777214
-OFPML_NONE = 16777215
-ofp_mpls_label_map = {
- 16777214 : 'OFPML_ANY',
- 16777215 : 'OFPML_NONE'
-}
-
-# Values from macro definitions
-OFP_FLOW_PERMANENT = 0
-OFP_DL_TYPE_ETH2_CUTOFF = 0x0600
-DESC_STR_LEN = 256
-OFPFW_ICMP_CODE = OFPFW_TP_DST
-OFPQ_MIN_RATE_UNCFG = 0xffff
-OFP_VERSION = 0x02
-OFP_MAX_TABLE_NAME_LEN = 32
-OFP_DL_TYPE_NOT_ETH_TYPE = 0x05ff
-OFP_DEFAULT_MISS_SEND_LEN = 128
-OFP_MAX_PORT_NAME_LEN = 16
-OFP_SSL_PORT = 6633
-OFPMT_STANDARD_LENGTH = 88
-OFPFW_ICMP_TYPE = OFPFW_TP_SRC
-OFP_TCP_PORT = 6633
-SERIAL_NUM_LEN = 32
-OFP_DEFAULT_PRIORITY = 0x8000
-OFP_ETH_ALEN = 6
-OFP_VLAN_NONE = OFPVID_NONE
-OFPQ_ALL = 0xffffffff
-
-# Basic structure size definitions.
-# Does not include ofp_header members.
-# Does not include variable length arrays.
-OFP_ACTION_DL_ADDR_BYTES = 16
-OFP_ACTION_EXPERIMENTER_HEADER_BYTES = 8
-OFP_ACTION_GROUP_BYTES = 8
-OFP_ACTION_HEADER_BYTES = 8
-OFP_ACTION_MPLS_LABEL_BYTES = 8
-OFP_ACTION_MPLS_TC_BYTES = 8
-OFP_ACTION_MPLS_TTL_BYTES = 8
-OFP_ACTION_NW_ADDR_BYTES = 8
-OFP_ACTION_NW_ECN_BYTES = 8
-OFP_ACTION_NW_TOS_BYTES = 8
-OFP_ACTION_NW_TTL_BYTES = 8
-OFP_ACTION_OUTPUT_BYTES = 16
-OFP_ACTION_POP_MPLS_BYTES = 8
-OFP_ACTION_PUSH_BYTES = 8
-OFP_ACTION_SET_QUEUE_BYTES = 8
-OFP_ACTION_TP_PORT_BYTES = 8
-OFP_ACTION_VLAN_PCP_BYTES = 8
-OFP_ACTION_VLAN_VID_BYTES = 8
-OFP_AGGREGATE_STATS_REPLY_BYTES = 24
-OFP_AGGREGATE_STATS_REQUEST_BYTES = 120
-OFP_BUCKET_BYTES = 16
-OFP_BUCKET_COUNTER_BYTES = 16
-OFP_DESC_STATS_BYTES = 1056
-OFP_ERROR_MSG_BYTES = 4
-OFP_EXPERIMENTER_HEADER_BYTES = 4
-OFP_FLOW_MOD_BYTES = 128
-OFP_FLOW_REMOVED_BYTES = 128
-OFP_FLOW_STATS_BYTES = 136
-OFP_FLOW_STATS_REQUEST_BYTES = 120
-OFP_GROUP_DESC_STATS_BYTES = 8
-OFP_GROUP_MOD_BYTES = 8
-OFP_GROUP_STATS_BYTES = 32
-OFP_GROUP_STATS_REQUEST_BYTES = 8
-OFP_HEADER_BYTES = 8
-OFP_HELLO_BYTES = 0
-OFP_INSTRUCTION_BYTES = 8
-OFP_INSTRUCTION_ACTIONS_BYTES = 8
-OFP_INSTRUCTION_EXPERIMENTER_BYTES = 8
-OFP_INSTRUCTION_GOTO_TABLE_BYTES = 8
-OFP_INSTRUCTION_WRITE_METADATA_BYTES = 24
-OFP_MATCH_BYTES = 88
-OFP_PACKET_IN_BYTES = 16
-OFP_PACKET_OUT_BYTES = 12
-OFP_PACKET_QUEUE_BYTES = 8
-OFP_PORT_BYTES = 64
-OFP_PORT_MOD_BYTES = 32
-OFP_PORT_STATS_BYTES = 104
-OFP_PORT_STATS_REQUEST_BYTES = 8
-OFP_PORT_STATUS_BYTES = 72
-OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
-OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 4
-OFP_QUEUE_PROP_HEADER_BYTES = 8
-OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
-OFP_QUEUE_STATS_BYTES = 32
-OFP_QUEUE_STATS_REQUEST_BYTES = 8
-OFP_STATS_REPLY_BYTES = 4
-OFP_STATS_REQUEST_BYTES = 4
-OFP_SWITCH_CONFIG_BYTES = 4
-OFP_SWITCH_FEATURES_BYTES = 24
-OFP_TABLE_MOD_BYTES = 8
-OFP_TABLE_STATS_BYTES = 88
-
diff --git a/src/python/of11/error.py b/src/python/of11/error.py
deleted file mode 100644
index 3ea74f4..0000000
--- a/src/python/of11/error.py
+++ /dev/null
@@ -1,456 +0,0 @@
-
-# Python OpenFlow error wrapper classes
-
-from cstruct import *
-
-
-
-class hello_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for hello_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_HELLO_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "hello_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_request_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_request error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_REQUEST
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_request_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_action_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_action error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_ACTION
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_action_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for flow_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_FLOW_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "flow_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for group_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_GROUP_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "group_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for port_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_PORT_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "port_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for table_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_TABLE_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "table_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_op_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for queue_op_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_QUEUE_OP_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "queue_op_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class switch_config_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for switch_config_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_SWITCH_CONFIG_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "switch_config_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
diff --git a/src/python/of11/instruction.py b/src/python/of11/instruction.py
deleted file mode 100644
index ce323c2..0000000
--- a/src/python/of11/instruction.py
+++ /dev/null
@@ -1,164 +0,0 @@
-
-# Python OpenFlow instruction wrapper classes
-
-from cstruct import *
-from action_list import action_list
-
-
-
-class instruction_goto_table(ofp_instruction_goto_table):
- """
- Wrapper class for goto_table instruction object
-
- Data members inherited from ofp_instruction_goto_table:
- @arg type
- @arg len
- @arg table_id
-
- """
- def __init__(self):
- ofp_instruction_goto_table.__init__(self)
- self.type = OFPIT_GOTO_TABLE
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_goto_table\n"
- outstr += ofp_instruction_goto_table.show(self, prefix)
- return outstr
-
-
-class instruction_write_actions(ofp_instruction_actions):
- """
- Wrapper class for write_actions instruction object
-
- Data members inherited from ofp_instruction_actions:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction_actions.__init__(self)
- self.type = OFPIT_WRITE_ACTIONS
- self.actions = action_list()
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_write_actions\n"
- outstr += ofp_instruction_actions.show(self, prefix)
- outstr += self.actions.show(prefix)
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_instruction_actions.unpack(self, binary_string)
- bytes = self.len - OFP_INSTRUCTION_ACTIONS_BYTES
- self.actions = action_list()
- binary_string = self.actions.unpack(binary_string, bytes=bytes)
- return binary_string
- def pack(self):
- self.len = self.__len__()
- packed = ""
- packed += ofp_instruction_actions.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_instruction_actions.__len__(self) + self.actions.__len__()
-
-
-class instruction_apply_actions(ofp_instruction_actions):
- """
- Wrapper class for apply_actions instruction object
-
- Data members inherited from ofp_instruction_actions:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction_actions.__init__(self)
- self.type = OFPIT_APPLY_ACTIONS
- self.actions = action_list()
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_apply_actions\n"
- outstr += ofp_instruction_actions.show(self, prefix)
- outstr += self.actions.show(prefix)
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_instruction_actions.unpack(self, binary_string)
- bytes = self.len - OFP_INSTRUCTION_ACTIONS_BYTES
- self.actions = action_list()
- binary_string = self.actions.unpack(binary_string, bytes=bytes)
- return binary_string
- def pack(self):
- self.len = self.__len__()
- packed = ""
- packed += ofp_instruction_actions.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_instruction_actions.__len__(self) + self.actions.__len__()
-
-
-class instruction_experimenter(ofp_instruction_experimenter):
- """
- Wrapper class for experimenter instruction object
-
- Data members inherited from ofp_instruction_experimenter:
- @arg type
- @arg len
- @arg experimenter
-
- """
- def __init__(self):
- ofp_instruction_experimenter.__init__(self)
- self.type = OFPIT_EXPERIMENTER
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_experimenter\n"
- outstr += ofp_instruction_experimenter.show(self, prefix)
- return outstr
-
-
-class instruction_write_metadata(ofp_instruction_write_metadata):
- """
- Wrapper class for write_metadata instruction object
-
- Data members inherited from ofp_instruction_write_metadata:
- @arg type
- @arg len
- @arg metadata
- @arg metadata_mask
-
- """
- def __init__(self):
- ofp_instruction_write_metadata.__init__(self)
- self.type = OFPIT_WRITE_METADATA
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_write_metadata\n"
- outstr += ofp_instruction_write_metadata.show(self, prefix)
- return outstr
-
-
-class instruction_clear_actions(ofp_instruction):
- """
- Wrapper class for clear_actions instruction object
-
- Data members inherited from ofp_instruction:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction.__init__(self)
- self.type = OFPIT_CLEAR_ACTIONS
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_clear_actions\n"
- outstr += ofp_instruction.show(self, prefix)
- return outstr
-
-instruction_class_list = (
- instruction_apply_actions,
- instruction_clear_actions,
- instruction_experimenter,
- instruction_goto_table,
- instruction_write_actions,
- instruction_write_metadata)
diff --git a/src/python/of11/instruction_list.py b/src/python/of11/instruction_list.py
deleted file mode 100644
index bce8cc7..0000000
--- a/src/python/of11/instruction_list.py
+++ /dev/null
@@ -1,97 +0,0 @@
-"""
-OpenFlow instruction list class
-"""
-
-import action
-import instruction
-from action_list import action_list
-from base_list import ofp_base_list
-from cstruct import ofp_header
-import unittest
-
-# Instruction list
-
-instruction_object_map = {
- action.OFPIT_GOTO_TABLE : instruction.instruction_goto_table,
- action.OFPIT_WRITE_METADATA : instruction.instruction_write_metadata,
- action.OFPIT_WRITE_ACTIONS : instruction.instruction_write_actions,
- action.OFPIT_APPLY_ACTIONS : instruction.instruction_apply_actions,
- action.OFPIT_CLEAR_ACTIONS : instruction.instruction_clear_actions,
- action.OFPIT_EXPERIMENTER : instruction.instruction_experimenter
-}
-
-class instruction_list(ofp_base_list):
- """
- Maintain a list of instructions
-
- Data members:
- @arg instructions An array of instructions such as write_actions
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.instructions = self.items
- self.name = "instruction"
- self.class_list = instruction.instruction_class_list
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of instructions
-
- Unpack instructions from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the instruction list in bytes.
- Ignored if decode is True. If bytes is None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- count = 0
- cur_string = binary_string
- while bytes_done < bytes:
- hdr = instruction.ofp_instruction()
- hdr.unpack(cur_string)
- if hdr.len < action.OFP_ACTION_HEADER_BYTES:
- print "ERROR: Action too short"
- break
- if not hdr.type in instruction_object_map.keys():
- print "WARNING: Skipping unknown action ", hdr.type, hdr.len
- else:
- self.instructions.append(instruction_object_map[hdr.type]())
- self.instructions[count].unpack(cur_string)
- count += 1
- cur_string = cur_string[hdr.len:]
- bytes_done += hdr.len
- return cur_string
-
-class Instruction_List_Test(unittest.TestCase):
- def runTest(self):
- # instructions header is 8 bytes
- l = instruction_list()
- act = action.action_output()
- act.port = 7
- inst = instruction.instruction_apply_actions()
- self.assertTrue(inst.actions.add(act))
- self.assertTrue(l.add(inst))
- pkt = l.pack()
- # 24 == 8 (list header) + (apply header) 8 + (output action) 8
- self.assertEqual(len(pkt),24)
-
- l = instruction_list()
- self.assertTrue(l.add(instruction.instruction_goto_table()))
-
diff --git a/src/python/of11/message.py b/src/python/of11/message.py
deleted file mode 100644
index a26da63..0000000
--- a/src/python/of11/message.py
+++ /dev/null
@@ -1,3692 +0,0 @@
-
-# Python OpenFlow message wrapper classes
-
-from cstruct import *
-from action_list import action_list
-from instruction_list import instruction_list
-from bucket_list import bucket_list
-from error import *
-
-# Define templates for documentation
-class ofp_template_msg(object):
- """
- Sample base class for template_msg; normally auto generated
- This class should live in the of_header name space and provides the
- base class for this type of message. It will be wrapped for the
- high level API.
-
- """
- def __init__(self):
- """
- Constructor for base class
-
- """
- self.header = ofp_header()
- # Additional base data members declared here
-
- # Normally will define pack, unpack, __len__ functions
-
-class template_msg(ofp_template_msg):
- """
- Sample class wrapper for template_msg
- This class should live in the of_message name space and provides the
- high level API for an OpenFlow message object. These objects must
- implement the functions indicated in this template.
-
- """
- def __init__(self):
- """
- Constructor
- Must set the header type value appropriately for the message
-
- """
-
- ##@var header
- # OpenFlow message header: length, version, xid, type
- ofp_template_msg.__init__(self)
- self.header = ofp_header()
- # For a real message, will be set to an integer
- self.header.type = "TEMPLATE_MSG_VALUE"
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- pass
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
-
- @return Typically returns the remainder of binary_string that
- was not parsed. May give a warning if that string is non-empty
-
- """
- pass
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- pass
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
- pass
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- pass
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- pass
-
-
-################################################################
-#
-# OpenFlow Message Definitions
-#
-################################################################
-
-class barrier_reply(object):
- """
- Wrapper class for barrier_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_BARRIER_REPLY=21)
-
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REPLY
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'barrier_reply (OFPT_BARRIER_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class barrier_request(object):
- """
- Wrapper class for barrier_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_BARRIER_REQUEST=20)
-
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REQUEST
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'barrier_request (OFPT_BARRIER_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class echo_reply(object):
- """
- Wrapper class for echo_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ECHO_REPLY=3)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REPLY
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'echo_reply (OFPT_ECHO_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class echo_request(object):
- """
- Wrapper class for echo_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ECHO_REQUEST=2)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REQUEST
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'echo_request (OFPT_ECHO_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class error(ofp_error_msg):
- """
- Wrapper class for error
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ERROR=1)
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_error_msg.__len__(self)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'error (OFPT_ERROR)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_error_msg.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class experimenter(ofp_experimenter_header):
- """
- Wrapper class for experimenter
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_EXPERIMENTER=4)
-
- Data members inherited from ofp_experimenter_header:
- @arg experimenter
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- ofp_experimenter_header.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_EXPERIMENTER
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_experimenter_header.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_experimenter_header.unpack(self, binary_string)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_experimenter_header.__len__(self)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'experimenter (OFPT_EXPERIMENTER)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_experimenter_header.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_experimenter_header.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class features_reply(ofp_switch_features):
- """
- Wrapper class for features_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FEATURES_REPLY=6)
-
- Data members inherited from ofp_switch_features:
- @arg datapath_id
- @arg n_buffers
- @arg n_tables
- @arg capabilities
- @arg reserved
- @arg ports: Variable length array of TBD
-
- """
-
- def __init__(self):
- ofp_switch_features.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REPLY
- self.ports = []
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_features.pack(self)
- for obj in self.ports:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_features.unpack(self, binary_string)
- while len(binary_string) >= OFP_PORT_BYTES:
- new_port = ofp_port()
- binary_string = new_port.unpack(binary_string)
- self.ports.append(new_port)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_features.__len__(self)
- for obj in self.ports:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'features_reply (OFPT_FEATURES_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_features.show(self, prefix)
- outstr += prefix + "Array ports\n"
- for obj in self.ports:
- outstr += obj.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_features.__eq__(self, other): return False
- if self.ports != other.ports: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class features_request(object):
- """
- Wrapper class for features_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FEATURES_REQUEST=5)
-
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REQUEST
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'features_request (OFPT_FEATURES_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class flow_mod(ofp_flow_mod):
- """
- Wrapper class for flow_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FLOW_MOD=14)
-
- Data members inherited from ofp_flow_mod:
- @arg cookie
- @arg cookie_mask
- @arg table_id
- @arg command
- @arg idle_timeout
- @arg hard_timeout
- @arg priority
- @arg buffer_id
- @arg out_port
- @arg out_group
- @arg flags
- @arg match
- @arg instructions: Object of type instruction_list
-
- """
-
- def __init__(self):
- ofp_flow_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_MOD
- self.instructions = instruction_list()
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_flow_mod.pack(self)
- packed += self.instructions.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_flow_mod.unpack(self, binary_string)
- ai_len = self.header.length - (OFP_FLOW_MOD_BYTES + OFP_HEADER_BYTES)
- binary_string = self.instructions.unpack(binary_string, bytes=ai_len)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_flow_mod.__len__(self)
- length += len(self.instructions)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'flow_mod (OFPT_FLOW_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_flow_mod.show(self, prefix)
- outstr += prefix + "List instructions\n"
- outstr += self.instructions.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_flow_mod.__eq__(self, other): return False
- if self.instructions != other.instructions: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class flow_removed(ofp_flow_removed):
- """
- Wrapper class for flow_removed
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FLOW_REMOVED=11)
-
- Data members inherited from ofp_flow_removed:
- @arg cookie
- @arg priority
- @arg reason
- @arg table_id
- @arg duration_sec
- @arg duration_nsec
- @arg idle_timeout
- @arg packet_count
- @arg byte_count
- @arg match
-
- """
-
- def __init__(self):
- ofp_flow_removed.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_REMOVED
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_flow_removed.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_flow_removed.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_flow_removed.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'flow_removed (OFPT_FLOW_REMOVED)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_flow_removed.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_flow_removed.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class get_config_reply(ofp_switch_config):
- """
- Wrapper class for get_config_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GET_CONFIG_REPLY=8)
-
- Data members inherited from ofp_switch_config:
- @arg flags
- @arg miss_send_len
-
- """
-
- def __init__(self):
- ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REPLY
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_config.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_config.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_config.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'get_config_reply (OFPT_GET_CONFIG_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_config.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_config.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class get_config_request(object):
- """
- Wrapper class for get_config_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GET_CONFIG_REQUEST=7)
-
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REQUEST
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'get_config_request (OFPT_GET_CONFIG_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class group_mod(ofp_group_mod):
- """
- Wrapper class for group_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GROUP_MOD=15)
-
- Data members inherited from ofp_group_mod:
- @arg command
- @arg type
- @arg group_id
- @arg buckets: Object of type bucket_list
-
- """
-
- def __init__(self):
- ofp_group_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_GROUP_MOD
- self.buckets = bucket_list()
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_group_mod.pack(self)
- packed += self.buckets.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_group_mod.unpack(self, binary_string)
- binary_string = self.buckets.unpack(binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_group_mod.__len__(self)
- length += len(self.buckets)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'group_mod (OFPT_GROUP_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_group_mod.show(self, prefix)
- outstr += prefix + "List buckets\n"
- outstr += self.buckets.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_group_mod.__eq__(self, other): return False
- if self.buckets != other.buckets: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class hello(object):
- """
- Wrapper class for hello
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_HELLO=0)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- self.header = ofp_header()
- self.header.type = OFPT_HELLO
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'hello (OFPT_HELLO)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class packet_in(ofp_packet_in):
- """
- Wrapper class for packet_in
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PACKET_IN=10)
-
- Data members inherited from ofp_packet_in:
- @arg buffer_id
- @arg in_port
- @arg in_phy_port
- @arg total_len
- @arg reason
- @arg table_id
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- ofp_packet_in.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_IN
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_packet_in.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_packet_in.unpack(self, binary_string)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_packet_in.__len__(self)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'packet_in (OFPT_PACKET_IN)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_packet_in.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_packet_in.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class packet_out(ofp_packet_out):
- """
- Wrapper class for packet_out
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PACKET_OUT=13)
-
- Data members inherited from ofp_packet_out:
- @arg buffer_id
- @arg in_port
- @arg actions_len
- @arg actions: Object of type action_list
- @arg data: Binary string following message members
-
- """
-
- def __init__(self):
- ofp_packet_out.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_OUT
- self.actions = action_list()
- self.data = ""
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- self.actions_len = len(self.actions)
- packed += ofp_packet_out.pack(self)
- packed += self.actions.pack()
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_packet_out.unpack(self, binary_string)
- binary_string = self.actions.unpack(binary_string, bytes=self.actions_len)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_packet_out.__len__(self)
- length += len(self.actions)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'packet_out (OFPT_PACKET_OUT)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_packet_out.show(self, prefix)
- outstr += prefix + "List actions\n"
- outstr += self.actions.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_packet_out.__eq__(self, other): return False
- if self.data != other.data: return False
- if self.actions != other.actions: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class port_mod(ofp_port_mod):
- """
- Wrapper class for port_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PORT_MOD=16)
-
- Data members inherited from ofp_port_mod:
- @arg port_no
- @arg hw_addr
- @arg config
- @arg mask
- @arg advertise
-
- """
-
- def __init__(self):
- ofp_port_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_MOD
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_port_mod.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_port_mod.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_port_mod.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'port_mod (OFPT_PORT_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_port_mod.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_port_mod.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class port_status(ofp_port_status):
- """
- Wrapper class for port_status
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PORT_STATUS=12)
-
- Data members inherited from ofp_port_status:
- @arg reason
- @arg desc
-
- """
-
- def __init__(self):
- ofp_port_status.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_STATUS
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_port_status.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_port_status.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_port_status.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'port_status (OFPT_PORT_STATUS)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_port_status.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_port_status.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class queue_get_config_reply(ofp_queue_get_config_reply):
- """
- Wrapper class for queue_get_config_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REPLY=23)
-
- Data members inherited from ofp_queue_get_config_reply:
- @arg port
- @arg queues: Variable length array of TBD
-
- """
-
- def __init__(self):
- ofp_queue_get_config_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REPLY
- self.queues = []
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_queue_get_config_reply.pack(self)
- for obj in self.queues:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_queue_get_config_reply.unpack(self, binary_string)
- for obj in self.queues:
- binary_string = obj.unpack(binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_queue_get_config_reply.__len__(self)
- for obj in self.queues:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'queue_get_config_reply (OFPT_QUEUE_GET_CONFIG_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_queue_get_config_reply.show(self, prefix)
- outstr += prefix + "Array queues\n"
- for obj in self.queues:
- outstr += obj.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_queue_get_config_reply.__eq__(self, other): return False
- if self.queues != other.queues: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class queue_get_config_request(ofp_queue_get_config_request):
- """
- Wrapper class for queue_get_config_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REQUEST=22)
-
- Data members inherited from ofp_queue_get_config_request:
- @arg port
-
- """
-
- def __init__(self):
- ofp_queue_get_config_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REQUEST
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_queue_get_config_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_queue_get_config_request.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_queue_get_config_request.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'queue_get_config_request (OFPT_QUEUE_GET_CONFIG_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_queue_get_config_request.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_queue_get_config_request.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class set_config(ofp_switch_config):
- """
- Wrapper class for set_config
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_SET_CONFIG=9)
-
- Data members inherited from ofp_switch_config:
- @arg flags
- @arg miss_send_len
-
- """
-
- def __init__(self):
- ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_SET_CONFIG
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_config.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_config.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_config.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'set_config (OFPT_SET_CONFIG)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_config.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_config.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class stats_reply(ofp_stats_reply):
- """
- Wrapper class for stats_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_STATS_REPLY=19)
-
- Data members inherited from ofp_stats_reply:
- @arg type
- @arg flags
-
- """
-
- def __init__(self):
- ofp_stats_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REPLY
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_stats_reply.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_stats_reply.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'stats_reply (OFPT_STATS_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_stats_reply.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class stats_request(ofp_stats_request):
- """
- Wrapper class for stats_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_STATS_REQUEST=18)
-
- Data members inherited from ofp_stats_request:
- @arg type
- @arg flags
-
- """
-
- def __init__(self):
- ofp_stats_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REQUEST
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_stats_request.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_stats_request.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'stats_request (OFPT_STATS_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_stats_request.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class table_mod(ofp_table_mod):
- """
- Wrapper class for table_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (2)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_TABLE_MOD=17)
-
- Data members inherited from ofp_table_mod:
- @arg table_id
- @arg config
-
- """
-
- def __init__(self):
- ofp_table_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_TABLE_MOD
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_table_mod.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_table_mod.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_table_mod.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'table_mod (OFPT_TABLE_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_table_mod.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_table_mod.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-
-################################################################
-#
-# Stats request and reply subclass definitions
-#
-################################################################
-
-
-# Stats request bodies for desc and table stats are not defined in the
-# OpenFlow header; We define them here. They are empty classes, really
-
-class ofp_desc_stats_request(object):
- """
- Forced definition of ofp_desc_stats_request (empty class)
- """
- def __init__(self):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_desc_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_DESC_STATS_REQUEST_BYTES = 0
-
-class ofp_table_stats_request(object):
- """
- Forced definition of ofp_table_stats_request (empty class)
- """
- def __init__(self):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_table_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_TABLE_STATS_REQUEST_BYTES = 0
-
-class ofp_group_desc_stats_request(object):
- """
- Forced definition of ofp_group_desc_stats_request (empty class)
- """
- def __init__(self):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_group_desc_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_GROUP_DESC_STATS_REQUEST_BYTES = 0
-
-
-
-# Stats entries define the content of one element in a stats
-# reply for the indicated type; define _entry for consistency
-
-aggregate_stats_entry = ofp_aggregate_stats_reply
-desc_stats_entry = ofp_desc_stats
-port_stats_entry = ofp_port_stats
-queue_stats_entry = ofp_queue_stats
-table_stats_entry = ofp_table_stats
-group_stats_entry = ofp_group_stats
-group_desc_stats_entry = ofp_group_desc_stats
-
-
-#
-# Flow stats entry contains an action list of variable length, so
-# it is done by hand
-#
-
-class flow_stats_entry(ofp_flow_stats):
- """
- Special case flow stats entry to handle action list object
- """
- def __init__(self):
- ofp_flow_stats.__init__(self)
- self.instructions = instruction_list()
-
- def pack(self, assertstruct=True):
- self.length = len(self)
- packed = ofp_flow_stats.pack(self, assertstruct)
- packed += self.instructions.pack()
- if len(packed) != self.length:
- print("ERROR: flow_stats_entry pack length not equal",
- self.length, len(packed))
- return packed
-
- def unpack(self, binary_string):
- binary_string = ofp_flow_stats.unpack(self, binary_string)
- ai_len = self.length - OFP_FLOW_STATS_BYTES
- if ai_len < 0:
- print("ERROR: flow_stats_entry unpack length too small",
- self.length)
- binary_string = self.instructions.unpack(binary_string, bytes=ai_len)
- return binary_string
-
- def __len__(self):
- return OFP_FLOW_STATS_BYTES + len(self.instructions)
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_entry\n"
- outstr += ofp_flow_stats.show(self, prefix + ' ')
- outstr += self.instructions.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (ofp_flow_stats.__eq__(self, other) and
- self.instructions == other.instructions)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class aggregate_stats_request(ofp_stats_request, ofp_aggregate_stats_request):
- """
- Wrapper class for aggregate stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_aggregate_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_AGGREGATE
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_aggregate_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_aggregate_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking aggregate: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_AGGREGATE_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "aggregate_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_aggregate_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_aggregate_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class aggregate_stats_reply(ofp_stats_reply):
- """
- Wrapper class for aggregate stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_AGGREGATE
- # stats: Array of type aggregate_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = aggregate_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = aggregate_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking aggregate stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "aggregate_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class desc_stats_request(ofp_stats_request, ofp_desc_stats_request):
- """
- Wrapper class for desc stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_desc_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_DESC
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_desc_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_desc_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking desc: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_DESC_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "desc_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_desc_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_desc_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class desc_stats_reply(ofp_stats_reply):
- """
- Wrapper class for desc stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_DESC
- # stats: Array of type desc_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = desc_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = desc_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking desc stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "desc_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_stats_request(ofp_stats_request, ofp_flow_stats_request):
- """
- Wrapper class for flow stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_flow_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_FLOW
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_flow_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_flow_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking flow: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_FLOW_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_flow_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_flow_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_stats_reply(ofp_stats_reply):
- """
- Wrapper class for flow stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_FLOW
- # stats: Array of type flow_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = flow_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = flow_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking flow stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_stats_request(ofp_stats_request, ofp_port_stats_request):
- """
- Wrapper class for port stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_port_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_PORT
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_port_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_port_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking port: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_PORT_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "port_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_port_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_port_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_stats_reply(ofp_stats_reply):
- """
- Wrapper class for port stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_PORT
- # stats: Array of type port_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = port_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = port_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking port stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "port_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_stats_request(ofp_stats_request, ofp_queue_stats_request):
- """
- Wrapper class for queue stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_queue_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_QUEUE
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_queue_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_queue_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking queue: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_QUEUE_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "queue_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_queue_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_queue_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_stats_reply(ofp_stats_reply):
- """
- Wrapper class for queue stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_QUEUE
- # stats: Array of type queue_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = queue_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = queue_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking queue stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "queue_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_stats_request(ofp_stats_request, ofp_group_stats_request):
- """
- Wrapper class for group stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_group_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_GROUP
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_group_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_group_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking group: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_GROUP_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "group_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_group_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_group_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_stats_reply(ofp_stats_reply):
- """
- Wrapper class for group stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_GROUP
- # stats: Array of type group_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = group_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = group_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking group stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "group_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_desc_stats_request(ofp_stats_request, ofp_group_desc_stats_request):
- """
- Wrapper class for group_desc stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_group_desc_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_GROUP_DESC
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_group_desc_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_group_desc_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking group_desc: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_GROUP_DESC_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "group_desc_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_group_desc_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_group_desc_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_desc_stats_reply(ofp_stats_reply):
- """
- Wrapper class for group_desc stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_GROUP_DESC
- # stats: Array of type group_desc_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = group_desc_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = group_desc_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking group_desc stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "group_desc_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_stats_request(ofp_stats_request, ofp_table_stats_request):
- """
- Wrapper class for table stats request message
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_table_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_TABLE
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_table_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_table_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking table: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_TABLE_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "table_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_table_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_table_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_stats_reply(ofp_stats_reply):
- """
- Wrapper class for table stats reply
- """
- def __init__(self):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_TABLE
- # stats: Array of type table_stats_entry
- self.stats = []
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = table_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = table_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking table stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "table_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-# @todo Add buckets to group and group_desc stats obejcts"
-message_type_list = (
- aggregate_stats_reply,
- aggregate_stats_request,
- bad_action_error_msg,
- bad_request_error_msg,
- barrier_reply,
- barrier_request,
- desc_stats_reply,
- desc_stats_request,
- echo_reply,
- echo_request,
- error,
- experimenter,
- features_reply,
- features_request,
- flow_mod,
- flow_mod_failed_error_msg,
- flow_removed,
- flow_stats_reply,
- flow_stats_request,
- get_config_reply,
- get_config_request,
- group_desc_stats_request,
- group_desc_stats_reply,
- group_stats_request,
- group_stats_reply,
- group_mod,
- group_mod_failed_error_msg,
- hello,
- hello_failed_error_msg,
- packet_in,
- packet_out,
- port_mod,
- port_mod_failed_error_msg,
- port_stats_reply,
- port_stats_request,
- port_status,
- queue_get_config_reply,
- queue_get_config_request,
- queue_op_failed_error_msg,
- queue_stats_reply,
- queue_stats_request,
- set_config,
- switch_config_failed_error_msg,
- table_mod,
- table_mod_failed_error_msg,
- table_stats_reply,
- table_stats_request,
- )
-
diff --git a/src/python/of11/message_unittests.py b/src/python/of11/message_unittests.py
deleted file mode 100755
index 04b8679..0000000
--- a/src/python/of11/message_unittests.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python
-
-import unittest
-import message
-import action
-import instruction
-import cstruct as ofp
-
-class flow_stats_pack(unittest.TestCase):
- def runTest(self):
- msg = message.flow_stats_entry()
- match = ofp.ofp_match()
- match.wildcards &= ~ofp.OFPFW_IN_PORT
- act = action.action_output()
- act.port = 3
- msg.match = match
- pkt = msg.pack()
- self.assertEqual(len(pkt), 136)
- inst = instruction.instruction_apply_actions()
- self.assertTrue(inst.actions.add(act), "Could not add action")
- self.assertTrue(msg.instructions.add(inst), "Could not add instructions")
- #self.assertTrue(msg.actions.add(act), "Could not add action")
- pkt = msg.pack()
- # 160 = 136 for flow_stats_entry and 24 for instruction_list
- self.assertEqual(len(pkt), 160)
- rep = message.flow_stats_reply()
- self.assertEqual(len(rep.pack()),12)
- rep.stats.append(msg)
- self.assertEqual(len(rep.pack()),172)
-
-
-
-class match_pack(unittest.TestCase):
- def runTest(self):
- match = ofp.ofp_match()
- self.assertEqual(len(match.pack()), 88)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/src/python/of11/parse.py b/src/python/of11/parse.py
deleted file mode 100644
index dfe24c6..0000000
--- a/src/python/of11/parse.py
+++ /dev/null
@@ -1,231 +0,0 @@
-"""
-OpenFlow message parsing functions
-"""
-
-import logging
-import message
-import cstruct as ofp
-
-"""
-of_message.py
-Contains wrapper functions and classes for the of_message namespace
-that are generated by hand. It includes the rest of the wrapper
-function information into the of_message namespace
-"""
-
-parse_logger = logging.getLogger("parse")
-#parse_logger.setLevel(logging.DEBUG)
-
-# These message types are subclassed
-msg_type_subclassed = [
- ofp.OFPT_STATS_REQUEST,
- ofp.OFPT_STATS_REPLY,
- ofp.OFPT_ERROR
-]
-
-# Maps from sub-types to classes
-stats_reply_to_class_map = {
- ofp.OFPST_DESC : message.desc_stats_reply,
- ofp.OFPST_AGGREGATE : message.aggregate_stats_reply,
- ofp.OFPST_FLOW : message.flow_stats_reply,
- ofp.OFPST_TABLE : message.table_stats_reply,
- ofp.OFPST_PORT : message.port_stats_reply,
- ofp.OFPST_QUEUE : message.queue_stats_reply
-}
-
-stats_request_to_class_map = {
- ofp.OFPST_DESC : message.desc_stats_request,
- ofp.OFPST_AGGREGATE : message.aggregate_stats_request,
- ofp.OFPST_FLOW : message.flow_stats_request,
- ofp.OFPST_TABLE : message.table_stats_request,
- ofp.OFPST_PORT : message.port_stats_request,
- ofp.OFPST_QUEUE : message.queue_stats_request
-}
-
-error_to_class_map = {
- ofp.OFPET_HELLO_FAILED : message.hello_failed_error_msg,
- ofp.OFPET_BAD_REQUEST : message.bad_request_error_msg,
- ofp.OFPET_BAD_ACTION : message.bad_action_error_msg,
- ofp.OFPET_FLOW_MOD_FAILED : message.flow_mod_failed_error_msg,
- ofp.OFPET_PORT_MOD_FAILED : message.port_mod_failed_error_msg,
- ofp.OFPET_QUEUE_OP_FAILED : message.queue_op_failed_error_msg,
- ofp.OFPET_TABLE_MOD_FAILED : message.table_mod_failed_error_msg,
- ofp.OFPET_QUEUE_OP_FAILED : message.queue_op_failed_error_msg,
- ofp.OFPET_SWITCH_CONFIG_FAILED : message.switch_config_failed_error_msg
-}
-
-# Map from header type value to the underlieing message class
-msg_type_to_class_map = {
- ofp.OFPT_HELLO : message.hello,
- ofp.OFPT_ERROR : message.error,
- ofp.OFPT_ECHO_REQUEST : message.echo_request,
- ofp.OFPT_ECHO_REPLY : message.echo_reply,
- ofp.OFPT_EXPERIMENTER : message.experimenter,
- ofp.OFPT_FEATURES_REQUEST : message.features_request,
- ofp.OFPT_FEATURES_REPLY : message.features_reply,
- ofp.OFPT_GET_CONFIG_REQUEST : message.get_config_request,
- ofp.OFPT_GET_CONFIG_REPLY : message.get_config_reply,
- ofp.OFPT_SET_CONFIG : message.set_config,
- ofp.OFPT_PACKET_IN : message.packet_in,
- ofp.OFPT_FLOW_REMOVED : message.flow_removed,
- ofp.OFPT_PORT_STATUS : message.port_status,
- ofp.OFPT_PACKET_OUT : message.packet_out,
- ofp.OFPT_FLOW_MOD : message.flow_mod,
- ofp.OFPT_PORT_MOD : message.port_mod,
- ofp.OFPT_TABLE_MOD : message.table_mod,
- ofp.OFPT_STATS_REQUEST : message.stats_request,
- ofp.OFPT_STATS_REPLY : message.stats_reply,
- ofp.OFPT_BARRIER_REQUEST : message.barrier_request,
- ofp.OFPT_BARRIER_REPLY : message.barrier_reply,
- ofp.OFPT_QUEUE_GET_CONFIG_REQUEST : message.queue_get_config_request,
- ofp.OFPT_QUEUE_GET_CONFIG_REPLY : message.queue_get_config_reply,
-}
-
-def _of_message_to_object(binary_string):
- """
- Map a binary string to the corresponding class.
-
- Appropriately resolves subclasses
- """
- hdr = ofp.ofp_header()
- hdr.unpack(binary_string)
- # FIXME: Add error detection
- if not hdr.type in msg_type_subclassed:
- return msg_type_to_class_map[hdr.type]()
- if hdr.type == ofp.OFPT_STATS_REQUEST:
- sub_hdr = ofp.ofp_stats_request()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- try:
- obj = stats_request_to_class_map[sub_hdr.type]()
- except LookupError:
- obj = None
- return obj
- elif hdr.type == ofp.OFPT_STATS_REPLY:
- sub_hdr = ofp.ofp_stats_reply()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- try:
- obj = stats_reply_to_class_map[sub_hdr.type]()
- except LookupError:
- obj = None
- return obj
- elif hdr.type == ofp.OFPT_ERROR:
- sub_hdr = ofp.ofp_error_msg()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- return error_to_class_map[sub_hdr.type]()
- else:
- parse_logger.error("Cannot parse pkt to message")
- return None
-
-def of_message_parse(binary_string, raw=False):
- """
- Parse an OpenFlow packet
-
- Parses a raw OpenFlow packet into a Python class, with class
- members fully populated.
-
- @param binary_string The packet (string) to be parsed
- @param raw If true, interpret the packet as an L2 packet. Not
- yet supported.
- @return An object of some message class or None if fails
- Note that any data beyond that parsed is not returned
-
- """
-
- if raw:
- parse_logger.error("raw packet message parsing not supported")
- return None
-
- obj = _of_message_to_object(binary_string)
- if obj:
- obj.unpack(binary_string)
- return obj
-
-
-def of_header_parse(binary_string, raw=False):
- """
- Parse only the header from an OpenFlow packet
-
- Parses the header from a raw OpenFlow packet into a
- an ofp_header Python class.
-
- @param binary_string The packet (string) to be parsed
- @param raw If true, interpret the packet as an L2 packet. Not
- yet supported.
- @return An ofp_header object
-
- """
-
- if raw:
- parse_logger.error("raw packet message parsing not supported")
- return None
-
- hdr = ofp.ofp_header()
- hdr.unpack(binary_string)
-
- return hdr
-
-map_wc_field_to_match_member = {
- 'OFPFW_DL_VLAN' : 'dl_vlan',
- 'OFPFW_DL_SRC' : 'dl_src',
- 'OFPFW_DL_DST' : 'dl_dst',
- 'OFPFW_DL_TYPE' : 'dl_type',
- 'OFPFW_NW_PROTO' : 'nw_proto',
- 'OFPFW_TP_SRC' : 'tp_src',
- 'OFPFW_TP_DST' : 'tp_dst',
- 'OFPFW_NW_SRC_SHIFT' : 'nw_src_shift',
- 'OFPFW_NW_SRC_BITS' : 'nw_src_bits',
- 'OFPFW_NW_SRC_MASK' : 'nw_src_mask',
- 'OFPFW_NW_SRC_ALL' : 'nw_src_all',
- 'OFPFW_NW_DST_SHIFT' : 'nw_dst_shift',
- 'OFPFW_NW_DST_BITS' : 'nw_dst_bits',
- 'OFPFW_NW_DST_MASK' : 'nw_dst_mask',
- 'OFPFW_NW_DST_ALL' : 'nw_dst_all',
- 'OFPFW_DL_VLAN_PCP' : 'dl_vlan_pcp',
- 'OFPFW_NW_TOS' : 'nw_tos'
-}
-
-
-def parse_mac(mac_str):
- """
- Parse a MAC address
-
- Parse a MAC address ':' separated string of hex digits to an
- array of integer values. '00:d0:05:5d:24:00' => [0, 208, 5, 93, 36, 0]
- @param mac_str The string to convert
- @return Array of 6 integer values
- """
- return map(lambda val:eval("0x" + val), mac_str.split(":"))
-
-def parse_ip(ip_str):
- """
- Parse an IP address
-
- Parse an IP address '.' separated string of decimal digits to an
- host ordered integer. '172.24.74.77' =>
- @param ip_str The string to convert
- @return Integer value
- """
- array = map(lambda val:eval(val),ip_str.split("."))
- val = 0
- for a in array:
- val <<= 8
- val += a
- return val
-
-def packet_to_flow_match(packet):
- """
- Create a flow match that matches packet with the given wildcards
-
- @param packet The packet to use as a flow template
- @param pkt_format Currently only L2 is supported. Will indicate the
- overall packet type for parsing
- @return An ofp_match object if successful. None if format is not
- recognized. The wildcards of the match will be cleared for the
- values extracted from the packet.
-
- @todo check min length of packet
- @todo Check if packet is other than L2 format
- @todo Implement ICMP and ARP fields
- """
-
- return packet.parse()
diff --git a/src/python/of12/__init__.py b/src/python/of12/__init__.py
deleted file mode 100644
index 36dd8fa..0000000
--- a/src/python/of12/__init__.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Allow accessing constants through the top-level module
-from cstruct import *
-
-# Allow accessing submodules without additional imports
-import action
-import bucket
-import instruction
-import match
-import message
-import parse
diff --git a/src/python/of12/action.py b/src/python/of12/action.py
deleted file mode 100644
index 059e390..0000000
--- a/src/python/of12/action.py
+++ /dev/null
@@ -1,427 +0,0 @@
-
-# Python OpenFlow action wrapper classes
-
-from cstruct import *
-from match import roundup
-from match_list import match_list
-
-class pop_mpls(ofp_action_pop_mpls):
- """
- Wrapper class for pop_mpls action object
-
- Data members inherited from ofp_action_pop_mpls:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self, **kwargs):
- ofp_action_pop_mpls.__init__(self)
- self.type = OFPAT_POP_MPLS
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_pop_mpls\n"
- outstr += ofp_action_pop_mpls.show(self, prefix)
- return outstr
-
-
-class push_vlan(ofp_action_push):
- """
- Wrapper class for push_vlan action object
-
- Data members inherited from ofp_action_push:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self, **kwargs):
- ofp_action_push.__init__(self)
- self.type = OFPAT_PUSH_VLAN
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_push_vlan\n"
- outstr += ofp_action_push.show(self, prefix)
- return outstr
-
-
-class experimenter(ofp_action_experimenter_header):
- """
- Wrapper class for experimenter action object
-
- Data members inherited from ofp_action_experimenter_header:
- @arg type
- @arg len
- @arg experimenter
-
- """
- def __init__(self, **kwargs):
- ofp_action_experimenter_header.__init__(self)
- self.type = OFPAT_EXPERIMENTER
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_experimenter\n"
- outstr += ofp_action_experimenter_header.show(self, prefix)
- return outstr
-
-
-class dec_mpls_ttl(ofp_action_header):
- """
- Wrapper class for dec_mpls_ttl action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self, **kwargs):
- ofp_action_header.__init__(self)
- self.type = OFPAT_DEC_MPLS_TTL
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_dec_mpls_ttl\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class set_nw_ttl(ofp_action_nw_ttl):
- """
- Wrapper class for set_nw_ttl action object
-
- Data members inherited from ofp_action_nw_ttl:
- @arg type
- @arg len
- @arg nw_ttl
-
- """
- def __init__(self, **kwargs):
- ofp_action_nw_ttl.__init__(self)
- self.type = OFPAT_SET_NW_TTL
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_set_nw_ttl\n"
- outstr += ofp_action_nw_ttl.show(self, prefix)
- return outstr
-
-
-class copy_ttl_in(ofp_action_header):
- """
- Wrapper class for copy_ttl_in action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self, **kwargs):
- ofp_action_header.__init__(self)
- self.type = OFPAT_COPY_TTL_IN
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_copy_ttl_in\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class group(ofp_action_group):
- """
- Wrapper class for group action object
-
- Data members inherited from ofp_action_group:
- @arg type
- @arg len
- @arg group_id
-
- """
- def __init__(self, **kwargs):
- ofp_action_group.__init__(self)
- self.type = OFPAT_GROUP
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_group\n"
- outstr += ofp_action_group.show(self, prefix)
- return outstr
- def __len__(self):
- return roundup(4 + 4,8)
-
-
-class set_queue(ofp_action_set_queue):
- """
- Wrapper class for set_queue action object
-
- Data members inherited from ofp_action_set_queue:
- @arg type
- @arg len
- @arg queue_id
-
- """
- def __init__(self, **kwargs):
- ofp_action_set_queue.__init__(self)
- self.type = OFPAT_SET_QUEUE
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_set_queue\n"
- outstr += ofp_action_set_queue.show(self, prefix)
- return outstr
-
-
-class push_mpls(ofp_action_push):
- """
- Wrapper class for push_mpls action object
-
- Data members inherited from ofp_action_push:
- @arg type
- @arg len
- @arg ethertype
-
- """
- def __init__(self, **kwargs):
- ofp_action_push.__init__(self)
- self.type = OFPAT_PUSH_MPLS
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_push_mpls\n"
- outstr += ofp_action_push.show(self, prefix)
- return outstr
-
-
-class copy_ttl_out(ofp_action_header):
- """
- Wrapper class for copy_ttl_out action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self, **kwargs):
- ofp_action_header.__init__(self)
- self.type = OFPAT_COPY_TTL_OUT
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_copy_ttl_out\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class set_field(ofp_action_set_field):
- """
- Wrapper class for set_field action object
-
- Data members inherited from ofp_action_set_field:
- @arg type
- @arg len
- @arg field
-
- """
- def __init__(self, **kwargs):
- ofp_action_set_field.__init__(self)
- self.type = OFPAT_SET_FIELD
- self.len = self.__len__()
- self.field = match_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self):
- packed = ""
- if len(self.field) <= 4:
- packed += ofp_action_set_field.pack()
- else:
- self.len = len(self)
- packed += struct.pack("!HH", self.type, self.len)
- packed += self.field.pack()
- padding_size = roundup(len(self.field) -4,8) - (len(self.field) -4)
- if padding_size:
- padding = [0] * padding_size
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- return packed
-
- def unpack(self, binary_string):
- if len(binary_string) <= 8:
- binary_string = ofp_action_set_field.unpack(self)
- else:
- (self.type, self.len) = struct.unpack("!HH", binary_string[0:4])
- binary_string = binary_string[4:]
- binary_string = self.field.unpack(binary_string, bytes = self.len - 4)
- padding_size = roundup(len(self.field) -4,8) - (len(self.field) -4)
- if padding_size:
- binary_string = binary_string[padding_size:]
- return binary_string
-
- def show(self, prefix=''):
- outstr = prefix + "action_set_field\n"
- outstr += ofp_action_set_field.show(self, prefix)
- return outstr
-
- def __len__(self):
- return roundup(4 + len(self.field),8)
-
-
-class set_mpls_ttl(ofp_action_mpls_ttl):
- """
- Wrapper class for set_mpls_ttl action object
-
- Data members inherited from ofp_action_mpls_ttl:
- @arg type
- @arg len
- @arg mpls_ttl
-
- """
- def __init__(self, **kwargs):
- ofp_action_mpls_ttl.__init__(self)
- self.type = OFPAT_SET_MPLS_TTL
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_set_mpls_ttl\n"
- outstr += ofp_action_mpls_ttl.show(self, prefix)
- return outstr
-
-
-class pop_vlan(ofp_action_header):
- """
- Wrapper class for pop_vlan action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self, **kwargs):
- ofp_action_header.__init__(self)
- self.type = OFPAT_POP_VLAN
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_pop_vlan\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class dec_nw_ttl(ofp_action_header):
- """
- Wrapper class for dec_nw_ttl action object
-
- Data members inherited from ofp_action_header:
- @arg type
- @arg len
-
- """
- def __init__(self, **kwargs):
- ofp_action_header.__init__(self)
- self.type = OFPAT_DEC_NW_TTL
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_dec_nw_ttl\n"
- outstr += ofp_action_header.show(self, prefix)
- return outstr
-
-
-class output(ofp_action_output):
- """
- Wrapper class for output action object
-
- Data members inherited from ofp_action_output:
- @arg type
- @arg len
- @arg port
- @arg max_len
-
- """
- def __init__(self, **kwargs):
- ofp_action_output.__init__(self)
- self.type = OFPAT_OUTPUT
- self.len = self.__len__()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- def show(self, prefix=''):
- outstr = prefix + "action_output\n"
- outstr += ofp_action_output.show(self, prefix)
- return outstr
-
-action_class_list = (
- copy_ttl_in,
- copy_ttl_out,
- dec_mpls_ttl,
- dec_nw_ttl,
- experimenter,
- group,
- output,
- pop_mpls,
- pop_vlan,
- push_mpls,
- push_vlan,
- set_field,
- set_mpls_ttl,
- set_nw_ttl,
- set_queue)
-
diff --git a/src/python/of12/action_list.py b/src/python/of12/action_list.py
deleted file mode 100644
index 78341e2..0000000
--- a/src/python/of12/action_list.py
+++ /dev/null
@@ -1,88 +0,0 @@
-"""
-OpenFlow action, instruction and bucket list classes
-"""
-
-from action import *
-from cstruct import ofp_header
-from base_list import ofp_base_list
-import copy
-
-action_object_map = {
- OFPAT_OUTPUT : output,
- OFPAT_SET_FIELD : set_field,
- OFPAT_COPY_TTL_OUT : copy_ttl_out,
- OFPAT_COPY_TTL_IN : copy_ttl_in,
- OFPAT_SET_MPLS_TTL : set_mpls_ttl,
- OFPAT_DEC_MPLS_TTL : dec_mpls_ttl,
- OFPAT_PUSH_VLAN : push_vlan,
- OFPAT_POP_VLAN : pop_vlan,
- OFPAT_PUSH_MPLS : push_mpls,
- OFPAT_POP_MPLS : pop_mpls,
- OFPAT_SET_QUEUE : set_queue,
- OFPAT_GROUP : group,
- OFPAT_SET_NW_TTL : set_nw_ttl,
- OFPAT_DEC_NW_TTL : dec_nw_ttl,
- OFPAT_EXPERIMENTER : experimenter
-}
-
-class action_list(ofp_base_list):
- """
- Maintain a list of actions
-
- Data members:
- @arg actions: An array of action objects such as action_output, etc.
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self, actions=None):
- ofp_base_list.__init__(self)
- self.actions = self.items
- if actions:
- self.actions.extend(actions)
- self.name = "action"
- self.class_list = action_class_list
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of actions
-
- Unpack actions from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the action list in bytes.
- Ignored if decode is True. If None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- count = 0
- cur_string = binary_string
- while bytes_done < bytes:
- hdr = ofp_action_header()
- hdr.unpack(cur_string)
- if hdr.len < OFP_ACTION_HEADER_BYTES:
- print "ERROR: Action too short"
- break
- if not hdr.type in action_object_map.keys():
- print "WARNING: Skipping unknown action ", hdr.type, hdr.len
- else:
- self.actions.append(action_object_map[hdr.type]())
- self.actions[count].unpack(cur_string)
- count += 1
- cur_string = cur_string[hdr.len:]
- bytes_done += hdr.len
- return cur_string
-
diff --git a/src/python/of12/base_list.py b/src/python/of12/base_list.py
deleted file mode 100644
index 938c68e..0000000
--- a/src/python/of12/base_list.py
+++ /dev/null
@@ -1,158 +0,0 @@
-
-"""
-Base list class for inheritance.
-Most of the list stuff is common; unpacking is the only thing that
-is left pure virtual.
-"""
-
-import copy
-
-class ofp_base_list(object):
- """
- Container type to maintain a list of ofp objects
-
- Data members:
- @arg items An array of objects
- @arg class_list A tuple of classes that may be added to the list;
- If None, no checking is done
- @arg name The name to use when displaying the list
-
- Methods:
- @arg pack Pack the structure into a string
- @arg unpack Unpack a string to objects, with proper typing
- @arg add Add an item to the list; you can directly access
- the item member, but add will validate that the added object
- is of the right type.
- @arg extend Add the items for another list to this list
-
- """
-
- def __init__(self):
- self.items = []
- self.class_list = None
- self.name = "unspecified"
-
- def pack(self):
- """
- Pack a list of items
-
- Returns the packed string
- """
- packed = ""
- for obj in self.items:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string, bytes=None):
- """
- Pure virtual function for a list of items
-
- Unpack items from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the list in bytes.
- Ignored if decode is True. If None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
- """
- pass
-
- def add(self, item):
- """
- Add an item to a list
-
- @param item The item to add
- @return True if successful, False if not proper type object
-
- """
-
- # Note that the second arg of isinstance can be a list which
- # checks that the type of item is in the list
- if (self.class_list is not None) and \
- not isinstance(item, tuple(self.class_list)):
- return False
-
- tmp = copy.deepcopy(item)
- self.items.append(tmp)
- return True
-
- def remove_type(self, target):
- """
- Remove the first item on the list of the given type
-
- @param target The type of item to search
-
- @return The object removed, if any; otherwise None
-
- """
- for index in xrange(len(self.items)):
- if self.items[index].type == target:
- return self.items.pop(index)
- return None
-
- def find_type(self, target):
- """
- Find the first item on the list of the given type
-
- @param target The type of item to search
-
- @return The object with the matching type if any; otherwise None
-
- """
- for index in xrange(len(self.items)):
- if self.items[index].type == target:
- return self.items[index]
- return None
-
- def extend(self, other):
- """
- Add the items in other to this list
-
- @param other An object of the same type of list whose
- entries are to be merged into this list
-
- @return True if successful. If not successful, the list
- may have been modified.
-
- @todo Check if this is proper deep copy or not
-
- """
- for act in other.items:
- if not self.add(act):
- return False
- return True
-
- def __len__(self):
- """
- Length of the list packed as a string
- """
- length = 0
- for item in self.items:
- length += item.__len__()
- return length
-
- def __eq__(self, other):
- if type(self) != type(other):
- return False
- if self.items != other.items:
- return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- # Methods to make class iterable
- def __iter__(self):
- return self.items.__iter__()
-
- def show(self, prefix=''):
- outstr = prefix + self.name + "list with " + str(len(self.items)) + \
- " items\n"
- count = 0
- for obj in self.items:
- count += 1
- outstr += prefix + " " + self.name + " " + str(count) + ": \n"
- outstr += obj.show(prefix + ' ')
- return outstr
diff --git a/src/python/of12/bucket.py b/src/python/of12/bucket.py
deleted file mode 100644
index 64caed1..0000000
--- a/src/python/of12/bucket.py
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Python OpenFlow bucket wrapper class
-
-from cstruct import ofp_bucket
-from action_list import action_list
-
-
-
-class bucket(ofp_bucket):
- """
- Wrapper class for bucket object
-
- Data members inherited from ofp_bucket:
- @arg len
- @arg weight
- @arg watch_port
- @arg watch_group
-
- """
- def __init__(self):
- ofp_bucket.__init__(self)
- self.actions = action_list()
- self.type = None
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "bucket\n"
- outstr += ofp_bucket.show(self, prefix)
- outstr += self.actions.show()
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_bucket.unpack(self, binary_string)
- self.actions = action_list()
- return self.actions.unpack(binary_string)
- def pack(self):
- self.len = len(self)
- packed = ""
- packed += ofp_bucket.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_bucket.__len__(self) + self.actions.__len__()
-
diff --git a/src/python/of12/bucket_list.py b/src/python/of12/bucket_list.py
deleted file mode 100644
index 33d9472..0000000
--- a/src/python/of12/bucket_list.py
+++ /dev/null
@@ -1,52 +0,0 @@
-
-from base_list import ofp_base_list
-from bucket import bucket
-
-class bucket_list(ofp_base_list):
- """
- Maintain a list of instructions
-
- Data members:
- @arg instructions An array of instructions such as write_actions
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.buckets = self.items
- self.name = "buckets"
- self.class_list = (bucket,)
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of buckets
-
- Unpack buckets from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the instruction list in bytes.
- Ignored if decode is True. If bytes is None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- cur_string = binary_string
- while bytes_done < bytes:
- b = bucket()
- cur_string = b.unpack(cur_string)
- self.buckets.append(b)
- bytes_done += len(b)
- return cur_string
diff --git a/src/python/of12/class_maps.py b/src/python/of12/class_maps.py
deleted file mode 100644
index cd60deb..0000000
--- a/src/python/of12/class_maps.py
+++ /dev/null
@@ -1,346 +0,0 @@
-
-# Class to array member map
-class_to_members_map = {
- 'ofp_aggregate_stats_reply' : [
- 'packet_count',
- 'byte_count',
- 'flow_count'
- ],
- 'ofp_role_request' : [
- 'role',
- 'generation_id'
- ],
- 'ofp_table_stats' : [
- 'table_id',
- 'name',
- 'match',
- 'wildcards',
- 'write_actions',
- 'apply_actions',
- 'write_setfields',
- 'apply_setfields',
- 'metadata_match',
- 'metadata_write',
- 'instructions',
- 'config',
- 'max_entries',
- 'active_count',
- 'lookup_count',
- 'matched_count'
- ],
- 'ofp_table_mod' : [
- 'table_id',
- 'config'
- ],
- 'ofp_group_stats' : [
- 'length',
- 'group_id',
- 'ref_count',
- 'packet_count',
- 'byte_count'
- ],
- 'ofp_instruction_actions' : [
- 'type',
- 'len'
- ],
- 'ofp_queue_stats' : [
- 'port_no',
- 'queue_id',
- 'tx_bytes',
- 'tx_packets',
- 'tx_errors'
- ],
- 'ofp_packet_in' : [
- 'buffer_id',
- 'total_len',
- 'reason',
- 'table_id',
- 'match'
- ],
- 'ofp_error_experimenter_msg' : [
- 'type',
- 'exp_type',
- 'experimenter'
- ],
- 'ofp_bucket_counter' : [
- 'packet_count',
- 'byte_count'
- ],
- 'ofp_port_stats_request' : [
- 'port_no'
- ],
- 'ofp_stats_request' : [
- 'type',
- 'flags'
- ],
- 'ofp_instruction' : [
- 'type',
- 'len'
- ],
- 'ofp_group_stats_request' : [
- 'group_id'
- ],
- 'ofp_experimenter_header' : [
- 'experimenter',
- 'exp_type'
- ],
- 'ofp_aggregate_stats_request' : [
- 'table_id',
- 'out_port',
- 'out_group',
- 'cookie',
- 'cookie_mask',
- 'match'
- ],
- 'ofp_queue_get_config_request' : [
- 'port'
- ],
- 'ofp_action_nw_ttl' : [
- 'type',
- 'len',
- 'nw_ttl'
- ],
- 'ofp_port_status' : [
- 'reason',
- 'desc'
- ],
- 'ofp_action_header' : [
- 'type',
- 'len'
- ],
- 'ofp_port_mod' : [
- 'port_no',
- 'hw_addr',
- 'config',
- 'mask',
- 'advertise'
- ],
- 'ofp_action_output' : [
- 'type',
- 'len',
- 'port',
- 'max_len'
- ],
- 'ofp_switch_config' : [
- 'flags',
- 'miss_send_len'
- ],
- 'ofp_queue_prop_experimenter' : [
- 'prop_header',
- 'experimenter'
- ],
- 'ofp_instruction_write_metadata' : [
- 'type',
- 'len',
- 'metadata',
- 'metadata_mask'
- ],
- 'ofp_action_experimenter_header' : [
- 'type',
- 'len',
- 'experimenter'
- ],
- 'ofp_queue_get_config_reply' : [
- 'port'
- ],
- 'ofp_oxm_experimenter_header' : [
- 'oxm_header',
- 'experimenter'
- ],
- 'ofp_action_set_queue' : [
- 'type',
- 'len',
- 'queue_id'
- ],
- 'ofp_action_set_field' : [
- 'type',
- 'len',
- 'field'
- ],
- 'ofp_flow_stats' : [
- 'length',
- 'table_id',
- 'duration_sec',
- 'duration_nsec',
- 'priority',
- 'idle_timeout',
- 'hard_timeout',
- 'cookie',
- 'packet_count',
- 'byte_count',
- 'match'
- ],
- 'ofp_flow_removed' : [
- 'cookie',
- 'priority',
- 'reason',
- 'table_id',
- 'duration_sec',
- 'duration_nsec',
- 'idle_timeout',
- 'hard_timeout',
- 'packet_count',
- 'byte_count',
- 'match'
- ],
- 'ofp_queue_prop_min_rate' : [
- 'prop_header',
- 'rate'
- ],
- 'ofp_header' : [
- 'version',
- 'type',
- 'length',
- 'xid'
- ],
- 'ofp_stats_reply' : [
- 'type',
- 'flags'
- ],
- 'ofp_queue_stats_request' : [
- 'port_no',
- 'queue_id'
- ],
- 'ofp_group_features_stats' : [
- 'types',
- 'capabilities',
- 'max_groups',
- 'actions'
- ],
- 'ofp_group_mod' : [
- 'command',
- 'type',
- 'group_id'
- ],
- 'ofp_port_stats' : [
- 'port_no',
- 'rx_packets',
- 'tx_packets',
- 'rx_bytes',
- 'tx_bytes',
- 'rx_dropped',
- 'tx_dropped',
- 'rx_errors',
- 'tx_errors',
- 'rx_frame_err',
- 'rx_over_err',
- 'rx_crc_err',
- 'collisions'
- ],
- 'ofp_packet_queue' : [
- 'queue_id',
- 'port',
- 'len'
- ],
- 'ofp_port' : [
- 'port_no',
- 'hw_addr',
- 'name',
- 'config',
- 'state',
- 'curr',
- 'advertised',
- 'supported',
- 'peer',
- 'curr_speed',
- 'max_speed'
- ],
- 'ofp_switch_features' : [
- 'datapath_id',
- 'n_buffers',
- 'n_tables',
- 'capabilities',
- 'reserved'
- ],
- 'ofp_queue_prop_header' : [
- 'property',
- 'len'
- ],
- 'ofp_flow_stats_request' : [
- 'table_id',
- 'out_port',
- 'out_group',
- 'cookie',
- 'cookie_mask',
- 'match'
- ],
- 'ofp_bucket' : [
- 'len',
- 'weight',
- 'watch_port',
- 'watch_group'
- ],
- 'ofp_action_pop_mpls' : [
- 'type',
- 'len',
- 'ethertype'
- ],
- 'ofp_match' : [
- 'type',
- 'length'
- ],
- 'ofp_flow_mod' : [
- 'cookie',
- 'cookie_mask',
- 'table_id',
- 'command',
- 'idle_timeout',
- 'hard_timeout',
- 'priority',
- 'buffer_id',
- 'out_port',
- 'out_group',
- 'flags',
- 'match'
- ],
- 'ofp_packet_out' : [
- 'buffer_id',
- 'in_port',
- 'actions_len'
- ],
- 'ofp_instruction_goto_table' : [
- 'type',
- 'len',
- 'table_id'
- ],
- 'ofp_queue_prop_max_rate' : [
- 'prop_header',
- 'rate'
- ],
- 'ofp_experimenter_stats_header' : [
- 'experimenter',
- 'exp_type'
- ],
- 'ofp_action_group' : [
- 'type',
- 'len',
- 'group_id'
- ],
- 'ofp_desc_stats' : [
- 'mfr_desc',
- 'hw_desc',
- 'sw_desc',
- 'serial_num',
- 'dp_desc'
- ],
- 'ofp_action_push' : [
- 'type',
- 'len',
- 'ethertype'
- ],
- 'ofp_group_desc_stats' : [
- 'length',
- 'type',
- 'group_id'
- ],
- 'ofp_error_msg' : [
- 'type',
- 'code'
- ],
- 'ofp_action_mpls_ttl' : [
- 'type',
- 'len',
- 'mpls_ttl'
- ],
- '_ignore' : []
-}
diff --git a/src/python/of12/cstruct.py b/src/python/of12/cstruct.py
deleted file mode 100644
index 06f9ac9..0000000
--- a/src/python/of12/cstruct.py
+++ /dev/null
@@ -1,5922 +0,0 @@
-import struct
-
-# Structure definitions
-class ofp_hello(object):
- """Automatically generated Python class for ofp_hello
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 0):
- return binaryString
- return binaryString[0:]
-
- def __len__(self):
- """Return length of message
- """
- l = 0
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- return outstr
-
-
-class ofp_aggregate_stats_reply(object):
- """Automatically generated Python class for ofp_aggregate_stats_reply
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.packet_count = 0
- self.byte_count = 0
- self.flow_count = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!QQL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 20
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.flow_count != other.flow_count: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n'
- return outstr
-
-
-class ofp_role_request(object):
- """Automatically generated Python class for ofp_role_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.role = 0
- self.pad= [0,0,0,0]
- self.generation_id = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.role)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!Q", self.generation_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.role,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!Q'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.generation_id,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.role != other.role: return False
- if self.pad != other.pad: return False
- if self.generation_id != other.generation_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'role: ' + str(self.role) + '\n'
- outstr += prefix + 'generation_id: ' + str(self.generation_id) + '\n'
- return outstr
-
-
-class ofp_table_stats(object):
- """Automatically generated Python class for ofp_table_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0,0,0,0,0]
- self.name= ""
- self.match = 0
- self.wildcards = 0
- self.write_actions = 0
- self.apply_actions = 0
- self.write_setfields = 0
- self.apply_setfields = 0
- self.metadata_match = 0
- self.metadata_write = 0
- self.instructions = 0
- self.config = 0
- self.max_entries = 0
- self.active_count = 0
- self.lookup_count = 0
- self.matched_count = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 7):
- return (False, "self.pad is not of size 7 as expected.")
- if(not isinstance(self.name, str)):
- return (False, "self.name is not string as expected.")
- if(len(self.name) > 32):
- return (False, "self.name is not of size 32 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
- packed += self.name.ljust(32,'\0')
- packed += struct.pack("!QQLLQQQQLLLLQQ", self.match, self.wildcards, self.write_actions, self.apply_actions, self.write_setfields, self.apply_setfields, self.metadata_match, self.metadata_write, self.instructions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 128):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
- self.name = binaryString[8:40].replace("\0","")
- fmt = '!QQLLQQQQLLLLQQ'
- start = 40
- end = start + struct.calcsize(fmt)
- (self.match, self.wildcards, self.write_actions, self.apply_actions, self.write_setfields, self.apply_setfields, self.metadata_match, self.metadata_write, self.instructions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[128:]
-
- def __len__(self):
- """Return length of message
- """
- l = 128
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.name != other.name: return False
- if self.match != other.match: return False
- if self.wildcards != other.wildcards: return False
- if self.write_actions != other.write_actions: return False
- if self.apply_actions != other.apply_actions: return False
- if self.write_setfields != other.write_setfields: return False
- if self.apply_setfields != other.apply_setfields: return False
- if self.metadata_write != other.metadata_match: return False
- if self.metadata_write != other.metadata_write: return False
- if self.instructions != other.instructions: return False
- if self.config != other.config: return False
- if self.max_entries != other.max_entries: return False
- if self.active_count != other.active_count: return False
- if self.lookup_count != other.lookup_count: return False
- if self.matched_count != other.matched_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'name: ' + str(self.name) + '\n'
- outstr += prefix + 'match: ' + str(self.match) + '\n'
- outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
- outstr += prefix + 'write_actions: ' + str(self.write_actions) + '\n'
- outstr += prefix + 'apply_actions: ' + str(self.apply_actions) + '\n'
- outstr += prefix + 'write_setfields: ' + str(self.write_setfields) + '\n'
- outstr += prefix + 'apply_setfields: ' + str(self.apply_setfields) + '\n'
- outstr += prefix + 'metadata_match: ' + str(self.metadata_match) + '\n'
- outstr += prefix + 'metadata_write: ' + str(self.metadata_write) + '\n'
- outstr += prefix + 'instructions: ' + str(self.instructions) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n'
- outstr += prefix + 'active_count: ' + str(self.active_count) + '\n'
- outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n'
- outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n'
- return outstr
-
-
-class ofp_table_mod(object):
- """Automatically generated Python class for ofp_table_mod
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad= [0,0,0]
- self.config = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!L", self.config)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!L'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.config,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.config != other.config: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- return outstr
-
-
-class ofp_group_stats(object):
- """Automatically generated Python class for ofp_group_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.pad= [0,0]
- self.group_id = 0
- self.ref_count = 0
- self.pad2= [0,0,0,0]
- self.packet_count = 0
- self.byte_count = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 4):
- return (False, "self.pad2 is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!H", self.length)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- packed += struct.pack("!LL", self.group_id, self.ref_count)
- packed += struct.pack("!BBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3])
- packed += struct.pack("!QQ", self.packet_count, self.byte_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!H'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 2
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.group_id, self.ref_count) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- if self.ref_count != other.ref_count: return False
- if self.pad2 != other.pad2: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- outstr += prefix + 'ref_count: ' + str(self.ref_count) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- return outstr
-
-
-class ofp_instruction_actions(object):
- """Automatically generated Python class for ofp_instruction_actions
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_queue_stats(object):
- """Automatically generated Python class for ofp_queue_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.queue_id = 0
- self.tx_bytes = 0
- self.tx_packets = 0
- self.tx_errors = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLQQQ", self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!LLQQQ'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.queue_id != other.queue_id: return False
- if self.tx_bytes != other.tx_bytes: return False
- if self.tx_packets != other.tx_packets: return False
- if self.tx_errors != other.tx_errors: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
- outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
- outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
- return outstr
-
-
-class ofp_packet_in(object):
- """Automatically generated Python class for ofp_packet_in
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.buffer_id = 0
- self.total_len = 0
- self.reason = 0
- self.table_id = 0
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LHBB", self.buffer_id, self.total_len, self.reason, self.table_id)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 12):
- return binaryString
- fmt = '!LHBB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.buffer_id, self.total_len, self.reason, self.table_id) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[8:])
- return binaryString[12:]
-
- def __len__(self):
- """Return length of message
- """
- l = 12
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.buffer_id != other.buffer_id: return False
- if self.total_len != other.total_len: return False
- if self.reason != other.reason: return False
- if self.table_id != other.table_id: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_error_experimenter_msg(object):
- """Automatically generated Python class for ofp_error_experimenter_msg
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.exp_type = 0
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.exp_type, self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.exp_type, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.exp_type != other.exp_type: return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_bucket_counter(object):
- """Automatically generated Python class for ofp_bucket_counter
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.packet_count = 0
- self.byte_count = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQ", self.packet_count, self.byte_count)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!QQ'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- return outstr
-
-
-class ofp_port_stats_request(object):
- """Automatically generated Python class for ofp_port_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- return outstr
-
-
-class ofp_stats_request(object):
- """Automatically generated Python class for ofp_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.flags = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
-
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.flags)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.flags != other.flags: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- return outstr
-
-
-class ofp_instruction(object):
- """Automatically generated Python class for ofp_instruction
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_group_stats_request(object):
- """Automatically generated Python class for ofp_group_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.group_id = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.group_id)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.group_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.group_id != other.group_id: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_experimenter_header(object):
- """Automatically generated Python class for ofp_experimenter_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.experimenter = 0
- self.exp_type = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.experimenter, self.exp_type)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.experimenter, self.exp_type) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.experimenter != other.experimenter: return False
- if self.exp_type != other.exp_type: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
- return outstr
-
-
-class ofp_aggregate_stats_request(object):
- """Automatically generated Python class for ofp_aggregate_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad_asr= [0,0,0]
- self.out_port = 0
- self.out_group = 0
- self.pad_asr2= [0,0,0,0]
- self.cookie = 0
- self.cookie_mask = 0
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad_asr, list)):
- return (False, "self.pad_asr is not list as expected.")
- if(len(self.pad_asr) != 3):
- return (False, "self.pad_asr is not of size 3 as expected.")
- if(not isinstance(self.pad_asr2, list)):
- return (False, "self.pad_asr2 is not list as expected.")
- if(len(self.pad_asr2) != 4):
- return (False, "self.pad_asr2 is not of size 4 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad_asr[0], self.pad_asr[1], self.pad_asr[2])
- packed += struct.pack("!LL", self.out_port, self.out_group)
- packed += struct.pack("!BBBB", self.pad_asr2[0], self.pad_asr2[1], self.pad_asr2[2], self.pad_asr2[3])
- packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 36):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad_asr[1], self.pad_asr[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad_asr2[1], self.pad_asr2[2], self.pad_asr2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[32:])
- return binaryString[36:]
-
- def __len__(self):
- """Return length of message
- """
- l = 36
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.pad2 != other.pad2: return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_queue_get_config_request(object):
- """Automatically generated Python class for ofp_queue_get_config_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port != other.port: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- return outstr
-
-
-class ofp_action_nw_ttl(object):
- """Automatically generated Python class for ofp_action_nw_ttl
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.nw_ttl = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.nw_ttl)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.nw_ttl) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.nw_ttl != other.nw_ttl: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'nw_ttl: ' + str(self.nw_ttl) + '\n'
- return outstr
-
-
-class ofp_port_status(object):
- """Automatically generated Python class for ofp_port_status
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.reason = 0
- self.pad= [0,0,0,0,0,0,0]
- self.desc = ofp_port()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 7):
- return (False, "self.pad is not of size 7 as expected.")
- if(not isinstance(self.desc, ofp_port)):
- return (False, "self.desc is not class ofp_port as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.reason)
- packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
- packed += self.desc.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 72):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.reason,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
- self.desc.unpack(binaryString[8:])
- return binaryString[72:]
-
- def __len__(self):
- """Return length of message
- """
- l = 72
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.reason != other.reason: return False
- if self.pad != other.pad: return False
- if self.desc != other.desc: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'desc: \n'
- outstr += self.desc.show(prefix + ' ')
- return outstr
-
-
-class ofp_action_header(object):
- """Automatically generated Python class for ofp_action_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_port_mod(object):
- """Automatically generated Python class for ofp_port_mod
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.hw_addr= [0,0,0,0,0,0]
- self.pad2= [0,0]
- self.config = 0
- self.mask = 0
- self.advertise = 0
- self.pad3= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- if(not isinstance(self.hw_addr, list)):
- return (False, "self.hw_addr is not list as expected.")
- if(len(self.hw_addr) != 6):
- return (False, "self.hw_addr is not of size 6 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 2):
- return (False, "self.pad2 is not of size 2 as expected.")
- if(not isinstance(self.pad3, list)):
- return (False, "self.pad3 is not list as expected.")
- if(len(self.pad3) != 4):
- return (False, "self.pad3 is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
- packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
- packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
- packed += struct.pack("!BBBB", self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 32):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 14
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LLL'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 28
- end = start + struct.calcsize(fmt)
- (self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[32:]
-
- def __len__(self):
- """Return length of message
- """
- l = 32
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.hw_addr != other.hw_addr: return False
- if self.pad2 != other.pad2: return False
- if self.config != other.config: return False
- if self.mask != other.mask: return False
- if self.advertise != other.advertise: return False
- if self.pad3 != other.pad3: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'mask: ' + str(self.mask) + '\n'
- outstr += prefix + 'advertise: ' + str(self.advertise) + '\n'
- return outstr
-
-
-class ofp_action_output(object):
- """Automatically generated Python class for ofp_action_output
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.port = 0
- self.max_len = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHLH", self.type, self.len, self.port, self.max_len)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!HHLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.port != other.port: return False
- if self.max_len != other.max_len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- outstr += prefix + 'max_len: ' + str(self.max_len) + '\n'
- return outstr
-
-
-class ofp_switch_config(object):
- """Automatically generated Python class for ofp_switch_config
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.flags = 0
- self.miss_send_len = 128
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.flags, self.miss_send_len)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.flags != other.flags: return False
- if self.miss_send_len != other.miss_send_len: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
- return outstr
-
-
-class ofp_queue_prop_experimenter(object):
- """Automatically generated Python class for ofp_queue_prop_experimenter
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.prop_header = ofp_queue_prop_header()
- self.experimenter = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.prop_header, ofp_queue_prop_header)):
- return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.prop_header.pack()
- packed += struct.pack("!L", self.experimenter)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- self.prop_header.unpack(binaryString[0:])
- fmt = '!L'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.experimenter,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.prop_header != other.prop_header: return False
- if self.experimenter != other.experimenter: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'prop_header: \n'
- outstr += self.prop_header.show(prefix + ' ')
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_instruction_write_metadata(object):
- """Automatically generated Python class for ofp_instruction_write_metadata
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.pad= [0,0,0,0]
- self.metadata = 0
- self.metadata_mask = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!QQ", self.metadata, self.metadata_mask)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.metadata, self.metadata_mask) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- if self.metadata != other.metadata: return False
- if self.metadata_mask != other.metadata_mask: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'metadata: ' + str(self.metadata) + '\n'
- outstr += prefix + 'metadata_mask: ' + str(self.metadata_mask) + '\n'
- return outstr
-
-
-class ofp_action_experimenter_header(object):
- """Automatically generated Python class for ofp_action_experimenter_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_queue_get_config_reply(object):
- """Automatically generated Python class for ofp_queue_get_config_reply
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port != other.port: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- return outstr
-
-
-class ofp_oxm_experimenter_header(object):
- """Automatically generated Python class for ofp_oxm_experimenter_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.oxm_header = 0
- self.experimenter = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.oxm_header, self.experimenter)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.oxm_header, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.oxm_header != other.oxm_header: return False
- if self.experimenter != other.experimenter: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'oxm_header: ' + str(self.oxm_header) + '\n'
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- return outstr
-
-
-class ofp_action_set_queue(object):
- """Automatically generated Python class for ofp_action_set_queue
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.queue_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.queue_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.queue_id != other.queue_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- return outstr
-
-
-class ofp_action_set_field(object):
- """Automatically generated Python class for ofp_action_set_field
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.field= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.field, list)):
- return (False, "self.field is not list as expected.")
- if(len(self.field) != 4):
- return (False, "self.field is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.len)
- packed += struct.pack("!BBBB", self.field[0], self.field[1], self.field[2], self.field[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.field[0], self.field[1], self.field[2], self.field[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.field != other.field: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'field: ' + str(self.field) + '\n'
- return outstr
-
-
-class ofp_flow_stats(object):
- """Automatically generated Python class for ofp_flow_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.table_id = 0
- self.pad = 0
- self.duration_sec = 0
- self.duration_nsec = 0
- self.priority = 0x8000
- self.idle_timeout = 0
- self.hard_timeout = 0
- self.pad2= [0,0,0,0,0,0]
- self.cookie = 0
- self.packet_count = 0
- self.byte_count = 0
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 6):
- return (False, "self.pad2 is not of size 6 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBLLHHH", self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout)
- packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5])
- packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 52):
- return binaryString
- fmt = '!HBBLLHHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 18
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQQ'
- start = 24
- end = start + struct.calcsize(fmt)
- (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[48:])
- return binaryString[52:]
-
- def __len__(self):
- """Return length of message
- """
- l = 52
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- if self.duration_sec != other.duration_sec: return False
- if self.duration_nsec != other.duration_nsec: return False
- if self.priority != other.priority: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.hard_timeout != other.hard_timeout: return False
- if self.pad2 != other.pad2: return False
- if self.cookie != other.cookie: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
- outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_flow_removed(object):
- """Automatically generated Python class for ofp_flow_removed
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.cookie = 0
- self.priority = 0
- self.reason = 0
- self.table_id = 0
- self.duration_sec = 0
- self.duration_nsec = 0
- self.idle_timeout = 0
- self.hard_timeout = 0
- self.packet_count = 0
- self.byte_count = 0
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QHBBLLHHQQ", self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout, self.hard_timeout, self.packet_count, self.byte_count)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 44):
- return binaryString
- fmt = '!QHBBLLHHQQ'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout, self.hard_timeout, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[40:])
- return binaryString[44:]
-
- def __len__(self):
- """Return length of message
- """
- l = 44
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.cookie != other.cookie: return False
- if self.priority != other.priority: return False
- if self.reason != other.reason: return False
- if self.table_id != other.table_id: return False
- if self.duration_sec != other.duration_sec: return False
- if self.duration_nsec != other.duration_nsec: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.hard_timeout != other.hard_timeout: return False
- if self.packet_count != other.packet_count: return False
- if self.byte_count != other.byte_count: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'reason: ' + str(self.reason) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
- outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
- outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
- outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_queue_prop_min_rate(object):
- """Automatically generated Python class for ofp_queue_prop_min_rate
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.prop_header = ofp_queue_prop_header()
- self.rate = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.prop_header, ofp_queue_prop_header)):
- return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.prop_header.pack()
- packed += struct.pack("!H", self.rate)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- self.prop_header.unpack(binaryString[0:])
- fmt = '!H'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.rate,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.prop_header != other.prop_header: return False
- if self.rate != other.rate: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'prop_header: \n'
- outstr += self.prop_header.show(prefix + ' ')
- outstr += prefix + 'rate: ' + str(self.rate) + '\n'
- return outstr
-
-
-class ofp_header(object):
- """Automatically generated Python class for ofp_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.version = 0x03
- self.type = 0
- self.length = 0
- self.xid = 0
-
- def __assert(self):
- """Sanity check
- """
- if (not (self.type in ofp_type_map.keys())):
- return (False, "type must have values from ofp_type_map.keys()")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!BBHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
- if self.length != other.length: return False
- if self.xid != other.xid: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'version: ' + str(self.version) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'xid: ' + str(self.xid) + '\n'
- return outstr
-
-
-class ofp_stats_reply(object):
- """Automatically generated Python class for ofp_stats_reply
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.flags = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.flags)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.flags != other.flags: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- return outstr
-
-
-class ofp_queue_stats_request(object):
- """Automatically generated Python class for ofp_queue_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.queue_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.port_no, self.queue_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.queue_id != other.queue_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- return outstr
-
-
-class ofp_group_features_stats(object):
- """Automatically generated Python class for ofp_group_features_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.types = 0
- self.capabilities = 0
- self.max_groups= [0,0,0,0]
- self.actions= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.max_groups, list)):
- return (False, "self.max_groups is not list as expected.")
- if(len(self.max_groups) != 4):
- return (False, "self.max_groups is not of size 4 as expected.")
- if(not isinstance(self.actions, list)):
- return (False, "self.actions is not list as expected.")
- if(len(self.actions) != 4):
- return (False, "self.actions is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.types, self.capabilities)
- packed += struct.pack("!LLLL", self.max_groups[0], self.max_groups[1], self.max_groups[2], self.max_groups[3])
- packed += struct.pack("!LLLL", self.actions[0], self.actions[1], self.actions[2], self.actions[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 40):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.types, self.capabilities) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LLLL'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.max_groups[0], self.max_groups[1], self.max_groups[2], self.max_groups[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LLLL'
- start = 24
- end = start + struct.calcsize(fmt)
- (self.actions[0], self.actions[1], self.actions[2], self.actions[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[40:]
-
- def __len__(self):
- """Return length of message
- """
- l = 40
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.types != other.types: return False
- if self.capabilities != other.capabilities: return False
- if self.max_groups != other.max_groups: return False
- if self.actions != other.actions: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'types: ' + str(self.types) + '\n'
- outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
- outstr += prefix + 'max_groups: ' + str(self.max_groups) + '\n'
- outstr += prefix + 'actions: ' + str(self.actions) + '\n'
- return outstr
-
-
-class ofp_group_mod(object):
- """Automatically generated Python class for ofp_group_mod
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.command = 0
- self.type = 0
- self.pad = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBL", self.command, self.type, self.pad, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HBBL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.command, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.command != other.command: return False
- if self.type != other.type: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'command: ' + str(self.command) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_port_stats(object):
- """Automatically generated Python class for ofp_port_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.rx_packets = 0
- self.tx_packets = 0
- self.rx_bytes = 0
- self.tx_bytes = 0
- self.rx_dropped = 0
- self.tx_dropped = 0
- self.rx_errors = 0
- self.tx_errors = 0
- self.rx_frame_err = 0
- self.rx_over_err = 0
- self.rx_crc_err = 0
- self.collisions = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!QQQQQQQQQQQQ", self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 104):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQQQQQQQQQQQ'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[104:]
-
- def __len__(self):
- """Return length of message
- """
- l = 104
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.rx_packets != other.rx_packets: return False
- if self.tx_packets != other.tx_packets: return False
- if self.rx_bytes != other.rx_bytes: return False
- if self.tx_bytes != other.tx_bytes: return False
- if self.rx_dropped != other.rx_dropped: return False
- if self.tx_dropped != other.tx_dropped: return False
- if self.rx_errors != other.rx_errors: return False
- if self.tx_errors != other.tx_errors: return False
- if self.rx_frame_err != other.rx_frame_err: return False
- if self.rx_over_err != other.rx_over_err: return False
- if self.rx_crc_err != other.rx_crc_err: return False
- if self.collisions != other.collisions: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n'
- outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
- outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n'
- outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
- outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n'
- outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n'
- outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n'
- outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
- outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n'
- outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n'
- outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n'
- outstr += prefix + 'collisions: ' + str(self.collisions) + '\n'
- return outstr
-
-
-class ofp_packet_queue(object):
- """Automatically generated Python class for ofp_packet_queue
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.queue_id = 0
- self.port = 0
- self.len = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLH", self.queue_id, self.port, self.len)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!LLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.queue_id, self.port, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.queue_id != other.queue_id: return False
- if self.port != other.port: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
- outstr += prefix + 'port: ' + str(self.port) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_port(object):
- """Automatically generated Python class for ofp_port
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.port_no = 0
- self.pad= [0,0,0,0]
- self.hw_addr= [0,0,0,0,0,0]
- self.pad2= [0,0]
- self.name= ""
- self.config = 0
- self.state = 0
- self.curr = 0
- self.advertised = 0
- self.supported = 0
- self.peer = 0
- self.curr_speed = 0
- self.max_speed = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- if(not isinstance(self.hw_addr, list)):
- return (False, "self.hw_addr is not list as expected.")
- if(len(self.hw_addr) != 6):
- return (False, "self.hw_addr is not of size 6 as expected.")
- if(not isinstance(self.pad2, list)):
- return (False, "self.pad2 is not list as expected.")
- if(len(self.pad2) != 2):
- return (False, "self.pad2 is not of size 2 as expected.")
- if(not isinstance(self.name, str)):
- return (False, "self.name is not string as expected.")
- if(len(self.name) > 16):
- return (False, "self.name is not of size 16 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!L", self.port_no)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
- packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
- packed += self.name.ljust(16,'\0')
- packed += struct.pack("!LLLLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 64):
- return binaryString
- fmt = '!L'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 14
- end = start + struct.calcsize(fmt)
- (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
- self.name = binaryString[16:32].replace("\0","")
- fmt = '!LLLLLLLL'
- start = 32
- end = start + struct.calcsize(fmt)
- (self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[64:]
-
- def __len__(self):
- """Return length of message
- """
- l = 64
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.port_no != other.port_no: return False
- if self.pad != other.pad: return False
- if self.hw_addr != other.hw_addr: return False
- if self.pad2 != other.pad2: return False
- if self.name != other.name: return False
- if self.config != other.config: return False
- if self.state != other.state: return False
- if self.curr != other.curr: return False
- if self.advertised != other.advertised: return False
- if self.supported != other.supported: return False
- if self.peer != other.peer: return False
- if self.curr_speed != other.curr_speed: return False
- if self.max_speed != other.max_speed: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
- outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
- outstr += prefix + 'name: ' + str(self.name) + '\n'
- outstr += prefix + 'config: ' + str(self.config) + '\n'
- outstr += prefix + 'state: ' + str(self.state) + '\n'
- outstr += prefix + 'curr: ' + str(self.curr) + '\n'
- outstr += prefix + 'advertised: ' + str(self.advertised) + '\n'
- outstr += prefix + 'supported: ' + str(self.supported) + '\n'
- outstr += prefix + 'peer: ' + str(self.peer) + '\n'
- outstr += prefix + 'curr_speed: ' + str(self.curr_speed) + '\n'
- outstr += prefix + 'max_speed: ' + str(self.max_speed) + '\n'
- return outstr
-
-
-class ofp_switch_features(object):
- """Automatically generated Python class for ofp_switch_features
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.datapath_id = 0
- self.n_buffers = 0
- self.n_tables = 0
- self.pad= [0,0,0]
- self.capabilities = 0
- self.reserved = 0
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- packed += struct.pack("!LL", self.capabilities, self.reserved)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 24):
- return binaryString
- fmt = '!QLB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 13
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.capabilities, self.reserved) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
-
- def __len__(self):
- """Return length of message
- """
- l = 24
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.datapath_id != other.datapath_id: return False
- if self.n_buffers != other.n_buffers: return False
- if self.n_tables != other.n_tables: return False
- if self.pad != other.pad: return False
- if self.capabilities != other.capabilities: return False
- if self.reserved != other.reserved: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
- outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
- outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
- outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
- outstr += prefix + 'reserved: ' + str(self.reserved) + '\n'
- return outstr
-
-
-class ofp_queue_prop_header(object):
- """Automatically generated Python class for ofp_queue_prop_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.property = 0
- self.len = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.property, self.len)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.property, self.len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.property != other.property: return False
- if self.len != other.len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'property: ' + str(self.property) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- return outstr
-
-
-class ofp_flow_stats_request(object):
- """Automatically generated Python class for ofp_flow_stats_request
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.table_id = 0
- self.pad_fstat= [0,0,0]
- self.out_port = 0
- self.out_group = 0
- self.pad_fstat2= [0,0,0,0]
- self.cookie = 0
- self.cookie_mask = 0
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad_fstat is not list as expected.")
- if(len(self.pad_fstat) != 3):
- return (False, "self.pad_fstat is not of size 3 as expected.")
- if(not isinstance(self.pad_fstat2, list)):
- return (False, "self.pad_fstat2 is not list as expected.")
- if(len(self.pad_fstat2) != 4):
- return (False, "self.pad_ftsat2 is not of size 4 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!B", self.table_id)
- packed += struct.pack("!BBB", self.pad_fstat[0], self.pad_fstat[1], self.pad_fstat[2])
- packed += struct.pack("!LL", self.out_port, self.out_group)
- packed += struct.pack("!BBBB", self.pad_fstat2[0], self.pad_fstat2[1], self.pad_fstat2[2], self.pad_fstat2[3])
- packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 36):
- return binaryString
- fmt = '!B'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 1
- end = start + struct.calcsize(fmt)
- (self.pad_fstat[0], self.pad_fstat[1], self.pad_fstat[2]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!LL'
- start = 4
- end = start + struct.calcsize(fmt)
- (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad_fstat2[0], self.pad_fstat2[1], self.pad_fstat2[2], self.pad_fstat2[3]) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!QQ'
- start = 16
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[32:])
- return binaryString[36:]
-
- def __len__(self):
- """Return length of message
- """
- l = 36
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.table_id != other.table_id: return False
- if self.pad_fstat != other.pad_fstat: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.pad_fstat2 != other.pad_fstat2: return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_bucket(object):
- """Automatically generated Python class for ofp_bucket
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.len = 0
- self.weight = 0
- self.watch_port = 0
- self.watch_group = 0
- self.pad= [0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 4):
- return (False, "self.pad is not of size 4 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHLL", self.len, self.weight, self.watch_port, self.watch_group)
- packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!HHLL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.len, self.weight, self.watch_port, self.watch_group) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBB'
- start = 12
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.len != other.len: return False
- if self.weight != other.weight: return False
- if self.watch_port != other.watch_port: return False
- if self.watch_group != other.watch_group: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'weight: ' + str(self.weight) + '\n'
- outstr += prefix + 'watch_port: ' + str(self.watch_port) + '\n'
- outstr += prefix + 'watch_group: ' + str(self.watch_group) + '\n'
- return outstr
-
-
-class ofp_action_pop_mpls(object):
- """Automatically generated Python class for ofp_action_pop_mpls
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.ethertype = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.ethertype != other.ethertype: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
- return outstr
-
-
-class ofp_match(object):
- """Automatically generated Python class for ofp_match
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = OFPMT_OXM
- #exclude padding bytes
- self.length = OFP_MATCH_BYTES
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.length)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.length) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.length != other.length: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- return outstr
-
-
-class ofp_flow_mod(object):
- """Automatically generated Python class for ofp_flow_mod
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.cookie = 0
- self.cookie_mask = 0
- self.table_id = 0
- self.command = 0
- self.idle_timeout = 0
- self.hard_timeout = 0
- self.priority = 0x8000
- self.buffer_id = 0
- self.out_port = 0
- self.out_group = 0
- self.flags = 0
- self.pad= [0,0]
- self.match = ofp_match()
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- if(not isinstance(self.match, ofp_match)):
- return (False, "self.match is not class ofp_match as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!QQBBHHHLLLH", self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- packed += self.match.pack()
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 44):
- return binaryString
- fmt = '!QQBBHHHLLLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 38
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- self.match.unpack(binaryString[40:])
- return binaryString[44:]
-
- def __len__(self):
- """Return length of message
- """
- l = 44
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.cookie != other.cookie: return False
- if self.cookie_mask != other.cookie_mask: return False
- if self.table_id != other.table_id: return False
- if self.command != other.command: return False
- if self.idle_timeout != other.idle_timeout: return False
- if self.hard_timeout != other.hard_timeout: return False
- if self.priority != other.priority: return False
- if self.buffer_id != other.buffer_id: return False
- if self.out_port != other.out_port: return False
- if self.out_group != other.out_group: return False
- if self.flags != other.flags: return False
- if self.pad != other.pad: return False
- if self.match != other.match: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
- outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- outstr += prefix + 'command: ' + str(self.command) + '\n'
- outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
- outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
- outstr += prefix + 'priority: ' + str(self.priority) + '\n'
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
- outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
- outstr += prefix + 'flags: ' + str(self.flags) + '\n'
- outstr += prefix + 'match: \n'
- outstr += self.match.show(prefix + ' ')
- return outstr
-
-
-class ofp_packet_out(object):
- """Automatically generated Python class for ofp_packet_out
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.buffer_id = 4294967295
- self.in_port = 0
- self.actions_len = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LLH", self.buffer_id, self.in_port, self.actions_len)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- fmt = '!LLH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.buffer_id != other.buffer_id: return False
- if self.in_port != other.in_port: return False
- if self.actions_len != other.actions_len: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
- outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
- outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
- return outstr
-
-
-class ofp_instruction_goto_table(object):
- """Automatically generated Python class for ofp_instruction_goto_table
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.table_id = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.table_id)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.table_id) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.table_id != other.table_id: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
- return outstr
-
-
-class ofp_queue_prop_max_rate(object):
- """Automatically generated Python class for ofp_queue_prop_max_rate
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.prop_header = ofp_queue_prop_header()
- self.rate = 0
- self.pad= [0,0,0,0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.prop_header, ofp_queue_prop_header)):
- return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 6):
- return (False, "self.pad is not of size 6 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.prop_header.pack()
- packed += struct.pack("!H", self.rate)
- packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 16):
- return binaryString
- self.prop_header.unpack(binaryString[0:])
- fmt = '!H'
- start = 8
- end = start + struct.calcsize(fmt)
- (self.rate,) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBBBBB'
- start = 10
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[16:]
-
- def __len__(self):
- """Return length of message
- """
- l = 16
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.prop_header != other.prop_header: return False
- if self.rate != other.rate: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'prop_header: \n'
- outstr += self.prop_header.show(prefix + ' ')
- outstr += prefix + 'rate: ' + str(self.rate) + '\n'
- return outstr
-
-
-class ofp_experimenter_stats_header(object):
- """Automatically generated Python class for ofp_experimenter_stats_header
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.experimenter = 0
- self.exp_type = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!LL", self.experimenter, self.exp_type)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!LL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.experimenter, self.exp_type) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.experimenter != other.experimenter: return False
- if self.exp_type != other.exp_type: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
- outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
- return outstr
-
-
-class ofp_action_group(object):
- """Automatically generated Python class for ofp_action_group
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHL", self.type, self.len, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_desc_stats(object):
- """Automatically generated Python class for ofp_desc_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.mfr_desc= ""
- self.hw_desc= ""
- self.sw_desc= ""
- self.serial_num= ""
- self.dp_desc= ""
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.mfr_desc, str)):
- return (False, "self.mfr_desc is not string as expected.")
- if(len(self.mfr_desc) > 256):
- return (False, "self.mfr_desc is not of size 256 as expected.")
- if(not isinstance(self.hw_desc, str)):
- return (False, "self.hw_desc is not string as expected.")
- if(len(self.hw_desc) > 256):
- return (False, "self.hw_desc is not of size 256 as expected.")
- if(not isinstance(self.sw_desc, str)):
- return (False, "self.sw_desc is not string as expected.")
- if(len(self.sw_desc) > 256):
- return (False, "self.sw_desc is not of size 256 as expected.")
- if(not isinstance(self.serial_num, str)):
- return (False, "self.serial_num is not string as expected.")
- if(len(self.serial_num) > 32):
- return (False, "self.serial_num is not of size 32 as expected.")
- if(not isinstance(self.dp_desc, str)):
- return (False, "self.dp_desc is not string as expected.")
- if(len(self.dp_desc) > 256):
- return (False, "self.dp_desc is not of size 256 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += self.mfr_desc.ljust(256,'\0')
- packed += self.hw_desc.ljust(256,'\0')
- packed += self.sw_desc.ljust(256,'\0')
- packed += self.serial_num.ljust(32,'\0')
- packed += self.dp_desc.ljust(256,'\0')
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 1056):
- return binaryString
- self.mfr_desc = binaryString[0:256].replace("\0","")
- self.hw_desc = binaryString[256:512].replace("\0","")
- self.sw_desc = binaryString[512:768].replace("\0","")
- self.serial_num = binaryString[768:800].replace("\0","")
- self.dp_desc = binaryString[800:1056].replace("\0","")
- return binaryString[1056:]
-
- def __len__(self):
- """Return length of message
- """
- l = 1056
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.mfr_desc != other.mfr_desc: return False
- if self.hw_desc != other.hw_desc: return False
- if self.sw_desc != other.sw_desc: return False
- if self.serial_num != other.serial_num: return False
- if self.dp_desc != other.dp_desc: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n'
- outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n'
- outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n'
- outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n'
- outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n'
- return outstr
-
-
-class ofp_action_push(object):
- """Automatically generated Python class for ofp_action_push
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.ethertype = 0
- self.pad= [0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 2):
- return (False, "self.pad is not of size 2 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
- packed += struct.pack("!BB", self.pad[0], self.pad[1])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BB'
- start = 6
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.ethertype != other.ethertype: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
- return outstr
-
-
-class ofp_group_desc_stats(object):
- """Automatically generated Python class for ofp_group_desc_stats
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.length = 0
- self.type = 0
- self.pad = 0
- self.group_id = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HBBL", self.length, self.type, self.pad, self.group_id)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HBBL'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.length, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.length != other.length: return False
- if self.type != other.type: return False
- if self.pad != other.pad: return False
- if self.group_id != other.group_id: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'length: ' + str(self.length) + '\n'
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
- return outstr
-
-
-class ofp_error_msg(object):
- """Automatically generated Python class for ofp_error_msg
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.code = 0
-
- def __assert(self):
- """Sanity check
- """
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HH", self.type, self.code)
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 4):
- return binaryString
- fmt = '!HH'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.code) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
-
- def __len__(self):
- """Return length of message
- """
- l = 4
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.code != other.code: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'code: ' + str(self.code) + '\n'
- return outstr
-
-
-class ofp_action_mpls_ttl(object):
- """Automatically generated Python class for ofp_action_mpls_ttl
-
- Date 2012-06-25
- Created by of.pythonize.pythonizer
- Core structure: Messages do not include ofp_header
- Does not include var-length arrays
- """
- def __init__(self):
- """Initialize
- Declare members and default values
- """
- self.type = 0
- self.len = 0
- self.mpls_ttl = 0
- self.pad= [0,0,0]
-
- def __assert(self):
- """Sanity check
- """
- if(not isinstance(self.pad, list)):
- return (False, "self.pad is not list as expected.")
- if(len(self.pad) != 3):
- return (False, "self.pad is not of size 3 as expected.")
- return (True, None)
-
- def pack(self, assertstruct=True):
- """Pack message
- Packs empty array used as placeholder
- """
- if(assertstruct):
- if(not self.__assert()[0]):
- return None
- packed = ""
- packed += struct.pack("!HHB", self.type, self.len, self.mpls_ttl)
- packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
- return packed
-
- def unpack(self, binaryString):
- """Unpack message
- Do not unpack empty array used as placeholder
- since they can contain heterogeneous type
- """
- if (len(binaryString) < 8):
- return binaryString
- fmt = '!HHB'
- start = 0
- end = start + struct.calcsize(fmt)
- (self.type, self.len, self.mpls_ttl) = struct.unpack(fmt, binaryString[start:end])
- fmt = '!BBB'
- start = 5
- end = start + struct.calcsize(fmt)
- (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
-
- def __len__(self):
- """Return length of message
- """
- l = 8
- return l
-
- def __eq__(self, other):
- """Return True if self and other have same values
- """
- if type(self) != type(other): return False
- if self.type != other.type: return False
- if self.len != other.len: return False
- if self.mpls_ttl != other.mpls_ttl: return False
- if self.pad != other.pad: return False
- return True
-
- def __ne__(self, other): return not self.__eq__(other)
-
- def show(self, prefix=''):
- """Generate string showing basic members of structure
- """
- outstr = ''
- outstr += prefix + 'type: ' + str(self.type) + '\n'
- outstr += prefix + 'len: ' + str(self.len) + '\n'
- outstr += prefix + 'mpls_ttl: ' + str(self.mpls_ttl) + '\n'
- return outstr
-
-
-# Enumerated type definitions
-ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_BAD_INSTRUCTION', 'OFPET_BAD_MATCH', 'OFPET_FLOW_MOD_FAILED', 'OFPET_GROUP_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_TABLE_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED', 'OFPET_SWITCH_CONFIG_FAILED', 'OFPET_ROLE_REQUEST_FAILED', 'OFPET_EXPERIMENTER']
-OFPET_HELLO_FAILED = 0
-OFPET_BAD_REQUEST = 1
-OFPET_BAD_ACTION = 2
-OFPET_BAD_INSTRUCTION = 3
-OFPET_BAD_MATCH = 4
-OFPET_FLOW_MOD_FAILED = 5
-OFPET_GROUP_MOD_FAILED = 6
-OFPET_PORT_MOD_FAILED = 7
-OFPET_TABLE_MOD_FAILED = 8
-OFPET_QUEUE_OP_FAILED = 9
-OFPET_SWITCH_CONFIG_FAILED = 10
-OFPET_ROLE_REQUEST_FAILED = 11
-OFPET_EXPERIMENTER = 65535
-ofp_error_type_map = {
- 0 : 'OFPET_HELLO_FAILED',
- 1 : 'OFPET_BAD_REQUEST',
- 2 : 'OFPET_BAD_ACTION',
- 3 : 'OFPET_BAD_INSTRUCTION',
- 4 : 'OFPET_BAD_MATCH',
- 5 : 'OFPET_FLOW_MOD_FAILED',
- 6 : 'OFPET_GROUP_MOD_FAILED',
- 7 : 'OFPET_PORT_MOD_FAILED',
- 8 : 'OFPET_TABLE_MOD_FAILED',
- 9 : 'OFPET_QUEUE_OP_FAILED',
- 10 : 'OFPET_SWITCH_CONFIG_FAILED',
- 11 : 'OFPET_ROLE_REQUEST_FAILED',
- 65535 : 'OFPET_EXPERIMENTER'
-}
-
-ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP', 'OFPFF_RESET_COUNTS']
-OFPFF_SEND_FLOW_REM = 1
-OFPFF_CHECK_OVERLAP = 2
-OFPFF_RESET_COUNTS = 4
-ofp_flow_mod_flags_map = {
- 1 : 'OFPFF_SEND_FLOW_REM',
- 2 : 'OFPFF_CHECK_OVERLAP',
- 4 : 'OFPFF_RESET_COUNTS'
-}
-
-ofp_controller_role = ['OFPCR_ROLE_NOCHANGE', 'OFPCR_ROLE_EQUAL', 'OFPCR_ROLE_MASTER', 'OFPCR_ROLE_SLAVE']
-OFPCR_ROLE_NOCHANGE = 0
-OFPCR_ROLE_EQUAL = 1
-OFPCR_ROLE_MASTER = 2
-OFPCR_ROLE_SLAVE = 3
-ofp_controller_role_map = {
- 0 : 'OFPCR_ROLE_NOCHANGE',
- 1 : 'OFPCR_ROLE_EQUAL',
- 2 : 'OFPCR_ROLE_MASTER',
- 3 : 'OFPCR_ROLE_SLAVE'
-}
-
-ofp_stats_reply_flags = ['OFPSF_REPLY_MORE']
-OFPSF_REPLY_MORE = 1
-ofp_stats_reply_flags_map = {
- 1 : 'OFPSF_REPLY_MORE'
-}
-
-ofp_port_no = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_ANY']
-OFPP_MAX = 4294967040
-OFPP_IN_PORT = 4294967288
-OFPP_TABLE = 4294967289
-OFPP_NORMAL = 4294967290
-OFPP_FLOOD = 4294967291
-OFPP_ALL = 4294967292
-OFPP_CONTROLLER = 4294967293
-OFPP_LOCAL = 4294967294
-OFPP_ANY = 4294967295
-ofp_port_no_map = {
- 4294967040 : 'OFPP_MAX',
- 4294967288 : 'OFPP_IN_PORT',
- 4294967289 : 'OFPP_TABLE',
- 4294967290 : 'OFPP_NORMAL',
- 4294967291 : 'OFPP_FLOOD',
- 4294967292 : 'OFPP_ALL',
- 4294967293 : 'OFPP_CONTROLLER',
- 4294967294 : 'OFPP_LOCAL',
- 4294967295 : 'OFPP_ANY'
-}
-
-ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_EXPERIMENTER', 'OFPBRC_BAD_EXP_TYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN', 'OFPBRC_BAD_TABLE_ID', 'OFPBRC_IS_SLAVE', 'OFPBRC_BAD_PORT', 'OFPBRC_BAD_PACKET']
-OFPBRC_BAD_VERSION = 0
-OFPBRC_BAD_TYPE = 1
-OFPBRC_BAD_STAT = 2
-OFPBRC_BAD_EXPERIMENTER = 3
-OFPBRC_BAD_EXP_TYPE = 4
-OFPBRC_EPERM = 5
-OFPBRC_BAD_LEN = 6
-OFPBRC_BUFFER_EMPTY = 7
-OFPBRC_BUFFER_UNKNOWN = 8
-OFPBRC_BAD_TABLE_ID = 9
-OFPBRC_IS_SLAVE = 10
-OFPBRC_BAD_PORT = 11
-OFPBRC_BAD_PACKET = 12
-ofp_bad_request_code_map = {
- 0 : 'OFPBRC_BAD_VERSION',
- 1 : 'OFPBRC_BAD_TYPE',
- 2 : 'OFPBRC_BAD_STAT',
- 3 : 'OFPBRC_BAD_EXPERIMENTER',
- 4 : 'OFPBRC_BAD_EXP_TYPE',
- 5 : 'OFPBRC_EPERM',
- 6 : 'OFPBRC_BAD_LEN',
- 7 : 'OFPBRC_BUFFER_EMPTY',
- 8 : 'OFPBRC_BUFFER_UNKNOWN',
- 9 : 'OFPBRC_BAD_TABLE_ID',
- 10 : 'OFPBRC_IS_SLAVE',
- 11 : 'OFPBRC_BAD_PORT',
- 12 : 'OFPBRC_BAD_PACKET'
-}
-
-ofp_bad_instruction_code = ['OFPBIC_UNKNOWN_INST', 'OFPBIC_UNSUP_INST', 'OFPBIC_BAD_TABLE_ID', 'OFPBIC_UNSUP_METADATA', 'OFPBIC_UNSUP_METADATA_MASK', 'OFPBIC_BAD_EXPERIMENTER', 'OFPBIC_BAD_EXP_TYPE', 'OFPBIC_BAD_LEN', 'OFPBIC_EPERM']
-OFPBIC_UNKNOWN_INST = 0
-OFPBIC_UNSUP_INST = 1
-OFPBIC_BAD_TABLE_ID = 2
-OFPBIC_UNSUP_METADATA = 3
-OFPBIC_UNSUP_METADATA_MASK = 4
-OFPBIC_BAD_EXPERIMENTER = 5
-OFPBIC_BAD_EXP_TYPE = 6
-OFPBIC_BAD_LEN = 7
-OFPBIC_EPERM = 8
-ofp_bad_instruction_code_map = {
- 0 : 'OFPBIC_UNKNOWN_INST',
- 1 : 'OFPBIC_UNSUP_INST',
- 2 : 'OFPBIC_BAD_TABLE_ID',
- 3 : 'OFPBIC_UNSUP_METADATA',
- 4 : 'OFPBIC_UNSUP_METADATA_MASK',
- 5 : 'OFPBIC_BAD_EXPERIMENTER',
- 6 : 'OFPBIC_BAD_EXP_TYPE',
- 7 : 'OFPBIC_BAD_LEN',
- 8 : 'OFPBIC_EPERM'
-}
-
-ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_RECV', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN']
-OFPPC_PORT_DOWN = 1
-OFPPC_NO_RECV = 4
-OFPPC_NO_FWD = 32
-OFPPC_NO_PACKET_IN = 64
-ofp_port_config_map = {
- 1 : 'OFPPC_PORT_DOWN',
- 4 : 'OFPPC_NO_RECV',
- 32 : 'OFPPC_NO_FWD',
- 64 : 'OFPPC_NO_PACKET_IN'
-}
-
-ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_BLOCKED', 'OFPPS_LIVE']
-OFPPS_LINK_DOWN = 1
-OFPPS_BLOCKED = 2
-OFPPS_LIVE = 4
-ofp_port_state_map = {
- 1 : 'OFPPS_LINK_DOWN',
- 2 : 'OFPPS_BLOCKED',
- 4 : 'OFPPS_LIVE'
-}
-
-ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK', 'OFPC_INVALID_TTL_TO_CONTROLLER']
-OFPC_FRAG_NORMAL = 0
-OFPC_FRAG_DROP = 1
-OFPC_FRAG_REASM = 2
-OFPC_FRAG_MASK = 3
-OFPC_INVALID_TTL_TO_CONTROLLER = 4
-ofp_config_flags_map = {
- 0 : 'OFPC_FRAG_NORMAL',
- 1 : 'OFPC_FRAG_DROP',
- 2 : 'OFPC_FRAG_REASM',
- 3 : 'OFPC_FRAG_MASK',
- 4 : 'OFPC_INVALID_TTL_TO_CONTROLLER'
-}
-
-ofp_switch_config_failed_code = ['OFPSCFC_BAD_FLAGS', 'OFPSCFC_BAD_LEN', 'OFPQCFC_EPERM']
-OFPSCFC_BAD_FLAGS = 0
-OFPSCFC_BAD_LEN = 1
-OFPQCFC_EPERM = 2
-ofp_switch_config_failed_code_map = {
- 0 : 'OFPSCFC_BAD_FLAGS',
- 1 : 'OFPSCFC_BAD_LEN',
- 2 : 'OFPQCFC_EPERM'
-}
-
-ofp_controller_max_len = ['OFPCML_MAX', 'OFPCML_NO_BUFFER']
-OFPCML_MAX = 65509
-OFPCML_NO_BUFFER = 65535
-ofp_controller_max_len_map = {
- 65509 : 'OFPCML_MAX',
- 65535 : 'OFPCML_NO_BUFFER'
-}
-
-ofp_role_request_failed_code = ['OFPRRFC_STALE', 'OFPRRFC_UNSUP', 'OFPRRFC_BAD_ROLE']
-OFPRRFC_STALE = 0
-OFPRRFC_UNSUP = 1
-OFPRRFC_BAD_ROLE = 2
-ofp_role_request_failed_code_map = {
- 0 : 'OFPRRFC_STALE',
- 1 : 'OFPRRFC_UNSUP',
- 2 : 'OFPRRFC_BAD_ROLE'
-}
-
-ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_GROUP_STATS', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_PORT_BLOCKED']
-OFPC_FLOW_STATS = 1
-OFPC_TABLE_STATS = 2
-OFPC_PORT_STATS = 4
-OFPC_GROUP_STATS = 8
-OFPC_IP_REASM = 32
-OFPC_QUEUE_STATS = 64
-OFPC_PORT_BLOCKED = 256
-ofp_capabilities_map = {
- 1 : 'OFPC_FLOW_STATS',
- 2 : 'OFPC_TABLE_STATS',
- 4 : 'OFPC_PORT_STATS',
- 8 : 'OFPC_GROUP_STATS',
- 32 : 'OFPC_IP_REASM',
- 64 : 'OFPC_QUEUE_STATS',
- 256 : 'OFPC_PORT_BLOCKED'
-}
-
-ofp_bad_match_code = ['OFPBMC_BAD_TYPE', 'OFPBMC_BAD_LEN', 'OFPBMC_BAD_TAG', 'OFPBMC_BAD_DL_ADDR_MASK', 'OFPBMC_BAD_NW_ADDR_MASK', 'OFPBMC_BAD_WILDCARDS', 'OFPBMC_BAD_FIELD', 'OFPBMC_BAD_VALUE', 'OFPBMC_BAD_MASK', 'OFPBMC_BAD_PREREQ', 'OFPBMC_DUP_FIELD', 'OFPBMC_EPERM']
-OFPBMC_BAD_TYPE = 0
-OFPBMC_BAD_LEN = 1
-OFPBMC_BAD_TAG = 2
-OFPBMC_BAD_DL_ADDR_MASK = 3
-OFPBMC_BAD_NW_ADDR_MASK = 4
-OFPBMC_BAD_WILDCARDS = 5
-OFPBMC_BAD_FIELD = 6
-OFPBMC_BAD_VALUE = 7
-OFPBMC_BAD_MASK = 8
-OFPBMC_BAD_PREREQ = 9
-OFPBMC_DUP_FIELD = 10
-OFPBMC_EPERM = 11
-ofp_bad_match_code_map = {
- 0 : 'OFPBMC_BAD_TYPE',
- 1 : 'OFPBMC_BAD_LEN',
- 2 : 'OFPBMC_BAD_TAG',
- 3 : 'OFPBMC_BAD_DL_ADDR_MASK',
- 4 : 'OFPBMC_BAD_NW_ADDR_MASK',
- 5 : 'OFPBMC_BAD_WILDCARDS',
- 6 : 'OFPBMC_BAD_FIELD',
- 7 : 'OFPBMC_BAD_VALUE',
- 8 : 'OFPBMC_BAD_MASK',
- 9 : 'OFPBMC_BAD_PREREQ',
- 10 : 'OFPBMC_DUP_FIELD',
- 11 : 'OFPBMC_EPERM'
-}
-
-ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE', 'OFPRR_GROUP_DELETE']
-OFPRR_IDLE_TIMEOUT = 0
-OFPRR_HARD_TIMEOUT = 1
-OFPRR_DELETE = 2
-OFPRR_GROUP_DELETE = 3
-ofp_flow_removed_reason_map = {
- 0 : 'OFPRR_IDLE_TIMEOUT',
- 1 : 'OFPRR_HARD_TIMEOUT',
- 2 : 'OFPRR_DELETE',
- 3 : 'OFPRR_GROUP_DELETE'
-}
-
-ofp_table_mod_failed_code = ['OFPTMFC_BAD_TABLE', 'OFPTMFC_BAD_CONFIG', 'OFPTMFC_EPERM']
-OFPTMFC_BAD_TABLE = 0
-OFPTMFC_BAD_CONFIG = 1
-OFPTMFC_EPERM = 2
-ofp_table_mod_failed_code_map = {
- 0 : 'OFPTMFC_BAD_TABLE',
- 1 : 'OFPTMFC_BAD_CONFIG',
- 2 : 'OFPTMFC_EPERM'
-}
-
-ofp_queue_properties = ['OFPQT_MIN_RATE', 'OFPQT_MAX_RATE', 'OFPQT_EXPERIMENTER']
-OFPQT_MIN_RATE = 1
-OFPQT_MAX_RATE = 2
-OFPQT_EXPERIMENTER = 65535
-ofp_queue_properties_map = {
- 1 : 'OFPQT_MIN_RATE',
- 2 : 'OFPQT_MAX_RATE',
- 65535 : 'OFPQT_EXPERIMENTER'
-}
-
-ofp_table = ['OFPTT_MAX', 'OFPTT_ALL']
-OFPTT_MAX = 254
-OFPTT_ALL = 255
-ofp_table_map = {
- 254 : 'OFPTT_MAX',
- 255 : 'OFPTT_ALL'
-}
-
-ofp_group = ['OFPG_MAX', 'OFPG_ALL', 'OFPG_ANY']
-OFPG_MAX = 4294967040
-OFPG_ALL = 4294967292
-OFPG_ANY = 4294967295
-ofp_group_map = {
- 4294967040 : 'OFPG_MAX',
- 4294967292 : 'OFPG_ALL',
- 4294967295 : 'OFPG_ANY'
-}
-
-ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY']
-OFPPR_ADD = 0
-OFPPR_DELETE = 1
-OFPPR_MODIFY = 2
-ofp_port_reason_map = {
- 0 : 'OFPPR_ADD',
- 1 : 'OFPPR_DELETE',
- 2 : 'OFPPR_MODIFY'
-}
-
-ofp_group_capabilities = ['OFPGFC_SELECT_WEIGHT', 'OFPGFC_SELECT_LIVENESS', 'OFPGFC_CHAINING', 'OFPGFC_CHAINING_CHECKS']
-OFPGFC_SELECT_WEIGHT = 1
-OFPGFC_SELECT_LIVENESS = 2
-OFPGFC_CHAINING = 4
-OFPGFC_CHAINING_CHECKS = 8
-ofp_group_capabilities_map = {
- 1 : 'OFPGFC_SELECT_WEIGHT',
- 2 : 'OFPGFC_SELECT_LIVENESS',
- 4 : 'OFPGFC_CHAINING',
- 8 : 'OFPGFC_CHAINING_CHECKS'
-}
-
-ofp_table_config = ['OFPTC_TABLE_MISS_CONTROLLER', 'OFPTC_TABLE_MISS_CONTINUE', 'OFPTC_TABLE_MISS_DROP', 'OFPTC_TABLE_MISS_MASK']
-OFPTC_TABLE_MISS_CONTROLLER = 0
-OFPTC_TABLE_MISS_CONTINUE = 1
-OFPTC_TABLE_MISS_DROP = 2
-OFPTC_TABLE_MISS_MASK = 3
-ofp_table_config_map = {
- 0 : 'OFPTC_TABLE_MISS_CONTROLLER',
- 1 : 'OFPTC_TABLE_MISS_CONTINUE',
- 2 : 'OFPTC_TABLE_MISS_DROP',
- 3 : 'OFPTC_TABLE_MISS_MASK'
-}
-
-ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_COPY_TTL_OUT', 'OFPAT_COPY_TTL_IN', 'OFPAT_SET_MPLS_TTL', 'OFPAT_DEC_MPLS_TTL', 'OFPAT_PUSH_VLAN', 'OFPAT_POP_VLAN', 'OFPAT_PUSH_MPLS', 'OFPAT_POP_MPLS', 'OFPAT_SET_QUEUE', 'OFPAT_GROUP', 'OFPAT_SET_NW_TTL', 'OFPAT_DEC_NW_TTL', 'OFPAT_SET_FIELD', 'OFPAT_EXPERIMENTER']
-OFPAT_OUTPUT = 0
-OFPAT_COPY_TTL_OUT = 11
-OFPAT_COPY_TTL_IN = 12
-OFPAT_SET_MPLS_TTL = 15
-OFPAT_DEC_MPLS_TTL = 16
-OFPAT_PUSH_VLAN = 17
-OFPAT_POP_VLAN = 18
-OFPAT_PUSH_MPLS = 19
-OFPAT_POP_MPLS = 20
-OFPAT_SET_QUEUE = 21
-OFPAT_GROUP = 22
-OFPAT_SET_NW_TTL = 23
-OFPAT_DEC_NW_TTL = 24
-OFPAT_SET_FIELD = 25
-OFPAT_EXPERIMENTER = 65535
-ofp_action_type_map = {
- 0 : 'OFPAT_OUTPUT',
- 11 : 'OFPAT_COPY_TTL_OUT',
- 12 : 'OFPAT_COPY_TTL_IN',
- 15 : 'OFPAT_SET_MPLS_TTL',
- 16 : 'OFPAT_DEC_MPLS_TTL',
- 17 : 'OFPAT_PUSH_VLAN',
- 18 : 'OFPAT_POP_VLAN',
- 19 : 'OFPAT_PUSH_MPLS',
- 20 : 'OFPAT_POP_MPLS',
- 21 : 'OFPAT_SET_QUEUE',
- 22 : 'OFPAT_GROUP',
- 23 : 'OFPAT_SET_NW_TTL',
- 24 : 'OFPAT_DEC_NW_TTL',
- 25 : 'OFPAT_SET_FIELD',
- 65535 : 'OFPAT_EXPERIMENTER'
-}
-
-ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT']
-OFPFC_ADD = 0
-OFPFC_MODIFY = 1
-OFPFC_MODIFY_STRICT = 2
-OFPFC_DELETE = 3
-OFPFC_DELETE_STRICT = 4
-ofp_flow_mod_command_map = {
- 0 : 'OFPFC_ADD',
- 1 : 'OFPFC_MODIFY',
- 2 : 'OFPFC_MODIFY_STRICT',
- 3 : 'OFPFC_DELETE',
- 4 : 'OFPFC_DELETE_STRICT'
-}
-
-ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM']
-OFPQOFC_BAD_PORT = 0
-OFPQOFC_BAD_QUEUE = 1
-OFPQOFC_EPERM = 2
-ofp_queue_op_failed_code_map = {
- 0 : 'OFPQOFC_BAD_PORT',
- 1 : 'OFPQOFC_BAD_QUEUE',
- 2 : 'OFPQOFC_EPERM'
-}
-
-ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM']
-OFPHFC_INCOMPATIBLE = 0
-OFPHFC_EPERM = 1
-ofp_hello_failed_code_map = {
- 0 : 'OFPHFC_INCOMPATIBLE',
- 1 : 'OFPHFC_EPERM'
-}
-
-ofp_match_type = ['OFPMT_STANDARD', 'OFPMT_OXM']
-OFPMT_STANDARD = 0
-OFPMT_OXM = 1
-ofp_match_type_map = {
- 0 : 'OFPMT_STANDARD',
- 1 : 'OFPMT_OXM'
-}
-
-ofp_vlan_id = ['OFPVID_PRESENT', 'OFPVID_NONE']
-OFPVID_PRESENT = 4096
-OFPVID_NONE = 0
-ofp_vlan_id_map = {
- 4096 : 'OFPVID_PRESENT',
- 0 : 'OFPVID_NONE'
-}
-
-ofp_oxm_class = ['OFPXMC_NXM_0', 'OFPXMC_NXM_1', 'OFPXMC_OPENFLOW_BASIC', 'OFPXMC_EXPERIMENTER']
-OFPXMC_NXM_0 = 0
-OFPXMC_NXM_1 = 1
-OFPXMC_OPENFLOW_BASIC = 32768
-OFPXMC_EXPERIMENTER = 65535
-ofp_oxm_class_map = {
- 0 : 'OFPXMC_NXM_0',
- 1 : 'OFPXMC_NXM_1',
- 32768 : 'OFPXMC_OPENFLOW_BASIC',
- 65535 : 'OFPXMC_EXPERIMENTER'
-}
-
-ofp_group_type = ['OFPGT_ALL', 'OFPGT_SELECT', 'OFPGT_INDIRECT', 'OFPGT_FF']
-OFPGT_ALL = 0
-OFPGT_SELECT = 1
-OFPGT_INDIRECT = 2
-OFPGT_FF = 3
-ofp_group_type_map = {
- 0 : 'OFPGT_ALL',
- 1 : 'OFPGT_SELECT',
- 2 : 'OFPGT_INDIRECT',
- 3 : 'OFPGT_FF'
-}
-
-ofp_instruction_type = ['OFPIT_GOTO_TABLE', 'OFPIT_WRITE_METADATA', 'OFPIT_WRITE_ACTIONS', 'OFPIT_APPLY_ACTIONS', 'OFPIT_CLEAR_ACTIONS', 'OFPIT_EXPERIMENTER']
-OFPIT_GOTO_TABLE = 1
-OFPIT_WRITE_METADATA = 2
-OFPIT_WRITE_ACTIONS = 3
-OFPIT_APPLY_ACTIONS = 4
-OFPIT_CLEAR_ACTIONS = 5
-OFPIT_EXPERIMENTER = 65535
-ofp_instruction_type_map = {
- 1 : 'OFPIT_GOTO_TABLE',
- 2 : 'OFPIT_WRITE_METADATA',
- 3 : 'OFPIT_WRITE_ACTIONS',
- 4 : 'OFPIT_APPLY_ACTIONS',
- 5 : 'OFPIT_CLEAR_ACTIONS',
- 65535 : 'OFPIT_EXPERIMENTER'
-}
-
-ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_EXPERIMENTER', 'OFPBAC_BAD_EXP_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE', 'OFPBAC_BAD_OUT_GROUP', 'OFPBAC_MATCH_INCONSISTENT', 'OFPBAC_UNSUPPORTED_ORDER', 'OFPBAC_BAD_TAG', 'OFPBAC_BAD_SET_TYPE', 'OFPBAC_BAD_SET_LEN', 'OFPBAC_BAD_SET_ARGUMENT']
-OFPBAC_BAD_TYPE = 0
-OFPBAC_BAD_LEN = 1
-OFPBAC_BAD_EXPERIMENTER = 2
-OFPBAC_BAD_EXP_TYPE = 3
-OFPBAC_BAD_OUT_PORT = 4
-OFPBAC_BAD_ARGUMENT = 5
-OFPBAC_EPERM = 6
-OFPBAC_TOO_MANY = 7
-OFPBAC_BAD_QUEUE = 8
-OFPBAC_BAD_OUT_GROUP = 9
-OFPBAC_MATCH_INCONSISTENT = 10
-OFPBAC_UNSUPPORTED_ORDER = 11
-OFPBAC_BAD_TAG = 12
-OFPBAC_BAD_SET_TYPE = 13
-OFPBAC_BAD_SET_LEN = 14
-OFPBAC_BAD_SET_ARGUMENT = 15
-ofp_bad_action_code_map = {
- 0 : 'OFPBAC_BAD_TYPE',
- 1 : 'OFPBAC_BAD_LEN',
- 2 : 'OFPBAC_BAD_EXPERIMENTER',
- 3 : 'OFPBAC_BAD_EXP_TYPE',
- 4 : 'OFPBAC_BAD_OUT_PORT',
- 5 : 'OFPBAC_BAD_ARGUMENT',
- 6 : 'OFPBAC_EPERM',
- 7 : 'OFPBAC_TOO_MANY',
- 8 : 'OFPBAC_BAD_QUEUE',
- 9 : 'OFPBAC_BAD_OUT_GROUP',
- 10 : 'OFPBAC_MATCH_INCONSISTENT',
- 11 : 'OFPBAC_UNSUPPORTED_ORDER',
- 12 : 'OFPBAC_BAD_TAG',
- 13 : 'OFPBAC_BAD_SET_TYPE',
- 14 : 'OFPBAC_BAD_SET_LEN',
- 15 : 'OFPBAC_BAD_SET_ARGUMENT'
-}
-
-oxm_ofb_match_fields = ['OFPXMT_OFB_IN_PORT', 'OFPXMT_OFB_IN_PHY_PORT', 'OFPXMT_OFB_METADATA', 'OFPXMT_OFB_ETH_DST', 'OFPXMT_OFB_ETH_SRC', 'OFPXMT_OFB_ETH_TYPE', 'OFPXMT_OFB_VLAN_VID', 'OFPXMT_OFB_VLAN_PCP', 'OFPXMT_OFB_IP_DSCP', 'OFPXMT_OFB_IP_ECN', 'OFPXMT_OFB_IP_PROTO', 'OFPXMT_OFB_IPV4_SRC', 'OFPXMT_OFB_IPV4_DST', 'OFPXMT_OFB_TCP_SRC', 'OFPXMT_OFB_TCP_DST', 'OFPXMT_OFB_UDP_SRC', 'OFPXMT_OFB_UDP_DST', 'OFPXMT_OFB_SCTP_SRC', 'OFPXMT_OFB_SCTP_DST', 'OFPXMT_OFB_ICMPV4_TYPE', 'OFPXMT_OFB_ICMPV4_CODE', 'OFPXMT_OFB_ARP_OP', 'OFPXMT_OFB_ARP_SPA', 'OFPXMT_OFB_ARP_TPA', 'OFPXMT_OFB_ARP_SHA', 'OFPXMT_OFB_ARP_THA', 'OFPXMT_OFB_IPV6_SRC', 'OFPXMT_OFB_IPV6_DST', 'OFPXMT_OFB_IPV6_FLABEL', 'OFPXMT_OFB_ICMPV6_TYPE', 'OFPXMT_OFB_ICMPV6_CODE', 'OFPXMT_OFB_IPV6_ND_TARGET', 'OFPXMT_OFB_IPV6_ND_SLL', 'OFPXMT_OFB_IPV6_ND_TLL', 'OFPXMT_OFB_MPLS_LABEL', 'OFPXMT_OFB_MPLS_TC']
-OFPXMT_OFB_IN_PORT = 0
-OFPXMT_OFB_IN_PHY_PORT = 1
-OFPXMT_OFB_METADATA = 2
-OFPXMT_OFB_ETH_DST = 3
-OFPXMT_OFB_ETH_SRC = 4
-OFPXMT_OFB_ETH_TYPE = 5
-OFPXMT_OFB_VLAN_VID = 6
-OFPXMT_OFB_VLAN_PCP = 7
-OFPXMT_OFB_IP_DSCP = 8
-OFPXMT_OFB_IP_ECN = 9
-OFPXMT_OFB_IP_PROTO = 10
-OFPXMT_OFB_IPV4_SRC = 11
-OFPXMT_OFB_IPV4_DST = 12
-OFPXMT_OFB_TCP_SRC = 13
-OFPXMT_OFB_TCP_DST = 14
-OFPXMT_OFB_UDP_SRC = 15
-OFPXMT_OFB_UDP_DST = 16
-OFPXMT_OFB_SCTP_SRC = 17
-OFPXMT_OFB_SCTP_DST = 18
-OFPXMT_OFB_ICMPV4_TYPE = 19
-OFPXMT_OFB_ICMPV4_CODE = 20
-OFPXMT_OFB_ARP_OP = 21
-OFPXMT_OFB_ARP_SPA = 22
-OFPXMT_OFB_ARP_TPA = 23
-OFPXMT_OFB_ARP_SHA = 24
-OFPXMT_OFB_ARP_THA = 25
-OFPXMT_OFB_IPV6_SRC = 26
-OFPXMT_OFB_IPV6_DST = 27
-OFPXMT_OFB_IPV6_FLABEL = 28
-OFPXMT_OFB_ICMPV6_TYPE = 29
-OFPXMT_OFB_ICMPV6_CODE = 30
-OFPXMT_OFB_IPV6_ND_TARGET = 31
-OFPXMT_OFB_IPV6_ND_SLL = 32
-OFPXMT_OFB_IPV6_ND_TLL = 33
-OFPXMT_OFB_MPLS_LABEL = 34
-OFPXMT_OFB_MPLS_TC = 35
-oxm_ofb_match_fields_map = {
- 0 : 'OFPXMT_OFB_IN_PORT',
- 1 : 'OFPXMT_OFB_IN_PHY_PORT',
- 2 : 'OFPXMT_OFB_METADATA',
- 3 : 'OFPXMT_OFB_ETH_DST',
- 4 : 'OFPXMT_OFB_ETH_SRC',
- 5 : 'OFPXMT_OFB_ETH_TYPE',
- 6 : 'OFPXMT_OFB_VLAN_VID',
- 7 : 'OFPXMT_OFB_VLAN_PCP',
- 8 : 'OFPXMT_OFB_IP_DSCP',
- 9 : 'OFPXMT_OFB_IP_ECN',
- 10 : 'OFPXMT_OFB_IP_PROTO',
- 11 : 'OFPXMT_OFB_IPV4_SRC',
- 12 : 'OFPXMT_OFB_IPV4_DST',
- 13 : 'OFPXMT_OFB_TCP_SRC',
- 14 : 'OFPXMT_OFB_TCP_DST',
- 15 : 'OFPXMT_OFB_UDP_SRC',
- 16 : 'OFPXMT_OFB_UDP_DST',
- 17 : 'OFPXMT_OFB_SCTP_SRC',
- 18 : 'OFPXMT_OFB_SCTP_DST',
- 19 : 'OFPXMT_OFB_ICMPV4_TYPE',
- 20 : 'OFPXMT_OFB_ICMPV4_CODE',
- 21 : 'OFPXMT_OFB_ARP_OP',
- 22 : 'OFPXMT_OFB_ARP_SPA',
- 23 : 'OFPXMT_OFB_ARP_TPA',
- 24 : 'OFPXMT_OFB_ARP_SHA',
- 25 : 'OFPXMT_OFB_ARP_THA',
- 26 : 'OFPXMT_OFB_IPV6_SRC',
- 27 : 'OFPXMT_OFB_IPV6_DST',
- 28 : 'OFPXMT_OFB_IPV6_FLABEL',
- 29 : 'OFPXMT_OFB_ICMPV6_TYPE',
- 30 : 'OFPXMT_OFB_ICMPV6_CODE',
- 31 : 'OFPXMT_OFB_IPV6_ND_TARGET',
- 32 : 'OFPXMT_OFB_IPV6_ND_SLL',
- 33 : 'OFPXMT_OFB_IPV6_ND_TLL',
- 34 : 'OFPXMT_OFB_MPLS_LABEL',
- 35 : 'OFPXMT_OFB_MPLS_TC'
-}
-
-ofp_flow_mod_failed_code = ['OFPFMFC_UNKNOWN', 'OFPFMFC_TABLE_FULL', 'OFPFMFC_BAD_TABLE_ID', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_BAD_FLAGS']
-OFPFMFC_UNKNOWN = 0
-OFPFMFC_TABLE_FULL = 1
-OFPFMFC_BAD_TABLE_ID = 2
-OFPFMFC_OVERLAP = 3
-OFPFMFC_EPERM = 4
-OFPFMFC_BAD_TIMEOUT = 5
-OFPFMFC_BAD_COMMAND = 6
-OFPFMFC_BAD_FLAGS = 7
-ofp_flow_mod_failed_code_map = {
- 0 : 'OFPFMFC_UNKNOWN',
- 1 : 'OFPFMFC_TABLE_FULL',
- 2 : 'OFPFMFC_BAD_TABLE_ID',
- 3 : 'OFPFMFC_OVERLAP',
- 4 : 'OFPFMFC_EPERM',
- 5 : 'OFPFMFC_BAD_TIMEOUT',
- 6 : 'OFPFMFC_BAD_COMMAND',
- 7 : 'OFPFMFC_BAD_FLAGS'
-}
-
-ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR', 'OFPPMFC_BAD_CONFIG', 'OFPPMFC_BAD_ADVERTISE', 'OFPPMFC_EPERM']
-OFPPMFC_BAD_PORT = 0
-OFPPMFC_BAD_HW_ADDR = 1
-OFPPMFC_BAD_CONFIG = 2
-OFPPMFC_BAD_ADVERTISE = 3
-OFPPMFC_EPERM = 4
-ofp_port_mod_failed_code_map = {
- 0 : 'OFPPMFC_BAD_PORT',
- 1 : 'OFPPMFC_BAD_HW_ADDR',
- 2 : 'OFPPMFC_BAD_CONFIG',
- 3 : 'OFPPMFC_BAD_ADVERTISE',
- 4 : 'OFPPMFC_EPERM'
-}
-
-ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_EXPERIMENTER', 'OFPT_FEATURES_REQUEST', 'OFPT_FEATURES_REPLY', 'OFPT_GET_CONFIG_REQUEST', 'OFPT_GET_CONFIG_REPLY', 'OFPT_SET_CONFIG', 'OFPT_PACKET_IN', 'OFPT_FLOW_REMOVED', 'OFPT_PORT_STATUS', 'OFPT_PACKET_OUT', 'OFPT_FLOW_MOD', 'OFPT_GROUP_MOD', 'OFPT_PORT_MOD', 'OFPT_TABLE_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY', 'OFPT_ROLE_REQUEST', 'OFPT_ROLE_REPLY']
-OFPT_HELLO = 0
-OFPT_ERROR = 1
-OFPT_ECHO_REQUEST = 2
-OFPT_ECHO_REPLY = 3
-OFPT_EXPERIMENTER = 4
-OFPT_FEATURES_REQUEST = 5
-OFPT_FEATURES_REPLY = 6
-OFPT_GET_CONFIG_REQUEST = 7
-OFPT_GET_CONFIG_REPLY = 8
-OFPT_SET_CONFIG = 9
-OFPT_PACKET_IN = 10
-OFPT_FLOW_REMOVED = 11
-OFPT_PORT_STATUS = 12
-OFPT_PACKET_OUT = 13
-OFPT_FLOW_MOD = 14
-OFPT_GROUP_MOD = 15
-OFPT_PORT_MOD = 16
-OFPT_TABLE_MOD = 17
-OFPT_STATS_REQUEST = 18
-OFPT_STATS_REPLY = 19
-OFPT_BARRIER_REQUEST = 20
-OFPT_BARRIER_REPLY = 21
-OFPT_QUEUE_GET_CONFIG_REQUEST = 22
-OFPT_QUEUE_GET_CONFIG_REPLY = 23
-OFPT_ROLE_REQUEST = 24
-OFPT_ROLE_REPLY = 25
-ofp_type_map = {
- 0 : 'OFPT_HELLO',
- 1 : 'OFPT_ERROR',
- 2 : 'OFPT_ECHO_REQUEST',
- 3 : 'OFPT_ECHO_REPLY',
- 4 : 'OFPT_EXPERIMENTER',
- 5 : 'OFPT_FEATURES_REQUEST',
- 6 : 'OFPT_FEATURES_REPLY',
- 7 : 'OFPT_GET_CONFIG_REQUEST',
- 8 : 'OFPT_GET_CONFIG_REPLY',
- 9 : 'OFPT_SET_CONFIG',
- 10 : 'OFPT_PACKET_IN',
- 11 : 'OFPT_FLOW_REMOVED',
- 12 : 'OFPT_PORT_STATUS',
- 13 : 'OFPT_PACKET_OUT',
- 14 : 'OFPT_FLOW_MOD',
- 15 : 'OFPT_GROUP_MOD',
- 16 : 'OFPT_PORT_MOD',
- 17 : 'OFPT_TABLE_MOD',
- 18 : 'OFPT_STATS_REQUEST',
- 19 : 'OFPT_STATS_REPLY',
- 20 : 'OFPT_BARRIER_REQUEST',
- 21 : 'OFPT_BARRIER_REPLY',
- 22 : 'OFPT_QUEUE_GET_CONFIG_REQUEST',
- 23 : 'OFPT_QUEUE_GET_CONFIG_REPLY',
- 24 : 'OFPT_ROLE_REQUEST',
- 25 : 'OFPT_ROLE_REPLY'
-}
-
-ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION', 'OFPR_INVALID_TTL']
-OFPR_NO_MATCH = 0
-OFPR_ACTION = 1
-OFPR_INVALID_TTL = 2
-ofp_packet_in_reason_map = {
- 0 : 'OFPR_NO_MATCH',
- 1 : 'OFPR_ACTION',
- 2 : 'OFPR_INVALID_TTL'
-}
-
-ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_GROUP', 'OFPST_GROUP_DESC', 'OFPST_GROUP_FEATURES', 'OFPST_EXPERIMENTER']
-OFPST_DESC = 0
-OFPST_FLOW = 1
-OFPST_AGGREGATE = 2
-OFPST_TABLE = 3
-OFPST_PORT = 4
-OFPST_QUEUE = 5
-OFPST_GROUP = 6
-OFPST_GROUP_DESC = 7
-OFPST_GROUP_FEATURES = 8
-OFPST_EXPERIMENTER = 65535
-ofp_stats_types_map = {
- 0 : 'OFPST_DESC',
- 1 : 'OFPST_FLOW',
- 2 : 'OFPST_AGGREGATE',
- 3 : 'OFPST_TABLE',
- 4 : 'OFPST_PORT',
- 5 : 'OFPST_QUEUE',
- 6 : 'OFPST_GROUP',
- 7 : 'OFPST_GROUP_DESC',
- 8 : 'OFPST_GROUP_FEATURES',
- 65535 : 'OFPST_EXPERIMENTER'
-}
-
-ofp_group_mod_command = ['OFPGC_ADD', 'OFPGC_MODIFY', 'OFPGC_DELETE']
-OFPGC_ADD = 0
-OFPGC_MODIFY = 1
-OFPGC_DELETE = 2
-ofp_group_mod_command_map = {
- 0 : 'OFPGC_ADD',
- 1 : 'OFPGC_MODIFY',
- 2 : 'OFPGC_DELETE'
-}
-
-ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_40GB_FD', 'OFPPF_100GB_FD', 'OFPPF_1TB_FD', 'OFPPF_OTHER', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM']
-OFPPF_10MB_HD = 1
-OFPPF_10MB_FD = 2
-OFPPF_100MB_HD = 4
-OFPPF_100MB_FD = 8
-OFPPF_1GB_HD = 16
-OFPPF_1GB_FD = 32
-OFPPF_10GB_FD = 64
-OFPPF_40GB_FD = 128
-OFPPF_100GB_FD = 256
-OFPPF_1TB_FD = 512
-OFPPF_OTHER = 1024
-OFPPF_COPPER = 2048
-OFPPF_FIBER = 4096
-OFPPF_AUTONEG = 8192
-OFPPF_PAUSE = 16384
-OFPPF_PAUSE_ASYM = 32768
-ofp_port_features_map = {
- 1 : 'OFPPF_10MB_HD',
- 2 : 'OFPPF_10MB_FD',
- 4 : 'OFPPF_100MB_HD',
- 8 : 'OFPPF_100MB_FD',
- 16 : 'OFPPF_1GB_HD',
- 32 : 'OFPPF_1GB_FD',
- 64 : 'OFPPF_10GB_FD',
- 128 : 'OFPPF_40GB_FD',
- 256 : 'OFPPF_100GB_FD',
- 512 : 'OFPPF_1TB_FD',
- 1024 : 'OFPPF_OTHER',
- 2048 : 'OFPPF_COPPER',
- 4096 : 'OFPPF_FIBER',
- 8192 : 'OFPPF_AUTONEG',
- 16384 : 'OFPPF_PAUSE',
- 32768 : 'OFPPF_PAUSE_ASYM'
-}
-
-ofp_group_mod_failed_code = ['OFPGMFC_GROUP_EXISTS', 'OFPGMFC_INVALID_GROUP', 'OFPGMFC_OUT_OF_GROUPS', 'OFPGMFC_OUT_OF_BUCKETS', 'OFPGMFC_CHAINING_UNSUPPORTED', 'OFPGMFC_WATCH_UNSUPPORTED', 'OFPGMFC_LOOP', 'OFPGMFC_UNKNOWN_GROUP', 'OFPGMFC_CHAINED_GROUP', 'OFPGMFC_BAD_TYPE', 'OFPGMFC_BAD_COMMAND', 'OFPGMFC_BAD_BUCKET', 'OFPGMFC_BAD_WATCH', 'OFPGMFC_EPERM']
-OFPGMFC_GROUP_EXISTS = 0
-OFPGMFC_INVALID_GROUP = 1
-OFPGMFC_OUT_OF_GROUPS = 3
-OFPGMFC_OUT_OF_BUCKETS = 4
-OFPGMFC_CHAINING_UNSUPPORTED = 5
-OFPGMFC_WATCH_UNSUPPORTED = 6
-OFPGMFC_LOOP = 7
-OFPGMFC_UNKNOWN_GROUP = 8
-OFPGMFC_CHAINED_GROUP = 9
-OFPGMFC_BAD_TYPE = 10
-OFPGMFC_BAD_COMMAND = 11
-OFPGMFC_BAD_BUCKET = 12
-OFPGMFC_BAD_WATCH = 13
-OFPGMFC_EPERM = 14
-ofp_group_mod_failed_code_map = {
- 0 : 'OFPGMFC_GROUP_EXISTS',
- 1 : 'OFPGMFC_INVALID_GROUP',
- 3 : 'OFPGMFC_OUT_OF_GROUPS',
- 4 : 'OFPGMFC_OUT_OF_BUCKETS',
- 5 : 'OFPGMFC_CHAINING_UNSUPPORTED',
- 6 : 'OFPGMFC_WATCH_UNSUPPORTED',
- 7 : 'OFPGMFC_LOOP',
- 8 : 'OFPGMFC_UNKNOWN_GROUP',
- 9 : 'OFPGMFC_CHAINED_GROUP',
- 10 : 'OFPGMFC_BAD_TYPE',
- 11 : 'OFPGMFC_BAD_COMMAND',
- 12 : 'OFPGMFC_BAD_BUCKET',
- 13 : 'OFPGMFC_BAD_WATCH',
- 14 : 'OFPGMFC_EPERM'
-}
-
-# Values from macro definitions
-OFP_ETH_ALEN = 6
-OFP_MAX_PORT_NAME_LEN = 16
-OFP_TCP_PORT = 6633
-OFP_FLOW_PERMANENT = 0
-OFPQ_MIN_RATE_UNCFG = 0xffff
-OFPQ_ALL = 0xffffffff
-OFP_VERSION = 0x03
-OFP_MAX_TABLE_NAME_LEN = 32
-OFP_DEFAULT_PRIORITY = 0x8000
-OFP_NO_BUFFER = 0xffffffff
-OFP_SSL_PORT = 6633
-OFP_DEFAULT_MISS_SEND_LEN = 128
-DESC_STR_LEN = 256
-SERIAL_NUM_LEN = 32
-
-# Basic structure size definitions.
-# Does not include ofp_header members.
-# Does not include variable length arrays.
-OFP_ACTION_EXPERIMENTER_HEADER_BYTES = 8
-OFP_ACTION_GROUP_BYTES = 8
-OFP_ACTION_HEADER_BYTES = 8
-OFP_ACTION_MPLS_TTL_BYTES = 8
-OFP_ACTION_NW_TTL_BYTES = 8
-OFP_ACTION_OUTPUT_BYTES = 16
-OFP_ACTION_POP_MPLS_BYTES = 8
-OFP_ACTION_PUSH_BYTES = 8
-OFP_ACTION_SET_FIELD_BYTES = 8
-OFP_ACTION_SET_QUEUE_BYTES = 8
-OFP_AGGREGATE_STATS_REPLY_BYTES = 24
-OFP_AGGREGATE_STATS_REQUEST_BYTES = 36
-OFP_BUCKET_BYTES = 16
-OFP_BUCKET_COUNTER_BYTES = 16
-OFP_DESC_STATS_BYTES = 1056
-OFP_ERROR_EXPERIMENTER_MSG_BYTES = 8
-OFP_ERROR_MSG_BYTES = 4
-OFP_EXPERIMENTER_HEADER_BYTES = 8
-OFP_EXPERIMENTER_STATS_HEADER_BYTES = 8
-OFP_FLOW_MOD_BYTES = 44
-OFP_FLOW_REMOVED_BYTES = 44
-OFP_FLOW_STATS_BYTES = 52
-OFP_FLOW_STATS_REQUEST_BYTES = 36
-OFP_GROUP_DESC_STATS_BYTES = 8
-OFP_GROUP_FEATURES_STATS_BYTES = 40
-OFP_GROUP_MOD_BYTES = 8
-OFP_GROUP_STATS_BYTES = 32
-OFP_GROUP_STATS_REQUEST_BYTES = 8
-OFP_HEADER_BYTES = 8
-OFP_HELLO_BYTES = 0
-OFP_INSTRUCTION_BYTES = 8
-OFP_INSTRUCTION_ACTIONS_BYTES = 8
-OFP_INSTRUCTION_GOTO_TABLE_BYTES = 8
-OFP_INSTRUCTION_WRITE_METADATA_BYTES = 24
-OFP_MATCH_BYTES = 4
-OFP_OXM_EXPERIMENTER_HEADER_BYTES = 8
-OFP_PACKET_IN_BYTES = 12
-OFP_PACKET_OUT_BYTES = 16
-OFP_PACKET_QUEUE_BYTES = 16
-OFP_PORT_BYTES = 64
-OFP_PORT_MOD_BYTES = 32
-OFP_PORT_STATS_BYTES = 104
-OFP_PORT_STATS_REQUEST_BYTES = 8
-OFP_PORT_STATUS_BYTES = 72
-OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
-OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 8
-OFP_QUEUE_PROP_EXPERIMENTER_BYTES = 16
-OFP_QUEUE_PROP_HEADER_BYTES = 8
-OFP_QUEUE_PROP_MAX_RATE_BYTES = 16
-OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
-OFP_QUEUE_STATS_BYTES = 32
-OFP_QUEUE_STATS_REQUEST_BYTES = 8
-OFP_ROLE_REQUEST_BYTES = 16
-OFP_STATS_REPLY_BYTES = 8
-OFP_STATS_REQUEST_BYTES = 8
-OFP_SWITCH_CONFIG_BYTES = 4
-OFP_SWITCH_FEATURES_BYTES = 24
-OFP_TABLE_MOD_BYTES = 8
-OFP_TABLE_STATS_BYTES = 128
-
diff --git a/src/python/of12/error.py b/src/python/of12/error.py
deleted file mode 100644
index 0a1244a..0000000
--- a/src/python/of12/error.py
+++ /dev/null
@@ -1,556 +0,0 @@
-
-# Python OpenFlow error wrapper classes
-
-from cstruct import *
-
-
-
-class hello_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for hello_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_HELLO_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "hello_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_request_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_request error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_REQUEST
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_request_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_action_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_action error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_ACTION
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_action_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_instruction_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_instruction error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_INSTRUCTION
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_instruction_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class bad_match_error_msg(ofp_error_msg):
- """
- Wrapper class for bad_match error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_BAD_MATCH
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "bad_match_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for flow_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_FLOW_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "flow_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for group_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_GROUP_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "group_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for port_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_PORT_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "port_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_mod_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for table_mod_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_TABLE_MOD_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "table_mod_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_op_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for queue_op_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_QUEUE_OP_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "queue_op_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class switch_config_failed_error_msg(ofp_error_msg):
- """
- Wrapper class for switch_config_failed error message class
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
- def __init__(self):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.type = OFPET_SWITCH_CONFIG_FAILED
- self.data = ""
-
- def pack(self, assertstruct=True):
- self.header.length = self.__len__()
- packed = self.header.pack()
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- return ""
-
- def __len__(self):
- return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
-
- def show(self, prefix=''):
- outstr = prefix + "switch_config_failed_error_msg\m"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix + ' ')
- outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
- ##@todo Consider trying to parse the string
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_error_msg.__eq__(self, other) and
- self.data == other.data)
-
- def __ne__(self, other): return not self.__eq__(other)
-
diff --git a/src/python/of12/instruction.py b/src/python/of12/instruction.py
deleted file mode 100644
index a945525..0000000
--- a/src/python/of12/instruction.py
+++ /dev/null
@@ -1,143 +0,0 @@
-
-# Python OpenFlow instruction wrapper classes
-
-from cstruct import *
-from action_list import action_list
-
-
-
-class instruction_write_metadata(ofp_instruction_write_metadata):
- """
- Wrapper class for write_metadata instruction object
-
- Data members inherited from ofp_instruction_write_metadata:
- @arg type
- @arg len
- @arg metadata
- @arg metadata_mask
-
- """
- def __init__(self):
- ofp_instruction_write_metadata.__init__(self)
- self.type = OFPIT_WRITE_METADATA
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_write_metadata\n"
- outstr += ofp_instruction_write_metadata.show(self, prefix)
- return outstr
-
-
-class instruction_goto_table(ofp_instruction_goto_table):
- """
- Wrapper class for goto_table instruction object
-
- Data members inherited from ofp_instruction_goto_table:
- @arg type
- @arg len
- @arg table_id
-
- """
- def __init__(self):
- ofp_instruction_goto_table.__init__(self)
- self.type = OFPIT_GOTO_TABLE
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_goto_table\n"
- outstr += ofp_instruction_goto_table.show(self, prefix)
- return outstr
-
-
-class instruction_write_actions(ofp_instruction_actions):
- """
- Wrapper class for write_actions instruction object
-
- Data members inherited from ofp_instruction_actions:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction_actions.__init__(self)
- self.type = OFPIT_WRITE_ACTIONS
- self.actions = action_list()
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_write_actions\n"
- outstr += ofp_instruction_actions.show(self, prefix)
- outstr += self.actions.show(prefix)
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_instruction_actions.unpack(self, binary_string)
- bytes = self.len - OFP_INSTRUCTION_ACTIONS_BYTES
- self.actions = action_list()
- binary_string = self.actions.unpack(binary_string, bytes=bytes)
- return binary_string
- def pack(self):
- self.len = self.__len__()
- packed = ""
- packed += ofp_instruction_actions.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_instruction_actions.__len__(self) + self.actions.__len__()
-
-
-class instruction_apply_actions(ofp_instruction_actions):
- """
- Wrapper class for apply_actions instruction object
-
- Data members inherited from ofp_instruction_actions:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction_actions.__init__(self)
- self.type = OFPIT_APPLY_ACTIONS
- self.actions = action_list()
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_apply_actions\n"
- outstr += ofp_instruction_actions.show(self, prefix)
- outstr += self.actions.show(prefix)
- return outstr
- def unpack(self, binary_string):
- binary_string = ofp_instruction_actions.unpack(self, binary_string)
- bytes = self.len - OFP_INSTRUCTION_ACTIONS_BYTES
- self.actions = action_list()
- binary_string = self.actions.unpack(binary_string, bytes=bytes)
- return binary_string
- def pack(self):
- self.len = self.__len__()
- packed = ""
- packed += ofp_instruction_actions.pack(self)
- packed += self.actions.pack()
- return packed
- def __len__(self):
- return ofp_instruction_actions.__len__(self) + self.actions.__len__()
-
-
-class instruction_clear_actions(ofp_instruction):
- """
- Wrapper class for clear_actions instruction object
-
- Data members inherited from ofp_instruction:
- @arg type
- @arg len
-
- """
- def __init__(self):
- ofp_instruction.__init__(self)
- self.type = OFPIT_CLEAR_ACTIONS
- self.len = self.__len__()
- def show(self, prefix=''):
- outstr = prefix + "instruction_clear_actions\n"
- outstr += ofp_instruction.show(self, prefix)
- return outstr
-
-instruction_class_list = (
- instruction_apply_actions,
- instruction_clear_actions,
- instruction_goto_table,
- instruction_write_actions,
- instruction_write_metadata)
diff --git a/src/python/of12/instruction_list.py b/src/python/of12/instruction_list.py
deleted file mode 100644
index 7b03fbf..0000000
--- a/src/python/of12/instruction_list.py
+++ /dev/null
@@ -1,96 +0,0 @@
-"""
-OpenFlow instruction list class
-"""
-
-import action as action
-import instruction as instruction
-from action_list import action_list
-from base_list import ofp_base_list
-from cstruct import ofp_header
-import unittest
-
-# Instruction list
-
-instruction_object_map = {
- action.OFPIT_GOTO_TABLE : instruction.instruction_goto_table,
- action.OFPIT_WRITE_METADATA : instruction.instruction_write_metadata,
- action.OFPIT_WRITE_ACTIONS : instruction.instruction_write_actions,
- action.OFPIT_APPLY_ACTIONS : instruction.instruction_apply_actions,
- action.OFPIT_CLEAR_ACTIONS : instruction.instruction_clear_actions,
-}
-
-class instruction_list(ofp_base_list):
- """
- Maintain a list of instructions
-
- Data members:
- @arg instructions An array of instructions such as write_actions
-
- Methods:
- @arg pack: Pack the structure into a string
- @arg unpack: Unpack a string to objects, with proper typing
- @arg add: Add an action to the list; you can directly access
- the action member, but add will validate that the added object
- is an action.
-
- """
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.instructions = self.items
- self.name = "instruction"
- self.class_list = instruction.instruction_class_list
-
- def unpack(self, binary_string, bytes=None):
- """
- Unpack a list of instructions
-
- Unpack instructions from a binary string, creating an array
- of objects of the appropriate type
-
- @param binary_string The string to be unpacked
-
- @param bytes The total length of the instruction list in bytes.
- Ignored if decode is True. If bytes is None and decode is false, the
- list is assumed to extend through the entire string.
-
- @return The remainder of binary_string that was not parsed
-
- """
- if bytes == None:
- bytes = len(binary_string)
- bytes_done = 0
- count = 0
- cur_string = binary_string
- while bytes_done < bytes:
- hdr = instruction.ofp_instruction()
- hdr.unpack(cur_string)
- if hdr.len < action.OFP_ACTION_HEADER_BYTES:
- print "ERROR: Action too short"
- break
- if not hdr.type in instruction_object_map.keys():
- print "WARNING: Skipping unknown action ", hdr.type, hdr.len
- else:
- self.instructions.append(instruction_object_map[hdr.type]())
- self.instructions[count].unpack(cur_string)
- count += 1
- cur_string = cur_string[hdr.len:]
- bytes_done += hdr.len
- return cur_string
-
-class Instruction_List_Test(unittest.TestCase):
- def runTest(self):
- # instructions header is 8 bytes
- l = instruction_list()
- act = action.action_output()
- act.port = 7
- inst = instruction.instruction_apply_actions()
- self.assertTrue(inst.actions.add(act))
- self.assertTrue(l.add(inst))
- pkt = l.pack()
- # 24 == 8 (list header) + (apply header) 8 + (output action) 8
- self.assertEqual(len(pkt),24)
-
- l = instruction_list()
- self.assertTrue(l.add(instruction.instruction_goto_table()))
-
diff --git a/src/python/of12/match.py b/src/python/of12/match.py
deleted file mode 100644
index c732467..0000000
--- a/src/python/of12/match.py
+++ /dev/null
@@ -1,893 +0,0 @@
-
-# Python OpenFlow instruction wrapper classes
-
-import struct
-import ipaddr
-import socket
-from cstruct import *
-
-
-class oxm_tlv(object):
- def __init__(self, field, hasmask, length, value, mask=None,
- class_ = 0x8000):
- self.class_ = class_
- self.field = field
- self.hasmask = hasmask
- self.length = length
- self.value = value
- self.mask = mask
-
- def __eq__(self, other):
- return (self.class_ == other.class_ and self.field == other.field
- and self.hasmask == other.hasmask and
- self.length == other.length and self.value == other.value and
- self.mask == self.mask)
-
- def pack(self, assertstruct=True):
-
- packed = ""
- packed += struct.pack("!I", ((self.class_ << 16) | (self.field << 9) |
- (self.hasmask << 8) | self.length))
- if self.length == 1:
- packed += struct.pack("B", self.value)
- if self.hasmask:
- packed += struct.pack("B", self.mask)
- elif self.length == 2 or (self.length == 4 and self.hasmask == True):
- packed += struct.pack("!H", self.value)
- if self.hasmask:
- packed += struct.pack("!H", self.mask)
- elif self.length == 4 or (self.length == 8 and self.hasmask == True):
- packed += struct.pack("!I", self.value)
- if self.hasmask:
- packed += struct.pack("!I", self.mask)
- elif self.length == 6 or self.length == 12:
- packed += struct.pack("!BBBBBB", self.value[0],self.value[1],
- self.value[2],self.value[3],self.value[4],self.value[5])
- if self.hasmask:
- packed += struct.pack("!BBBBBB", self.mask[0],self.mask[1],
- self.mask[2],self.mask[3],self.mask[4],self.mask[5])
- elif self.length == 8 or (self.length == 16 and self.hasmask == True):
- packed += struct.pack("!Q", self.value)
- if self.hasmask:
- packed += struct.pack("!Q", self.mask)
- elif self.length == 16 or self.length == 32:
- packed += self.value.packed
- if self.hasmask:
- packed += self.mask.packed
- return packed
-
- def __len__(self):
- return self.length + 4
-
- def show(self, prefix=''):
- return "\n".join(
-# ("oxm_tlv_class=" + hex(self.class_),
- (prefix + "oxm_tlv_class=" + hex(self.class_),
- prefix + "oxm_tlv_field=" + str(self.field),
- prefix +"oxm_tlv_hasmask=" + str(bool(self.hasmask)),
- prefix +"oxm_tlv_length: " + str(self.length) + "\n",))
-
-
- subclasses = {}
-
- def set_value(self, value):
- self.value = value
-
- def set_hasmask(self, hasmask):
- self.hasmask = hasmask
-
- def set_mask(self, mask):
- self.mask = mask
-
- @staticmethod
- def factory():
- for subclass in oxm_tlv.__subclasses__():
- obj = subclass()
- oxm_tlv.subclasses[obj.field] = subclass
-
- @staticmethod
- def create(field):
- return oxm_tlv.subclasses[field]()
-
-
-
-def roundup (x,y):
- return (((x) + ((y) - 1)) / (y) * (y))
-
-class in_port(oxm_tlv):
- """
- Wrapper class for in_port match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IN_PORT , hasmask, 4, value)
- def show(self, prefix=''):
- outstr = prefix + "name = in_port\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-
-class in_phy_port(oxm_tlv):
- """
- Wrapper class for in_phy_port match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self,OFPXMT_OFB_IN_PHY_PORT, hasmask, 4, value)
- def show(self, prefix=''):
- outstr = prefix + "name = in_phy_port\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-
-class metadata(oxm_tlv):
- """
- Wrapper class for metadata match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, mask =None):
- if mask == None:
- oxm_tlv.__init__(self, OFPXMT_OFB_METADATA, False, 8, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_METADATA, True, 16, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = metadata\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class eth_dst(oxm_tlv):
- """
- Wrapper class for eth_dst match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, mask=None):
- if mask == None:
- oxm_tlv.__init__(self, OFPXMT_OFB_ETH_DST, False, 6, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ETH_DST, True, 12, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = eth_dst\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + ":".join(["%.2x" %x
- for x in self.value]) +"\n"
- return outstr
-
-class eth_src(oxm_tlv):
- """
- Wrapper class for eth_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_ETH_SRC, hasmask, 6, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ETH_SRC, hasmask, 12,
- value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = eth_src\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + ":".join(["%.2x" %x
- for x in self.value]) +"\n"
- return outstr
-
-class eth_type(oxm_tlv):
- """
- Wrapper class for eth_type match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ETH_TYPE, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = eth_type\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + hex(self.value) +"\n"
- return outstr
-
-class vlan_vid(oxm_tlv):
- """
- Wrapper class for vlan_vid match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_VLAN_VID, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = vlan_vid\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class vlan_pcp(oxm_tlv):
- """
- Wrapper class for vlan_pcp match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_VLAN_PCP, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = vlan_pcp\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ip_dscp(oxm_tlv):
- """
- Wrapper class for ip_dscp match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IP_DSCP, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ip_dscp\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ip_ecn(oxm_tlv):
- """
- Wrapper class for ip_dscp match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IP_ECN, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ip_ecn\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ip_proto(oxm_tlv):
- """
- Wrapper class for ip_proto match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IP_PROTO, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ip_proto\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ipv4_src(oxm_tlv):
- """
- Wrapper class for ipv4_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_SRC, hasmask, 4, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_SRC, hasmask, 4, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv4_src\n"
- outstr += oxm_tlv.show(self, prefix)
- #Value can be a long int or a string
- try:
- addr = ipaddr.IPv4Address(self.value)
- except ValueError:
- addr = ipaddr.IPv4Address(int(self.value, 16))
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class ipv4_dst(oxm_tlv):
- """
- Wrapper class for ipv4_dst match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_DST, hasmask, 4, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_DST, hasmask, 4, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv4_dst\n"
- outstr += oxm_tlv.show(self, prefix)
- #Value can be a long int or a string
- #try:
- addr = ipaddr.IPv4Address(self.value)
- #except ValueError:
- # addr = ipaddr.IPv4Address(int(self.value, 16))
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class tcp_src(oxm_tlv):
- """
- Wrapper class for tcp_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_TCP_SRC, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = tcp_src\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class tcp_dst(oxm_tlv):
- """
- Wrapper class for tcp_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_TCP_DST, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = tcp_dst\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class udp_src(oxm_tlv):
- """
- Wrapper class for udp_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_UDP_SRC, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = udp_src\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class udp_dst(oxm_tlv):
- """
- Wrapper class for udp_dst match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_UDP_DST, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = udp_dst\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class sctp_src(oxm_tlv):
- """
- Wrapper class for sctp_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_SCTP_SRC, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = sctp_src\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-
-class sctp_dst(oxm_tlv):
- """
- Wrapper class for sctp_dst match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_SCTP_DST, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = sctp_dst\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class icmpv4_type(oxm_tlv):
- """
- Wrapper class for icmpv4_type match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV4_TYPE, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = icmpv4_type\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class icmpv4_code(oxm_tlv):
- """
- Wrapper class for icmpv4_code match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV4_CODE, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = icmpv4_code\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outs
-
-class arp_op(oxm_tlv):
- """
- Wrapper class for arp_op match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_OP, hasmask, 2, value)
- def show(self, prefix=''):
- outstr = prefix + "name = arp_op\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outs
-
-class arp_spa(oxm_tlv):
- """
- Wrapper class for arp_spa match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SPA, hasmask, 4, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SPA, hasmask, 4, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = arp_spa\n"
- #Value can be a long int or a string
- try:
- addr = ipaddr.IPv4Address(self.value)
- except ValueError:
- addr = ipaddr.IPv4Address(int(self.value, 16))
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class arp_tpa(oxm_tlv):
- """
- Wrapper class for arp_tpa match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_TPA, hasmask, 4, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_TPA, hasmask, 4, value, mask)
- def show(self, prefix=''):
- outstr = prefix + "name = arp_tpa\n"
- #Value can be a long int or a string
- try:
- addr = ipaddr.IPv4Address(self.value)
- except ValueError:
- addr = ipaddr.IPv4Address(int(self.value, 16))
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + ":".join(["%.2x" %x
- for x in self.value]) +"\n"
- return outstr
-
-
-class arp_sha(oxm_tlv):
- """
- Wrapper class for arp_sha match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SHA, hasmask, 6, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SHA, hasmask, 12, value)
- def show(self, prefix=''):
- outstr = prefix + "name = arp_sha\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + ":".join(["%.2x" %x
- for x in self.value]) +"\n"
- return outstr
-
-class arp_tha(oxm_tlv):
- """
- Wrapper class for arp_tha match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_THA, hasmask, 6, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_ARP_THA, hasmask, 12, value)
- def show(self, prefix=''):
- outstr = prefix + "name = arp_tha\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ipv6_src(oxm_tlv):
- """
- Wrapper class for ipv6_src match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_SRC, False, 16, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_SRC, True, 32, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_src\n"
- try:
- addr = ipaddr.IPv6Address(self.value)
- except ValueError:
- addr = ipaddr.IPv6Address(int(self.value, 16))
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class ipv6_dst(oxm_tlv):
- """
- Wrapper class for ipv6_dst match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_DST, False, 16, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_DST, True, 32, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_dst\n"
- try:
- addr = ipaddr.IPv6Address(self.value)
- except ValueError:
- addr = ipaddr.IPv6Address(int(self.value, 16))
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class ipv6_flabel(oxm_tlv):
- """
- Wrapper class for ipv6_flabel match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- if not hasmask:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_FLABEL, hasmask, 4, value)
- else:
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_FLABEL, hasmask, 8, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_flabel\n"
- outstr += oxm_tlv.show(self, prefix)
- return outstr
-
-class icmpv6_type(oxm_tlv):
- """
- Wrapper class for icmpv6_type match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV6_TYPE, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = icmpv6_type\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class icmpv6_code(oxm_tlv):
- """
- Wrapper class for icmpv6_code match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV6_CODE, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = icmpv6_code\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outs
-
-class ipv6_nd_target(oxm_tlv):
- """
- Wrapper class for ipv6_nd_target match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_TARGET, hasmask, 16, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_nd_target\n"
- try:
- addr = ipaddr.IPv6Address(self.value)
- except ValueError:
- addr = ipaddr.IPv6Address(int(self.value, 16))
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(addr) +"\n"
- return outstr
-
-class ipv6_nd_sll(oxm_tlv):
- """
- Wrapper class for ipv6_nd_sll match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_SLL, hasmask, 6, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_nd_sll\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class ipv6_nd_tll(oxm_tlv):
- """
- Wrapper class for ipv6_nd_tll match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_TLL, hasmask, 6, value)
- def show(self, prefix=''):
- outstr = prefix + "name = ipv6_nd_tll\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class mpls_label(oxm_tlv):
- """
- Wrapper class for mpls_label match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_MPLS_LABEL, hasmask, 4, value)
- def show(self, prefix=''):
- outstr = prefix + "name = mpls_label\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-class mpls_tc(oxm_tlv):
- """
- Wrapper class for mpls_ltc match object
-
- Data members inherited from oxm_tlv:
- @arg class
- @arg field
- @arg hasmask
- @arg body
-
- """
- def __init__(self, value=None, hasmask=False):
- oxm_tlv.__init__(self, OFPXMT_OFB_MPLS_TC, hasmask, 1, value)
- def show(self, prefix=''):
- outstr = prefix + "name = mpls_tc\n"
- outstr += oxm_tlv.show(self, prefix)
- outstr += prefix + "value = " + str(self.value) +"\n"
- return outstr
-
-match_class_list = (
- in_port,
- in_phy_port,
- metadata,
- eth_dst,
- eth_src,
- eth_type,
- vlan_vid,
- vlan_pcp,
- ip_dscp,
- ip_ecn,
- ip_proto,
- ipv4_src,
- ipv4_dst,
- tcp_src,
- tcp_dst,
- udp_src,
- udp_dst,
- sctp_src,
- sctp_dst,
- icmpv4_type,
- icmpv4_code,
- arp_op,
- arp_spa,
- arp_tpa,
- arp_sha,
- arp_tha,
- ipv6_src,
- ipv6_dst,
- ipv6_flabel,
- icmpv6_type,
- icmpv6_code,
- ipv6_nd_target,
- ipv6_nd_sll,
- ipv6_nd_tll,
- mpls_label,
- mpls_tc)
diff --git a/src/python/of12/match_list.py b/src/python/of12/match_list.py
deleted file mode 100644
index 7a50c75..0000000
--- a/src/python/of12/match_list.py
+++ /dev/null
@@ -1,90 +0,0 @@
-import struct
-import binascii
-import match as match
-from match import oxm_tlv
-from base_list import ofp_base_list
-
-
-class match_list(ofp_base_list):
-
- def __init__(self):
- ofp_base_list.__init__(self)
- self.tlvs = self.items
- self.name = "match"
- self.class_list = match.match_class_list
-
- def __len__(self):
- return sum([len(i) for i in self])
-
- def __eq__(self, other):
- self.tlvs.sort(key=lambda x: x.field);
- other.tlvs.sort(key=lambda x: x.field);
- return self.tlvs == other.tlvs
-
- def unpack(self, binary_string, bytes=None):
- oxm_tlv.factory()
- if bytes <= 4:
- return binary_string[4:]
- if bytes == None:
- bytes = len(binary_string)
- offset = 0
- cur_string = binary_string
- part = lambda: cur_string[read+4:read+4+oxm_length]
- while offset < bytes:
- read = 0
- oxm_class, oxm_fieldhm, oxm_length = struct.unpack("!HBB",
- cur_string[read:read+4])
- #Found padding bytes?
- if not oxm_class:
- break
- oxm_field = oxm_fieldhm >> 1
- oxm_hasmask = oxm_fieldhm & 0x00000001
-
- if oxm_length == 1:
- if oxm_hasmask:
- value, mask = struct.unpack("BB", part())[:2]
- else:
- value = struct.unpack("!B", part())[0]
- mask = None
- elif oxm_length == 2 or (oxm_length == 4 and oxm_hasmask == True):
- if oxm_hasmask:
- value, mask = struct.unpack("!HH", part())[:2]
- else:
- value = struct.unpack("!H", part())[0]
- mask = None
- elif oxm_length == 4 or (oxm_length == 8 and oxm_hasmask == True):
- if oxm_hasmask:
- value, mask = struct.unpack("!II", part())[:2]
- else:
- value = struct.unpack("!I", part())[0]
- mask = None
- elif oxm_length == 6 or oxm_length == 12:
- if oxm_hasmask:
- data = struct.unpack("!12B", part())[0]
- value, mask = data[:6], data[6:]
- else:
- value = list(struct.unpack("!6B", part()))
- mask = None
- elif oxm_length == 8 or (oxm_length == 16 and oxm_hasmask == True):
- if oxm_hasmask:
- value, mask = struct.unpack("!QQ", part())[0]
- else:
- value = struct.unpack("!Q", part())[0]
- mask = None
- elif oxm_length == 16 or oxm_length == 32:
- if oxm_hasmask:
- data = struct.unpack("!32s", part())[0]
- value, mask = data[:16], data[16:]
- else:
- value = struct.unpack("!16s", part())[0]
- mask = None
-
- oxm = oxm_tlv.create(oxm_field)
- oxm.set_hasmask(oxm_hasmask)
- oxm.set_value(value)
- oxm.set_mask(mask)
- self.tlvs.append(oxm)
- read = 4 + oxm_length
- offset += read
- cur_string = cur_string[read:]
- return cur_string
diff --git a/src/python/of12/message.py b/src/python/of12/message.py
deleted file mode 100644
index b8fb9b8..0000000
--- a/src/python/of12/message.py
+++ /dev/null
@@ -1,4015 +0,0 @@
-
-# Python OpenFlow message wrapper classes
-
-from cstruct import *
-from match import oxm_tlv
-from match import roundup
-from match_list import match_list
-from action_list import action_list
-from instruction_list import instruction_list
-from bucket_list import bucket_list
-from error import *
-
-# Define templates for documentation
-class ofp_template_msg(object):
- """
- Sample base class for template_msg; normally auto generated
- This class should live in the of_header name space and provides the
- base class for this type of message. It will be wrapped for the
- high level API.
-
- """
- def __init__(self, **kwargs):
- """
- Constructor for base class
-
- """
- self.header = ofp_header()
- # Additional base data members declared here
-
- # Normally will define pack, unpack, __len__ functions
-
-class template_msg(ofp_template_msg):
- """
- Sample class wrapper for template_msg
- This class should live in the of_message name space and provides the
- high level API for an OpenFlow message object. These objects must
- implement the functions indicated in this template.
-
- """
- def __init__(self, **kwargs):
- """
- Constructor
- Must set the header type value appropriately for the message
-
- """
-
- ##@var header
- # OpenFlow message header: length, version, xid, type
- ofp_template_msg.__init__(self)
- self.header = ofp_header()
- # For a real message, will be set to an integer
- self.header.type = "TEMPLATE_MSG_VALUE"
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- pass
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
-
- @return Typically returns the remainder of binary_string that
- was not parsed. May give a warning if that string is non-empty
-
- """
- pass
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- pass
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
- pass
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- pass
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- pass
-
-
-################################################################
-#
-# OpenFlow Message Definitions
-#
-################################################################
-
-class barrier_reply(object):
- """
- Wrapper class for barrier_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_BARRIER_REPLY=21)
-
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REPLY
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'barrier_reply (OFPT_BARRIER_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class barrier_request(object):
- """
- Wrapper class for barrier_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_BARRIER_REQUEST=20)
-
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REQUEST
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'barrier_request (OFPT_BARRIER_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class echo_reply(object):
- """
- Wrapper class for echo_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ECHO_REPLY=3)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REPLY
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'echo_reply (OFPT_ECHO_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class echo_request(object):
- """
- Wrapper class for echo_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ECHO_REQUEST=2)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REQUEST
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'echo_request (OFPT_ECHO_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class error(ofp_error_msg):
- """
- Wrapper class for error
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_ERROR=1)
-
- Data members inherited from ofp_error_msg:
- @arg type
- @arg code
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_error_msg.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_error_msg.unpack(self, binary_string)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_error_msg.__len__(self)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'error (OFPT_ERROR)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_error_msg.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_error_msg.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class experimenter(ofp_experimenter_header):
- """
- Wrapper class for experimenter
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_EXPERIMENTER=4)
-
- Data members inherited from ofp_experimenter_header:
- @arg experimenter
- @arg exp_type
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- ofp_experimenter_header.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_EXPERIMENTER
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_experimenter_header.pack(self)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_experimenter_header.unpack(self, binary_string)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_experimenter_header.__len__(self)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'experimenter (OFPT_EXPERIMENTER)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_experimenter_header.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_experimenter_header.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class features_reply(ofp_switch_features):
- """
- Wrapper class for features_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FEATURES_REPLY=6)
-
- Data members inherited from ofp_switch_features:
- @arg datapath_id
- @arg n_buffers
- @arg n_tables
- @arg capabilities
- @arg reserved
- @arg ports: Variable length array of TBD
-
- """
-
- def __init__(self, **kwargs):
- ofp_switch_features.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REPLY
- self.ports = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_features.pack(self)
- for obj in self.ports:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_features.unpack(self, binary_string)
- while len(binary_string) >= OFP_PORT_BYTES:
- new_port = ofp_port()
- binary_string = new_port.unpack(binary_string)
- self.ports.append(new_port)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_features.__len__(self)
- for obj in self.ports:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'features_reply (OFPT_FEATURES_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_features.show(self, prefix)
- outstr += prefix + "Array ports\n"
- for obj in self.ports:
- outstr += obj.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_features.__eq__(self, other): return False
- if self.ports != other.ports: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class features_request(object):
- """
- Wrapper class for features_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FEATURES_REQUEST=5)
-
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REQUEST
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'features_request (OFPT_FEATURES_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class flow_mod(ofp_flow_mod):
- """
- Wrapper class for flow_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FLOW_MOD=14)
-
- Data members inherited from ofp_flow_mod:
- @arg cookie
- @arg cookie_mask
- @arg table_id
- @arg command
- @arg idle_timeout
- @arg hard_timeout
- @arg priority
- @arg buffer_id
- @arg out_port
- @arg out_group
- @arg flags
- @arg match
- @arg instructions: Object of type instruction_list
-
- """
-
- def __init__(self, **kwargs):
- ofp_flow_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_MOD
- self.buffer_id = 0xffffffff #no buffer
- self.out_port = OFPP_ANY
- self.out_group = OFPG_ANY
- self.match_fields = match_list()
- self.instructions = instruction_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- if not len(self.match_fields):
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed = self.header.pack()
- packed += ofp_flow_mod.pack(self)
- self.match_fields.tlvs.sort(key=lambda x : x.field)
- packed += self.match_fields.pack()
- padding_size = roundup( len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- packed += self.instructions.pack()
- return packed
-
-
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_flow_mod.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup(OFP_FLOW_MOD_BYTES + len(self.match_fields),8) - (OFP_FLOW_MOD_BYTES + len(self.match_fields))
- if padding:
- binary_string = binary_string[padding:]
- ai_len = self.length - roundup(OFP_FLOW_MOD_BYTES + len(self.match_fields),8)
- binary_string = self.instructions.unpack(binary_string, bytes=ai_len)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_flow_mod.__len__(self)
- length = roundup(length + len(self.match_fields), 8)
- length += len(self.instructions)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'flow_mod (OFPT_FLOW_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_flow_mod.show(self, prefix)
- outstr += self.match_fields.show(prefix + ' ')
- outstr += prefix + "List instructions\n"
- outstr += self.instructions.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_flow_mod.__eq__(self, other): return False
- if self.match_fields != other.match_fields: return False
- if self.instructions != other.instructions: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class flow_removed(ofp_flow_removed):
- """
- Wrapper class for flow_removed
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_FLOW_REMOVED=11)
-
- Data members inherited from ofp_flow_removed:
- @arg cookie
- @arg priority
- @arg reason
- @arg table_id
- @arg duration_sec
- @arg duration_nsec
- @arg idle_timeout
- @arg hard_timeout
- @arg packet_count
- @arg byte_count
- @arg match
-
- """
-
- def __init__(self, **kwargs):
- ofp_flow_removed.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_REMOVED
- self.match_fields = match_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- if not len(self.match_fields):
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match.length += 4
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed = self.header.pack()
- packed += ofp_flow_removed.pack(self)
- packed += self.match_fields.pack()
- padding_size = roundup( len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_flow_removed.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup(OFP_FLOW_REMOVED_BYTES + len(self.match_fields),8) - (OFP_FLOW_REMOVED_BYTES + len(self.match_fields))
- if padding:
- binary_string = binary_string[padding:]
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
- length += roundup(ofp_flow_removed.__len__(self) + len(self.match_fields),8)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'flow_removed (OFPT_FLOW_REMOVED)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_flow_removed.show(self, prefix)
- outstr += self.match_fields.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
- if not ofp_flow_removed.__eq__(self, other): return False
- if self.match_fields != other.match_fields: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class get_config_reply(ofp_switch_config):
- """
- Wrapper class for get_config_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GET_CONFIG_REPLY=8)
-
- Data members inherited from ofp_switch_config:
- @arg flags
- @arg miss_send_len
-
- """
-
- def __init__(self, **kwargs):
- ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REPLY
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_config.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_config.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_config.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'get_config_reply (OFPT_GET_CONFIG_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_config.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_config.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class get_config_request(object):
- """
- Wrapper class for get_config_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GET_CONFIG_REQUEST=7)
-
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REQUEST
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'get_config_request (OFPT_GET_CONFIG_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class group_mod(ofp_group_mod):
- """
- Wrapper class for group_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_GROUP_MOD=15)
-
- Data members inherited from ofp_group_mod:
- @arg command
- @arg type
- @arg group_id
- @arg buckets: Object of type bucket_list
-
- """
-
- def __init__(self, **kwargs):
- ofp_group_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_GROUP_MOD
- self.buckets = bucket_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_group_mod.pack(self)
- packed += self.buckets.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_group_mod.unpack(self, binary_string)
- binary_string = self.buckets.unpack(binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_group_mod.__len__(self)
- length += len(self.buckets)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'group_mod (OFPT_GROUP_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_group_mod.show(self, prefix)
- outstr += prefix + "List buckets\n"
- outstr += self.buckets.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_group_mod.__eq__(self, other): return False
- if self.buckets != other.buckets: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class hello(object):
- """
- Wrapper class for hello
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_HELLO=0)
-
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_HELLO
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'hello (OFPT_HELLO)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class packet_in(ofp_packet_in):
- """
- Wrapper class for packet_in
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PACKET_IN=10)
-
- Data members inherited from ofp_packet_in:
- @arg buffer_id
- @arg total_len
- @arg reason
- @arg table_id
- @arg match
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- ofp_packet_in.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_IN
- self.match_fields = match_list()
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- if len(self.match_fields) < 4:
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match.length += 4
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed = self.header.pack()
- packed += ofp_packet_in.pack(self)
- packed += self.match_fields.pack()
- padding_size = roundup( len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_packet_in.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup(OFP_PACKET_IN_BYTES + len(self.match_fields),8) - (OFP_PACKET_IN_BYTES + len(self.match_fields))
- if padding:
- binary_string = binary_string[padding:]
- binary_string = binary_string[2:]
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += roundup(ofp_packet_in.__len__(self) + len(self.match_fields),8)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'packet_in (OFPT_PACKET_IN)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_packet_in.show(self, prefix)
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_packet_in.__eq__(self, other): return False
- if self.data != other.data: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class packet_out(ofp_packet_out):
- """
- Wrapper class for packet_out
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PACKET_OUT=13)
-
- Data members inherited from ofp_packet_out:
- @arg buffer_id
- @arg in_port
- @arg actions_len
- @arg actions: Object of type action_list
- @arg data: Binary string following message members
-
- """
-
- def __init__(self, **kwargs):
- ofp_packet_out.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_OUT
- self.actions = []
- self.data = ""
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
- self.actions = action_list(self.actions)
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- self.actions_len = len(self.actions)
- packed += ofp_packet_out.pack(self)
- packed += self.actions.pack()
- packed += self.data
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_packet_out.unpack(self, binary_string)
- binary_string = self.actions.unpack(binary_string, bytes=self.actions_len)
- self.data = binary_string
- binary_string = ''
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_packet_out.__len__(self)
- length += len(self.actions)
- length += len(self.data)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'packet_out (OFPT_PACKET_OUT)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_packet_out.show(self, prefix)
- outstr += prefix + "List actions\n"
- outstr += self.actions.show(prefix + ' ')
- outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
- ##@todo Fix this circular reference
- # if len(self.data) > 0:
- # obj = of_message_parse(self.data)
- # if obj != None:
- # outstr += obj.show(prefix)
- # else:
- # outstr += prefix + "Unable to parse data\n"
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_packet_out.__eq__(self, other): return False
- if self.data != other.data: return False
- if self.actions != other.actions: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class port_mod(ofp_port_mod):
- """
- Wrapper class for port_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PORT_MOD=16)
-
- Data members inherited from ofp_port_mod:
- @arg port_no
- @arg hw_addr
- @arg config
- @arg mask
- @arg advertise
-
- """
-
- def __init__(self, **kwargs):
- ofp_port_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_MOD
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_port_mod.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_port_mod.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_port_mod.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'port_mod (OFPT_PORT_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_port_mod.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_port_mod.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class port_status(ofp_port_status):
- """
- Wrapper class for port_status
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_PORT_STATUS=12)
-
- Data members inherited from ofp_port_status:
- @arg reason
- @arg desc
-
- """
-
- def __init__(self, **kwargs):
- ofp_port_status.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_STATUS
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_port_status.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_port_status.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_port_status.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'port_status (OFPT_PORT_STATUS)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_port_status.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_port_status.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class queue_get_config_reply(ofp_queue_get_config_reply):
- """
- Wrapper class for queue_get_config_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REPLY=23)
-
- Data members inherited from ofp_queue_get_config_reply:
- @arg port
- @arg queues: Variable length array of TBD
-
- """
-
- def __init__(self, **kwargs):
- ofp_queue_get_config_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REPLY
- self.queues = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_queue_get_config_reply.pack(self)
- for obj in self.queues:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_queue_get_config_reply.unpack(self, binary_string)
- for obj in self.queues:
- binary_string = obj.unpack(binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_queue_get_config_reply.__len__(self)
- for obj in self.queues:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'queue_get_config_reply (OFPT_QUEUE_GET_CONFIG_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_queue_get_config_reply.show(self, prefix)
- outstr += prefix + "Array queues\n"
- for obj in self.queues:
- outstr += obj.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_queue_get_config_reply.__eq__(self, other): return False
- if self.queues != other.queues: return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class queue_get_config_request(ofp_queue_get_config_request):
- """
- Wrapper class for queue_get_config_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REQUEST=22)
-
- Data members inherited from ofp_queue_get_config_request:
- @arg port
-
- """
-
- def __init__(self, **kwargs):
- ofp_queue_get_config_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REQUEST
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_queue_get_config_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_queue_get_config_request.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_queue_get_config_request.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'queue_get_config_request (OFPT_QUEUE_GET_CONFIG_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_queue_get_config_request.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_queue_get_config_request.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class set_config(ofp_switch_config):
- """
- Wrapper class for set_config
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_SET_CONFIG=9)
-
- Data members inherited from ofp_switch_config:
- @arg flags
- @arg miss_send_len
-
- """
-
- def __init__(self, **kwargs):
- ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_SET_CONFIG
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_switch_config.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_switch_config.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_switch_config.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'set_config (OFPT_SET_CONFIG)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_switch_config.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_switch_config.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class stats_reply(ofp_stats_reply):
- """
- Wrapper class for stats_reply
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_STATS_REPLY=19)
-
- Data members inherited from ofp_stats_reply:
- @arg type
- @arg flags
-
- """
-
- def __init__(self, **kwargs):
- ofp_stats_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REPLY
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_stats_reply.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_stats_reply.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'stats_reply (OFPT_STATS_REPLY)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_stats_reply.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class stats_request(ofp_stats_request):
- """
- Wrapper class for stats_request
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_STATS_REQUEST=18)
-
- Data members inherited from ofp_stats_request:
- @arg type
- @arg flags
-
- """
-
- def __init__(self, **kwargs):
- ofp_stats_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REQUEST
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_stats_request.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_stats_request.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'stats_request (OFPT_STATS_REQUEST)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_stats_request.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-class table_mod(ofp_table_mod):
- """
- Wrapper class for table_mod
-
- OpenFlow message header: length, version, xid, type
- @arg length: The total length of the message
- @arg version: The OpenFlow version (3)
- @arg xid: The transaction ID
- @arg type: The message type (OFPT_TABLE_MOD=17)
-
- Data members inherited from ofp_table_mod:
- @arg table_id
- @arg config
-
- """
-
- def __init__(self, **kwargs):
- ofp_table_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_TABLE_MOD
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
-
- def pack(self):
- """
- Pack object into string
-
- @return The packed string which can go on the wire
-
- """
- self.header.length = len(self)
- packed = self.header.pack()
-
- packed += ofp_table_mod.pack(self)
- return packed
-
- def unpack(self, binary_string):
- """
- Unpack object from a binary string
-
- @param binary_string The wire protocol byte string holding the object
- represented as an array of bytes.
- @return The remainder of binary_string that was not parsed.
-
- """
- binary_string = self.header.unpack(binary_string)
-
- binary_string = ofp_table_mod.unpack(self, binary_string)
- # Fixme: If no self.data, add check for data remaining
- return binary_string
-
- def __len__(self):
- """
- Return the length of this object once packed into a string
-
- @return An integer representing the number bytes in the packed
- string.
-
- """
- length = OFP_HEADER_BYTES
-
- length += ofp_table_mod.__len__(self)
- return length
-
- def show(self, prefix=''):
- """
- Generate a string (with multiple lines) describing the contents
- of the object in a readable manner
-
- @param prefix Pre-pended at the beginning of each line.
-
- """
-
- outstr = prefix + 'table_mod (OFPT_TABLE_MOD)\n'
- prefix += ' '
- outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_table_mod.show(self, prefix)
- return outstr
-
- def __eq__(self, other):
- """
- Return True if self and other hold the same data
-
- @param other Other object in comparison
-
- """
- if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
-
- if not ofp_table_mod.__eq__(self, other): return False
- return True
-
- def __ne__(self, other):
- """
- Return True if self and other do not hold the same data
-
- @param other Other object in comparison
-
- """
- return not self.__eq__(other)
-
-
-
-################################################################
-#
-# Stats request and reply subclass definitions
-#
-################################################################
-
-
-# Stats request bodies for desc and table stats are not defined in the
-# OpenFlow header; We define them here. They are empty classes, really
-
-class ofp_desc_stats_request(object):
- """
- Forced definition of ofp_desc_stats_request (empty class)
- """
- def __init__(self, **kwargs):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_desc_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_DESC_STATS_REQUEST_BYTES = 0
-
-class ofp_table_stats_request(object):
- """
- Forced definition of ofp_table_stats_request (empty class)
- """
- def __init__(self, **kwargs):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_table_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_TABLE_STATS_REQUEST_BYTES = 0
-
-class ofp_group_desc_stats_request(object):
- """
- Forced definition of ofp_group_desc_stats_request (empty class)
- """
- def __init__(self, **kwargs):
- pass
- def pack(self, assertstruct=True):
- return ""
- def unpack(self, binary_string):
- return binary_string
- def __len__(self):
- return 0
- def show(self, prefix=''):
- return prefix + "ofp_group_desc_stats_request (empty)\n"
- def __eq__(self, other):
- return type(self) == type(other)
- def __ne__(self, other):
- return type(self) != type(other)
-
-OFP_GROUP_DESC_STATS_REQUEST_BYTES = 0
-
-
-
-# Stats entries define the content of one element in a stats
-# reply for the indicated type; define _entry for consistency
-
-aggregate_stats_entry = ofp_aggregate_stats_reply
-desc_stats_entry = ofp_desc_stats
-port_stats_entry = ofp_port_stats
-queue_stats_entry = ofp_queue_stats
-table_stats_entry = ofp_table_stats
-group_stats_entry = ofp_group_stats
-group_desc_stats_entry = ofp_group_desc_stats
-
-
-#
-# Flow stats entry contains an action list of variable length, so
-# it is done by hand
-#
-
-class flow_stats_entry(ofp_flow_stats):
- """
- Special case flow stats entry to handle action list object
- """
- def __init__(self, **kwargs):
- ofp_flow_stats.__init__(self)
- self.match_fields = match_list()
- self.instructions = instruction_list()
-
- def pack(self, assertstruct=True):
- self.length = len(self)
- if not len(self.match_fields):
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match.length += 4
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed = ofp_flow_stats.pack(self, assertstruct)
- packed += self.match_fields.pack()
- padding_size = roundup(len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- packed += self.instructions.pack()
- if len(packed) != self.length:
- print("ERROR: flow_stats_entry pack length not equal",
- self.length, len(packed))
- return packed
-
- def unpack(self, binary_string):
- binary_string = ofp_flow_stats.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup((OFP_FLOW_STATS_BYTES -4) + self.match.length,8) - ((OFP_FLOW_STATS_BYTES - 4) + self.match.length)
- if padding:
- binary_string = binary_string[padding:]
- ai_len = self.length - roundup(OFP_FLOW_STATS_BYTES + len(self.match_fields),8)
- if ai_len < 0:
- print("ERROR: flow_stats_entry unpack length too small",
- self.length)
- binary_string = self.instructions.unpack(binary_string, bytes=ai_len)
- return binary_string
-
- def __len__(self):
- return roundup(OFP_FLOW_STATS_BYTES + len(self.match_fields),8) + len(self.instructions)
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_entry\n"
- outstr += ofp_flow_stats.show(self, prefix + ' ')
- outstr += self.match_fields.show(prefix + ' ')
- outstr += self.instructions.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (ofp_flow_stats.__eq__(self, other) and
- self.instructions == other.instructions)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class aggregate_stats_request(ofp_stats_request, ofp_aggregate_stats_request):
- """
- Wrapper class for aggregate stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_aggregate_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_AGGREGATE
- self.match_fields = match_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- if not len(self.match_fields):
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match.length += 4
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed += ofp_aggregate_stats_request.pack(self, assertstruct)
- packed += self.match_fields.pack()
- padding_size = roundup(len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
-
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_aggregate_stats_request.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup(OFP_AGGREGATE_STATS_REQUEST_BYTES + len(self.match_fields),8) - (OFP_AGGREGATE_STATS_REQUEST_BYTES + len(self.match_fields))
- if padding:
- binary_string = binary_string[padding:]
- if len(binary_string) != 0:
- print "ERROR unpacking flow: extra data"
- return binary_string
-
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_AGGREGATE_STATS_REQUEST_BYTES
- if not len(self.match_fields):
- return length + 4
- else:
- return roundup(length + len(self.match_fields),8)
-
- def show(self, prefix=''):
- outstr = prefix + "aggregate_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_aggregate_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_aggregate_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class aggregate_stats_reply(ofp_stats_reply):
- """
- Wrapper class for aggregate stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_AGGREGATE
- # stats: Array of type aggregate_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = aggregate_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = aggregate_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking aggregate stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "aggregate_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class desc_stats_request(ofp_stats_request, ofp_desc_stats_request):
- """
- Wrapper class for desc stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_desc_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_DESC
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_desc_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_desc_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking desc: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_DESC_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "desc_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_desc_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_desc_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class desc_stats_reply(ofp_stats_reply):
- """
- Wrapper class for desc stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_DESC
- # stats: Array of type desc_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = desc_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = desc_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking desc stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "desc_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_stats_request(ofp_stats_request, ofp_flow_stats_request):
- """
- Wrapper class for flow stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_flow_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_FLOW
- self.match_fields = match_list()
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- if not len(self.match_fields):
- tlv_pad = oxm_tlv(0,0,0,0,0,0)
- self.match.length += 4
- self.match_fields.tlvs.append(tlv_pad)
- else:
- if len(self.match_fields) > 4:
- self.match.length += len(self.match_fields)
- packed += ofp_flow_stats_request.pack(self)
- packed += self.match_fields.pack()
- padding_size = roundup(len(self.match) + len(self.match_fields),8) - (len(self.match) + len(self.match_fields))
- padding = [0] * padding_size
- if padding_size:
- packed += struct.pack("!" + str(padding_size) + "B", *padding)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_flow_stats_request.unpack(self, binary_string)
- binary_string = self.match_fields.unpack(binary_string, bytes = self.match.length - 4)
- padding = roundup(OFP_FLOW_STATS_REQUEST_BYTES + len(self.match_fields),8) - (OFP_FLOW_STATS_REQUEST_BYTES + len(self.match_fields))
- if padding:
- binary_string = binary_string[padding:]
- if len(binary_string) != 0:
- print "ERROR unpacking flow: extra data"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_FLOW_STATS_REQUEST_BYTES
- if not len(self.match_fields):
- return length + 4
- else:
- return roundup(length + len(self.match_fields),8)
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_flow_stats_request.show(self)
- outstr += self.match_fields.show(prefix + ' ')
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_flow_stats_request.__eq__(self, other) and
- self.match_fields != other.match_fields)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class flow_stats_reply(ofp_stats_reply):
- """
- Wrapper class for flow stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_FLOW
- # stats: Array of type flow_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = flow_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = flow_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking flow stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "flow_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_stats_request(ofp_stats_request, ofp_port_stats_request):
- """
- Wrapper class for port stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_port_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_PORT
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_port_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_port_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking port: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_PORT_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "port_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_port_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_port_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class port_stats_reply(ofp_stats_reply):
- """
- Wrapper class for port stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_PORT
- # stats: Array of type port_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = port_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = port_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking port stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "port_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_stats_request(ofp_stats_request, ofp_queue_stats_request):
- """
- Wrapper class for queue stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_queue_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_QUEUE
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_queue_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_queue_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking queue: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_QUEUE_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "queue_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_queue_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_queue_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class queue_stats_reply(ofp_stats_reply):
- """
- Wrapper class for queue stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_QUEUE
- # stats: Array of type queue_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = queue_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = queue_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking queue stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "queue_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_stats_request(ofp_stats_request, ofp_group_stats_request):
- """
- Wrapper class for group stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_group_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_GROUP
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_group_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_group_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking group: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_GROUP_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "group_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_group_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_group_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_stats_reply(ofp_stats_reply):
- """
- Wrapper class for group stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_GROUP
- # stats: Array of type group_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = group_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = group_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking group stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "group_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_desc_stats_request(ofp_stats_request, ofp_group_desc_stats_request):
- """
- Wrapper class for group_desc stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_group_desc_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_GROUP_DESC
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_group_desc_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_group_desc_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking group_desc: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_GROUP_DESC_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "group_desc_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_group_desc_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_group_desc_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class group_desc_stats_reply(ofp_stats_reply):
- """
- Wrapper class for group_desc stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_GROUP_DESC
- # stats: Array of type group_desc_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = group_desc_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = group_desc_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking group_desc stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "group_desc_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_stats_request(ofp_stats_request, ofp_table_stats_request):
- """
- Wrapper class for table stats request message
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_request.__init__(self)
- ofp_table_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
- self.type = OFPST_TABLE
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_request.pack(self)
- packed += ofp_table_stats_request.pack(self)
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_request.unpack(self, binary_string)
- binary_string = ofp_table_stats_request.unpack(self, binary_string)
- if len(binary_string) != 0:
- print "ERROR unpacking table: extra data"
- return binary_string
-
- def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
- OFP_TABLE_STATS_REQUEST_BYTES
-
- def show(self, prefix=''):
- outstr = prefix + "table_stats_request\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_request.show(self)
- outstr += ofp_table_stats_request.show(self)
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
- ofp_table_stats_request.__eq__(self, other))
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-class table_stats_reply(ofp_stats_reply):
- """
- Wrapper class for table stats reply
- """
- def __init__(self, **kwargs):
- self.header = ofp_header()
- ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_TABLE
- # stats: Array of type table_stats_entry
- self.stats = []
- for (k, v) in kwargs.items():
- if hasattr(self, k):
- setattr(self, k, v)
- else:
- raise NameError("field %s does not exist in %s" % (k, self.__class__))
-
- def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
- packed += ofp_stats_reply.pack(self)
- for obj in self.stats:
- packed += obj.pack()
- return packed
-
- def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
- binary_string = ofp_stats_reply.unpack(self, binary_string)
- dummy = table_stats_entry()
- while len(binary_string) >= len(dummy):
- obj = table_stats_entry()
- binary_string = obj.unpack(binary_string)
- self.stats.append(obj)
- if len(binary_string) != 0:
- print "ERROR unpacking table stats string: extra bytes"
- return binary_string
-
- def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
- for obj in self.stats:
- length += len(obj)
- return length
-
- def show(self, prefix=''):
- outstr = prefix + "table_stats_reply\n"
- outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
- outstr += ofp_stats_reply.show(self)
- outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
- for obj in self.stats:
- outstr += obj.show()
- return outstr
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
- self.stats == other.stats)
-
- def __ne__(self, other): return not self.__eq__(other)
-
-
-# @todo Add buckets to group and group_desc stats obejcts"
-message_type_list = (
- aggregate_stats_reply,
- aggregate_stats_request,
- bad_action_error_msg,
- bad_request_error_msg,
- barrier_reply,
- barrier_request,
- desc_stats_reply,
- desc_stats_request,
- echo_reply,
- echo_request,
- error,
- experimenter,
- features_reply,
- features_request,
- flow_mod,
- flow_mod_failed_error_msg,
- flow_removed,
- flow_stats_reply,
- flow_stats_request,
- get_config_reply,
- get_config_request,
- group_desc_stats_request,
- group_desc_stats_reply,
- group_stats_request,
- group_stats_reply,
- group_mod,
- group_mod_failed_error_msg,
- hello,
- hello_failed_error_msg,
- packet_in,
- packet_out,
- port_mod,
- port_mod_failed_error_msg,
- port_stats_reply,
- port_stats_request,
- port_status,
- queue_get_config_reply,
- queue_get_config_request,
- queue_op_failed_error_msg,
- queue_stats_reply,
- queue_stats_request,
- set_config,
- switch_config_failed_error_msg,
- table_mod,
- table_mod_failed_error_msg,
- table_stats_reply,
- table_stats_request,
- )
-
diff --git a/src/python/of12/parse.py b/src/python/of12/parse.py
deleted file mode 100644
index 6374a75..0000000
--- a/src/python/of12/parse.py
+++ /dev/null
@@ -1,333 +0,0 @@
-"""
-OpenFlow message parsing functions
-"""
-
-import sys
-import logging
-import message
-from match_list import match_list
-import match
-#from error import *
-#from action import *
-#from action_list import action_list
-import cstruct as ofp
-
-try:
- logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
- from scapy.all import *
- from oftest.mpls import *
-except ImportError:
- sys.exit("Need to install scapy for packet parsing")
-
-"""
-of_message.py
-Contains wrapper functions and classes for the of_message namespace
-that are generated by hand. It includes the rest of the wrapper
-function information into the of_message namespace
-"""
-
-parse_logger = logging.getLogger("parse")
-#parse_logger.setLevel(logging.DEBUG)
-
-# These message types are subclassed
-msg_type_subclassed = [
- ofp.OFPT_STATS_REQUEST,
- ofp.OFPT_STATS_REPLY,
- ofp.OFPT_ERROR
-]
-
-# Maps from sub-types to classes
-stats_reply_to_class_map = {
- ofp.OFPST_DESC : message.desc_stats_reply,
- ofp.OFPST_FLOW : message.flow_stats_reply,
- ofp.OFPST_AGGREGATE : message.aggregate_stats_reply,
- ofp.OFPST_TABLE : message.table_stats_reply,
- ofp.OFPST_PORT : message.port_stats_reply,
- ofp.OFPST_QUEUE : message.queue_stats_reply,
- ofp.OFPST_GROUP : message.group_stats_reply,
- ofp.OFPST_GROUP_DESC : message.group_desc_stats_reply
-# ofp.OFPST_EXPERIMENTER
-}
-
-stats_request_to_class_map = {
- ofp.OFPST_DESC : message.desc_stats_request,
- ofp.OFPST_FLOW : message.flow_stats_request,
- ofp.OFPST_AGGREGATE : message.aggregate_stats_request,
- ofp.OFPST_TABLE : message.table_stats_request,
- ofp.OFPST_PORT : message.port_stats_request,
- ofp.OFPST_QUEUE : message.queue_stats_request,
- ofp.OFPST_GROUP : message.group_stats_request,
- ofp.OFPST_GROUP_DESC : message.group_desc_stats_request
-# ofp.OFPST_EXPERIMENTER
-}
-
-error_to_class_map = {
- ofp.OFPET_HELLO_FAILED : message.hello_failed_error_msg,
- ofp.OFPET_BAD_REQUEST : message.bad_request_error_msg,
- ofp.OFPET_BAD_ACTION : message.bad_action_error_msg,
- ofp.OFPET_BAD_INSTRUCTION : message.bad_instruction_error_msg,
- ofp.OFPET_BAD_MATCH : message.bad_match_error_msg,
- ofp.OFPET_FLOW_MOD_FAILED : message.flow_mod_failed_error_msg,
- ofp.OFPET_GROUP_MOD_FAILED : message.group_mod_failed_error_msg,
- ofp.OFPET_PORT_MOD_FAILED : message.port_mod_failed_error_msg,
- ofp.OFPET_TABLE_MOD_FAILED : message.table_mod_failed_error_msg,
- ofp.OFPET_QUEUE_OP_FAILED : message.queue_op_failed_error_msg,
- ofp.OFPET_SWITCH_CONFIG_FAILED : message.switch_config_failed_error_msg
-}
-
-# Map from header type value to the underlieing message class
-msg_type_to_class_map = {
- ofp.OFPT_HELLO : message.hello,
- ofp.OFPT_ERROR : message.error,
- ofp.OFPT_ECHO_REQUEST : message.echo_request,
- ofp.OFPT_ECHO_REPLY : message.echo_reply,
- ofp.OFPT_EXPERIMENTER : message.experimenter,
- ofp.OFPT_FEATURES_REQUEST : message.features_request,
- ofp.OFPT_FEATURES_REPLY : message.features_reply,
- ofp.OFPT_GET_CONFIG_REQUEST : message.get_config_request,
- ofp.OFPT_GET_CONFIG_REPLY : message.get_config_reply,
- ofp.OFPT_SET_CONFIG : message.set_config,
- ofp.OFPT_PACKET_IN : message.packet_in,
- ofp.OFPT_FLOW_REMOVED : message.flow_removed,
- ofp.OFPT_PORT_STATUS : message.port_status,
- ofp.OFPT_PACKET_OUT : message.packet_out,
- ofp.OFPT_FLOW_MOD : message.flow_mod,
- ofp.OFPT_GROUP_MOD : message.group_mod,
- ofp.OFPT_PORT_MOD : message.port_mod,
- ofp.OFPT_TABLE_MOD : message.table_mod,
- ofp.OFPT_STATS_REQUEST : message.stats_request,
- ofp.OFPT_STATS_REPLY : message.stats_reply,
- ofp.OFPT_BARRIER_REQUEST : message.barrier_request,
- ofp.OFPT_BARRIER_REPLY : message.barrier_reply,
- ofp.OFPT_QUEUE_GET_CONFIG_REQUEST : message.queue_get_config_request,
- ofp.OFPT_QUEUE_GET_CONFIG_REPLY : message.queue_get_config_reply,
-}
-
-def _of_message_to_object(binary_string):
- """
- Map a binary string to the corresponding class.
-
- Appropriately resolves subclasses
- """
- hdr = ofp.ofp_header()
- hdr.unpack(binary_string)
- # FIXME: Add error detection
- if not hdr.type in msg_type_subclassed:
- return msg_type_to_class_map[hdr.type]()
- if hdr.type == ofp.OFPT_STATS_REQUEST:
- sub_hdr = ofp.ofp_stats_request()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- try:
- obj = stats_request_to_class_map[sub_hdr.type]()
- except LookupError:
- obj = None
- return obj
- elif hdr.type == ofp.OFPT_STATS_REPLY:
- sub_hdr = ofp.ofp_stats_reply()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- try:
- obj = stats_reply_to_class_map[sub_hdr.type]()
- except LookupError:
- obj = None
- return obj
- elif hdr.type == ofp.OFPT_ERROR:
- sub_hdr = ofp.ofp_error_msg()
- sub_hdr.unpack(binary_string[ofp.OFP_HEADER_BYTES:])
- return error_to_class_map[sub_hdr.type]()
- else:
- parse_logger.error("Cannot parse pkt to message")
- return None
-
-def of_message_parse(binary_string, raw=False):
- """
- Parse an OpenFlow packet
-
- Parses a raw OpenFlow packet into a Python class, with class
- members fully populated.
-
- @param binary_string The packet (string) to be parsed
- @param raw If true, interpret the packet as an L2 packet. Not
- yet supported.
- @return An object of some message class or None if fails
- Note that any data beyond that parsed is not returned
-
- """
-
- if raw:
- parse_logger.error("raw packet message parsing not supported")
- return None
-
- obj = _of_message_to_object(binary_string)
- if obj:
- obj.unpack(binary_string)
- return obj
-
-
-def of_header_parse(binary_string, raw=False):
- """
- Parse only the header from an OpenFlow packet
-
- Parses the header from a raw OpenFlow packet into a
- an ofp_header Python class.
-
- @param binary_string The packet (string) to be parsed
- @param raw If true, interpret the packet as an L2 packet. Not
- yet supported.
- @return An ofp_header object
-
- """
-
- if raw:
- parse_logger.error("raw packet message parsing not supported")
- return None
-
- hdr = ofp.ofp_header()
- hdr.unpack(binary_string)
-
- return hdr
-
-map_wc_field_to_match_member = {
- 'OFPFW_DL_VLAN' : 'dl_vlan',
- 'OFPFW_DL_SRC' : 'dl_src',
- 'OFPFW_DL_DST' : 'dl_dst',
- 'OFPFW_DL_TYPE' : 'dl_type',
- 'OFPFW_NW_PROTO' : 'nw_proto',
- 'OFPFW_TP_SRC' : 'tp_src',
- 'OFPFW_TP_DST' : 'tp_dst',
- 'OFPFW_NW_SRC_SHIFT' : 'nw_src_shift',
- 'OFPFW_NW_SRC_BITS' : 'nw_src_bits',
- 'OFPFW_NW_SRC_MASK' : 'nw_src_mask',
- 'OFPFW_NW_SRC_ALL' : 'nw_src_all',
- 'OFPFW_NW_DST_SHIFT' : 'nw_dst_shift',
- 'OFPFW_NW_DST_BITS' : 'nw_dst_bits',
- 'OFPFW_NW_DST_MASK' : 'nw_dst_mask',
- 'OFPFW_NW_DST_ALL' : 'nw_dst_all',
- 'OFPFW_DL_VLAN_PCP' : 'dl_vlan_pcp',
- 'OFPFW_NW_TOS' : 'nw_tos'
-}
-
-
-def parse_mac(mac_str):
- """
- Parse a MAC address
-
- Parse a MAC address ':' separated string of hex digits to an
- array of integer values. '00:d0:05:5d:24:00' => [0, 208, 5, 93, 36, 0]
- @param mac_str The string to convert
- @return Array of 6 integer values
- """
- return map(lambda val:eval("0x" + val), mac_str.split(":"))
-
-def parse_ip(ip_str):
- """
- Parse an IP address
-
- Parse an IP address '.' separated string of decimal digits to an
- host ordered integer. '172.24.74.77' =>
- @param ip_str The string to convert
- @return Integer value
- """
- array = map(lambda val:eval(val),ip_str.split("."))
- val = 0
- for a in array:
- val <<= 8
- val += a
- return val
-
-def packet_to_flow_match(packet):
- """
- Create a flow match that matches packet with the given wildcards
-
- @param packet The packet to use as a flow template
- @param pkt_format Currently only L2 is supported. Will indicate the
- overall packet type for parsing
- @return An ofp_match object if successful. None if format is not
- recognized. The wildcards of the match will be cleared for the
- values extracted from the packet.
-
- @todo check min length of packet
- @todo Check if packet is other than L2 format
- @todo implement other fields covered by OpenFlow 1.2
- """
- match_ls = match_list()
-
- if Ether in packet:
- ether = packet[Ether]
- eth_type = match.eth_type(ether.type)
- eth_dst = match.eth_dst(parse_mac(ether.dst))
- eth_src = match.eth_src(parse_mac(ether.src))
- match_ls.add(eth_type)
- match_ls.add(eth_dst)
- match_ls.add(eth_src)
- else:
- return match_ls
-
- if Dot1Q in packet:
- #TODO: nicer way to get last vlan tag?
- vlan = packet[Dot1Q:0]
- vlan_vid = match.vlan_vid(vlan.vlan)
- vlan_pcp = match.vlan_pcp(vlan.prio)
- match_ls.add(vlan_vid)
- match_ls.add(vlan_pcp)
- vlan_pl = vlan.payload
- while vlan_pl is not None and vlan_pl.name == Dot1Q.name:
- vlan = vlan_pl
- vlan_pl = vlan.payload
- #We need to overwrite the already
- # inserted eth_type
- eth_index = match.tlvs.index()
- eth_type = match.eth_type(vlan.type)
- match_ls.tlvs.insert(vlan.type,eth_index)
- #TODO ARP
-
- if MPLS in packet:
- mpls = packet[MPLS:0]
- mpls_label = match.mpls_label(mpls.label)
- mpls_tc = match.mpls_tc(mpls.cos)
- match_ls.add(mpls_label)
- match_ls.add(mpls_tc)
- return match_ls
-
- if IP in packet:
- ip = packet[IP]
- ipv4_src = match.ipv4_src(parse_ip(ip.src))
- ipv4_dst = match.ipv4_dst(parse_ip(ip.dst))
- ip_dscp = match.ip_dscp(ip.tos >> 2)
- ip_ecn = match.ip_ecn(ip.tos & 0x03)
- match_ls.add(ipv4_src)
- match_ls.add(ipv4_dst)
- match_ls.add(ip_dscp)
- match_ls.add(ip_ecn)
- else:
- return match_ls
-
- if TCP in packet:
- tcp = packet[TCP]
- ip_proto = match.ip_proto(6)
- tcp_src = match.tcp_src(tcp.sport)
- tcp_dst = match.tcp_dst(tcp.dport)
- match_ls.add(ip_proto)
- match_ls.add(tcp_src)
- match_ls.add(tcp_dst)
- return match_ls
-
- if UDP in packet:
- udp = packet[UDP]
- ip_proto = match.ip_proto(17)
- udp_src = match.tcp_src(udp.sport)
- udp_dst = match.tcp_dst(udp.dport)
- match_ls.add(ip_proto)
- match_ls.add(udp_src)
- match_ls.add(udp_dst)
- return match_ls
-
- if ICMP in packet:
- icmp = packet[ICMP]
- ip_proto = match.ip_proto(1)
- icmp_type = match.icmp_type(icmp.type)
- icmp_code = match.icmp_code(icmp.code)
- match_ls.add(icmp_type)
- match_ls.add(icmp_code)
- return match_ls
-
- return match_ls