Improve PID and Versioning Node Data Retrieval#55
Conversation
There was a problem hiding this comment.
apologies - I renamed this file in the previous merge :-o
| return nil | ||
| } | ||
|
|
||
| func (d *XEDriver) fetchDeviceInfo(ctx context.Context) *common.DeviceInfo { |
There was a problem hiding this comment.
I wonder now if openconfig is the way to go or not. We can't use it for anything else, and now I see the code we either accept the one-off JSON parsing pattern or import a bunch of openconfig YANG models and bindings. Do we know what the alternative 'native' model would be? Maybe that is better supported across cisco XE (driver scope) devices and suit our needs better?
For example these two seem to return something useful for both c8kv and c9k and possibly contains everything we need?:
/restconf/data/Cisco-IOS-XE-device-hardware-oper:device-hardware-data
There was a problem hiding this comment.
I shifted (for this version) across to the native model, unfortunately, it still populates the version field as a large string which requires regexp parsing:
"device-system-data": {
"current-time": "2026-02-06T14:39:00+00:00",
"boot-time": "2026-02-05T19:54:23+00:00",
"software-version": "Cisco IOS Software [IOSXE], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 17.18.2, RELEASE SOFTWARE (fc3)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2025 by Cisco Systems, Inc.\nCompiled Fri 19-Dec-25 03:36 by mcpre",
"rommon-version": "IOS-XE ROMMON",
"last-reboot-reason": "Reload Command",
"reason-severity": "normal",
"unsaved-config": true,
"reload-history-support": [null],
"reload-history": {
"rl-history": [
{
"reload-category": "rc-rld",
"reload-desc": "Reload Command",
"reload-time": "2026-02-05T19:54:36+00:00",
"reload-severity": "normal",
"sw-ver": "",
"ha-role": "ha-role-unknown",
"crash-data-file": ""
}
],
"fru-type": "device-hardware-fru-rp",
"fru-id": 0
},
"mac-address": "34:73:2d:81:67:80"
}
}
}
}
cmd/virtual-kubelet/root.go
Outdated
| "syscall" | ||
|
|
||
| "github.com/cisco/virtual-kubelet-cisco/internal/config" | ||
| "github.com/cisco/virtual-kubelet-cisco/internal/drivers" |
There was a problem hiding this comment.
by design, i don' think we should be importing driver code here. Could we provide a skeleton device info and then update once the provider initialises the driver? We need to do this anyway for node lifecycle maintenance. We currently have an unimplemented nodeProvider that I suspect caters for this.
803d8ba to
5aad77a
Compare
PR Comment Review SummaryBased on my review of PR #55 ( Comment 1: File Rename ConflictAuthor: @cunningr Status: ✅ ADDRESSED Comment 2: Use Native YANG Model Instead of OpenConfigAuthor: @cunningr Status: ✅ ADDRESSED err := d.client.Get(ctx, "/restconf/data/Cisco-IOS-XE-device-hardware-oper:device-hardware-data", &resp, json.Unmarshal)Comment 3: Remove Driver Import from root.goAuthor: @cunningr Status: ✅ ADDRESSED
Comment 4: Version String ParsingAuthor: @joshhalley (your response to comment 2) Status: ✅ ADDRESSED func parseVersionNumber(fullVersion string) string {
re := regexp.MustCompile(`Version\s+(\d+\.\d+\.\d+)`)
matches := re.FindStringSubmatch(fullVersion)
if len(matches) > 1 {
return matches[1]
}
return fullVersion
}Summary@cunningr the branch is ready for re-review and merge after pushing the rebased changes. |
internal/provider/defaults.go
Outdated
| OSImage: "Cisco IOSXE", | ||
| KernelVersion: "__cisco_ios__", | ||
| ContainerRuntimeVersion: "cisco.app.hosting", | ||
| Architecture: "amd64", |
There was a problem hiding this comment.
I wonder if we should make this obvious that if we failed to populate this with proper information, we add values to indicate this information is bogus, like: "version_unknown" etc.
|
Adjusted driver pattern, and further references in node outputs to be more representative (see below): @cunningr - a ygot struct for XE-native would be helpful if you can share one |
|
@joshhalley you can rebase off of this branch -> cunningr/models-update |
d769ef6 to
cbf9bde
Compare
|
Confirmed functionality with suggested enrichments: |
Description
This PR enhances the Kubernetes node information for Cisco IOS-XE devices by dynamically fetching device details from the network device at initialization time using RESTCONF and the
openconfig-platformYANG model. Addressing issue #51 .Changes:
/restconf/data/openconfig-platform:componentsduring CheckConnectionsoftware-versionstring to extract just the numeric version (e.g.,17.18.2)MachineID/SystemUUID→ Device serial numberKernelVersion→ IOS-XE version numberOSImage→Cisco IOS-XE <ProductID>Before:
After:
Test Results
Node and Pod details are populating correctly during provision:
Type of Change
Checklist
Files Changed (6):
deviceInfoto node spec