Skip to content

Commit

Permalink
[config][generic-update] Implementing patch sorting (2nd attempt) (#1794
Browse files Browse the repository at this point in the history
)

#### What I did
Implemented [JSON Patch Ordering using YANG Models Design Doc](https://github.com/Azure/SONiC/blob/master/doc/config-generic-update-rollback/Json_Patch_Ordering_using_YANG_Models_Design.md)

#### How to verify it
Unit-Tests

**NOTE: The code in this PR was [reverted](github.com/Azure/sonic-utilities/commit/0a145e8027380e8d4decb36bdfc647062c722612) before because of some [build issues](sonic-net/sonic-utilities#1761). Build issues have been fixed [here](#8632). To check the original PR comments please go [here](sonic-net/sonic-utilities#1599
  • Loading branch information
ghooo authored Sep 2, 2021
1 parent 7ed9a91 commit d7900dd
Show file tree
Hide file tree
Showing 24 changed files with 4,077 additions and 23 deletions.
8 changes: 2 additions & 6 deletions generic_config_updater/generic_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from enum import Enum
from .gu_common import GenericConfigUpdaterError, ConfigWrapper, \
DryRunConfigWrapper, PatchWrapper
from .patch_sorter import PatchSorter

CHECKPOINTS_DIR = "/etc/sonic/checkpoints"
CHECKPOINT_EXT = ".cp.json"
Expand All @@ -16,11 +17,6 @@ def release_lock(self):
# TODO: Implement ConfigLock
pass

class PatchSorter:
def sort(self, patch):
# TODO: Implement patch sorter
raise NotImplementedError("PatchSorter.sort(patch) is not implemented yet")

class ChangeApplier:
def apply(self, change):
# TODO: Implement change applier
Expand All @@ -36,7 +32,7 @@ def __init__(self,
changeapplier=None,
config_wrapper=None,
patch_wrapper=None):
self.patchsorter = patchsorter if patchsorter is not None else PatchSorter()
self.patchsorter = patchsorter if patchsorter is not None else PatchSorter(config_wrapper, patch_wrapper)
self.changeapplier = changeapplier if changeapplier is not None else ChangeApplier()
self.config_wrapper = config_wrapper if config_wrapper is not None else ConfigWrapper()
self.patch_wrapper = patch_wrapper if patch_wrapper is not None else PatchWrapper()
Expand Down
Loading

0 comments on commit d7900dd

Please sign in to comment.