summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-05-10 12:01:10 +0200
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-05-10 21:50:34 +0000
commit72d8758fdc2266b9f4cd53063da2d23f0855c1df (patch)
tree972c5260846e3cc5c10a9be8c6318812ed5faa75 /test
parentf89a6de8f032536080c4a11b267bf921093d3740 (diff)
cli: Add return value in cli_inband
Even when a CLI command called through the cli_inband API failed the API would return 0 (SUCCESS). This patch fixes that, but since most CLI handlers return error->code == 0, in most failure cases it will return -1 (UNSPECIFIED ERROR). Type: fix Change-Id: Ic83f3b23e8e8954bb8aa211301baba24e8c20ef6 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_cli.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_cli.py b/test/test_cli.py
new file mode 100644
index 00000000000..d3e69e924b5
--- /dev/null
+++ b/test/test_cli.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""CLI functional tests"""
+
+import unittest
+from framework import VppTestCase, VppTestRunner
+
+
+class TestCLI(VppTestCase):
+ """ CLI Test Case """
+ maxDiff = None
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestCLI, cls).setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super(TestCLI, cls).tearDownClass()
+
+ def setUp(self):
+ super(TestCLI, self).setUp()
+
+ def tearDown(self):
+ super(TestCLI, self).tearDown()
+
+ def test_cli_retval(self):
+ """ CLI inband retval """
+ rv = self.vapi.papi.cli_inband(cmd='this command does not exist')
+ self.assertNotEqual(rv.retval, 0)
+
+ rv = self.vapi.papi.cli_inband(cmd='show version')
+ self.assertEqual(rv.retval, 0)
+
+
+if __name__ == '__main__':
+ unittest.main(testRunner=VppTestRunner)