Skip to content

Add OpenConfig DNS provider implementation - #471

Open
rgildein wants to merge 2 commits into
mainfrom
feat/openconfig-dns
Open

Add OpenConfig DNS provider implementation#471
rgildein wants to merge 2 commits into
mainfrom
feat/openconfig-dns

Conversation

@rgildein

Copy link
Copy Markdown

Implement EnsureDNS and DeleteDNS for the OpenConfig provider targeting SR Linux via gNMI. Maps DNSSpec. Domain to /system/dns/config/search and DNSSpec.Servers to /system/dns/servers/server list.
Rejects unsupported fields (adminState: Down, sourceInterfaceName, vrfName) with explicit UnsupportedFieldError.

How I tested it

$ kubectl apply -f - <<EOF
  apiVersion: networking.metal.ironcore.dev/v1alpha1
  kind: DNS
  metadata:
    name: dns
    namespace: default
  spec:
    deviceRef:
      name: leaf1
    domain: example.com
    servers:
      - address: 8.8.8.8
      - address: 1.1.1.1
EOF
dns.networking.metal.ironcore.dev/dns configured
$ gnmic -a 172.20.20.2 --port 57400 -u admin -p 'NokiaSrl1!' --skip-verify --encoding JSON_IETF get --path "openconfig-system:system/dns"
[
  {
    "source": "172.20.20.2",
    "timestamp": 1785331298950342192,
    "time": "2026-07-29T15:21:38.950342192+02:00",
    "updates": [
      {
        "Path": "openconfig-system:system/dns",
        "values": {
          "openconfig-system:system/dns": {
            "config": {
              "search": [
                "example.com"
              ]
            },
            "host-entries": {},
            "servers": {
              "server": [
                {
                  "address": "8.8.8.8",
                  "config": {
                    "address": "8.8.8.8"
                  },
                  "state": {
                    "address": "8.8.8.8"
                  }
                },
                {
                  "address": "1.1.1.1",
                  "config": {
                    "address": "1.1.1.1"
                  },
                  "state": {
                    "address": "1.1.1.1"
                  }
                }
              ]
            },
            "state": {
              "search": [
                "example.com"
              ]
            }
          }
        }
      }
    ]
  }
]

Implement EnsureDNS and DeleteDNS for the OpenConfig provider targeting
SR Linux via gNMI. Maps DNSSpec.Domain to /system/dns/config/search and
DNSSpec.Servers to /system/dns/servers/server list. Rejects unsupported
fields (adminState: Down, sourceInterfaceName, vrfName) with explicit
UnsupportedFieldError.

Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
@rgildein rgildein self-assigned this Jul 30, 2026
@rgildein rgildein added the area/switch-automation Automation processes for network switch management and operations. label Jul 30, 2026
@rgildein
rgildein marked this pull request as ready for review August 4, 2026 08:59
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/internal/provider/openconfig 1.05% (+1.05%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/internal/provider/openconfig/dns.go 4.35% (+4.35%) 23 (+23) 1 (+1) 22 (+22) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/ironcore-dev/network-operator/internal/provider/openconfig/dns_test.go

@felix-kaestner felix-kaestner Aug 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we already validate the expected payload through the testdata file in test/gnmi/testdata/openconfig/dns.txt, I think we can just leave out the Payload tests here in this internal/provider/openconfig/ package.

So generally, I would only add a dns_test.go if you really have some logic that you would want to test. One could e.g. add a table driven test func for the validateDNSSpec func, but other than that, I don't see much that would be worth a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations. size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants