aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/netconf-pnp-simulator/engine/tests/nctest.py
diff options
context:
space:
mode:
authorebo <eliezio.oliveira@est.tech>2020-03-09 15:42:08 +0000
committerMarco Platania <platania@research.att.com>2020-03-11 21:06:13 +0000
commit769a79125d17ded007894464a7151eafbd65f355 (patch)
treec5a40275f7b7eba8f3bd1e9665ac0ba461209912 /test/mocks/netconf-pnp-simulator/engine/tests/nctest.py
parentc27713e8c8b5467e8e900f7020227de366c67014 (diff)
netconf-pnp-simulator: make PYTHONPATH always globally defined
Add IT using ncclient and tox Issue-ID: INT-1124 Change-Id: I560d4fd2468ac93f8ead36062b2e316821af8d07 Signed-off-by: ebo <eliezio.oliveira@est.tech>
Diffstat (limited to 'test/mocks/netconf-pnp-simulator/engine/tests/nctest.py')
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/tests/nctest.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/mocks/netconf-pnp-simulator/engine/tests/nctest.py b/test/mocks/netconf-pnp-simulator/engine/tests/nctest.py
new file mode 100644
index 000000000..2f848c361
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/tests/nctest.py
@@ -0,0 +1,37 @@
+from ncclient import manager, operations
+import settings
+import unittest
+
+class NCTestCase(unittest.TestCase):
+ """ Base class for NETCONF test cases. Provides a NETCONF connection and some helper methods. """
+
+ def setUp(self):
+ self.nc = manager.connect(
+ host=settings.HOST,
+ port=settings.PORT,
+ username=settings.USERNAME,
+ key_filename=settings.KEY_FILENAME,
+ allow_agent=False,
+ look_for_keys=False,
+ hostkey_verify=False)
+ self.nc.raise_mode = operations.RaiseMode.NONE
+
+ def tearDown(self):
+ self.nc.close_session()
+
+ def check_reply_ok(self, reply):
+ self.assertIsNotNone(reply)
+ if settings.DEBUG:
+ print(reply.xml)
+ self.assertTrue(reply.ok)
+ self.assertIsNone(reply.error)
+
+ def check_reply_err(self, reply):
+ self.assertIsNotNone(reply)
+ if settings.DEBUG:
+ print(reply.xml)
+ self.assertFalse(reply.ok)
+ self.assertIsNotNone(reply.error)
+
+ def check_reply_data(self, reply):
+ self.check_reply_ok(reply)