aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/netconf-pnp-simulator/engine/tests/test_basic_operations.py
blob: 06164e6b5278c8cd99ccf61c99a9d7ecdc5d682e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import nctest


class TestBasicOperations(nctest.NCTestCase):
    """ Tests basic NETCONF operations with no prerequisites on datastore content. """

    def test_capabilities(self):
        assert ":startup" in self.nc.server_capabilities
        assert ":candidate" in self.nc.server_capabilities
        assert ":validate" in self.nc.server_capabilities
        assert ":xpath" in self.nc.server_capabilities

    def test_get(self):
        reply = self.nc.get()
        nctest.check_reply_data(reply)

    def test_get_config_startup(self):
        reply = self.nc.get_config(source='startup')
        nctest.check_reply_data(reply)

    def test_get_config_running(self):
        reply = self.nc.get_config(source='running')
        nctest.check_reply_data(reply)

    def test_copy_config(self):
        reply = self.nc.copy_config(source='startup', target='candidate')
        nctest.check_reply_ok(reply)

    def test_neg_filter(self):
        reply = self.nc.get(filter=("xpath", "/non-existing-module:non-existing-data"))
        nctest.check_reply_err(reply)

    def test_lock(self):
        reply = self.nc.lock("startup")
        nctest.check_reply_ok(reply)
        reply = self.nc.lock("running")
        nctest.check_reply_ok(reply)
        reply = self.nc.lock("candidate")
        nctest.check_reply_ok(reply)

        reply = self.nc.lock("startup")
        nctest.check_reply_err(reply)

        reply = self.nc.unlock("startup")
        nctest.check_reply_ok(reply)
        reply = self.nc.unlock("running")
        nctest.check_reply_ok(reply)
        reply = self.nc.unlock("candidate")
        nctest.check_reply_ok(reply)