Skip to content

Commit

Permalink
[config][generic-update] Implementing patch sorting (sonic-net#1599)
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 I did it

#### How to verify it
Unit-Tests

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
  • Loading branch information
ghooo authored Aug 10, 2021
1 parent 30907c4 commit 920bb87
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 920bb87

Please sign in to comment.