VPP-91 fix sr tunnel add_del collision check 65/1265/3
authorChris Luke <chrisy@flirble.org>
Thu, 2 Jun 2016 15:00:41 +0000 (11:00 -0400)
committerChris Luke <chrisy@flirble.org>
Thu, 2 Jun 2016 15:28:59 +0000 (11:28 -0400)
commite54436005341800f76a584299ef8bf99e8d66227
treed1e09b9561eb5b2df3c79c7aeea8ab18fb8bac76
parent3419d0b9c1f64c6f477601eeea6b0e5465a89dce
VPP-91 fix sr tunnel add_del collision check

The add_del function was not properly checking if a tunnel already
existed; instead it was checking if the given tunnel name existed.
If no tunnel name was given it flat out refused to add a tunnel
even though that is optional.

Cleanup the add/del parameter validation to "do what I expect" it
to do:

When adding a tunnel:
- If a "name" is given, it must not exist.
- The "key" is always checked, and must not exist.

When deleting a tunnel:
- If the "name" is given, and it exists, then use it.
- If the "name" is not given, use the "key".
- If the "name" and the "key" are given, then both must point to the
  same thing.

Change-Id: I9b48ae0203f9664cf8af0f7dc49bf480ddec10d5
Signed-off-by: Chris Luke <chrisy@flirble.org>
vnet/vnet/sr/sr.c