diff options
author | Ting Xu <ting.xu@intel.com> | 2023-03-16 01:22:33 +0000 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2023-05-15 20:20:12 +0000 |
commit | f34420ff1169746c07946940ed165416a5908f06 (patch) | |
tree | ce4c5f8b9cc7db95d7915955326d4524db21902b /extras/packetforge/packetforge.py | |
parent | 9794326125264dc6543325ee10f58c3862c70095 (diff) |
packetforge: add option to show spec and mask only
In some cases with Generic FLow, it is only required to show the pattern
of spec and mask, but no need to add the flow. Therefore, add an option
in packetforge so that users can show spec and mask only.
Type: improvement
Signed-off-by: Ting Xu <ting.xu@intel.com>
Change-Id: I7b3040689eb82d0b58924712ee6fc9cfa0a42fa1
Diffstat (limited to 'extras/packetforge/packetforge.py')
-rw-r--r-- | extras/packetforge/packetforge.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/extras/packetforge/packetforge.py b/extras/packetforge/packetforge.py index 4f149dcd046..42bfeb01e00 100644 --- a/extras/packetforge/packetforge.py +++ b/extras/packetforge/packetforge.py @@ -21,7 +21,7 @@ import os parsegraph_path = os.getcwd() + "/parsegraph" -def Forge(pattern, actions, file_flag): +def Forge(pattern, actions, file_flag, show_result_only): pg = ParseGraph.Create(parsegraph_path) if pg == None: print("error: create parsegraph failed") @@ -54,7 +54,6 @@ def Forge(pattern, actions, file_flag): # create generic flow my_flow = { - "type": VppEnum.vl_api_flow_type_v2_t.FLOW_TYPE_GENERIC_V2, "flow": { "generic": { "pattern": {"spec": bytes(spec.encode()), "mask": bytes(mask.encode())} @@ -62,6 +61,15 @@ def Forge(pattern, actions, file_flag): }, } + if show_result_only: + return my_flow + + my_flow.update( + { + "type": VppEnum.vl_api_flow_type_v2_t.FLOW_TYPE_GENERIC_V2, + } + ) + # update actions entry my_flow = GetAction(actions, my_flow) |