aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/tracenode/test.c
diff options
context:
space:
mode:
authorPim van Pelt <pim@ipng.nl>2024-01-15 11:06:19 +0100
committerDamjan Marion <dmarion@0xa5.net>2024-01-16 17:39:17 +0000
commit4a515d35a8702fafb1119e3dc4f969160b0e4372 (patch)
tree078f3e76448bb9f9eacadc6e5548f511b13768d4 /src/plugins/tracenode/test.c
parent276cd73b754f861948a2bd8f242a09b4d9fae0dd (diff)
build: Provide clang-14 for Debian12
checkstyle.sh assumes clang-format-11 but allows it to be overridden. Debian12 ships with a minimal version of clang-14, so set the correct version for checkstyle. Before: $ make checkstyle extras/scripts/checkstyle.sh: line 41: --version: command not found make: *** [Makefile:720: checkstyle] Error 127 After: $ make checkstyle Debian clang-format version 14.0.6 ******************************************************************* * CHECKSTYLE SUCCESSFULLY COMPLETED ******************************************************************* Type: make Fixes: 712fc0308981c61444e593d6bcc2ad62102c726d Change-Id: I0c58456477011397115810dab825865b5850d10d Signed-off-by: pim@ipng.nl
Diffstat (limited to 'src/plugins/tracenode/test.c')
0 files changed, 0 insertions, 0 deletions
d { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/router/bin/python

import trex_client
from jsonrpclib import ProtocolError, AppError

class CTRexAdvClient(trex_client.CTRexClient):
    def __init__ (self, trex_host, max_history_size = 100, trex_daemon_port = 8090, trex_zmq_port = 4500, verbose = False):
        super(CTRexAdvClient, self).__init__(trex_host, max_history_size, trex_daemon_port, trex_zmq_port, verbose)
        pass

    # TRex KIWI advanced methods
    def start_quick_trex(self, pcap_file, d, delay, dual, ipv6, times, interfaces):
        try:
            return self.server.start_quick_trex(pcap_file = pcap_file, duration = d, dual = dual, delay = delay, ipv6 = ipv6, times = times, interfaces = interfaces)
        except AppError as err:
            self.__handle_AppError_exception(err.args[0])
        except ProtocolError:
            raise
        finally:
            self.prompt_verbose_data()

    def stop_quick_trex(self):
        try:
            return self.server.stop_quick_trex()
        except AppError as err:
            self.__handle_AppError_exception(err.args[0])
        except ProtocolError:
            raise
        finally:
            self.prompt_verbose_data()

#   def is_running(self):
#       pass

    def get_running_stats(self):
        try:
            return self.server.get_running_stats()
        except AppError as err:
            self.__handle_AppError_exception(err.args[0])
        except ProtocolError:
            raise
        finally:
            self.prompt_verbose_data()

    def clear_counters(self):
        try:
            return self.server.clear_counters()
        except AppError as err:
            self.__handle_AppError_exception(err.args[0])
        except ProtocolError:
            raise
        finally:
            self.prompt_verbose_data()


if __name__ == "__main__":
    trex = CTRexAdvClient('trex-dan', trex_daemon_port = 8383, verbose = True)
    print trex.start_quick_trex(delay = 10, 
        dual = True, 
        d = 20,
        interfaces = ["gig0/0/1", "gig0/0/2"], 
        ipv6 = False, 
        pcap_file="avl/http_browsing.pcap", 
        times=3)
    print trex.stop_quick_trex()
    print trex.get_running_stats()
    print trex.clear_counters()
    pass