+/*
+ * enable or disable the output_feature
+ */
+static clib_error_t *
+nsim_output_feature_enable_disable_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ nsim_main_t *nsm = &nsim_main;
+ unformat_input_t _line_input, *line_input = &_line_input;
+ u32 sw_if_index = ~0;
+ int enable_disable = 1;
+ int rv;
+
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "disable"))
+ enable_disable = 0;
+ else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
+ nsm->vnet_main, &sw_if_index))
+ ;
+ else
+ {
+ clib_error_t *error = clib_error_return (0, "unknown input `%U'",
+ format_unformat_error,
+ line_input);
+ unformat_free (line_input);
+ return error;
+ }
+ }
+
+ unformat_free (line_input);
+
+ if (sw_if_index == ~0)
+ return clib_error_return (0, "Please specify one interface...");
+
+ rv = nsim_output_feature_enable_disable (nsm, sw_if_index, enable_disable);
+
+ switch (rv)
+ {
+ case 0:
+ break;
+
+ case VNET_API_ERROR_CANNOT_ENABLE_DISABLE_FEATURE:
+ return clib_error_return (0, "Not configured, please 'set nsim' first");
+
+ case VNET_API_ERROR_INVALID_SW_IF_INDEX:
+ return clib_error_return
+ (0, "Invalid interface, only works on physical ports");
+ break;
+
+ case VNET_API_ERROR_UNIMPLEMENTED:
+ return clib_error_return (0,
+ "Device driver doesn't support redirection");
+ break;
+
+ default:
+ return clib_error_return
+ (0, "nsim_output_feature_enable_disable returned %d", rv);
+ }
+ return 0;
+}
+
+/*?
+ * Enable or disable network simulation output feature on an interface
+ * The network simulator must have already been configured, see
+ * the "nsim_configure" command.
+ *
+ * @cliexpar
+ * To enable or disable network simulation output feature
+ * @clistart
+ * nsim output-feature enable-disable TenGigabitEthernet2/0/0
+ * nsim output-feature enable-disable TenGigabitEthernet2/0/0 disable
+ * @cliend
+ * @cliexcmd{nsim output-feature enable-disable <intfc> [disable]}
+?*/
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (nsim_output_feature_enable_disable_command, static) =
+{
+ .path = "nsim output-feature enable-disable",
+ .short_help =
+ "nsim output-feature enable-disable <interface-name> [disable]",
+ .function = nsim_output_feature_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+