diff options
author | 2016-03-16 18:32:45 +0200 | |
---|---|---|
committer | 2016-03-16 19:17:55 +0200 | |
commit | aa334e0ef9258ffc70f0741627861b832d79a69b (patch) | |
tree | 2ea277e05acd3c45fafa308fcdfe695bdcfc32e5 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py | |
parent | 9518c16c5f10bef7a87b2237b635ea47ef5c183a (diff) |
tunables show on the console
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py index 3d12f32c..de07e9e4 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py @@ -1977,7 +1977,13 @@ class STLClient(object): # pack the profile try: for port, t in zip(opts.ports, tunables): - profile = STLProfile.load(opts.file[0], direction = (port % 2), port = port, **t) + + # give priority to the user configuration over default direction + if not 'direction' in t: + t['direction'] = (port % 2) + + profile = STLProfile.load(opts.file[0], **t) + self.add_streams(profile.get_streams(), ports = port) except STLError as e: @@ -2270,3 +2276,42 @@ class STLClient(object): return + + @__console + def show_profile_line (self, line): + '''Shows profile information''' + + parser = parsing_opts.gen_parser(self, + "port", + self.show_profile_line.__doc__, + parsing_opts.FILE_PATH) + + opts = parser.parse_args(line.split()) + if opts is None: + return + + info = STLProfile.get_info(opts.file[0]) + + self.logger.log(format_text('\nProfile Information:\n', 'bold')) + + # general info + self.logger.log(format_text('\nGeneral Information:', 'underline')) + self.logger.log('Filename: {:^12}'.format(opts.file[0])) + self.logger.log('Stream count: {:^12}'.format(info['stream_count'])) + + # specific info + profile_type = info['type'] + self.logger.log(format_text('\nSpecific Information:', 'underline')) + + if profile_type == 'python': + self.logger.log('Type: {:^12}'.format('Python Module')) + self.logger.log('Tunables: {:^12}'.format(['{0} = {1}'.format(k ,v) for k, v in info['tunables'].iteritems()])) + + elif profile_type == 'yaml': + self.logger.log('Type: {:^12}'.format('YAML')) + + elif profile_type == 'pcap': + self.logger.log('Type: {:^12}'.format('PCAP file')) + + self.logger.log("") + |