{"id":27945147,"url":"https://github.com/metal-stack/sonic-configdb-utils","last_synced_at":"2025-08-03T21:33:48.462Z","repository":{"id":267774766,"uuid":"902316746","full_name":"metal-stack/sonic-configdb-utils","owner":"metal-stack","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-16T07:58:40.000Z","size":145,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-10T09:17:57.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metal-stack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-12T10:30:51.000Z","updated_at":"2025-06-16T07:58:42.000Z","dependencies_parsed_at":"2024-12-12T11:31:42.635Z","dependency_job_id":"85088037-099a-4dd8-a481-70c0a981d403","html_url":"https://github.com/metal-stack/sonic-configdb-utils","commit_stats":null,"previous_names":["metal-stack/sonic-configdb-utils"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/metal-stack/sonic-configdb-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal-stack%2Fsonic-configdb-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal-stack%2Fsonic-configdb-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal-stack%2Fsonic-configdb-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal-stack%2Fsonic-configdb-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metal-stack","download_url":"https://codeload.github.com/metal-stack/sonic-configdb-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metal-stack%2Fsonic-configdb-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268617308,"owners_count":24279230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T12:56:09.585Z","updated_at":"2025-08-03T21:33:48.395Z","avatar_url":"https://github.com/metal-stack.png","language":"Go","readme":"# SONiC config_db Utils\n\nCommandline tool for generating a `config_db.json` file for SONiC.\n\n## Usage\n\nCreate a `sonic-config.yaml` file with config variables.\nThen run\n\n```bash\nsonic-confidb-utils generate\n```\n\nFollowing files and directories are expected to be in place:\n\n1. The `/usr/share/sonic/device` directory holds all device specific information. `sonic-configdb-utils` needs to read `usr/share/sonic/device/\u003cplatform-identifier\u003e/platform.json` to set and validate the ports' breakout configurations.\n2. To retrieve the platform identifier and HWSKU the `/etc/sonic/sonic-environment` file is read which looks like this:\n\n```bash\nSONIC_VERSION=sonic-123\nPLATFORM=x86_64-accton_as7726_32x-r0\nHWSKU=Accton-AS7726-32X\nDEVICE_TYPE=LeafRouter\nASIC_TYPE=broadcom\n```\n\n## Configuration Parameters\n\n### bgp_ports\n\nExample:\n\n```yaml\nbgp_ports:\n  - Ethernet120\n  - Ethernet124\n```\n\nResult:\n\n```json\n{\n  \"INTERFACE\": {\n    \"Ethernet120\": {\n      \"ipv6_use_link_local_only\": \"enable\"\n    },\n    \"Ethernet124\": {\n      \"ipv6_use_link_local_only\": \"enable\"\n    }\n  }\n}\n```\n\n### breakouts\n\nExample:\n\n```yaml\nbreakouts:\n  Ethernet0: 4x25G\n  Ethernet120: 1x100G[40G]\n```\n\nResult:\n\n```json\n{\n  \"BREAKOUT_CFG\": {\n    \"Ethernet0\": {\n      \"brkout_mode\": \"4x25G\"\n    },\n    \"Ethernet120\": {\n      \"brkout_mode\": \"100G[40G]\"\n    }\n  }\n}\n```\n\nFor each breakout also the correspondig ports entries are added.\n\n### docker_routing_config_mode\n\nCan be one of `separated`, `split`, `split-unified`, `unified`.\n\nExample:\n\n```yaml\ndocker_routing_config_mode: split\n```\n\nResult:\n\n```json\n{\n  \"DEVICE_METADATA\": {\n    \"localhost\": {\n      \"docker_routing_config_mode\": \"split\"\n    }\n  }\n}\n```\n\n### features\n\nEnabling a feature makes SONiC check the status of the corresponding container.\nIf a feature is enabled and the container stops running `container_checker` will complain and `show system-health summary` will show\n\n```\nStatus: Not OK\n  Reasons: Container 'your-feature' is not running\n```\n\nFurthermore, enabling `auto_restart` on a service will tell SONiC to automatically restart the container if it stops unexpectedly.\n\nExample:\n\n```yaml\nfeatures:\n  metal-core.service:\n    enabled: true\n    auto_restart: true\n```\n\nResult:\n\n```json\n{\n  \"FEATURE\": {\n    \"metal-core.service\": {\n      \"auto_restart\": \"enabled\",\n      \"state\": \"enabled\"\n    }\n  }\n}\n```\n\n### frr_mgmt_framework_config\n\nExample:\n\n```yaml\nfrr_mgmt_framework_config: false\n```\n\nResult:\n\n```json\n{\n  \"DEVICE_METADATA\": {\n    \"localhost\": {\n      \"frr_mgmt_framework_config\": \"false\"\n    }\n  }\n}\n```\n\n### interconnects\n\nExample:\n\n```yaml\ninterconnects:\n  mpls:\n    vni: 104010\n    vrf: VrfMpls\n    unnumbered_interfaces:\n      - Ethernet0\n      - Ethernet1\n```\n\nResult:\n\n```json\n{\n  \"INTERFACE\": {\n    \"Ethernet0\": {\n      \"ipv6_use_link_local_only\": \"enable\",\n      \"vrf_name\": \"VrfMpls\"\n    },\n    \"Ethernet1\": {\n      \"ipv6_use_link_local_only\": \"enable\",\n      \"vrf_name\": \"VrfMpls\"\n    }\n  }\n}\n```\n\n### lldp_hello_time\n\nThis configuration slightly differs across SONiC versions and might not always have an effect.\nAs this tool is tailored for Edgecore SONiC versions 202111.x the LLDP configuration for those versions should work.\n\nExample:\n\n```yaml\nlldp_hello_time: 10\n```\n\nResult:\n\n```json\n{\n  \"LLDP\": {\n    \"Global\": {\n      \"hello_timer\": \"10\"\n    }\n  }\n}\n```\n\n### looback_address\n\nExample:\n\n```yaml\nloopback_address: 10.7.7.7\n```\n\nResult:\n\n```json\n{\n  \"LOOPBACK_INTERFACE\": {\n    \"Loopback0\": {},\n    \"Loopback0|10.7.7.7/32\": {}\n  }\n}\n```\n\n### mclag\n\nExample:\n\n```yaml\nmclag:\n  keepalive_vlan: 1000\n  member_port_channels:\n    - 11\n    - 22\n  peer_ip: 192.168.255.1\n  peer_link: PortChannel01\n  source_ip: 192.168.255.2\n  system_mac: aa:aa:aa:aa:aa:aa\n```\n\nResult:\n\n```json\n{\n  \"MCLAG_DOMAIN\": {\n    \"1\": {\n      \"mclag_system_id\": \"aa:aa:aa:aa:aa:aa\",\n      \"peer_ip\": \"192.168.255.1\",\n      \"peer_link\": \"PortChannel01\",\n      \"source_ip\": \"192.168.255.2\"\n    }\n  },\n  \"MCLAG_INTERFACE\": {\n    \"1|PortChannel11\": {\n      \"if_type\": \"PortChannel\"\n    },\n    \"1|PortChannel22\": {\n      \"if_type\": \"PortChannel\"\n    }\n  },\n  \"MCLAG_UNIQUE_IP\": {\n    \"Vlan1000\": {\n      \"unique_ip\": \"enable\"\n    }\n  }\n}\n```\n\n### mgmt_interface\n\nExample:\n\n```yaml\nmgmt_interface:\n  gateway_address: 10.7.10.1\n  ip: 10.7.10.2\n```\n\nResult:\n\n```json\n{\n  \"MGMT_INTERFACE\": {\n    \"eth0|10.7.10.2\": {\n      \"gwaddr\": \"10.7.10.1\"\n    }\n  }\n}\n```\n\n### mgmt_vrf\n\nExample:\n\n```yaml\nmgmt_vrf: false\n```\n\nResult:\n\n```json\n{\n  \"MGMT_VRF_CONFIG\": {\n    \"vrf_global\": {\n      \"mgmtVrfEnabled\": \"false\"\n    }\n  }\n}\n```\n\n### nameservers\n\nExample:\n\n```yaml\nnameservers:\n  - 1.1.1.1\n  - 8.8.8.8\n```\n\nResult:\n\n```json\n{\n  \"DNS_NAMESERVER\": {\n    \"1.1.1.1\": {},\n    \"8.8.8.8\": {}\n  }\n}\n```\n\n### ntp\n\nExample:\n\n```yaml\nntp:\n  src_interface: Loopback0\n  vrf: default\n  servers:\n    - 0.europe.pool.ntp.org\n    - 1.europe.pool.ntp.org\n    - 2.europe.pool.ntp.org\n    - 3.europe.pool.ntp.org\n```\n\nResult:\n\n```json\n{\n  \"NTP\": {\n    \"global\": {\n      \"src_intf\": \"Loopback0\",\n      \"vrf\": \"default\"\n    }\n  },\n  \"NTP_SERVER\": {\n    \"0.europe.pool.ntp.org\": {},\n    \"1.europe.pool.ntp.org\": {},\n    \"2.europe.pool.ntp.org\": {},\n    \"3.europe.pool.ntp.org\": {}\n  }\n}\n```\n\n### portchannels\n\nExample:\n\n```yaml\nportchannels:\n  default_mtu: 9000\n  list:\n    - number: 01\n      mtu: 1500\n      fallback: true\n      members:\n        - Ethernet4\n        - Ethernet5\n```\n\nResult:\n\n```json\n{\n  \"PORTCHANNEL\": {\n    \"PortChannel01\": {\n      \"admin_status\": \"up\",\n      \"fallback\": \"true\",\n      \"fast_rate\": \"false\",\n      \"lacp_key\": \"auto\",\n      \"min_links\": \"1\",\n      \"mix_speed\": \"false\",\n      \"mtu\": \"1500\"\n    }\n  },\n  \"PORTCHANNEL_MEMBER\": {\n    \"PortChannel01|Ethernet4\": {},\n    \"PortChannel01|Ethernet5\": {}\n  }\n}\n```\n\n### ports\n\nExample:\n\n```yaml\nbreakouts:\n  Ethernet0: 4x25G\n\nports:\n  default_fec: none\n  default_mtu: 9000\n  default_autoneg: on\n  list:\n    - name: Ethernet0\n      ips:\n        - 10.4.3.2\n      fec: rs\n      mtu: 1500\n      vrf: VrfMpls\n```\n\nResult:\n\n```json\n{\n  \"PORT\": {\n    \"Ethernet0\": {\n      \"admin_status\": \"up\",\n      \"alias\": \"Eth1/1(Port1)\",\n      \"autoneg\": \"on\",\n      \"fec\": \"rs\",\n      \"index\": \"1\",\n      \"lanes\": \"1\",\n      \"mtu\": \"1500\",\n      \"speed\": \"25000\"\n    }\n  }\n}\n```\n\nand\n\n```json\n{\n  \"INTERFACE\": {\n    \"Ethernet0\": {\n      \"vrf_name\": \"VrfMpls\"\n    },\n    \"Ethernet0|10.4.3.2\": {}\n  }\n}\n```\n\nThe speed of a port is determined by its breakout configuration.\nIf no breakout configuration for a port is provided its default breakout is assumed.\nIf a breakout configuration allows more than one speed options, e.g. `1x100G[40G]`, the first speed option is used as a default (`100G` in the example).\nA `speed` option can be added to the port config to specify an alternative speed, e.g.\n\n```yaml\nports:\n  - name: Ethernet120\n    speed: 40000\n```\n\nFor each port that is not explicitly configured in `breakouts` and `ports` an entry with defaults will be added to the `\"PORT\"` dictionary.\n\n### sag\n\nExample:\n\n```yaml\nsag:\n  mac: bb:bb:bb:bb:bb:bb\n```\n\nResult:\n\n```json\n{\n  \"SAG\": {\n    \"GLOBAL\": {\n      \"gateway_mac\": \"bb:bb:bb:bb:bb:bb\"\n    }\n  }\n}\n```\n\n### ssh_sourceranges\n\nExample:\n\n```yaml\nssh_sourceranges:\n  - 10.1.23.1/30\n```\n\nResult:\n\n```json\n{\n  \"ACL_RULE\": {\n    \"ALLOW_NTP|DEFAULT_RULE\": {\n      \"ETHER_TYPE\": \"2048\",\n      \"PACKET_ACTION\": \"DROP\",\n      \"PRIORITY\": \"1\"\n    },\n    \"ALLOW_NTP|RULE_1\": {\n      \"PACKET_ACTION\": \"ACCEPT\",\n      \"PRIORITY\": \"99\",\n      \"SRC_IP\": \"0.0.0.0/0\"\n    },\n    \"ALLOW_SSH|DEFAULT_RULE\": {\n      \"ETHER_TYPE\": \"2048\",\n      \"PACKET_ACTION\": \"DROP\",\n      \"PRIORITY\": \"1\"\n    },\n    \"ALLOW_SSH|RULE_1\": {\n      \"PACKET_ACTION\": \"ACCEPT\",\n      \"PRIORITY\": \"91\",\n      \"SRC_IP\": \"10.1.23.1/30\"\n    }\n  },\n  \"ACL_TABLE\": {\n    \"ALLOW_NTP\": {\n      \"policy_desc\": \"Allow NTP\",\n      \"services\": [\"NTP\"],\n      \"stage\": \"ingress\",\n      \"type\": \"CTRLPLANE\"\n    },\n    \"ALLOW_SSH\": {\n      \"policy_desc\": \"Allow SSH access\",\n      \"services\": [\"SSH\"],\n      \"stage\": \"ingress\",\n      \"type\": \"CTRLPLANE\"\n    }\n  }\n}\n```\n\n### vlan_subinterfaces\n\nExample:\n\n```yaml\nvlan_subinterfaces:\n  - cidr: 1.2.3.0/24\n    port: Ethernet0\n    vlan: 1000\n    vrf: Vrf45\n```\n\nResult:\n\n```json\n{\n  \"VLAN_SUB_INTERFACE\": {\n    \"Ethernet0.1000\": {\n      \"admin_status\": \"up\",\n      \"vrf_name\": \"Vrf45\"\n    },\n    \"Ethernet0.1000|1.2.3.0/24\": {}\n  }\n}\n```\n\n### vlans\n\nExample:\n\n```yaml\nvlans:\n  - id: 4000\n    dhcp_servers:\n      - 10.9.8.7\n      - 10.9.8.6\n    ip: 10.9.7.0\n    sag: true\n    tagged_ports:\n      - PortChannel01\n    untagged_ports:\n      - PortChannel11\n    vrf: Vrf45\n```\n\nResult:\n\n```json\n{\n  \"VLAN\": {\n    \"Vlan4000\": {\n      \"dhcp_servers\": [\"10.9.8.7\", \"10.9.8.6\"],\n      \"vlanid\": \"4000\"\n    }\n  },\n  \"VLAN_INTERFACE\": {\n    \"Vlan4000\": {\n      \"static_anycast_gateway\": \"true\",\n      \"vrf_name\": \"Vrf45\"\n    },\n    \"Vlan4000|10.9.7.0\": {}\n  },\n  \"VLAN_MEMBER\": {\n    \"Vlan4000|PortChannel01\": {\n      \"tagging_mode\": \"tagged\"\n    },\n    \"Vlan4000|PortChannel11\": {\n      \"tagging_mode\": \"untagged\"\n    }\n  }\n}\n```\n\n### vtep\n\nExample:\n\n```yaml\nloopback_address: 10.7.7.7\n\nvtep:\n  vxlan_tunnel_maps:\n    - vni: 103999\n      vlan: Vlan3999\n```\n\nResult:\n\n```json\n{\n  \"VXLAN_EVPN_NVO\": {\n    \"nvo\": {\n      \"source_vtep\": \"vtep\"\n    }\n  },\n  \"VXLAN_TUNNEL\": {\n    \"vtep\": {\n      \"src_ip\": \"10.7.7.7\"\n    }\n  },\n  \"VXLAN_TUNNEL_MAP\": {\n    \"vtep|map_103999_Vlan3999\": {\n      \"vlan\": \"Vlan3999\",\n      \"vni\": \"103999\"\n    }\n  }\n}\n```\n\nIf only `VXLAN_EVPN_NVO` and `VXLAN_TUNNEL` are needed with no tunnel maps:\n\n```yaml\nloopback_address: 10.7.7.7\n\nvtep:\n  enabled: true\n```\n\nResult:\n\n```json\n{\n  \"VXLAN_EVPN_NVO\": {\n    \"nvo\": {\n      \"source_vtep\": \"vtep\"\n    }\n  },\n  \"VXLAN_TUNNEL\": {\n    \"vtep\": {\n      \"src_ip\": \"10.7.7.7\"\n    }\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetal-stack%2Fsonic-configdb-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetal-stack%2Fsonic-configdb-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetal-stack%2Fsonic-configdb-utils/lists"}