Conversation
felix-kaestner
left a comment
There was a problem hiding this comment.
@weneghawi Please have a look at the openconfig-system:system/aaa yang model. Only configurations that are part of this or are otherwise commonly found on all vendors (Nokia, Juniper, Arista & Co.) should be part of the core api. All Cisco NX-OS specific configuration should be refactored into a vendor specific provider config, see e.g. the ManagementAccess resource on how this is done. There is a separate api package for cisco specific CRDs.
Done. The core API (
All Cisco NX-OS specific config has been moved to the |
14c783c to
c4937c1
Compare
ce3748b to
9b58290
Compare
98588a4 to
b202cf6
Compare
5c5f3d9 to
3fb343d
Compare
f177bb2 to
cc8c8bd
Compare
Enable or disable the DHCP feature based on AdminState. When enabled, configure DHCP relay on each referenced interface with the specified server addresses. The provider uses the VRF context from VrfRef (or the NXOS default "!unspecified" if no VRF is specified) when configuring server addresses. The implementation uses the Update operation to ensure stale DHCP relay entries are removed when the configuration changes. This also affects entries referencing interfaces not managed by the operator. The entire tree is removed on deletion, affecting non-managed interfaces., It leaves the DHCP feature in its current state. GetDHCPRelayStatus queries the device for all interfaces with DHCP relay configured and returns their names.
cc8c8bd to
9e64d28
Compare
AAA TACACS/RADIUS gNMI Testing
Device: Baseline Readgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
get --path 'System/fm-items/tacacsplus-items' \
--path 'System/userext-items/authrealm-items/defaultauth-items' \
--path 'System/userext-items/authrealm-items/consoleauth-items' \
--path 'System/userext-items/tacacsext-items'Result: TACACS disabled, all auth TACACSEnable featuregnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/fm-items/tacacsplus-items/adminSt' \
--update-value '"enabled"'Add servergnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/tacacsext-items/tacacsplusprovider-items/TacacsPlusProvider-list[name=192.0.2.1]' \
--update-value '{"name":"192.0.2.1","port":49,"keyEnc":"7","key":"testkey","timeout":5}'Create server groupgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/tacacsext-items/tacacsplusprovidergroup-items/TacacsPlusProviderGroup-list[name=test-group]' \
--update-value '{"name":"test-group","providerref-items":{"ProviderRef-list":[{"name":"192.0.2.1"}]}}'Cleanup# Clear providerGroup reference first (required before group delete)
gnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/authrealm-items/defaultauth-items' \
--update-value '{"realm":"local","providerGroup":"","fallback":"yes","local":"yes"}'
gnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --delete 'System/userext-items/tacacsext-items/tacacsplusprovidergroup-items/TacacsPlusProviderGroup-list[name=test-group]' \
--delete 'System/userext-items/tacacsext-items/tacacsplusprovider-items/TacacsPlusProvider-list[name=192.0.2.1]'
gnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/fm-items/tacacsplus-items/adminSt' \
--update-value '"disabled"'All operations: ✅ RADIUSAdd servergnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/radiusext-items/radiusprovider-items/RadiusProvider-list[name=192.0.2.2]' \
--update-value '{"name":"192.0.2.2","authPort":1812,"acctPort":1813,"keyEnc":"7","key":"testkey","timeout":5}'Create server groupgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/radiusext-items/radiusprovidergroup-items/RadiusProviderGroup-list[name=test-radius-group]' \
--update-value '{"name":"test-radius-group","providerref-items":{"ProviderRef-list":[{"name":"192.0.2.2"}]}}'Cleanupgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --delete 'System/userext-items/radiusext-items/radiusprovidergroup-items/RadiusProviderGroup-list[name=test-radius-group]' \
--delete 'System/userext-items/radiusext-items/radiusprovider-items/RadiusProvider-list[name=192.0.2.2]'All operations: ✅ AAA Authorizationgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/authrealm-items/defaultauthor-items/DefaultAuthor-list[cmdType=config]' \
--update-value '{"cmdType":"config","localRbac":true}'Result: ✅ — NX-OS correctly populates read-only AAA Accountinggnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/authrealm-items/defaultacc-items' \
--update-value '{"realm":"local","localRbac":true}'Result: ✅ AAA Console Authgnmic -a localhost:9339 -u mooapi -p '***' --skip-verify \
set --update-path 'System/userext-items/authrealm-items/consoleauth-items' \
--update-value '{"realm":"local","fallback":"yes","local":"yes"}'Result: ✅ Notes
|
28c67ae to
a0af584
Compare
a0af584 to
9847dac
Compare
| Port int32 `json:"port,omitempty"` | ||
| Key string `json:"key,omitempty"` | ||
| KeyEnc string `json:"keyEnc,omitempty"` | ||
| Timeout int32 `json:"timeout,omitempty"` | ||
| Retries int32 `json:"retries,omitempty"` | ||
| AuthProtocol string `json:"authProtocol,omitempty"` |
There was a problem hiding this comment.
When using omitempty, please be sure that this value is really not present by default in the YANG payload. Otherwise, this can cause the diff of gnmiext to fail and thus trigger a gnmi call on every reconcilation. So when these fields have a default value, the omitempty should be omitted. Please check the YANG model for this.
2d9df38 to
1f8f646
Compare
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
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
|
Summary
Restructured the core AAA API to align with the OpenConfig
system/aaaYANG model, making it vendor-agnostic and suitable for multi-vendor support (Nokia, Juniper, Arista, etc.). All Cisco NX-OS specific configuration has been moved to a dedicatedAAAConfigprovider CRD. RADIUS server group support has been added alongside the existing TACACS+ implementation.Core API Changes (
api/core/v1alpha1/aaa_types.go)TACACSServers+TACACSGroupwithServerGroups []AAAServerGroup— protocol-agnostic containers with nested servers, following OpenConfig/system/aaa/server-groups/server-group. Supports bothTACACSandRADIUSgroup types.AAAServerRADIUSstruct withauthPort(default 1812),acctPort(default 1813), andkeySecretRefAuthentication,Authorization, andAccountingto simple method lists (removed NX-OS specific nesting likeLogin.Default/ConsoleandConfigCommands)VRF->VrfName,SourceInterface->SourceInterfaceName(leaves room for future object references)KeyEncryption,LoginErrorEnablemoved to CiscoAAAConfigCRDserverGroups,authentication,authorization, oraccountingmust be settacacsconfigradiusconfiggroupNameis required when method type isGroupdeviceRefis immutableCisco AAAConfig CRD (
api/cisco/nx/v1alpha1/aaaconfig_types.go)ConsoleAuthentication *NXOSMethodList— NX-OS:aaa authentication login consoleConfigCommandsAuthorization *NXOSMethodList— NX-OS:aaa authorization config-commands defaultRADIUSKeyEncryptiontype (Type6/Type7/Clear) withradiusKeyEncryptionfield (default Type7)KeyEncryption(Type6/Type7/Clear) andLoginErrorEnableController (
internal/controller/core/aaa_controller.go)ServerGroups[].Servers[].TACACS.KeySecretRefandServerGroups[].Servers[].RADIUS.KeySecretRefsecretToAAAwatch mapping to trigger reconciliation on changes to both TACACS and RADIUS key secretsNX-OS Provider (
internal/provider/cisco/nxos/)RadiusProvider,RadiusProviderGroup,RadiusProviderRefNX-OS DME structs. AddedMapRADIUSKeyEncryptionhelper. AddedgroupTypeByNameandMapRealmFromGroupto correctly resolve realm as"radius"or"tacacs"based on the referenced server group type. Removed read-onlyNameandRealmfields fromAAADefaultAuthor(NX-OS rejects writes to these). AddedMapNXOSRealm,MapNXOSLocal,MapNXOSFallbackhelpers. Note: RADIUS on NX-OS requires no feature flag (unlike TACACS+ which requiresfeature tacacs+).EnsureAAAto iterateServerGroupswith aswitchon group type covering both TACACS and RADIUS. RewroteDeleteAAAwith batched resets and RADIUS group/server cleanup. Changed fromPatchtoUpdate(netconf replace).Sample YAML (
config/samples/networking_v1alpha1_aaa.yaml)serverGroups, nestedservers, flat method lists, and separate CiscoAAAConfigwith console/config-commands authorization.Test Plan
go build ./...— compiles cleanlygo test ./api/... ./internal/provider/... ./internal/clientutil/...— all passmake run-golangci-lint— 0 issuesmake generate— CRDs and deepcopy regeneratedradius