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

Function Main

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

Source from the content-addressed store, hash-verified

16
17
18def Main(argv):
19 file_flag = False
20 operation = None
21 try:
22 opts, args = getopt.getopt(
23 argv,
24 "hf:p:a:i:I:",
25 [
26 "help",
27 "show",
28 "file=",
29 "pattern=",
30 ],
31 )
32 except getopt.GetoptError:
33 print("flow_parse.py --show -f <file> -p <pattern>")
34 sys.exit()
35 for opt, arg in opts:
36 if opt == "-h":
37 print("flow_parse.py --show -f <file> -p <pattern>")
38 sys.exit()
39 elif opt == "--show":
40 operation = "show"
41 elif opt in ("-f", "--file"):
42 json_file = arg
43 file_flag = True
44 elif opt in ("-p", "--pattern") and not file_flag:
45 pattern = arg
46
47 if operation == None:
48 print("Error: Please choose the operation: show")
49 sys.exit()
50
51 if not file_flag:
52 result = packetforge.Forge(pattern, None, False, True)
53 else:
54 result = packetforge.Forge(json_file, None, True, True)
55
56 return result
57
58
59if __name__ == "__main__":

Callers 1

flow_parse.pyFile · 0.70

Calls 2

printFunction · 0.85
ForgeMethod · 0.80

Tested by

no test coverage detected