diff options
author | Ting Xu <ting.xu@intel.com> | 2022-04-24 06:14:25 +0000 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2022-09-20 20:44:42 +0000 |
commit | ce4b6451787389c5b0ebfac413c350ef3a424b8b (patch) | |
tree | aa777368e14fca9b6613f747817331336ca2b11b /extras/packetforge/parsegraph/edges | |
parent | f5e0a17c9cca09822296a0ed3196fde36c1ca5f8 (diff) |
packetforge: add packetforge for generic flow to extras
Add a new tool packetforge to extras. This tool is to support generic flow.
Packetforge is a library to translate naming or json profile format flow
pattern to the required input of generic flow, i.e. spec and mask. Using
python script flow_create.py, it can add and enable a new flow rule for
an interface via flow VAPI, and can delete an existed flow rule as well.
Command examples are shown below. Json profile examples can be found in
./parsegraph/samples.
Naming format input:
python flow_create.py --add -p "mac()/ipv4(src=1.1.1.1,dst=2.2.2.2)/udp()"
-a "redirect-to-queue 3" -i 1
python flow_create.py --del -i 1 -I 0
Json profile format input:
python flow_create.py -f "./flow_rule_examples/mac_ipv4.json" -i 1
With this command, flow rule can be added or deleted, and the flow
entry can be listed with "show flow entry" command in VPP CLI.
Packetforge is based on a parsegraph. The parsegraph can be built by
users. A Spec can be found in ./parsegraph as guidance. More details
about packetforge are in README file.
Type: feature
Signed-off-by: Ting Xu <ting.xu@intel.com>
Change-Id: Ia9f539741c5dca27ff236f2bcc493c5dd48c0df1
Diffstat (limited to 'extras/packetforge/parsegraph/edges')
42 files changed, 450 insertions, 0 deletions
diff --git a/extras/packetforge/parsegraph/edges/ah_after_ipv4.json b/extras/packetforge/parsegraph/edges/ah_after_ipv4.json new file mode 100644 index 00000000000..7f123916114 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ah_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "ah", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "51" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ah_after_ipv6.json b/extras/packetforge/parsegraph/edges/ah_after_ipv6.json new file mode 100644 index 00000000000..64620fa276b --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ah_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "ah", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "51" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/arpv4_after_macvlan.json b/extras/packetforge/parsegraph/edges/arpv4_after_macvlan.json new file mode 100644 index 00000000000..28c042b9c93 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/arpv4_after_macvlan.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "mac,vlan", + "end" : "arpv4", + "actions" : [ + { + "dst" : "start.ethertype", + "src" : "0x0806" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/esp_after_ipv4.json b/extras/packetforge/parsegraph/edges/esp_after_ipv4.json new file mode 100644 index 00000000000..c573ee3aa28 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/esp_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "esp", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "50" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/esp_after_ipv6.json b/extras/packetforge/parsegraph/edges/esp_after_ipv6.json new file mode 100644 index 00000000000..e3d8bf660d3 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/esp_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "esp", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "50" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/gre_after_ipv4.json b/extras/packetforge/parsegraph/edges/gre_after_ipv4.json new file mode 100644 index 00000000000..5ae8eb27681 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/gre_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "gre,nvgre", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "47" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/gre_after_ipv6.json b/extras/packetforge/parsegraph/edges/gre_after_ipv6.json new file mode 100644 index 00000000000..a5a53139de3 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/gre_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "gre,nvgre", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "47" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/gtpc_after_udp.json b/extras/packetforge/parsegraph/edges/gtpc_after_udp.json new file mode 100644 index 00000000000..237704c87cc --- /dev/null +++ b/extras/packetforge/parsegraph/edges/gtpc_after_udp.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "udp", + "end" : "gtpc", + "actions" : [ + { + "dst" : "start.dst", + "src" : "2123" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/gtppsc_after_gtpu.json b/extras/packetforge/parsegraph/edges/gtppsc_after_gtpu.json new file mode 100644 index 00000000000..ec985bb888f --- /dev/null +++ b/extras/packetforge/parsegraph/edges/gtppsc_after_gtpu.json @@ -0,0 +1,19 @@ +{ + "type" : "edge", + "start" : "gtpu", + "end" : "gtppsc", + "actions" : [ + { + "dst" : "start.e", + "src" : "1" + }, + { + "dst" : "start.nextextentionheadertype", + "src" : "0x85" + }, + { + "dst" : "start.messagetype", + "src" : "0xff" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/gtpu_after_udp.json b/extras/packetforge/parsegraph/edges/gtpu_after_udp.json new file mode 100644 index 00000000000..e2591fad5ac --- /dev/null +++ b/extras/packetforge/parsegraph/edges/gtpu_after_udp.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "udp", + "end" : "gtpu", + "actions" : [ + { + "dst" : "start.dst", + "src" : "2152" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/icmp_after_ipv4.json b/extras/packetforge/parsegraph/edges/icmp_after_ipv4.json new file mode 100644 index 00000000000..e701cc8c28c --- /dev/null +++ b/extras/packetforge/parsegraph/edges/icmp_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "icmp", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "1" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/icmpv6_after_ipv6.json b/extras/packetforge/parsegraph/edges/icmpv6_after_ipv6.json new file mode 100644 index 00000000000..a83181450ad --- /dev/null +++ b/extras/packetforge/parsegraph/edges/icmpv6_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "icmpv6", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "58" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ip_after_gtppsc.json b/extras/packetforge/parsegraph/edges/ip_after_gtppsc.json new file mode 100644 index 00000000000..13e11a3c67a --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ip_after_gtppsc.json @@ -0,0 +1,5 @@ +{ + "type" : "edge", + "start" : "gtppsc", + "end" : "ipv4" +} diff --git a/extras/packetforge/parsegraph/edges/ip_after_gtpu.json b/extras/packetforge/parsegraph/edges/ip_after_gtpu.json new file mode 100644 index 00000000000..03d89ffc4b9 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ip_after_gtpu.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "gtpu", + "end" : "ipv4,ipv6", + "actions" : [ + { + "dst" : "start.messagetype", + "src" : "0xff" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_geneve.json b/extras/packetforge/parsegraph/edges/ipv4_after_geneve.json new file mode 100644 index 00000000000..40c733b9688 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_geneve.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "geneve", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.protocoltype", + "src" : "0x0800" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_gre.json b/extras/packetforge/parsegraph/edges/ipv4_after_gre.json new file mode 100644 index 00000000000..87cd14beecd --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_gre.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "gre", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.protocoltype", + "src" : "0x0800" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_ipv4.json b/extras/packetforge/parsegraph/edges/ipv4_after_ipv4.json new file mode 100644 index 00000000000..0590f6738b3 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "4" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_ipv6.json b/extras/packetforge/parsegraph/edges/ipv4_after_ipv6.json new file mode 100644 index 00000000000..e804139cfe5 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "4" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_macvlan.json b/extras/packetforge/parsegraph/edges/ipv4_after_macvlan.json new file mode 100644 index 00000000000..3722126f6f4 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_macvlan.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "mac,vlan", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.ethertype", + "src" : "0x0800" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv4_after_vxlangpe.json b/extras/packetforge/parsegraph/edges/ipv4_after_vxlangpe.json new file mode 100644 index 00000000000..ab7c16707fb --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv4_after_vxlangpe.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "vxlangpe", + "end" : "ipv4", + "actions" : [ + { + "dst" : "start.nextprotocol", + "src" : "1" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_geneve.json b/extras/packetforge/parsegraph/edges/ipv6_after_geneve.json new file mode 100644 index 00000000000..6ad81a4550a --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_geneve.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "geneve", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.protocoltype", + "src" : "0x86dd" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_gre.json b/extras/packetforge/parsegraph/edges/ipv6_after_gre.json new file mode 100644 index 00000000000..90c40ec3974 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_gre.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "gre", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.protocoltype", + "src" : "0x86dd" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_ipv4.json b/extras/packetforge/parsegraph/edges/ipv6_after_ipv4.json new file mode 100644 index 00000000000..cc57b44cf25 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "41" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_ipv6.json b/extras/packetforge/parsegraph/edges/ipv6_after_ipv6.json new file mode 100644 index 00000000000..79184bb55dd --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "41" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_macvlan.json b/extras/packetforge/parsegraph/edges/ipv6_after_macvlan.json new file mode 100644 index 00000000000..6da21082024 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_macvlan.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "mac,vlan", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.ethertype", + "src" : "0x86dd" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6_after_vxlangpe.json b/extras/packetforge/parsegraph/edges/ipv6_after_vxlangpe.json new file mode 100644 index 00000000000..ebd294cf378 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6_after_vxlangpe.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "vxlangpe", + "end" : "ipv6", + "actions" : [ + { + "dst" : "start.nextprotocol", + "src" : "2" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/ipv6srh_after_ipv6.json b/extras/packetforge/parsegraph/edges/ipv6srh_after_ipv6.json new file mode 100644 index 00000000000..9ddea00e926 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/ipv6srh_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "ipv6srh", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "43" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/l2tpv2_after_udp.json b/extras/packetforge/parsegraph/edges/l2tpv2_after_udp.json new file mode 100644 index 00000000000..c34927ac47f --- /dev/null +++ b/extras/packetforge/parsegraph/edges/l2tpv2_after_udp.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "udp", + "end" : "l2tpv2ctl,l2tpv2data", + "actions" : [ + { + "dst" : "start.dst", + "src" : "1701" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/mac_after_geneve.json b/extras/packetforge/parsegraph/edges/mac_after_geneve.json new file mode 100644 index 00000000000..3eba08ee802 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/mac_after_geneve.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "geneve", + "end" : "mac", + "actions" : [ + { + "dst" : "start.protocoltype", + "src" : "0x6558" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/mac_after_gre.json b/extras/packetforge/parsegraph/edges/mac_after_gre.json new file mode 100644 index 00000000000..cb5fd4078e5 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/mac_after_gre.json @@ -0,0 +1,5 @@ +{ + "type" : "edge", + "start" : "gre", + "end" : "mac" +} diff --git a/extras/packetforge/parsegraph/edges/mac_after_nvgre.json b/extras/packetforge/parsegraph/edges/mac_after_nvgre.json new file mode 100644 index 00000000000..1c9f98373bf --- /dev/null +++ b/extras/packetforge/parsegraph/edges/mac_after_nvgre.json @@ -0,0 +1,5 @@ +{ + "type" : "edge", + "start" : "nvgre", + "end" : "mac" +} diff --git a/extras/packetforge/parsegraph/edges/mac_after_vxlan.json b/extras/packetforge/parsegraph/edges/mac_after_vxlan.json new file mode 100644 index 00000000000..c1c1fa25540 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/mac_after_vxlan.json @@ -0,0 +1,5 @@ +{ + "type" : "edge", + "start" : "vxlan", + "end" : "mac" +} diff --git a/extras/packetforge/parsegraph/edges/mac_after_vxlangpe.json b/extras/packetforge/parsegraph/edges/mac_after_vxlangpe.json new file mode 100644 index 00000000000..b5012bf71fb --- /dev/null +++ b/extras/packetforge/parsegraph/edges/mac_after_vxlangpe.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "vxlangpe", + "end" : "mac", + "actions" : [ + { + "dst" : "start.nextprotocol", + "src" : "3" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/pfcp_after_udp.json b/extras/packetforge/parsegraph/edges/pfcp_after_udp.json new file mode 100644 index 00000000000..fec4aaa739e --- /dev/null +++ b/extras/packetforge/parsegraph/edges/pfcp_after_udp.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "udp", + "end" : "pfcp", + "actions" : [ + { + "dst" : "start.dst", + "src" : "8805" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/sctp_after_ipv4.json b/extras/packetforge/parsegraph/edges/sctp_after_ipv4.json new file mode 100644 index 00000000000..e58c36efc7a --- /dev/null +++ b/extras/packetforge/parsegraph/edges/sctp_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "sctp", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "132" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/sctp_after_ipv6.json b/extras/packetforge/parsegraph/edges/sctp_after_ipv6.json new file mode 100644 index 00000000000..7fa306811eb --- /dev/null +++ b/extras/packetforge/parsegraph/edges/sctp_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6", + "end" : "sctp", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "132" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/tcp_after_ipv4.json b/extras/packetforge/parsegraph/edges/tcp_after_ipv4.json new file mode 100644 index 00000000000..13c74f85edc --- /dev/null +++ b/extras/packetforge/parsegraph/edges/tcp_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "tcp", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "6" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/tcp_after_ipv6.json b/extras/packetforge/parsegraph/edges/tcp_after_ipv6.json new file mode 100644 index 00000000000..f0d0b415e22 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/tcp_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "tcp", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "6" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/tunnel_after_udp.json b/extras/packetforge/parsegraph/edges/tunnel_after_udp.json new file mode 100644 index 00000000000..fa498d4378e --- /dev/null +++ b/extras/packetforge/parsegraph/edges/tunnel_after_udp.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "udp", + "end" : "geneve,vxlan,vxlangpe", + "actions" : [ + { + "dst" : "start.dst", + "src" : "end.udpport" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/udp_after_ipv4.json b/extras/packetforge/parsegraph/edges/udp_after_ipv4.json new file mode 100644 index 00000000000..cb2f533bd39 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/udp_after_ipv4.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv4", + "end" : "udp", + "actions" : [ + { + "dst" : "start.protocol", + "src" : "17" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/udp_after_ipv6.json b/extras/packetforge/parsegraph/edges/udp_after_ipv6.json new file mode 100644 index 00000000000..fbbe972e4e5 --- /dev/null +++ b/extras/packetforge/parsegraph/edges/udp_after_ipv6.json @@ -0,0 +1,11 @@ +{ + "type" : "edge", + "start" : "ipv6,ipv6srh,ipv6crh16,ipv6crh32", + "end" : "udp", + "actions" : [ + { + "dst" : "start.nextheader", + "src" : "17" + } + ] +} diff --git a/extras/packetforge/parsegraph/edges/vlan_after_macvlan.json b/extras/packetforge/parsegraph/edges/vlan_after_macvlan.json new file mode 100644 index 00000000000..5c0b81ebacf --- /dev/null +++ b/extras/packetforge/parsegraph/edges/vlan_after_macvlan.json @@ -0,0 +1,15 @@ +{ + "type" : "edge", + "start" : "mac,vlan", + "end" : "vlan", + "actions" : [ + { + "dst" : "start.ethertype", + "src" : "end.tpid" + }, + { + "dst" : "end.ethertype", + "src" : "start.ethertype" + } + ] +} |