tests: add generalized tags for tests, use them for run-solo tests

We have accumulated several scenarios in prod or wishlists
where it would be useful to have a general infra to say yes/no
about a certain test, and potentially make decisions based on that,
for example:

- runs solo (aka 'time-dependent')
- (wishlist) part of quick smoke-test set
- (wishlist) intermittent failure unrelated to timing
- (wishlist) test broken with a multi-worker config in vpp

Refactor the current "run-solo" code to allow for this extension.

Type: test

Change-Id: Ia5b3810e57c0543753c8e0dc4dc0cfb4a30b36ac
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Signed-off-by: Klement Sekera <ksekera@cisco.com>
diff --git a/src/vnet/bfd/test/test_bfd.py b/src/vnet/bfd/test/test_bfd.py
index 784cdad..71904a8 100644
--- a/src/vnet/bfd/test/test_bfd.py
+++ b/src/vnet/bfd/test/test_bfd.py
@@ -22,6 +22,7 @@
 from bfd import VppBFDAuthKey, BFD, BFDAuthType, VppBFDUDPSession, \
     BFDDiagCode, BFDState, BFD_vpp_echo
 from framework import VppTestCase, VppTestRunner, running_extended_tests
+from framework import tag_run_solo
 from util import ppp
 from vpp_ip import DpoProto
 from vpp_ip_route import VppIpRoute, VppRoutePath
@@ -677,6 +678,7 @@
     return p
 
 
+@tag_run_solo
 class BFD4TestCase(VppTestCase):
     """Bidirectional Forwarding Detection (BFD)"""
 
@@ -686,10 +688,6 @@
     test_session = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFD4TestCase, cls).setUpClass()
         cls.vapi.cli("set log class bfd level debug")
@@ -1489,6 +1487,7 @@
         self.assertFalse(vpp_session.query_vpp_config())
 
 
+@tag_run_solo
 class BFD6TestCase(VppTestCase):
     """Bidirectional Forwarding Detection (BFD) (IPv6) """
 
@@ -1498,10 +1497,6 @@
     test_session = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFD6TestCase, cls).setUpClass()
         cls.vapi.cli("set log class bfd level debug")
@@ -1706,6 +1701,7 @@
         self.assertFalse(vpp_session.query_vpp_config())
 
 
+@tag_run_solo
 class BFDFIBTestCase(VppTestCase):
     """ BFD-FIB interactions (IPv6) """
 
@@ -1713,10 +1709,6 @@
     test_session = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFDFIBTestCase, cls).setUpClass()
 
@@ -1896,6 +1888,7 @@
         bfd_session_down(self)
 
 
+@tag_run_solo
 class BFDSHA1TestCase(VppTestCase):
     """Bidirectional Forwarding Detection (BFD) (SHA1 auth) """
 
@@ -1905,10 +1898,6 @@
     test_session = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFDSHA1TestCase, cls).setUpClass()
         cls.vapi.cli("set log class bfd level debug")
@@ -2131,6 +2120,7 @@
         bfd_session_up(self)
 
 
+@tag_run_solo
 class BFDAuthOnOffTestCase(VppTestCase):
     """Bidirectional Forwarding Detection (BFD) (changing auth) """
 
@@ -2139,10 +2129,6 @@
     test_session = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFDAuthOnOffTestCase, cls).setUpClass()
         cls.vapi.cli("set log class bfd level debug")
@@ -2347,15 +2333,12 @@
                           "number of bfd events")
 
 
+@tag_run_solo
 class BFDCLITestCase(VppTestCase):
     """Bidirectional Forwarding Detection (BFD) (CLI) """
     pg0 = None
 
     @classmethod
-    def force_solo(cls):
-        return True
-
-    @classmethod
     def setUpClass(cls):
         super(BFDCLITestCase, cls).setUpClass()
         cls.vapi.cli("set log class bfd level debug")