def test_execute_lock_unlock_rpc(self): lock_rpc = ietf_netconf.LockRpc() lock_rpc.input.target.candidate = Empty() op = self.executor.execute_rpc(self.ncc, lock_rpc) self.assertIn('ok', op) unlock_rpc = ietf_netconf.UnlockRpc() unlock_rpc.input.target.candidate = Empty() op = self.executor.execute_rpc(self.ncc, unlock_rpc) self.assertIn('ok', op)
def test_execute_lock_unlock_rpc_fail(self): lock_rpc = ietf_netconf.LockRpc() lock_rpc.input.target.candidate = Empty() op = self.executor.execute_rpc(self.ncc, lock_rpc) self.assertIn('ok', op) unlock_rpc = ietf_netconf.UnlockRpc() unlock_rpc.input.target.running = Empty() try: op = self.executor.execute_rpc(self.ncc, unlock_rpc) except Exception as e: self.assertIsInstance(e, YPYError)
def unlock(self, provider, target): """ Execute an unlock operation to release a configuration lock, previously obtained with the 'lock' operation. Args: - target: Particular configuration to unlock Returns: - ok reply if operation succeeds else, raises an exception Raises: `YPYDataValidationError <ydk.errors.html#ydk.errors.YPYDataValidationError>`_ if validation error occurs. `YPYError <ydk.errors.html#ydk.errors.YPYError>`_ if other error has occurred. Possible errors could be - a server side error - if there isn't enough information in the entity to prepare the message (missing keys for example) """ assert target is not None rpc = ietf_netconf.UnlockRpc() rpc.input.target = _get_rpc_datastore_object(target, rpc.input.target) return self.executor.execute_rpc(provider, rpc)