@sentriflow/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +86 -0
  3. package/package.json +60 -0
  4. package/src/constants.ts +77 -0
  5. package/src/engine/RuleExecutor.ts +256 -0
  6. package/src/engine/Runner.ts +312 -0
  7. package/src/engine/SandboxedExecutor.ts +208 -0
  8. package/src/errors.ts +88 -0
  9. package/src/helpers/arista/helpers.ts +1220 -0
  10. package/src/helpers/arista/index.ts +12 -0
  11. package/src/helpers/aruba/helpers.ts +637 -0
  12. package/src/helpers/aruba/index.ts +13 -0
  13. package/src/helpers/cisco/helpers.ts +534 -0
  14. package/src/helpers/cisco/index.ts +11 -0
  15. package/src/helpers/common/helpers.ts +265 -0
  16. package/src/helpers/common/index.ts +5 -0
  17. package/src/helpers/common/validation.ts +280 -0
  18. package/src/helpers/cumulus/helpers.ts +676 -0
  19. package/src/helpers/cumulus/index.ts +12 -0
  20. package/src/helpers/extreme/helpers.ts +422 -0
  21. package/src/helpers/extreme/index.ts +12 -0
  22. package/src/helpers/fortinet/helpers.ts +892 -0
  23. package/src/helpers/fortinet/index.ts +12 -0
  24. package/src/helpers/huawei/helpers.ts +790 -0
  25. package/src/helpers/huawei/index.ts +11 -0
  26. package/src/helpers/index.ts +53 -0
  27. package/src/helpers/juniper/helpers.ts +756 -0
  28. package/src/helpers/juniper/index.ts +12 -0
  29. package/src/helpers/mikrotik/helpers.ts +722 -0
  30. package/src/helpers/mikrotik/index.ts +12 -0
  31. package/src/helpers/nokia/helpers.ts +856 -0
  32. package/src/helpers/nokia/index.ts +11 -0
  33. package/src/helpers/paloalto/helpers.ts +939 -0
  34. package/src/helpers/paloalto/index.ts +12 -0
  35. package/src/helpers/vyos/helpers.ts +429 -0
  36. package/src/helpers/vyos/index.ts +12 -0
  37. package/src/index.ts +30 -0
  38. package/src/json-rules/ExpressionEvaluator.ts +292 -0
  39. package/src/json-rules/HelperRegistry.ts +177 -0
  40. package/src/json-rules/JsonRuleCompiler.ts +339 -0
  41. package/src/json-rules/JsonRuleValidator.ts +371 -0
  42. package/src/json-rules/index.ts +97 -0
  43. package/src/json-rules/schema.json +350 -0
  44. package/src/json-rules/types.ts +303 -0
  45. package/src/pack-loader/PackLoader.ts +332 -0
  46. package/src/pack-loader/index.ts +17 -0
  47. package/src/pack-loader/types.ts +135 -0
  48. package/src/parser/IncrementalParser.ts +527 -0
  49. package/src/parser/Sanitizer.ts +104 -0
  50. package/src/parser/SchemaAwareParser.ts +504 -0
  51. package/src/parser/VendorSchema.ts +72 -0
  52. package/src/parser/vendors/arista-eos.ts +206 -0
  53. package/src/parser/vendors/aruba-aoscx.ts +123 -0
  54. package/src/parser/vendors/aruba-aosswitch.ts +113 -0
  55. package/src/parser/vendors/aruba-wlc.ts +173 -0
  56. package/src/parser/vendors/cisco-ios.ts +110 -0
  57. package/src/parser/vendors/cisco-nxos.ts +107 -0
  58. package/src/parser/vendors/cumulus-linux.ts +161 -0
  59. package/src/parser/vendors/extreme-exos.ts +154 -0
  60. package/src/parser/vendors/extreme-voss.ts +167 -0
  61. package/src/parser/vendors/fortinet-fortigate.ts +217 -0
  62. package/src/parser/vendors/huawei-vrp.ts +192 -0
  63. package/src/parser/vendors/index.ts +1521 -0
  64. package/src/parser/vendors/juniper-junos.ts +230 -0
  65. package/src/parser/vendors/mikrotik-routeros.ts +274 -0
  66. package/src/parser/vendors/nokia-sros.ts +251 -0
  67. package/src/parser/vendors/paloalto-panos.ts +264 -0
  68. package/src/parser/vendors/vyos-vyos.ts +454 -0
  69. package/src/types/ConfigNode.ts +72 -0
  70. package/src/types/DeclarativeRule.ts +158 -0
  71. package/src/types/IRule.ts +270 -0
@@ -0,0 +1,206 @@
1
+ // packages/core/src/parser/vendors/arista-eos.ts
2
+
3
+ import type { VendorSchema } from '../VendorSchema';
4
+
5
+ /**
6
+ * Arista EOS (Extensible Operating System) configuration schema.
7
+ *
8
+ * Arista EOS is heavily based on Cisco IOS-like syntax but includes
9
+ * unique features and constructs specific to Arista switches:
10
+ *
11
+ * - **MLAG (Multi-Chassis Link Aggregation)**: peer-link, domain-id
12
+ * - **VXLAN**: vxlan vni, vxlan flood vtep
13
+ * - **eAPI**: management api http-commands
14
+ * - **Daemon**: custom daemon configurations
15
+ * - **Event-handler**: event-driven automation
16
+ * - **CVX (CloudVision Exchange)**: CVX service integration
17
+ * - **Traffic policies**: hardware counters, queuing
18
+ *
19
+ * Configuration structure:
20
+ * - Uses indentation-based hierarchy (like Cisco IOS)
21
+ * - '!' serves as comment marker and section delimiter
22
+ * - exit/end commands to close blocks
23
+ * - No braces for hierarchy
24
+ *
25
+ * Example config:
26
+ * ```
27
+ * hostname arista-leaf-01
28
+ * !
29
+ * interface Ethernet1
30
+ * description Uplink to Spine
31
+ * mtu 9214
32
+ * no switchport
33
+ * ip address 10.0.0.1/30
34
+ * !
35
+ * mlag configuration
36
+ * domain-id MLAG_DOMAIN
37
+ * local-interface Vlan4094
38
+ * peer-address 10.0.0.2
39
+ * peer-link Port-Channel1
40
+ * !
41
+ * ```
42
+ */
43
+ export const AristaEOSSchema: VendorSchema = {
44
+ id: 'arista-eos',
45
+ name: 'Arista EOS',
46
+ useBraceHierarchy: false,
47
+
48
+ commentPatterns: [/^!/],
49
+ sectionDelimiter: '!',
50
+
51
+ blockStarters: [
52
+ // ============ DEPTH 0: Top-level blocks ============
53
+
54
+ // Interface blocks (all interface types)
55
+ { pattern: /^interface\s+\S+/i, depth: 0 },
56
+
57
+ // Routing protocols
58
+ { pattern: /^router\s+(?!router-id)\S+/i, depth: 0 },
59
+
60
+ // VLAN configuration
61
+ { pattern: /^vlan\s+\d+/i, depth: 0 },
62
+
63
+ // ACL and Security
64
+ { pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
65
+ { pattern: /^ipv6\s+access-list\s+\S+/i, depth: 0 },
66
+ { pattern: /^mac\s+access-list\s+\S+/i, depth: 0 },
67
+ { pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
68
+ { pattern: /^ipv6\s+prefix-list\s+\S+/i, depth: 0 },
69
+ { pattern: /^route-map\s+\S+/i, depth: 0 },
70
+ { pattern: /^as-path\s+access-list\s+\S+/i, depth: 0 },
71
+ { pattern: /^community-list\s+\S+/i, depth: 0 },
72
+
73
+ // QoS
74
+ { pattern: /^class-map\s+\S+/i, depth: 0 },
75
+ { pattern: /^policy-map\s+\S+/i, depth: 0 },
76
+ { pattern: /^control-plane/i, depth: 0 },
77
+
78
+ // Line and management
79
+ { pattern: /^line\s+(vty|console)\s+\S+/i, depth: 0 },
80
+ { pattern: /^line\s+\d+/i, depth: 0 },
81
+
82
+ // AAA
83
+ { pattern: /^aaa\s+\S+/i, depth: 0 },
84
+ { pattern: /^tacacs-server\s+\S+/i, depth: 0 },
85
+ { pattern: /^radius-server\s+\S+/i, depth: 0 },
86
+
87
+ // VRF
88
+ { pattern: /^vrf\s+instance\s+\S+/i, depth: 0 },
89
+ { pattern: /^vrf\s+definition\s+\S+/i, depth: 0 },
90
+ { pattern: /^ip\s+routing\s+vrf\s+\S+/i, depth: 0 },
91
+
92
+ // ============ Arista-specific top-level blocks ============
93
+
94
+ // MLAG configuration
95
+ { pattern: /^mlag\s+configuration/i, depth: 0 },
96
+
97
+ // VXLAN configuration
98
+ { pattern: /^interface\s+Vxlan\d*/i, depth: 0 },
99
+
100
+ // Management API (eAPI)
101
+ { pattern: /^management\s+api\s+\S+/i, depth: 0 },
102
+ { pattern: /^management\s+ssh/i, depth: 0 },
103
+ { pattern: /^management\s+telnet/i, depth: 0 },
104
+ { pattern: /^management\s+security/i, depth: 0 },
105
+ { pattern: /^management\s+console/i, depth: 0 },
106
+ { pattern: /^management\s+cvx/i, depth: 0 },
107
+
108
+ // Daemon configuration
109
+ { pattern: /^daemon\s+\S+/i, depth: 0 },
110
+
111
+ // Event handler
112
+ { pattern: /^event-handler\s+\S+/i, depth: 0 },
113
+
114
+ // CVX (CloudVision Exchange)
115
+ { pattern: /^cvx/i, depth: 0 },
116
+
117
+ // Spanning tree
118
+ { pattern: /^spanning-tree\s+\S+/i, depth: 0 },
119
+
120
+ // Port-channel
121
+ { pattern: /^port-channel\s+\S+/i, depth: 0 },
122
+
123
+ // Monitor session (SPAN)
124
+ { pattern: /^monitor\s+session\s+\S+/i, depth: 0 },
125
+
126
+ // Tap aggregation
127
+ { pattern: /^tap\s+aggregation/i, depth: 0 },
128
+
129
+ // Traffic policy
130
+ { pattern: /^traffic-policy\s+\S+/i, depth: 0 },
131
+
132
+ // Peer filter
133
+ { pattern: /^peer-filter\s+\S+/i, depth: 0 },
134
+
135
+ // Hardware counters
136
+ { pattern: /^hardware\s+counter\s+\S+/i, depth: 0 },
137
+
138
+ // Queue monitor
139
+ { pattern: /^queue-monitor\s+\S+/i, depth: 0 },
140
+
141
+ // SFlow
142
+ { pattern: /^sflow\s+\S*/i, depth: 0 },
143
+
144
+ // LLDP
145
+ { pattern: /^lldp\s+\S*/i, depth: 0 },
146
+
147
+ // BFD
148
+ { pattern: /^bfd/i, depth: 0 },
149
+
150
+ // PTP (Precision Time Protocol)
151
+ { pattern: /^ptp/i, depth: 0 },
152
+
153
+ // MPLS
154
+ { pattern: /^mpls\s+\S+/i, depth: 0 },
155
+
156
+ // IP virtual-router
157
+ { pattern: /^ip\s+virtual-router\s+\S+/i, depth: 0 },
158
+
159
+ // Multicast
160
+ { pattern: /^ip\s+multicast-routing/i, depth: 0 },
161
+ { pattern: /^ip\s+pim\s+\S+/i, depth: 0 },
162
+ { pattern: /^ip\s+igmp\s+snooping/i, depth: 0 },
163
+
164
+ // EVPN
165
+ { pattern: /^router\s+bgp\s+\d+/i, depth: 0 },
166
+
167
+ // Loopback, SVI, Port-Channel interfaces
168
+ { pattern: /^interface\s+Loopback\d+/i, depth: 0 },
169
+ { pattern: /^interface\s+Vlan\d+/i, depth: 0 },
170
+ { pattern: /^interface\s+Port-Channel\d+/i, depth: 0 },
171
+ { pattern: /^interface\s+Management\d+/i, depth: 0 },
172
+
173
+ // Other common blocks
174
+ { pattern: /^key\s+chain\s+\S+/i, depth: 0 },
175
+ { pattern: /^track\s+\d+/i, depth: 0 },
176
+ { pattern: /^ip\s+sla\s+\d+/i, depth: 0 },
177
+ { pattern: /^snmp-server\s+\S+/i, depth: 0 },
178
+ { pattern: /^banner\s+(motd|login|exec)/i, depth: 0 },
179
+ { pattern: /^logging\s+\S+/i, depth: 0 },
180
+ { pattern: /^ntp\s+\S+/i, depth: 0 },
181
+
182
+ // ============ DEPTH 1: Inside routing protocols ============
183
+
184
+ { pattern: /^address-family\s+\S+/i, depth: 1 },
185
+ { pattern: /^vrf\s+\S+/i, depth: 1 },
186
+ { pattern: /^neighbor\s+\S+/i, depth: 1 },
187
+ { pattern: /^network\s+\S+/i, depth: 1 },
188
+ { pattern: /^class\s+\S+/i, depth: 1 },
189
+ { pattern: /^redistribute\s+\S+/i, depth: 1 },
190
+
191
+ // EVPN address family
192
+ { pattern: /^address-family\s+evpn/i, depth: 1 },
193
+
194
+ // ============ DEPTH 2: Inside address-family ============
195
+
196
+ { pattern: /^neighbor\s+\S+\s+activate/i, depth: 2 },
197
+ { pattern: /^neighbor\s+\S+\s+\S+/i, depth: 2 },
198
+ ],
199
+
200
+ blockEnders: [
201
+ /^exit-address-family$/i,
202
+ /^exit-vrf$/i,
203
+ /^exit$/i,
204
+ /^end$/i,
205
+ ],
206
+ };
@@ -0,0 +1,123 @@
1
+ // packages/core/src/parser/vendors/aruba-aoscx.ts
2
+
3
+ import type { VendorSchema } from '../VendorSchema';
4
+
5
+ /**
6
+ * Aruba AOS-CX configuration schema.
7
+ *
8
+ * AOS-CX is used on modern Aruba CX series switches (6100, 6200, 6300, 8xxx).
9
+ * It uses a Cisco-like indent-based hierarchy with '!' as comment/delimiter.
10
+ *
11
+ * Key characteristics:
12
+ * - Interface naming: slot/member/port format (e.g., 1/1/1, 1/1/2)
13
+ * - VLAN interfaces: interface vlan 100
14
+ * - LAGs: interface lag 100
15
+ * - Port configuration: vlan access/trunk commands under interface
16
+ *
17
+ * Configuration structure:
18
+ * - Top-level: interface, vlan, router, vrf, access-list, etc.
19
+ * - Nested: address-family inside router protocols
20
+ */
21
+ export const ArubaAOSCXSchema: VendorSchema = {
22
+ id: 'aruba-aoscx',
23
+ name: 'Aruba AOS-CX',
24
+ useBraceHierarchy: false,
25
+
26
+ commentPatterns: [/^!/],
27
+ sectionDelimiter: '!',
28
+
29
+ blockStarters: [
30
+ // ============ DEPTH 0: Top-level blocks ============
31
+
32
+ // Physical interfaces (slot/member/port format)
33
+ { pattern: /^interface\s+\d+\/\d+\/\d+/i, depth: 0 },
34
+
35
+ // VLAN interfaces
36
+ { pattern: /^interface\s+vlan\s*\d+/i, depth: 0 },
37
+
38
+ // LAG interfaces
39
+ { pattern: /^interface\s+lag\s*\d+/i, depth: 0 },
40
+
41
+ // Loopback interfaces
42
+ { pattern: /^interface\s+loopback\s*\d+/i, depth: 0 },
43
+
44
+ // Management interface
45
+ { pattern: /^interface\s+mgmt/i, depth: 0 },
46
+
47
+ // VLAN definitions
48
+ { pattern: /^vlan\s+\d+/i, depth: 0 },
49
+
50
+ // VRF definitions
51
+ { pattern: /^vrf\s+\S+/i, depth: 0 },
52
+
53
+ // Routing protocols
54
+ { pattern: /^router\s+ospf\s+\d+/i, depth: 0 },
55
+ { pattern: /^router\s+ospfv3\s+\d+/i, depth: 0 },
56
+ { pattern: /^router\s+bgp\s+\d+/i, depth: 0 },
57
+
58
+ // Access lists and prefix lists
59
+ { pattern: /^access-list\s+ip\s+\S+/i, depth: 0 },
60
+ { pattern: /^access-list\s+ipv6\s+\S+/i, depth: 0 },
61
+ { pattern: /^access-list\s+mac\s+\S+/i, depth: 0 },
62
+ { pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
63
+
64
+ // Route maps
65
+ { pattern: /^route-map\s+\S+/i, depth: 0 },
66
+
67
+ // AAA configuration
68
+ { pattern: /^aaa\s+authentication\s+\S+/i, depth: 0 },
69
+ { pattern: /^aaa\s+authorization\s+\S+/i, depth: 0 },
70
+ { pattern: /^aaa\s+accounting\s+\S+/i, depth: 0 },
71
+ { pattern: /^aaa\s+group\s+server\s+\S+/i, depth: 0 },
72
+
73
+ // RADIUS/TACACS+
74
+ { pattern: /^radius-server\s+host\s+\S+/i, depth: 0 },
75
+ { pattern: /^tacacs-server\s+host\s+\S+/i, depth: 0 },
76
+
77
+ // SNMP
78
+ { pattern: /^snmp-server\s+\S+/i, depth: 0 },
79
+
80
+ // Spanning tree
81
+ { pattern: /^spanning-tree\s+\S+/i, depth: 0 },
82
+
83
+ // QoS
84
+ { pattern: /^qos\s+\S+/i, depth: 0 },
85
+ { pattern: /^class\s+\S+/i, depth: 0 },
86
+ { pattern: /^policy\s+\S+/i, depth: 0 },
87
+
88
+ // VSX (Virtual Switching Extension)
89
+ { pattern: /^vsx\s*$/i, depth: 0 },
90
+ { pattern: /^vsx-sync\s+\S+/i, depth: 0 },
91
+
92
+ // User accounts
93
+ { pattern: /^user\s+\S+/i, depth: 0 },
94
+
95
+ // SSH configuration
96
+ { pattern: /^ssh\s+\S+/i, depth: 0 },
97
+
98
+ // NTP
99
+ { pattern: /^ntp\s+\S+/i, depth: 0 },
100
+
101
+ // Logging
102
+ { pattern: /^logging\s+\S+/i, depth: 0 },
103
+
104
+ // DHCP
105
+ { pattern: /^dhcp-server\s+\S+/i, depth: 0 },
106
+
107
+ // ============ DEPTH 1: Inside routing protocols ============
108
+
109
+ { pattern: /^address-family\s+\S+/i, depth: 1 },
110
+ { pattern: /^area\s+\S+/i, depth: 1 },
111
+ { pattern: /^neighbor\s+\S+/i, depth: 1 },
112
+
113
+ // ============ DEPTH 2: Inside address-family ============
114
+
115
+ { pattern: /^vrf\s+\S+/i, depth: 2 },
116
+ ],
117
+
118
+ blockEnders: [
119
+ /^exit-address-family$/i,
120
+ /^exit-vrf$/i,
121
+ /^exit$/i,
122
+ ],
123
+ };
@@ -0,0 +1,113 @@
1
+ // packages/core/src/parser/vendors/aruba-aosswitch.ts
2
+
3
+ import type { VendorSchema } from '../VendorSchema';
4
+
5
+ /**
6
+ * Aruba AOS-Switch (ProVision) configuration schema.
7
+ *
8
+ * AOS-Switch is used on legacy ProCurve/Aruba switches (2530, 2930, 3810, etc.).
9
+ * It uses a VLAN-centric configuration model where ports are assigned to VLANs
10
+ * rather than VLANs being assigned to ports.
11
+ *
12
+ * Key characteristics:
13
+ * - VLAN-centric: VLANs contain port lists with tagged/untagged designations
14
+ * - Port ranges: 1-24, 25-48, A1-A24 (for stacking)
15
+ * - Trunks: LAG configuration using 'trunk' command
16
+ * - Comments: Both ';' and '!' can be comments
17
+ *
18
+ * Configuration structure:
19
+ * - VLANs are the primary configuration unit
20
+ * - Ports are referenced within VLAN definitions
21
+ * - Less hierarchical than Cisco/AOS-CX
22
+ */
23
+ export const ArubaAOSSwitchSchema: VendorSchema = {
24
+ id: 'aruba-aosswitch',
25
+ name: 'Aruba AOS-Switch (ProVision)',
26
+ useBraceHierarchy: false,
27
+
28
+ commentPatterns: [/^;/, /^!/],
29
+ sectionDelimiter: undefined, // Uses 'exit' to end blocks
30
+
31
+ blockStarters: [
32
+ // ============ DEPTH 0: Top-level blocks ============
33
+
34
+ // VLAN definitions (primary configuration unit)
35
+ { pattern: /^vlan\s+\d+/i, depth: 0 },
36
+
37
+ // Interface configuration (less common, but supported)
38
+ { pattern: /^interface\s+\S+/i, depth: 0 },
39
+
40
+ // Trunk (LAG) configuration
41
+ { pattern: /^trunk\s+\S+/i, depth: 0 },
42
+
43
+ // Spanning tree configuration
44
+ { pattern: /^spanning-tree\s+\S+/i, depth: 0 },
45
+
46
+ // Routing protocols
47
+ { pattern: /^router\s+ospf\s*\d*/i, depth: 0 },
48
+ { pattern: /^router\s+rip/i, depth: 0 },
49
+
50
+ // IP routing
51
+ { pattern: /^ip\s+route\s+\S+/i, depth: 0 },
52
+ { pattern: /^ip\s+routing/i, depth: 0 },
53
+
54
+ // RADIUS/TACACS+ servers
55
+ { pattern: /^radius-server\s+\S+/i, depth: 0 },
56
+ { pattern: /^tacacs-server\s+\S+/i, depth: 0 },
57
+
58
+ // AAA configuration
59
+ { pattern: /^aaa\s+\S+/i, depth: 0 },
60
+
61
+ // Port access (802.1X)
62
+ { pattern: /^aaa\s+port-access\s+\S+/i, depth: 0 },
63
+
64
+ // SNMP configuration
65
+ { pattern: /^snmp-server\s+\S+/i, depth: 0 },
66
+
67
+ // Console configuration
68
+ { pattern: /^console\s+\S+/i, depth: 0 },
69
+
70
+ // Telnet/SSH configuration
71
+ { pattern: /^telnet-server\s+\S+/i, depth: 0 },
72
+ { pattern: /^ip\s+ssh\s*$/i, depth: 0 },
73
+
74
+ // Time/NTP configuration
75
+ { pattern: /^timesync\s+\S+/i, depth: 0 },
76
+ { pattern: /^sntp\s+\S+/i, depth: 0 },
77
+
78
+ // Logging configuration
79
+ { pattern: /^logging\s+\S+/i, depth: 0 },
80
+
81
+ // Manager/Operator passwords
82
+ { pattern: /^password\s+\S+/i, depth: 0 },
83
+
84
+ // Access control lists
85
+ { pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
86
+
87
+ // IGMP/Multicast
88
+ { pattern: /^igmp\s+\S+/i, depth: 0 },
89
+
90
+ // LLDP
91
+ { pattern: /^lldp\s+\S+/i, depth: 0 },
92
+
93
+ // Loop protection
94
+ { pattern: /^loop-protect\s+\S+/i, depth: 0 },
95
+
96
+ // QoS
97
+ { pattern: /^qos\s+\S+/i, depth: 0 },
98
+
99
+ // DHCP snooping
100
+ { pattern: /^dhcp-snooping\s*$/i, depth: 0 },
101
+
102
+ // Banner
103
+ { pattern: /^banner\s+\S+/i, depth: 0 },
104
+
105
+ // ============ DEPTH 1: Nested blocks (rare in AOS-Switch) ============
106
+
107
+ { pattern: /^area\s+\S+/i, depth: 1 },
108
+ ],
109
+
110
+ blockEnders: [
111
+ /^exit$/i,
112
+ ],
113
+ };
@@ -0,0 +1,173 @@
1
+ // packages/core/src/parser/vendors/aruba-wlc.ts
2
+
3
+ import type { VendorSchema } from '../VendorSchema';
4
+
5
+ /**
6
+ * Aruba ArubaOS WLC (Wireless LAN Controller) configuration schema.
7
+ *
8
+ * ArubaOS is used on Aruba Mobility Controllers (7xxx, 9xxx series) and
9
+ * Mobility Masters. It uses a profile-based architecture with hierarchical
10
+ * configuration.
11
+ *
12
+ * Key characteristics:
13
+ * - Profile-based: WLAN profiles, AAA profiles, AP groups, RF profiles
14
+ * - Quoted names: Profile names use double quotes (e.g., "Corp-SSID")
15
+ * - Context-based: Configuration blocks with '!' delimiters
16
+ * - Inheritance: Profiles reference other profiles
17
+ *
18
+ * Configuration structure:
19
+ * - WLAN SSID profiles define wireless network settings
20
+ * - Virtual-AP profiles combine SSID + AAA + other settings
21
+ * - AP groups apply virtual-APs to sets of access points
22
+ * - AAA profiles define authentication/authorization
23
+ */
24
+ export const ArubaWLCSchema: VendorSchema = {
25
+ id: 'aruba-wlc',
26
+ name: 'Aruba ArubaOS WLC',
27
+ useBraceHierarchy: false,
28
+
29
+ commentPatterns: [/^!/],
30
+ sectionDelimiter: '!',
31
+
32
+ blockStarters: [
33
+ // ============ DEPTH 0: Top-level profile blocks ============
34
+
35
+ // WLAN SSID profiles
36
+ { pattern: /^wlan\s+ssid-profile\s+"[^"]+"/i, depth: 0 },
37
+ { pattern: /^wlan\s+ssid-profile\s+\S+/i, depth: 0 },
38
+
39
+ // WLAN Virtual-AP profiles (combine SSID + AAA)
40
+ { pattern: /^wlan\s+virtual-ap\s+"[^"]+"/i, depth: 0 },
41
+ { pattern: /^wlan\s+virtual-ap\s+\S+/i, depth: 0 },
42
+
43
+ // WLAN handoff profile
44
+ { pattern: /^wlan\s+handoff-profile\s+"[^"]+"/i, depth: 0 },
45
+ { pattern: /^wlan\s+handoff-profile\s+\S+/i, depth: 0 },
46
+
47
+ // WLAN HT/VHT SSID profile
48
+ { pattern: /^wlan\s+ht-ssid-profile\s+"[^"]+"/i, depth: 0 },
49
+ { pattern: /^wlan\s+ht-ssid-profile\s+\S+/i, depth: 0 },
50
+
51
+ // AAA profiles
52
+ { pattern: /^aaa\s+profile\s+"[^"]+"/i, depth: 0 },
53
+ { pattern: /^aaa\s+profile\s+\S+/i, depth: 0 },
54
+
55
+ // AAA authentication servers
56
+ { pattern: /^aaa\s+authentication-server\s+radius\s+"[^"]+"/i, depth: 0 },
57
+ { pattern: /^aaa\s+authentication-server\s+radius\s+\S+/i, depth: 0 },
58
+ { pattern: /^aaa\s+authentication-server\s+tacacs\s+"[^"]+"/i, depth: 0 },
59
+ { pattern: /^aaa\s+authentication-server\s+tacacs\s+\S+/i, depth: 0 },
60
+ { pattern: /^aaa\s+authentication-server\s+ldap\s+"[^"]+"/i, depth: 0 },
61
+ { pattern: /^aaa\s+authentication-server\s+ldap\s+\S+/i, depth: 0 },
62
+
63
+ // AAA server groups
64
+ { pattern: /^aaa\s+server-group\s+"[^"]+"/i, depth: 0 },
65
+ { pattern: /^aaa\s+server-group\s+\S+/i, depth: 0 },
66
+
67
+ // AAA authentication (method lists)
68
+ { pattern: /^aaa\s+authentication\s+\S+/i, depth: 0 },
69
+
70
+ // AP groups
71
+ { pattern: /^ap-group\s+"[^"]+"/i, depth: 0 },
72
+ { pattern: /^ap-group\s+\S+/i, depth: 0 },
73
+
74
+ // AP name (specific AP config)
75
+ { pattern: /^ap-name\s+"[^"]+"/i, depth: 0 },
76
+ { pattern: /^ap-name\s+\S+/i, depth: 0 },
77
+
78
+ // AP system profile
79
+ { pattern: /^ap\s+system-profile\s+"[^"]+"/i, depth: 0 },
80
+ { pattern: /^ap\s+system-profile\s+\S+/i, depth: 0 },
81
+
82
+ // RF profiles (ARM, dot11a, dot11g)
83
+ { pattern: /^rf\s+arm-profile\s+"[^"]+"/i, depth: 0 },
84
+ { pattern: /^rf\s+arm-profile\s+\S+/i, depth: 0 },
85
+ { pattern: /^rf\s+dot11a-radio-profile\s+"[^"]+"/i, depth: 0 },
86
+ { pattern: /^rf\s+dot11a-radio-profile\s+\S+/i, depth: 0 },
87
+ { pattern: /^rf\s+dot11g-radio-profile\s+"[^"]+"/i, depth: 0 },
88
+ { pattern: /^rf\s+dot11g-radio-profile\s+\S+/i, depth: 0 },
89
+ { pattern: /^rf\s+ht-radio-profile\s+"[^"]+"/i, depth: 0 },
90
+ { pattern: /^rf\s+ht-radio-profile\s+\S+/i, depth: 0 },
91
+
92
+ // User roles
93
+ { pattern: /^user-role\s+"[^"]+"/i, depth: 0 },
94
+ { pattern: /^user-role\s+\S+/i, depth: 0 },
95
+
96
+ // Netdestination (network object groups)
97
+ { pattern: /^netdestination\s+\S+/i, depth: 0 },
98
+ { pattern: /^netdestination6\s+\S+/i, depth: 0 },
99
+
100
+ // IP access lists
101
+ { pattern: /^ip\s+access-list\s+session\s+\S+/i, depth: 0 },
102
+ { pattern: /^ip\s+access-list\s+eth\s+\S+/i, depth: 0 },
103
+ { pattern: /^ip\s+access-list\s+extended\s+\S+/i, depth: 0 },
104
+ { pattern: /^ip\s+access-list\s+standard\s+\S+/i, depth: 0 },
105
+
106
+ // Controller interfaces
107
+ { pattern: /^interface\s+\S+/i, depth: 0 },
108
+
109
+ // VLANs
110
+ { pattern: /^vlan\s+\d+/i, depth: 0 },
111
+ { pattern: /^vlan-name\s+\S+/i, depth: 0 },
112
+
113
+ // VLAN pool
114
+ { pattern: /^vlan-pool\s+"[^"]+"/i, depth: 0 },
115
+ { pattern: /^vlan-pool\s+\S+/i, depth: 0 },
116
+
117
+ // Controller IP
118
+ { pattern: /^controller-ip\s+\S+/i, depth: 0 },
119
+
120
+ // IDS profile
121
+ { pattern: /^ids\s+\S+-profile\s+"[^"]+"/i, depth: 0 },
122
+ { pattern: /^ids\s+\S+-profile\s+\S+/i, depth: 0 },
123
+
124
+ // Firewall policies
125
+ { pattern: /^firewall\s+\S+/i, depth: 0 },
126
+
127
+ // Captive portal profile
128
+ { pattern: /^aaa\s+captive-portal\s+"[^"]+"/i, depth: 0 },
129
+ { pattern: /^aaa\s+captive-portal\s+\S+/i, depth: 0 },
130
+
131
+ // Regulatory domain
132
+ { pattern: /^regulatory-domain-profile\s+"[^"]+"/i, depth: 0 },
133
+ { pattern: /^regulatory-domain-profile\s+\S+/i, depth: 0 },
134
+
135
+ // Mesh cluster profile
136
+ { pattern: /^mesh\s+cluster-profile\s+"[^"]+"/i, depth: 0 },
137
+ { pattern: /^mesh\s+cluster-profile\s+\S+/i, depth: 0 },
138
+
139
+ // SNMP configuration
140
+ { pattern: /^snmp-server\s+\S+/i, depth: 0 },
141
+
142
+ // NTP
143
+ { pattern: /^ntp\s+\S+/i, depth: 0 },
144
+
145
+ // Logging
146
+ { pattern: /^logging\s+\S+/i, depth: 0 },
147
+
148
+ // ============ DEPTH 1: Nested within profiles ============
149
+
150
+ // Authentication methods within AAA profiles
151
+ { pattern: /^authentication-\S+/i, depth: 1 },
152
+
153
+ // References within virtual-AP
154
+ { pattern: /^ssid-profile\s+"[^"]+"/i, depth: 1 },
155
+ { pattern: /^ssid-profile\s+\S+/i, depth: 1 },
156
+ { pattern: /^aaa-profile\s+"[^"]+"/i, depth: 1 },
157
+ { pattern: /^aaa-profile\s+\S+/i, depth: 1 },
158
+
159
+ // Dot1x within AAA
160
+ { pattern: /^dot1x-\S+/i, depth: 1 },
161
+
162
+ // Server references within server-group
163
+ { pattern: /^auth-server\s+\S+/i, depth: 1 },
164
+
165
+ // ============ DEPTH 2: Deeply nested ============
166
+
167
+ { pattern: /^server\s+\S+/i, depth: 2 },
168
+ ],
169
+
170
+ blockEnders: [
171
+ /^exit$/i,
172
+ ],
173
+ };