diff options
Diffstat (limited to 'src/python/netconf_server/sysrepo_interface/sysrepo_message_model.py')
-rw-r--r-- | src/python/netconf_server/sysrepo_interface/sysrepo_message_model.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/python/netconf_server/sysrepo_interface/sysrepo_message_model.py b/src/python/netconf_server/sysrepo_interface/sysrepo_message_model.py new file mode 100644 index 0000000..e21a9b5 --- /dev/null +++ b/src/python/netconf_server/sysrepo_interface/sysrepo_message_model.py @@ -0,0 +1,42 @@ +### +# ============LICENSE_START======================================================= +# Netconf Server +# ================================================================================ +# Copyright (C) 2021 Nokia. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +import sysrepo + + +class SysrepoMessage(object): + + def __init__(self, change): + self._change = change + + def is_modified(self): + return isinstance(self._change, sysrepo.ChangeModified) + + def is_created(self): + return isinstance(self._change, sysrepo.ChangeCreated) + + def value(self): + return self._change.value + + def xpath(self): + return self._change.xpath + + def prev_val(self): + return self._change.prev_val |