diff options
author | Fangyin Hu <fangyinx.hu@intel.com> | 2017-04-11 00:31:33 -0700 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2017-06-09 06:59:11 +0000 |
commit | 5ce772f3b2d83c31eda5c2abdcd6cc4547ecc6c8 (patch) | |
tree | 746b1f0ad5be956e3627fd8af85a69ff31e47b34 /resources/libraries/python/SFC/TunnelProtocol.py | |
parent | 1e59ee6e39f0604be721ac8ebdb36be14b738bd8 (diff) |
Add the NSH SFC functional test cases.
1. Proxy Inbound test with 152/256/512/1024/1280/1518 Bytes VxLAN-GPE + NSH packet
2. Proxy Outbound test with 128/256/512/1024/1280/1518 Bytes VxLAN packet
3. SFC SFF test with 152/256/512/1024/1280/1518 Bytes VxLAN-GPE + NSH packet
Separate the functional test bootstrap file to another code review.
Change-Id: I05cf6ab1d01c1b41c1c61044d6d31fd6219b86af
Signed-off-by: Fangyin Hu <fangyinx.hu@intel.com>
Diffstat (limited to 'resources/libraries/python/SFC/TunnelProtocol.py')
-rw-r--r-- | resources/libraries/python/SFC/TunnelProtocol.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/libraries/python/SFC/TunnelProtocol.py b/resources/libraries/python/SFC/TunnelProtocol.py new file mode 100644 index 0000000000..4b4377c895 --- /dev/null +++ b/resources/libraries/python/SFC/TunnelProtocol.py @@ -0,0 +1,41 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This module implements the VxLAN/VXLAN-GPE/NSH protocol +for the packet analyse. +""" +from scapy.all import Packet +from scapy.all import XByteField, ShortField +from scapy.all import BitField, XBitField, IntField + +class VxLAN(Packet): + """Define the vxlan protocol for the packet analysis.""" + name = "vxlan" + fields_desc = [XByteField("flags", 0x08), BitField("reserved", 0, 24), + BitField("vni", 0, 24), XByteField("reserved", 0x00)] + +class VxLANGPE(Packet): + """Define the vxlan-gpe protocol for the packet analysis.""" + name = "vxlan-gpe" + fields_desc = [XByteField("flags", 0x0c), ShortField("reserved", 0), + XByteField("nextproto", 0x3), BitField("vni", 0, 24), + XByteField("reserved", 0x0)] + +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), + IntField("nsp_nsi", 0), IntField("c1", 0), + IntField("c2", 0), IntField("c3", 0), IntField("c4", 0)] |