MCPcopy Create free account
hub / github.com/FDio/vpp / Main

Function Main

extras/packetforge/flow_create.py:56–130  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

54
55
56def Main(argv):
57 file_flag = False
58 operation = None
59 actions = ""
60 iface = ""
61 try:
62 opts, args = getopt.getopt(
63 argv,
64 "hf:p:a:i:I:",
65 [
66 "help",
67 "add",
68 "del",
69 "show",
70 "file=",
71 "pattern=",
72 "actions=",
73 "interface=",
74 "flow-index=",
75 ],
76 )
77 except getopt.GetoptError:
78 print(
79 "flow_create.py --add|del|show -f <file> -p <pattern> -a <actions> -i <interface> -I <flow-index>"
80 )
81 sys.exit()
82 for opt, arg in opts:
83 if opt == "-h":
84 print(
85 "flow_create.py --add|del|show -f <file> -p <pattern> -a <actions> -i <interface> -I <flow-index>"
86 )
87 sys.exit()
88 elif opt == "--add":
89 operation = "add"
90 elif opt == "--del":
91 operation = "del"
92 elif opt == "--show":
93 operation = "show"
94 elif opt in ("-f", "--file"):
95 json_file = arg
96 file_flag = True
97 elif opt in ("-p", "--pattern") and not file_flag:
98 pattern = arg
99 elif opt in ("-a", "--actions"):
100 actions = arg
101 elif opt in ("-i", "--interface"):
102 iface = arg
103 elif opt in ("-I", "--flow-index"):
104 flow_index = arg
105
106 if operation == None:
107 print("Error: Please choose the operation: add or del")
108 sys.exit()
109
110 if operation == "show":
111 if not file_flag:
112 result = packetforge.Forge(pattern, actions, False, True)
113 else:

Callers 1

flow_create.pyFile · 0.70

Calls 4

printFunction · 0.85
load_json_api_filesFunction · 0.85
ForgeMethod · 0.80
connect_vppFunction · 0.70

Tested by

no test coverage detected