Пример #1
0
class SanityTest(unittest.TestCase):
    PROVIDER_TYPE = "non-native"

    @classmethod
    def setUpClass(self):
        self.ydk_client = NativeNetconfServiceProvider(address='127.0.0.1',
                                                       username='******',
                                                       password='******',
                                                       protocol='ssh',
                                                       port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ydk_client.close()
        pass

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_payload(self):
        result = self.ydk_client.execute('''
            <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
            <edit-config>
            <target><candidate/></target>
            <config>
                <runner xmlns="http://cisco.com/ns/yang/ydktest-sanity"><ytypes><built-in-t><number8>12</number8></built-in-t></ytypes></runner>
            </config>
            </edit-config>
            </rpc>''', '')
        self.assertIn('ok', result)

    def test_server_error(self):
        try:
            result = self.ydk_client.execute('''
                <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
                <edit-config>
                <target><candidate/></target>
                <config>
                    <runner xmlns="http://invalid.com"></runner>
                </config>
                </edit-config>
                </rpc>''', '')
            self.assertIn('ok', result)
        except Exception as e:
            self.assertIsInstance(e, YPYServiceProviderError)
            msg = str(e)
            self.assertEqual(msg, 'Server rejected request.\n\terror-type: protocol\n\terror-tag: unknown-namespace\n\t'
                             'error-severity: error\n\terror-path: /rpc/edit-config/config\n\tbad-element: runner\n'
                             '\tbad-namespace: http://invalid.com')

    def test_compare_clients(self):
        ncc = NetconfServiceProvider(address='127.0.0.1',
                                     username='******',
                                     password='******',
                                     protocol='ssh',
                                     port=12022)
        import time
        start_time = time.time()
        native_result = self.netconf_service.get(self.ydk_client, None)
        native_end_time = time.time()
        ncc_result = self.netconf_service.get(ncc, None)
        ncc_end_time = time.time()
        print 'Native client time taken: ' + str(native_end_time - start_time) + ' seconds'
        print 'NCClient time taken: ' + str(ncc_end_time - native_end_time) + ' seconds'
        self.assertEqual(True, is_equal(native_result, ncc_result))
Пример #2
0
class SanityNetconf(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.ncc = NetconfServiceProvider(address='127.0.0.1',
                                          username='******',
                                          password='******',
                                          protocol='ssh',
                                          port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ncc.close()

    def setUp(self):
        from ydk.services import CRUDService
        crud = CRUDService()
        runner = ysanity.Runner()
        crud.delete(self.ncc, runner)

        print '\nIn method', self._testMethodName + ':'

    def tearDown(self):
        pass

    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertIn('ok', op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate,
                                                 get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_copy(self):
        op = self.netconf_service.copy_config(self.ncc,
                                              target=Datastore.candidate,
                                              source=Datastore.running)
        self.assertIn('ok', op)

    def test_lock_unlock(self):
        op = self.netconf_service.lock(self.ncc, Datastore.running)
        self.assertIn('ok', op)

        op = self.netconf_service.unlock(self.ncc, Datastore.running)
        self.assertIn('ok', op)

    def test_lock_unlock_fail(self):
        op = self.netconf_service.lock(self.ncc, Datastore.candidate)
        self.assertIn('ok', op)

        try:
            op = self.netconf_service.unlock(self.ncc, Datastore.running)
        except Exception as e:
            self.assertIsInstance(e, YPYError)

    def test_validate(self):
        op = self.netconf_service.validate(self.ncc,
                                           source=Datastore.candidate)
        self.assertIn('ok', op)

        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'
        op = self.netconf_service.validate(self.ncc, config=runner)
        self.assertIn('ok', op)

    def test_validate_fail(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 2
        try:
            self.netconf_service.validate(self.ncc, config=runner)
        except Exception as e:
            self.assertIsInstance(e, YPYDataValidationError)

    def test_commit_discard(self):
        runner = ysanity.Runner()
        runner.two.number = 2
        runner.two.name = 'runner:two:name'
        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertIn('ok', op)

        op = self.netconf_service.discard_changes(self.ncc)
        self.assertIn('ok', op)

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertIn('ok', op)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_copy_config(self):
        op = self.netconf_service.copy_config(self.ncc, Datastore.candidate,
                                              Datastore.running)
        self.assertIn('ok', op)
Пример #3
0
class SanityNetconf(unittest.TestCase):
    PROVIDER_TYPE = "non-native"

    @classmethod
    def setUpClass(self):
        if SanityNetconf.PROVIDER_TYPE == "native":
            self.ncc = NativeNetconfServiceProvider(address='127.0.0.1',
                                                    username='******',
                                                    password='******',
                                                    protocol='ssh',
                                                    port=12022)
        else:
            self.ncc = NetconfServiceProvider(address='127.0.0.1',
                                              username='******',
                                              password='******',
                                              protocol='ssh',
                                              port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ncc.close()

    def setUp(self):
        from ydk.services import CRUDService
        crud = CRUDService()
        runner = ysanity.Runner()
        crud.delete(self.ncc, runner)

    def tearDown(self):
        pass

    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertEqual(None, op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate,
                                                 get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertEqual(None, op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_lock_unlock(self):
        op = self.netconf_service.lock(self.ncc, Datastore.running)
        self.assertEqual(None, op)

        op = self.netconf_service.unlock(self.ncc, Datastore.running)
        self.assertEqual(None, op)

    def test_lock_unlock_fail(self):
        op = self.netconf_service.lock(self.ncc, Datastore.candidate)
        self.assertEqual(None, op)

        try:
            op = self.netconf_service.unlock(self.ncc, Datastore.running)
        except Exception as e:
            self.assertIsInstance(e, YPYError)

    def test_validate(self):
        op = self.netconf_service.validate(self.ncc,
                                           source=Datastore.candidate)
        self.assertEqual(None, op)

        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'
        op = self.netconf_service.validate(self.ncc, source=runner)
        self.assertEqual(None, op)

    def test_validate_fail(self):
        # should have been handled by YDK local validation
        pass

    def test_commit_discard(self):
        runner = ysanity.Runner()
        runner.two.number = 2
        runner.two.name = 'runner:two:name'
        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertEqual(None, op)

        op = self.netconf_service.discard_changes(self.ncc)
        self.assertEqual(None, op)

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertEqual(None, op)

        op = self.netconf_service.commit(self.ncc)
        self.assertEqual(None, op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_confirmed_commit(self):
        runner = ysanity.Runner()
        runner.two.number = 2
        runner.two.name = 'runner:two:name'
        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertEqual(None, op)

        op = self.netconf_service.commit(self.ncc,
                                         confirmed=True,
                                         confirm_timeout=120)
        self.assertEqual(None, op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.cancel_commit(self.ncc)
        self.assertEqual(None, op)

    def test_copy_config(self):
        op = self.netconf_service.copy_config(self.ncc, Datastore.candidate,
                                              Datastore.running)
        self.assertEqual(None, op)

        runner = ysanity.Runner()
        runner.two.number = 2
        runner.two.name = 'runner:two:name'
        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertEqual(None, op)

        op = self.netconf_service.copy_config(self.ncc, Datastore.running,
                                              Datastore.candidate)
        self.assertEqual(None, op)

        result = self.netconf_service.get_config(self.ncc, Datastore.running,
                                                 get_filter)
        self.assertEqual(is_equal(result, runner), True)

        runner.two.name += 'modified'

        op = self.netconf_service.copy_config(self.ncc, Datastore.running,
                                              runner)
        self.assertEqual(None, op)

        result = self.netconf_service.get_config(self.ncc, Datastore.running,
                                                 get_filter)
        self.assertEqual(is_equal(result, runner), True)

    def test_delete_config(self):
        pass
        # startup and candidate cannot be both enabled in ConfD
        # op = self.netconf_service.delete_config(self.ncc, Datastore.startup)
        # self.assertEqual(None, op)

    def test_delete_config_fail(self):
        self.assertRaises(YPYServiceError, self.netconf_service.delete_config,
                          self.ncc, Datastore.running)
        self.assertRaises(YPYServiceError, self.netconf_service.delete_config,
                          self.ncc, Datastore.candidate)

    def test_copy_config_fail(self):
        self.assertRaises(YPYServiceError,
                          self.netconf_service.copy_config,
                          self.ncc,
                          target=123,
                          source=456)

    def test_edit_config_fail(self):
        self.assertRaises(YPYServiceError, self.netconf_service.edit_config,
                          self.ncc, Datastore.startup, Datastore.candidate)

    def test_get_config_fail(self):
        runner = ysanity.Runner()
        self.assertRaises(YPYServiceError, self.netconf_service.get_config,
                          self.ncc, "invalid-input", runner)

    def test_lock_fail(self):
        self.assertRaises(YPYServiceError, self.netconf_service.lock, self.ncc,
                          "invalid-input")

    def test_unlock_fail(self):
        self.assertRaises(YPYServiceError, self.netconf_service.unlock,
                          self.ncc, "invalid-input")
Пример #4
0
class SanityNetconf(unittest.TestCase):
    PROVIDER_TYPE = "non-native"

    @classmethod
    def setUpClass(self):
        if SanityNetconf.PROVIDER_TYPE == "native":
            self.ncc = NativeNetconfServiceProvider(address='127.0.0.1',
                                                    username='******',
                                                    password='******',
                                                    protocol='ssh',
                                                    port=12022)
        else:
            self.ncc = NetconfServiceProvider(address='127.0.0.1',
                                              username='******',
                                              password='******',
                                              protocol='ssh',
                                              port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ncc.close()

    def setUp(self):
        from ydk.services import CRUDService
        crud = CRUDService()
        runner = ysanity.Runner()
        crud.delete(self.ncc, runner)


    def tearDown(self):
        pass

    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
        self.assertIn('ok', op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate, get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_copy(self):
        op = self.netconf_service.copy_config(self.ncc, target=Datastore.candidate, source=Datastore.running)
        self.assertIn('ok', op)

    def test_lock_unlock(self):
        op = self.netconf_service.lock(self.ncc, Datastore.running)
        self.assertIn('ok', op)

        op = self.netconf_service.unlock(self.ncc, Datastore.running)
        self.assertIn('ok', op)

    def test_lock_unlock_fail(self):
        op = self.netconf_service.lock(self.ncc, Datastore.candidate)
        self.assertIn('ok', op)

        try:
            op = self.netconf_service.unlock(self.ncc, Datastore.running)
        except Exception as e:
            self.assertIsInstance(e, YPYError)

    def test_validate(self):
        op = self.netconf_service.validate(self.ncc, source=Datastore.candidate)
        self.assertIn('ok', op)

        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'
        op = self.netconf_service.validate(self.ncc, config=runner)
        self.assertIn('ok', op)

    def test_validate_fail(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 2
        try:
            self.netconf_service.validate(self.ncc, config=runner)
        except Exception as e:
            self.assertIsInstance(e, YPYModelError)

    def test_commit_discard(self):
        runner = ysanity.Runner()
        runner.two.number = 2
        runner.two.name = 'runner:two:name'
        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
        self.assertIn('ok', op)

        op = self.netconf_service.discard_changes(self.ncc)
        self.assertIn('ok', op)

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
        self.assertIn('ok', op)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)

    def test_copy_config(self):
        op = self.netconf_service.copy_config(self.ncc, Datastore.candidate, Datastore.running)
        self.assertIn('ok', op)
class SanityNetconf(unittest.TestCase):
    PROVIDER_TYPE = "non-native"

    @classmethod
    def setUpClass(self):
        from ydk.providers import NetconfServiceProvider
        from ydk.services import NetconfService

        if SanityNetconf.PROVIDER_TYPE == "native":
            self.ncc = NativeNetconfServiceProvider(address='127.0.0.1',
                                                    username='******',
                                                    password='******',
                                                    protocol='ssh',
                                                    port=12022)
        else:
            self.ncc = NetconfServiceProvider(address='127.0.0.1',
                                              username='******',
                                              password='******',
                                              protocol='ssh',
                                              port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ncc.close()

    def setUp(self):
        from ydk.services import CRUDService
        crud = CRUDService()
        runner = ysanity.Runner()
        crud.delete(self.ncc, runner)


    def tearDown(self):
        pass

    def _create_runner(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'
        return runner

    def test_copy_config_invalid_1(self):
        try:
            from ydk.services import Datastore
            op = self.netconf_service.copy_config(self.ncc, target=None, source=Datastore.running)
        except YPYServiceError as err:
            expected_msg = "'target' and 'source' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_copy_config_invalid_2(self):
        try:
            from ydk.services import Datastore
            op = self.netconf_service.copy_config(self.ncc, target=Datastore.candidate, source=None)
        except YPYServiceError as err:
            expected_msg = "'target' and 'source' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_copy_config_invalid_3(self):
        try:
            op = self.netconf_service.copy_config(self.ncc, target=None, source=None)
        except YPYServiceError as err:
            expected_msg = "'target' and 'source' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_copy_config_invalid_4(self):
        try:
            from ydk.services import Datastore
            op = self.netconf_service.copy_config(
                self.ncc, target=Datastore.candidate, source=Datastore.running, with_defaults_option=1)
        except YPYServiceError as err:
            expected_msg = "optional arg 'with_defaults_option' must be of type ietf_netconf_with_defaults.WithDefaultsModeEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_delete_config_invalid(self):
        try:
            op = self.netconf_service.delete_config(self.ncc, target=None)
        except YPYServiceError as err:
            expected_msg = "'target' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_1(self):
        try:
            runner = self._create_runner()
            op = self.netconf_service.edit_config(self.ncc, None, runner)
        except YPYServiceError as err:
            expected_msg = "'target' and 'config' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_2(self):
        try:
            from ydk.services import Datastore
            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, None)
        except YPYServiceError as err:
            expected_msg = "'target' and 'config' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_3(self):
        try:
            op = self.netconf_service.edit_config(self.ncc, None, None)
        except YPYServiceError as err:
            expected_msg = "'target' and 'config' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_4(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner, default_operation=1)
        except YPYServiceError as err:
            expected_msg = "optional arg 'default_operation' must be of type ietf_netconf.EditConfigRpc.Input.DefaultOperationEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_5(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner, error_option=1)
        except YPYServiceError as err:
            expected_msg = "optional arg 'error_option' must be of type ietf_netconf.EditConfigRpc.Input.ErrorOptionEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_edit_config_invalid_6(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner, test_option=1)
        except YPYServiceError as err:
            expected_msg = "optional arg 'test_option' must be of type ietf_netconf.EditConfigRpc.Input.TestOptionEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_get_config_invalid_1(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            get_filter = ysanity.Runner()

            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
            result = self.netconf_service.get_config(self.ncc, None, get_filter)
        except YPYServiceError as err:
            expected_msg = "'source' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_get_config_invalid_2(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            get_filter = ysanity.Runner()

            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
            result = self.netconf_service.get_config(self.ncc, Datastore.candidate, get_filter, with_defaults_option=1)
        except YPYServiceError as err:
            expected_msg = "optional arg 'with_defaults_option' must be of type ietf_netconf_with_defaults.WithDefaultsModeEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_get_invalid(self):
        try:
            from ydk.services import Datastore
            runner = self._create_runner()
            get_filter = ysanity.Runner()

            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
            self.assertIn('ok', op)

            op = self.netconf_service.discard_changes(self.ncc)
            self.assertIn('ok', op)

            op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
            self.assertIn('ok', op)

            op = self.netconf_service.commit(self.ncc)
            self.assertIn('ok', op)

            result = self.netconf_service.get(self.ncc, get_filter, with_defaults_option=1)
            self.assertEqual(is_equal(runner, result), True)
        except YPYServiceError as err:
            expected_msg = "optional arg 'with_defaults_option' must be of type ietf_netconf_with_defaults.WithDefaultsModeEnum"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_lock_invalid(self):
        try:
            op = self.netconf_service.lock(self.ncc, None)
        except YPYServiceError as err:
            expected_msg = "'target' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_unlock_invalid(self):
        try:
            from ydk.services import Datastore
            op = self.netconf_service.lock(self.ncc, Datastore.candidate)
            op = self.netconf_service.unlock(self.ncc, None)
        except YPYServiceError as err:
            expected_msg = "'target' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')

    def test_validate_invalid(self):
        try:
            op = self.netconf_service.validate(self.ncc)
        except YPYServiceError as err:
            expected_msg = "'source' cannot be None"
            self.assertEqual(err.message, expected_msg)
        else:
            raise Exception('YPYServiceError not raised')
Пример #6
0
class SanityTest(unittest.TestCase):
    PROVIDER_TYPE = "non-native"

    @classmethod
    def setUpClass(self):
        self.ydk_client = NativeNetconfServiceProvider(address='127.0.0.1',
                                                       username='******',
                                                       password='******',
                                                       protocol='ssh',
                                                       port=12022)
        self.netconf_service = NetconfService()

    @classmethod
    def tearDownClass(self):
        self.ydk_client.close()
        pass

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_payload(self):
        result = self.ydk_client.execute(
            '''
            <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
            <edit-config>
            <target><candidate/></target>
            <config>
                <runner xmlns="http://cisco.com/ns/yang/ydktest-sanity"><ytypes><built-in-t><number8>12</number8></built-in-t></ytypes></runner>
            </config>
            </edit-config>
            </rpc>''', '')
        self.assertIn('ok', result)

    def test_server_error(self):
        try:
            result = self.ydk_client.execute(
                '''
                <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
                <edit-config>
                <target><candidate/></target>
                <config>
                    <runner xmlns="http://invalid.com"></runner>
                </config>
                </edit-config>
                </rpc>''', '')
            self.assertIn('ok', result)
        except Exception as e:
            self.assertIsInstance(e, YPYServiceProviderError)
            msg = str(e)
            self.assertEqual(
                msg,
                'Server rejected request.\n\terror-type: protocol\n\terror-tag: unknown-namespace\n\t'
                'error-severity: error\n\terror-path: /rpc/edit-config/config\n\tbad-element: runner\n'
                '\tbad-namespace: http://invalid.com')

    def test_compare_clients(self):
        ncc = NetconfServiceProvider(address='127.0.0.1',
                                     username='******',
                                     password='******',
                                     protocol='ssh',
                                     port=12022)
        import time
        start_time = time.time()
        native_result = self.netconf_service.get(self.ydk_client, None)
        native_end_time = time.time()
        ncc_result = self.netconf_service.get(ncc, None)
        ncc_end_time = time.time()
        print('Native client time taken: %s seconds' %
              (native_end_time - start_time))
        print('NCClient time taken: %s seconds' %
              (ncc_end_time - native_end_time))
        self.assertEqual(True, is_equal(native_result, ncc_result))