diff options
author | itraviv <itraviv@cisco.com> | 2016-08-10 15:53:30 +0300 |
---|---|---|
committer | itraviv <itraviv@cisco.com> | 2016-08-10 15:53:30 +0300 |
commit | 661d27af339a57319d41655b6bfa71810e4e60ba (patch) | |
tree | 17c89112ffe923b0def3761806284d35b0db9e6e /scripts/automation/trex_control_plane | |
parent | 8183f683a33231cc00b7b6ec6c7144bb5cfff54b (diff) |
move 'main' function to bottom of file
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_server.py | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_server.py b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_server.py index 659a7f6c..b2f2d526 100755 --- a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_server.py +++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_server.py @@ -96,25 +96,6 @@ class Scapy_wrapper: finally:
return response
-#arg1 is port number for the server to listen to
-def main(arg1=4507):
- s = Scapy_server(arg1)
- s.activate()
-
-if __name__=='__main__':
- if len(sys.argv)>1:
- parser = ArgumentParser(description=' Runs Scapy Server ')
- parser.add_argument('-s','--scapy-port',type=int, default = 4507, dest='scapy_port',
- help='Select port to which Scapy Server will listen to.\n default is 4507\n',action='store')
- args = parser.parse_args()
- port = args.scapy_port
- sys.exit(main(port))
- else:
- sys.exit(main())
-
-
-
-
class Scapy_server():
def __init__(self, port=4507):
self.scapy_wrapper = Scapy_wrapper()
@@ -157,4 +138,18 @@ class Scapy_server(): +#arg1 is port number for the server to listen to
+def main(arg1=4507):
+ s = Scapy_server(arg1)
+ s.activate()
+if __name__=='__main__':
+ if len(sys.argv)>1:
+ parser = ArgumentParser(description=' Runs Scapy Server ')
+ parser.add_argument('-s','--scapy-port',type=int, default = 4507, dest='scapy_port',
+ help='Select port to which Scapy Server will listen to.\n default is 4507\n',action='store')
+ args = parser.parse_args()
+ port = args.scapy_port
+ sys.exit(main(port))
+ else:
+ sys.exit(main())
|