diff options
author | Fangyin Hu <fangyinx.hu@intel.com> | 2017-10-25 21:47:04 -0700 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2017-10-26 06:02:23 +0000 |
commit | b7b364ce32f88d983875b86fa9c886c7c5471c0c (patch) | |
tree | 2d126e2797f6dd38f5309380f8be36daeff68ad4 | |
parent | 0b2c59be595a3749923566ee45a79939557c7de1 (diff) |
Update the NSH protocol header fields
Fix the NSH SFC functional test cases failed issues.
Change-Id: I5d49b50a8c0958dc8db4bc10d6852f0cf4e77962
Signed-off-by: Fangyin Hu <fangyinx.hu@intel.com>
(cherry picked from commit eb9eec208b6e66bf585546ffe5a9554a48fe1208)
-rw-r--r-- | resources/libraries/python/SFC/SFCConstants.py | 1 | ||||
-rw-r--r-- | resources/libraries/python/SFC/TunnelProtocol.py | 6 | ||||
-rw-r--r-- | resources/libraries/python/SFC/VerifyPacket.py | 11 |
3 files changed, 12 insertions, 6 deletions
diff --git a/resources/libraries/python/SFC/SFCConstants.py b/resources/libraries/python/SFC/SFCConstants.py index 33391a1771..b9eef22788 100644 --- a/resources/libraries/python/SFC/SFCConstants.py +++ b/resources/libraries/python/SFC/SFCConstants.py @@ -31,7 +31,6 @@ class SFCConstants(object): VxLANGPE_FLAGS = 0xc VxLANGPE_NEXT_PROTOCOL = 0x4 VxLANGPE_DEFAULT_VNI = 9 - NSH_FLAGS = 0x0 NSH_HEADER_LENGTH = 0x6 NSH_DEFAULT_MDTYPE = 0x1 NSH_NEXT_PROTOCOL = 0x3 diff --git a/resources/libraries/python/SFC/TunnelProtocol.py b/resources/libraries/python/SFC/TunnelProtocol.py index 4b4377c895..3248cf9103 100644 --- a/resources/libraries/python/SFC/TunnelProtocol.py +++ b/resources/libraries/python/SFC/TunnelProtocol.py @@ -35,7 +35,9 @@ class VxLANGPE(Packet): class NSH(Packet): """Define the NSH protocol for the packet analysis.""" name = "nsh" - fields_desc = [XBitField("flags", 0x0, 10), XBitField("length", 0x6, 6), - XByteField("MDtype", 0x1), XByteField("nextproto", 0x3), + fields_desc = [XBitField("Version", 0x0, 2), XBitField("OAM", 0x0, 1), + XBitField("Unassigned", 0x0, 1), XBitField("TTL", 0x0, 6), + XBitField("length", 0x6, 6), XBitField("Unassigned", 0x0, 4), + XBitField("MDtype", 0x1, 4), XByteField("nextproto", 0x3), IntField("nsp_nsi", 0), IntField("c1", 0), IntField("c2", 0), IntField("c3", 0), IntField("c4", 0)] diff --git a/resources/libraries/python/SFC/VerifyPacket.py b/resources/libraries/python/SFC/VerifyPacket.py index 189301002c..84eb6aa0a2 100644 --- a/resources/libraries/python/SFC/VerifyPacket.py +++ b/resources/libraries/python/SFC/VerifyPacket.py @@ -106,9 +106,14 @@ class VerifyPacket(object): # get the NSH packet and check it nsh_pkt = NSH(payload_data[8:32]) - if nsh_pkt.flags != sfccon.NSH_FLAGS: - raise RuntimeError("Unexpected NSH flags: {0}". - format(nsh_pkt.flags)) + if nsh_pkt.Version != 0: + raise RuntimeError("Unexpected NSH version: {0}". + format(nsh_pkt.Version)) + + print type(nsh_pkt.OAM) + if nsh_pkt.OAM != 0 or nsh_pkt.OAM != 1: + raise RuntimeError("Unexpected NSH OAM: {0}". + format(nsh_pkt.OAM)) if nsh_pkt.length != sfccon.NSH_HEADER_LENGTH: raise RuntimeError("NSH length {0} incorrect". |