def cli_error_check(result)
      # Check for messages that can be safely ignored.
      # The NXOS interface private-vlan cli does not raise an exception
      # in some conditions and instead just displays a STDOUT error message
      # thus NXAPI does not detect the failure.
      # We must catch it by inspecting the "body" hash entry returned by NXAPI.
      # This vlan cli behavior is unlikely to change.

      errors = /(ERROR:|VLAN:|Eth)/
      return unless
        result[1].is_a?(Hash) && errors.match(result[1]['body'].to_s)
      # Split errors into a list, but keep the delimiter as part of the message.
      error_list =
        (result[1]['body'].split(errors) - ['']).each_slice(2).map(&:join)
      error_list.each do |_msg|
        fail result[1]['body']
      end
    end
def cli_error_check(result)
      # Check for messages that can be safely ignored.
      # The NXOS interface private-vlan cli does not raise an exception
      # in some conditions and instead just displays a STDOUT error message
      # thus NXAPI does not detect the failure.
      # We must catch it by inspecting the "body" hash entry returned by NXAPI.
      # This vlan cli behavior is unlikely to change.

      errors = /(ERROR:|VLAN:|Eth)/
      return unless
        result[1].is_a?(Hash) && errors.match(result[1]['body'].to_s)
      # Split errors into a list, but keep the delimiter as part of the message.
      error_list =
        (result[1]['body'].split(errors) - ['']).each_slice(2).map(&:join)
      error_list.each do |_msg|
        fail result[1]['body']
      end
    end
--------------------------