How to get the autocorrelation of this finite discrete function?
Calculating the autocorrelation of this function is relatively easy. You just need to follow the formula you have written:

\begin{equation}
\ r_{xx}(l) = \displaystyle\sum_{n=-\infty}^{\infty} x(n)x(n-l) \end{equation}

It gets much easier because your function is $\neq0$ for only a few values ($2N+1$ exactly).

Because of this the previous sum can be replaced with this much simpler one: 

\begin{equation}
\ r_{xx}(l) = \displaystyle\sum_{n=-N}^{N} x(n-l) \end{equation}

Which is basically just counting how many times $x(n-l)$ is not zero on that finite interval. Because of this it appears easily that 

\begin{equation}
r_{xx}(l)=max(2N-1-|l|,0)  \end{equation}

You almost had it in your question but the sign was wrong.