@@ -225,6 +225,28 @@ def enable_generator(self, c_key, gen_name, enable):
225
225
EMUValidator .verify (ver_args )
226
226
return self .emu_c ._send_plugin_cmd_to_client ('ipfix_c_set_gen_state' , c_key = c_key , gen_name = gen_name , enable = enable )
227
227
228
+ @client_api ('command' , True )
229
+ def enable_ipfix (self , c_key , enable ):
230
+ """
231
+ Enable/disable IPFix plugin for a client.
232
+ It enable/disable all generators and the exporter.
233
+
234
+ :parameters:
235
+
236
+ c_key: :class:`trex.emu.trex_emu_profile.EMUClientKey`
237
+ EMUClientKey
238
+
239
+ enable: bool
240
+ True if we wish to enable ipfix for the client, False if we wish to disable it.
241
+
242
+ :returns:
243
+ bool : Flag indicating the result of the operation.
244
+ """
245
+ ver_args = [{'name' : 'c_key' , 'arg' : c_key , 't' : EMUClientKey },
246
+ {'name' : 'enable' , 'arg' : enable , 't' : bool }]
247
+ EMUValidator .verify (ver_args )
248
+ return self .emu_c ._send_plugin_cmd_to_client ('ipfix_c_set_state' , c_key = c_key , enable = enable )
249
+
228
250
# Plugins methods
229
251
@plugin_api ('ipfix_show_counters' , 'emu' )
230
252
def ipfix_show_counters_line (self , line ):
@@ -307,6 +329,32 @@ def _enable_disable_gen_line(self, line, caller_func, enable_disable):
307
329
c_key = EMUClientKey (ns_key , opts .mac )
308
330
return self .enable_generator (c_key , opts .gen_name , enable_disable == 'enable' )
309
331
332
+ @plugin_api ('ipfix_enable' , 'emu' )
333
+ def ipfix_enable_line (self , line ):
334
+ """Enable IPFix plugin for a client.\n """
335
+ res = self ._enable_disable_line (line , self .ipfix_enable_line , "enable" )
336
+ self .logger .post_cmd (res )
337
+
338
+ @plugin_api ('ipfix_disable' , 'emu' )
339
+ def ipfix_disable_line (self , line ):
340
+ """Disable IPFix plugin for a client.\n """
341
+ res = self ._enable_disable_line (line , self .ipfix_enable_line , "disable" )
342
+ self .logger .post_cmd (res )
343
+
344
+ def _enable_disable_line (self , line , caller_func , enable_disable ):
345
+ parser = parsing_opts .gen_parser (self ,
346
+ "ipfix_enable" ,
347
+ caller_func .__doc__ ,
348
+ parsing_opts .EMU_NS_GROUP_NOT_REQ ,
349
+ parsing_opts .MAC_ADDRESS ,
350
+ )
351
+
352
+ opts = parser .parse_args (line .split ())
353
+ self ._validate_port (opts )
354
+ ns_key = EMUNamespaceKey (opts .port , opts .vlan , opts .tpid )
355
+ c_key = EMUClientKey (ns_key , opts .mac )
356
+ return self .enable_ipfix (c_key , enable_disable == 'enable' )
357
+
310
358
@plugin_api ('ipfix_set_data_rate' , 'emu' )
311
359
def ipfix_set_data_rate_line (self , line ):
312
360
"""Set IPFix generator data rate.\n """
0 commit comments