Protocols can mow be accesed as packet[n].
Signed-off-by: Shaun Crampton <[email protected]>
---
ryu/lib/packet/packet.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index 84e5bf8..2ef08c1 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -95,3 +95,15 @@ class Packet(object):
def __iter__(self):
return self
+
+ def __getitem__(self, idx):
+ return self.protocols[idx]
+
+ def __setitem__(self, idx, item):
+ self.protocols[idx] = item
+
+ def __delitem__(self, idx):
+ del self.protocols[idx]
+
+ def __len__(self):
+ return len(self.protocols)
--
1.7.9.5
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel