Skip to content

Commit

Permalink
Dev 202111 cli nat (sonic-net#13)
Browse files Browse the repository at this point in the history
* Added hepler function to get list of the disabled components
The list of disabled components is store in src/sonic-utilities/exclude-cfg/exclude-cfg.yaml

* Used Hedgehog sonic-utilities submodule

* Alligned sonic-utilities submodule.
	Added base infrastructure to get list of the disabled components
	Moved "clear nat" to separate module - nat.py
	Disable NAT commands when INCLUDE_NAT is not set
  • Loading branch information
nazar-garmadiy authored and Maksym Hedeon committed Feb 1, 2023
1 parent a5edfb9 commit f61b72a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
url = https://github.com/p4lang/ptf.git
[submodule "src/sonic-utilities"]
path = src/sonic-utilities
url = https://github.com/sonic-net/sonic-utilities
url = https://github.com/githedgehog/sonic-utilities_dev_202111.git
[submodule "platform/broadcom/sonic-platform-modules-arista"]
path = platform/broadcom/sonic-platform-modules-arista
url = https://github.com/aristanetworks/sonic
Expand Down
34 changes: 34 additions & 0 deletions build_exclude_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/python3

import yaml

from build_img_metadata import get_bld_config

EXCL_CFG_PATH = 'src/sonic-utilities/exclude-cfg/exclude-cfg.yaml'

#get configuration with excluded components only

def get_excl_config():
bld_cfg = {}
excl_cfg = {}

bld_cfg = get_bld_config()

for key, val in bld_cfg.items():
if str(key).startswith("INCLUDE_") and val == "n":
excl_cfg[key] = val

return excl_cfg

# Write build metadata into yaml file

def write_data(path:str, data_dict:dict):
with open(path, 'w') as file:
yaml.dump(data_dict, file)

def build_excl_cfg():
excl_data = get_excl_config()
write_data(EXCL_CFG_PATH, excl_data)

if __name__ == '__main__':
build_excl_cfg()
3 changes: 3 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ endif
# Overwrite the buildinfo in slave container
$(shell sudo scripts/prepare_slave_container_buildinfo.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV))

# Create a list with excluded modules that will be disabled
$(shell ./build_exclude_cfg.py)

include Makefile.cache

ifeq ($(SONIC_USE_DOCKER_BUILDKIT),y)
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-utilities

0 comments on commit f61b72a

Please sign in to comment.