summaryrefslogtreecommitdiffstats
path: root/extras/packetforge/packetforge.py
diff options
context:
space:
mode:
Diffstat (limited to 'extras/packetforge/packetforge.py')
-rw-r--r--extras/packetforge/packetforge.py12
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)