VPP-91 fix sr tunnel add_del collision check 76/1376/2
authorChris Luke <chrisy@flirble.org>
Thu, 2 Jun 2016 15:00:41 +0000 (11:00 -0400)
committerChris Luke <chris_luke@cable.comcast.com>
Fri, 3 Jun 2016 00:58:17 +0000 (00:58 +0000)
commitb98a3a87a968d9675103e16b6d4b3949955288c0
treeaa52156a5e95a61dcd97ba2bc57abdd1f3f13896
parent1f752a3f8ff420aa7d67904c2bf29ca3f2ea10b7
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>
(cherry picked from commit e54436005341800f76a584299ef8bf99e8d66227)
vnet/vnet/sr/sr.c