Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting all json config-elements residing in config_db.json #1454

Merged
merged 1 commit into from
Mar 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dockers/docker-config-engine/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev
# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev python-natsort

RUN pip install --upgrade pip

Expand Down
3 changes: 3 additions & 0 deletions src/sonic-config-engine/sonic-cfggen
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ from minigraph import parse_device_desc_xml
from sonic_platform import get_machine_info
from sonic_platform import get_platform_info
from swsssdk import ConfigDBConnector
from collections import OrderedDict
from natsort import natsorted

def is_ipv4(value):
if not value:
Expand Down Expand Up @@ -98,6 +100,7 @@ TODO(taoyl): Current version of config db only supports BGP admin states.
def to_serialized(data):
for table in data:
if type(data[table]) is dict:
data[table] = OrderedDict(natsorted(data[table].items()))
for key in data[table].keys():
new_key = ConfigDBConnector.serialize_key(key)
if new_key != key:
Expand Down