Skip to content

Commit c4937c1

Browse files
committed
Restructure AAA API to OpenConfig system/aaa model
1 parent e6166b0 commit c4937c1

40 files changed

Lines changed: 1085 additions & 745 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
import (
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
9+
"github.com/ironcore-dev/network-operator/api/core/v1alpha1"
10+
)
11+
12+
// +kubebuilder:rbac:groups=nx.cisco.networking.metal.ironcore.dev,resources=aaaconfigs,verbs=get;list;watch
13+
14+
// AAAConfigSpec defines the desired state of AAAConfig
15+
type AAAConfigSpec struct {
16+
// LoginErrorEnable enables login error messages (NX-OS specific).
17+
// Maps to: aaa authentication login error-enable
18+
// +optional
19+
LoginErrorEnable bool `json:"loginErrorEnable,omitempty"`
20+
21+
// KeyEncryption specifies the default encryption type for TACACS+ keys.
22+
// +kubebuilder:validation:Enum=Type6;Type7;Clear
23+
// +kubebuilder:default=Type7
24+
KeyEncryption TACACSKeyEncryption `json:"keyEncryption,omitempty"`
25+
26+
// ConsoleAuthentication defines NX-OS console-specific authentication methods.
27+
// Maps to: aaa authentication login console <methods>
28+
// +optional
29+
ConsoleAuthentication *NXOSMethodList `json:"consoleAuthentication,omitempty"`
30+
31+
// ConfigCommandsAuthorization defines NX-OS config-commands authorization methods.
32+
// Maps to: aaa authorization config-commands default <methods>
33+
// +optional
34+
ConfigCommandsAuthorization *NXOSMethodList `json:"configCommandsAuthorization,omitempty"`
35+
}
36+
37+
// TACACSKeyEncryption defines the encryption type for TACACS+ server keys.
38+
// +kubebuilder:validation:Enum=Type6;Type7;Clear
39+
type TACACSKeyEncryption string
40+
41+
const (
42+
// TACACSKeyEncryptionType6 uses AES encryption (more secure).
43+
TACACSKeyEncryptionType6 TACACSKeyEncryption = "Type6"
44+
// TACACSKeyEncryptionType7 uses Cisco Type 7 encryption (reversible).
45+
TACACSKeyEncryptionType7 TACACSKeyEncryption = "Type7"
46+
// TACACSKeyEncryptionClear sends the key in cleartext.
47+
TACACSKeyEncryptionClear TACACSKeyEncryption = "Clear"
48+
)
49+
50+
// NXOSMethodList defines an ordered list of AAA methods for NX-OS specific contexts.
51+
type NXOSMethodList struct {
52+
// Methods is the ordered list of methods.
53+
// +required
54+
// +listType=atomic
55+
// +kubebuilder:validation:MinItems=1
56+
// +kubebuilder:validation:MaxItems=4
57+
Methods []NXOSMethod `json:"methods"`
58+
}
59+
60+
// NXOSMethod represents a single AAA method in an NX-OS context.
61+
type NXOSMethod struct {
62+
// Type is the method type.
63+
// +required
64+
// +kubebuilder:validation:Enum=Group;Local;None
65+
Type string `json:"type"`
66+
67+
// GroupName is the server group name when Type is Group.
68+
// +optional
69+
// +kubebuilder:validation:MaxLength=63
70+
GroupName string `json:"groupName,omitempty"`
71+
}
72+
73+
// +kubebuilder:object:root=true
74+
// +kubebuilder:resource:path=aaaconfigs
75+
// +kubebuilder:resource:singular=aaaconfig
76+
// +kubebuilder:resource:shortName=nxaaa
77+
78+
// AAAConfig is the Schema for the aaaconfigs API
79+
type AAAConfig struct {
80+
metav1.TypeMeta `json:",inline"`
81+
metav1.ObjectMeta `json:"metadata,omitempty"`
82+
83+
// Specification of the desired state of the resource.
84+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
85+
// +required
86+
Spec AAAConfigSpec `json:"spec"`
87+
}
88+
89+
// +kubebuilder:object:root=true
90+
91+
// AAAConfigList contains a list of AAAConfig
92+
type AAAConfigList struct {
93+
metav1.TypeMeta `json:",inline"`
94+
metav1.ListMeta `json:"metadata,omitempty"`
95+
Items []AAAConfig `json:"items"`
96+
}
97+
98+
func init() {
99+
v1alpha1.RegisterAAADependency(GroupVersion.WithKind("AAAConfig"))
100+
SchemeBuilder.Register(&AAAConfig{}, &AAAConfigList{})
101+
}

api/cisco/nx/v1alpha1/zz_generated.deepcopy.go

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)