of12: support actions keyword argument in packet_out message
diff --git a/src/python/of12/action_list.py b/src/python/of12/action_list.py
index f3c0723..78341e2 100644
--- a/src/python/of12/action_list.py
+++ b/src/python/of12/action_list.py
@@ -41,9 +41,11 @@
"""
- def __init__(self):
+ 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
diff --git a/src/python/of12/message.py b/src/python/of12/message.py
index 45d458e..b8fb9b8 100644
--- a/src/python/of12/message.py
+++ b/src/python/of12/message.py
@@ -1872,13 +1872,14 @@
ofp_packet_out.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_PACKET_OUT
- self.actions = action_list()
+ 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):