@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.
- package/LICENSE +190 -0
- package/README.md +86 -0
- package/package.json +60 -0
- package/src/constants.ts +77 -0
- package/src/engine/RuleExecutor.ts +256 -0
- package/src/engine/Runner.ts +312 -0
- package/src/engine/SandboxedExecutor.ts +208 -0
- package/src/errors.ts +88 -0
- package/src/helpers/arista/helpers.ts +1220 -0
- package/src/helpers/arista/index.ts +12 -0
- package/src/helpers/aruba/helpers.ts +637 -0
- package/src/helpers/aruba/index.ts +13 -0
- package/src/helpers/cisco/helpers.ts +534 -0
- package/src/helpers/cisco/index.ts +11 -0
- package/src/helpers/common/helpers.ts +265 -0
- package/src/helpers/common/index.ts +5 -0
- package/src/helpers/common/validation.ts +280 -0
- package/src/helpers/cumulus/helpers.ts +676 -0
- package/src/helpers/cumulus/index.ts +12 -0
- package/src/helpers/extreme/helpers.ts +422 -0
- package/src/helpers/extreme/index.ts +12 -0
- package/src/helpers/fortinet/helpers.ts +892 -0
- package/src/helpers/fortinet/index.ts +12 -0
- package/src/helpers/huawei/helpers.ts +790 -0
- package/src/helpers/huawei/index.ts +11 -0
- package/src/helpers/index.ts +53 -0
- package/src/helpers/juniper/helpers.ts +756 -0
- package/src/helpers/juniper/index.ts +12 -0
- package/src/helpers/mikrotik/helpers.ts +722 -0
- package/src/helpers/mikrotik/index.ts +12 -0
- package/src/helpers/nokia/helpers.ts +856 -0
- package/src/helpers/nokia/index.ts +11 -0
- package/src/helpers/paloalto/helpers.ts +939 -0
- package/src/helpers/paloalto/index.ts +12 -0
- package/src/helpers/vyos/helpers.ts +429 -0
- package/src/helpers/vyos/index.ts +12 -0
- package/src/index.ts +30 -0
- package/src/json-rules/ExpressionEvaluator.ts +292 -0
- package/src/json-rules/HelperRegistry.ts +177 -0
- package/src/json-rules/JsonRuleCompiler.ts +339 -0
- package/src/json-rules/JsonRuleValidator.ts +371 -0
- package/src/json-rules/index.ts +97 -0
- package/src/json-rules/schema.json +350 -0
- package/src/json-rules/types.ts +303 -0
- package/src/pack-loader/PackLoader.ts +332 -0
- package/src/pack-loader/index.ts +17 -0
- package/src/pack-loader/types.ts +135 -0
- package/src/parser/IncrementalParser.ts +527 -0
- package/src/parser/Sanitizer.ts +104 -0
- package/src/parser/SchemaAwareParser.ts +504 -0
- package/src/parser/VendorSchema.ts +72 -0
- package/src/parser/vendors/arista-eos.ts +206 -0
- package/src/parser/vendors/aruba-aoscx.ts +123 -0
- package/src/parser/vendors/aruba-aosswitch.ts +113 -0
- package/src/parser/vendors/aruba-wlc.ts +173 -0
- package/src/parser/vendors/cisco-ios.ts +110 -0
- package/src/parser/vendors/cisco-nxos.ts +107 -0
- package/src/parser/vendors/cumulus-linux.ts +161 -0
- package/src/parser/vendors/extreme-exos.ts +154 -0
- package/src/parser/vendors/extreme-voss.ts +167 -0
- package/src/parser/vendors/fortinet-fortigate.ts +217 -0
- package/src/parser/vendors/huawei-vrp.ts +192 -0
- package/src/parser/vendors/index.ts +1521 -0
- package/src/parser/vendors/juniper-junos.ts +230 -0
- package/src/parser/vendors/mikrotik-routeros.ts +274 -0
- package/src/parser/vendors/nokia-sros.ts +251 -0
- package/src/parser/vendors/paloalto-panos.ts +264 -0
- package/src/parser/vendors/vyos-vyos.ts +454 -0
- package/src/types/ConfigNode.ts +72 -0
- package/src/types/DeclarativeRule.ts +158 -0
- package/src/types/IRule.ts +270 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// packages/core/src/parser/vendors/cisco-ios.ts
|
|
2
|
+
|
|
3
|
+
import type { VendorSchema } from '../VendorSchema';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cisco IOS/IOS-XE configuration schema.
|
|
7
|
+
*
|
|
8
|
+
* Cisco IOS uses indentation-based hierarchy with specific exit commands
|
|
9
|
+
* for nested blocks like address-family. The '!' character serves as
|
|
10
|
+
* both a comment marker and section delimiter.
|
|
11
|
+
*
|
|
12
|
+
* Configuration structure:
|
|
13
|
+
* - Top-level: interface, router, vlan, access-list, etc.
|
|
14
|
+
* - Nested: address-family inside router bgp/ospf
|
|
15
|
+
* - Deeply nested: vrf inside address-family
|
|
16
|
+
*/
|
|
17
|
+
export const CiscoIOSSchema: VendorSchema = {
|
|
18
|
+
id: 'cisco-ios',
|
|
19
|
+
name: 'Cisco IOS/IOS-XE',
|
|
20
|
+
useBraceHierarchy: false,
|
|
21
|
+
|
|
22
|
+
commentPatterns: [/^!/],
|
|
23
|
+
sectionDelimiter: '!',
|
|
24
|
+
|
|
25
|
+
blockStarters: [
|
|
26
|
+
// ============ DEPTH 0: Top-level blocks ============
|
|
27
|
+
|
|
28
|
+
// Interface blocks
|
|
29
|
+
{ pattern: /^interface\s+\S+/i, depth: 0 },
|
|
30
|
+
|
|
31
|
+
// Routing protocol blocks
|
|
32
|
+
{ pattern: /^router\s+(?!router-id)\S+/i, depth: 0 },
|
|
33
|
+
|
|
34
|
+
// VLAN and L2
|
|
35
|
+
{ pattern: /^vlan\s+\d+/i, depth: 0 },
|
|
36
|
+
|
|
37
|
+
// ACL and Security
|
|
38
|
+
{ pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
|
|
39
|
+
{ pattern: /^access-list\s+\S+/i, depth: 0 },
|
|
40
|
+
{ pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
|
|
41
|
+
{ pattern: /^route-map\s+\S+/i, depth: 0 },
|
|
42
|
+
{ pattern: /^crypto\s+map\s+\S+/i, depth: 0 },
|
|
43
|
+
{ pattern: /^crypto\s+isakmp\s+\S+/i, depth: 0 },
|
|
44
|
+
{ pattern: /^crypto\s+ipsec\s+\S+/i, depth: 0 },
|
|
45
|
+
{ pattern: /^crypto\s+pki\s+\S+/i, depth: 0 },
|
|
46
|
+
|
|
47
|
+
// QoS
|
|
48
|
+
{ pattern: /^class-map\s+\S+/i, depth: 0 },
|
|
49
|
+
{ pattern: /^policy-map\s+\S+/i, depth: 0 },
|
|
50
|
+
|
|
51
|
+
// Line and management
|
|
52
|
+
{ pattern: /^line\s+(vty|console|aux)\s+\S+/i, depth: 0 },
|
|
53
|
+
{ pattern: /^line\s+\d+/i, depth: 0 },
|
|
54
|
+
|
|
55
|
+
// Object groups (ASA/IOS)
|
|
56
|
+
{ pattern: /^object-group\s+\S+/i, depth: 0 },
|
|
57
|
+
{ pattern: /^object\s+\S+/i, depth: 0 },
|
|
58
|
+
|
|
59
|
+
// AAA
|
|
60
|
+
{ pattern: /^aaa\s+group\s+server\s+\S+/i, depth: 0 },
|
|
61
|
+
|
|
62
|
+
// Voice
|
|
63
|
+
{ pattern: /^dial-peer\s+voice\s+\S+/i, depth: 0 },
|
|
64
|
+
{ pattern: /^voice\s+register\s+\S+/i, depth: 0 },
|
|
65
|
+
{ pattern: /^telephony-service/i, depth: 0 },
|
|
66
|
+
{ pattern: /^ephone-dn\s+\S+/i, depth: 0 },
|
|
67
|
+
{ pattern: /^ephone\s+\S+/i, depth: 0 },
|
|
68
|
+
|
|
69
|
+
// VRF
|
|
70
|
+
{ pattern: /^ip\s+vrf\s+\S+/i, depth: 0 },
|
|
71
|
+
{ pattern: /^vrf\s+definition\s+\S+/i, depth: 0 },
|
|
72
|
+
|
|
73
|
+
// Other common blocks
|
|
74
|
+
{ pattern: /^key\s+chain\s+\S+/i, depth: 0 },
|
|
75
|
+
{ pattern: /^track\s+\d+/i, depth: 0 },
|
|
76
|
+
{ pattern: /^redundancy/i, depth: 0 },
|
|
77
|
+
{ pattern: /^controller\s+\S+/i, depth: 0 },
|
|
78
|
+
{ pattern: /^archive/i, depth: 0 },
|
|
79
|
+
{ pattern: /^ip\s+sla\s+\d+/i, depth: 0 },
|
|
80
|
+
{ pattern: /^tacacs\s+server\s+\S+/i, depth: 0 },
|
|
81
|
+
{ pattern: /^radius\s+server\s+\S+/i, depth: 0 },
|
|
82
|
+
{ pattern: /^snmp-server\s+view\s+\S+/i, depth: 0 },
|
|
83
|
+
{ pattern: /^banner\s+(motd|login|exec)/i, depth: 0 },
|
|
84
|
+
{ pattern: /^control-plane/i, depth: 0 },
|
|
85
|
+
{ pattern: /^ip\s+ips\s+signature-category/i, depth: 0 },
|
|
86
|
+
|
|
87
|
+
// ============ DEPTH 1: Inside routing protocols ============
|
|
88
|
+
|
|
89
|
+
{ pattern: /^address-family\s+\S+/i, depth: 1 },
|
|
90
|
+
{ pattern: /^af-interface\s+\S+/i, depth: 1 },
|
|
91
|
+
{ pattern: /^topology\s+\S+/i, depth: 1 },
|
|
92
|
+
{ pattern: /^service-family\s+\S+/i, depth: 1 },
|
|
93
|
+
{ pattern: /^class\s+\S+/i, depth: 1 },
|
|
94
|
+
{ pattern: /^category\s+\S+/i, depth: 1 },
|
|
95
|
+
|
|
96
|
+
// ============ DEPTH 2: Inside address-family ============
|
|
97
|
+
|
|
98
|
+
{ pattern: /^vrf\s+\S+/i, depth: 2 },
|
|
99
|
+
],
|
|
100
|
+
|
|
101
|
+
blockEnders: [
|
|
102
|
+
/^exit-address-family$/i,
|
|
103
|
+
/^exit-af-interface$/i,
|
|
104
|
+
/^exit-af-topology$/i,
|
|
105
|
+
/^exit-service-family$/i,
|
|
106
|
+
/^exit-sf-topology$/i,
|
|
107
|
+
/^exit-vrf$/i,
|
|
108
|
+
/^exit$/i,
|
|
109
|
+
],
|
|
110
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// packages/core/src/parser/vendors/cisco-nxos.ts
|
|
2
|
+
|
|
3
|
+
import type { VendorSchema } from '../VendorSchema';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cisco NX-OS configuration schema.
|
|
7
|
+
*
|
|
8
|
+
* NX-OS (Nexus Operating System) is used on Cisco Nexus data center switches.
|
|
9
|
+
* It shares similarities with IOS but has unique features:
|
|
10
|
+
* - Feature-based activation (feature bgp, feature ospf)
|
|
11
|
+
* - VDC (Virtual Device Context) support
|
|
12
|
+
* - Different VRF syntax (vrf member vs ip vrf)
|
|
13
|
+
* - Role-based CLI
|
|
14
|
+
*
|
|
15
|
+
* Configuration structure follows IOS patterns but with NX-OS extensions.
|
|
16
|
+
*/
|
|
17
|
+
export const CiscoNXOSSchema: VendorSchema = {
|
|
18
|
+
id: 'cisco-nxos',
|
|
19
|
+
name: 'Cisco NX-OS',
|
|
20
|
+
useBraceHierarchy: false,
|
|
21
|
+
|
|
22
|
+
commentPatterns: [/^!/],
|
|
23
|
+
sectionDelimiter: '!',
|
|
24
|
+
|
|
25
|
+
blockStarters: [
|
|
26
|
+
// ============ DEPTH 0: Top-level blocks (NX-OS specific) ============
|
|
27
|
+
|
|
28
|
+
// NX-OS specific features
|
|
29
|
+
{ pattern: /^feature\s+\S+/i, depth: 0 },
|
|
30
|
+
{ pattern: /^vdc\s+\S+/i, depth: 0 },
|
|
31
|
+
{ pattern: /^install\s+feature-set\s+\S+/i, depth: 0 },
|
|
32
|
+
|
|
33
|
+
// Port-channel and vPC (NX-OS specific)
|
|
34
|
+
{ pattern: /^vpc\s+domain\s+\d+/i, depth: 0 },
|
|
35
|
+
|
|
36
|
+
// FabricPath (NX-OS specific)
|
|
37
|
+
{ pattern: /^fabricpath\s+domain\s+\S+/i, depth: 0 },
|
|
38
|
+
|
|
39
|
+
// OTV (Overlay Transport Virtualization)
|
|
40
|
+
{ pattern: /^otv\s+site-identifier\s+\S+/i, depth: 0 },
|
|
41
|
+
|
|
42
|
+
// Interface blocks (same as IOS)
|
|
43
|
+
{ pattern: /^interface\s+\S+/i, depth: 0 },
|
|
44
|
+
|
|
45
|
+
// Routing protocol blocks
|
|
46
|
+
{ pattern: /^router\s+(?!router-id)\S+/i, depth: 0 },
|
|
47
|
+
|
|
48
|
+
// VLAN
|
|
49
|
+
{ pattern: /^vlan\s+\d+/i, depth: 0 },
|
|
50
|
+
|
|
51
|
+
// ACL (NX-OS uses similar syntax)
|
|
52
|
+
{ pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
|
|
53
|
+
{ pattern: /^ipv6\s+access-list\s+\S+/i, depth: 0 },
|
|
54
|
+
{ pattern: /^mac\s+access-list\s+\S+/i, depth: 0 },
|
|
55
|
+
|
|
56
|
+
// Route-map and prefix-list
|
|
57
|
+
{ pattern: /^route-map\s+\S+/i, depth: 0 },
|
|
58
|
+
{ pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
|
|
59
|
+
{ pattern: /^ipv6\s+prefix-list\s+\S+/i, depth: 0 },
|
|
60
|
+
|
|
61
|
+
// QoS (NX-OS Modular QoS CLI)
|
|
62
|
+
{ pattern: /^class-map\s+\S+/i, depth: 0 },
|
|
63
|
+
{ pattern: /^policy-map\s+\S+/i, depth: 0 },
|
|
64
|
+
|
|
65
|
+
// Line and management
|
|
66
|
+
{ pattern: /^line\s+(vty|console)\s+\S+/i, depth: 0 },
|
|
67
|
+
|
|
68
|
+
// AAA
|
|
69
|
+
{ pattern: /^aaa\s+group\s+server\s+\S+/i, depth: 0 },
|
|
70
|
+
|
|
71
|
+
// VRF definition (NX-OS style)
|
|
72
|
+
{ pattern: /^vrf\s+context\s+\S+/i, depth: 0 },
|
|
73
|
+
|
|
74
|
+
// Zone-based firewall
|
|
75
|
+
{ pattern: /^zone\s+\S+/i, depth: 0 },
|
|
76
|
+
|
|
77
|
+
// Control plane
|
|
78
|
+
{ pattern: /^control-plane/i, depth: 0 },
|
|
79
|
+
|
|
80
|
+
// Spanning tree (MST configuration)
|
|
81
|
+
{ pattern: /^spanning-tree\s+mst\s+configuration/i, depth: 0 },
|
|
82
|
+
|
|
83
|
+
// Role-based CLI
|
|
84
|
+
{ pattern: /^role\s+name\s+\S+/i, depth: 0 },
|
|
85
|
+
|
|
86
|
+
// SNMP server
|
|
87
|
+
{ pattern: /^snmp-server\s+user\s+\S+/i, depth: 0 },
|
|
88
|
+
|
|
89
|
+
// ============ DEPTH 1: Inside routing protocols ============
|
|
90
|
+
|
|
91
|
+
{ pattern: /^address-family\s+\S+/i, depth: 1 },
|
|
92
|
+
{ pattern: /^vrf\s+member\s+\S+/i, depth: 1 },
|
|
93
|
+
{ pattern: /^template\s+peer\s+\S+/i, depth: 1 },
|
|
94
|
+
{ pattern: /^neighbor\s+\S+/i, depth: 1 },
|
|
95
|
+
{ pattern: /^class\s+\S+/i, depth: 1 },
|
|
96
|
+
|
|
97
|
+
// ============ DEPTH 2: Inside address-family ============
|
|
98
|
+
|
|
99
|
+
// Note: NX-OS uses different VRF nesting than IOS
|
|
100
|
+
],
|
|
101
|
+
|
|
102
|
+
blockEnders: [
|
|
103
|
+
/^exit-address-family$/i,
|
|
104
|
+
/^exit-vrf$/i,
|
|
105
|
+
/^exit$/i,
|
|
106
|
+
],
|
|
107
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// packages/core/src/parser/vendors/cumulus-linux.ts
|
|
2
|
+
|
|
3
|
+
import type { VendorSchema } from '../VendorSchema';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NVIDIA Cumulus Linux configuration schema.
|
|
7
|
+
*
|
|
8
|
+
* Cumulus Linux is a Linux-based network operating system that supports
|
|
9
|
+
* multiple configuration formats:
|
|
10
|
+
*
|
|
11
|
+
* 1. NCLU (Network Command Line Utility) - Legacy CLI (Cumulus 3.x-4.x)
|
|
12
|
+
* - Commands: net add, net del, net commit
|
|
13
|
+
* - Example: "net add interface swp1 ip address 10.0.0.1/24"
|
|
14
|
+
*
|
|
15
|
+
* 2. NVUE (NVIDIA User Experience) - Modern CLI (Cumulus 5.x+)
|
|
16
|
+
* - Commands: nv set, nv unset, nv config apply
|
|
17
|
+
* - Example: "nv set interface swp1 ip address 10.0.0.1/24"
|
|
18
|
+
*
|
|
19
|
+
* 3. /etc/network/interfaces - Debian ifupdown2 format
|
|
20
|
+
* - Stanzas: auto, iface, bridge-ports, bridge-vids
|
|
21
|
+
* - Example:
|
|
22
|
+
* auto swp1
|
|
23
|
+
* iface swp1
|
|
24
|
+
* address 10.0.0.1/24
|
|
25
|
+
*
|
|
26
|
+
* 4. /etc/frr/frr.conf - FRR routing daemon (Cisco-like syntax)
|
|
27
|
+
* - Blocks: router bgp, router ospf, interface
|
|
28
|
+
* - Example:
|
|
29
|
+
* router bgp 65001
|
|
30
|
+
* bgp router-id 10.0.0.1
|
|
31
|
+
* neighbor swp1 interface remote-as external
|
|
32
|
+
*
|
|
33
|
+
* Interface naming conventions:
|
|
34
|
+
* - swp1-swpN: Switch ports (front panel)
|
|
35
|
+
* - eth0: Management interface
|
|
36
|
+
* - lo: Loopback
|
|
37
|
+
* - bridge, br_default: Bridge interfaces
|
|
38
|
+
* - bond0-bondN: Bond/LAG interfaces
|
|
39
|
+
* - vlan10, vlan20: VLAN interfaces (SVIs)
|
|
40
|
+
* - peerlink: MLAG peer link
|
|
41
|
+
*
|
|
42
|
+
* This schema handles:
|
|
43
|
+
* - NCLU/NVUE set-style commands (single line, depth 0)
|
|
44
|
+
* - /etc/network/interfaces stanzas (auto/iface blocks)
|
|
45
|
+
* - FRR routing configuration (router blocks with address-family)
|
|
46
|
+
*/
|
|
47
|
+
export const CumulusLinuxSchema: VendorSchema = {
|
|
48
|
+
id: 'cumulus-linux',
|
|
49
|
+
name: 'NVIDIA Cumulus Linux',
|
|
50
|
+
useBraceHierarchy: false,
|
|
51
|
+
|
|
52
|
+
commentPatterns: [
|
|
53
|
+
/^#/, // Hash comments (interfaces file, FRR, NCLU output)
|
|
54
|
+
/^!/, // Bang comments (FRR style)
|
|
55
|
+
],
|
|
56
|
+
sectionDelimiter: '!',
|
|
57
|
+
|
|
58
|
+
blockStarters: [
|
|
59
|
+
// ============ DEPTH 0: Top-level blocks ============
|
|
60
|
+
|
|
61
|
+
// NCLU commands (net add/del) - single line commands
|
|
62
|
+
{ pattern: /^net\s+add\s+/i, depth: 0 },
|
|
63
|
+
{ pattern: /^net\s+del\s+/i, depth: 0 },
|
|
64
|
+
|
|
65
|
+
// NVUE commands (nv set/unset) - single line commands
|
|
66
|
+
{ pattern: /^nv\s+set\s+/i, depth: 0 },
|
|
67
|
+
{ pattern: /^nv\s+unset\s+/i, depth: 0 },
|
|
68
|
+
{ pattern: /^nv\s+config\s+/i, depth: 0 },
|
|
69
|
+
|
|
70
|
+
// /etc/network/interfaces format (ifupdown2)
|
|
71
|
+
{ pattern: /^auto\s+\S+/i, depth: 0 },
|
|
72
|
+
{ pattern: /^iface\s+\S+/i, depth: 0 },
|
|
73
|
+
{ pattern: /^allow-hotplug\s+\S+/i, depth: 0 },
|
|
74
|
+
{ pattern: /^source\s+/i, depth: 0 },
|
|
75
|
+
{ pattern: /^source-directory\s+/i, depth: 0 },
|
|
76
|
+
|
|
77
|
+
// FRR routing configuration blocks
|
|
78
|
+
{ pattern: /^router\s+bgp\s+\d+/i, depth: 0 },
|
|
79
|
+
{ pattern: /^router\s+ospf/i, depth: 0 },
|
|
80
|
+
{ pattern: /^router\s+ospf6/i, depth: 0 },
|
|
81
|
+
{ pattern: /^router\s+rip/i, depth: 0 },
|
|
82
|
+
{ pattern: /^router\s+ripng/i, depth: 0 },
|
|
83
|
+
{ pattern: /^router\s+isis\s+\S+/i, depth: 0 },
|
|
84
|
+
{ pattern: /^router\s+pim/i, depth: 0 },
|
|
85
|
+
|
|
86
|
+
// FRR global configuration
|
|
87
|
+
{ pattern: /^frr\s+defaults\s+/i, depth: 0 },
|
|
88
|
+
{ pattern: /^frr\s+version\s+/i, depth: 0 },
|
|
89
|
+
{ pattern: /^hostname\s+\S+/i, depth: 0 },
|
|
90
|
+
{ pattern: /^log\s+/i, depth: 0 },
|
|
91
|
+
{ pattern: /^service\s+/i, depth: 0 },
|
|
92
|
+
{ pattern: /^debug\s+/i, depth: 0 },
|
|
93
|
+
{ pattern: /^no\s+debug\s+/i, depth: 0 },
|
|
94
|
+
|
|
95
|
+
// FRR interface configuration
|
|
96
|
+
{ pattern: /^interface\s+\S+/i, depth: 0 },
|
|
97
|
+
|
|
98
|
+
// FRR route-map, prefix-list, access-list
|
|
99
|
+
{ pattern: /^route-map\s+\S+/i, depth: 0 },
|
|
100
|
+
{ pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
|
|
101
|
+
{ pattern: /^ipv6\s+prefix-list\s+\S+/i, depth: 0 },
|
|
102
|
+
{ pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
|
|
103
|
+
{ pattern: /^ip\s+community-list\s+\S+/i, depth: 0 },
|
|
104
|
+
{ pattern: /^ip\s+as-path\s+access-list\s+\S+/i, depth: 0 },
|
|
105
|
+
|
|
106
|
+
// FRR VRF configuration
|
|
107
|
+
{ pattern: /^vrf\s+\S+/i, depth: 0 },
|
|
108
|
+
|
|
109
|
+
// FRR line configuration
|
|
110
|
+
{ pattern: /^line\s+vty/i, depth: 0 },
|
|
111
|
+
|
|
112
|
+
// EVPN configuration
|
|
113
|
+
{ pattern: /^advertise-all-vni/i, depth: 0 },
|
|
114
|
+
|
|
115
|
+
// PBR (Policy Based Routing)
|
|
116
|
+
{ pattern: /^pbr-map\s+\S+/i, depth: 0 },
|
|
117
|
+
{ pattern: /^nexthop-group\s+\S+/i, depth: 0 },
|
|
118
|
+
|
|
119
|
+
// ============ DEPTH 1: Inside router blocks ============
|
|
120
|
+
|
|
121
|
+
// BGP address families
|
|
122
|
+
{ pattern: /^address-family\s+ipv4\s+unicast/i, depth: 1 },
|
|
123
|
+
{ pattern: /^address-family\s+ipv6\s+unicast/i, depth: 1 },
|
|
124
|
+
{ pattern: /^address-family\s+l2vpn\s+evpn/i, depth: 1 },
|
|
125
|
+
{ pattern: /^address-family\s+ipv4\s+vpn/i, depth: 1 },
|
|
126
|
+
{ pattern: /^address-family\s+ipv6\s+vpn/i, depth: 1 },
|
|
127
|
+
{ pattern: /^address-family\s+ipv4\s+labeled-unicast/i, depth: 1 },
|
|
128
|
+
{ pattern: /^address-family\s+ipv6\s+labeled-unicast/i, depth: 1 },
|
|
129
|
+
{ pattern: /^address-family\s+ipv4\s+multicast/i, depth: 1 },
|
|
130
|
+
{ pattern: /^address-family\s+ipv6\s+multicast/i, depth: 1 },
|
|
131
|
+
{ pattern: /^address-family\s+ipv4\s+flowspec/i, depth: 1 },
|
|
132
|
+
{ pattern: /^address-family\s+ipv6\s+flowspec/i, depth: 1 },
|
|
133
|
+
|
|
134
|
+
// BGP neighbor configuration (can be at depth 0 or 1 depending on context)
|
|
135
|
+
{ pattern: /^neighbor\s+\S+\s+/i, depth: 1 },
|
|
136
|
+
|
|
137
|
+
// OSPF area configuration
|
|
138
|
+
{ pattern: /^area\s+\S+/i, depth: 1 },
|
|
139
|
+
|
|
140
|
+
// VRF inside router
|
|
141
|
+
{ pattern: /^vrf\s+\S+/i, depth: 1 },
|
|
142
|
+
|
|
143
|
+
// ============ DEPTH 2: Inside address-family ============
|
|
144
|
+
|
|
145
|
+
// Network statements, redistribute, neighbor activation inside AF
|
|
146
|
+
{ pattern: /^network\s+/i, depth: 2 },
|
|
147
|
+
{ pattern: /^redistribute\s+/i, depth: 2 },
|
|
148
|
+
{ pattern: /^neighbor\s+\S+\s+activate/i, depth: 2 },
|
|
149
|
+
{ pattern: /^neighbor\s+\S+\s+route-map/i, depth: 2 },
|
|
150
|
+
{ pattern: /^neighbor\s+\S+\s+soft-reconfiguration/i, depth: 2 },
|
|
151
|
+
{ pattern: /^advertise-all-vni/i, depth: 2 },
|
|
152
|
+
{ pattern: /^advertise\s+/i, depth: 2 },
|
|
153
|
+
{ pattern: /^vni\s+\d+/i, depth: 2 },
|
|
154
|
+
],
|
|
155
|
+
|
|
156
|
+
blockEnders: [
|
|
157
|
+
/^exit-address-family$/i,
|
|
158
|
+
/^exit-vrf$/i,
|
|
159
|
+
/^exit$/i,
|
|
160
|
+
],
|
|
161
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// packages/core/src/parser/vendors/extreme-exos.ts
|
|
2
|
+
|
|
3
|
+
import type { VendorSchema } from '../VendorSchema';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extreme Networks ExtremeXOS (EXOS) configuration schema.
|
|
7
|
+
*
|
|
8
|
+
* ExtremeXOS uses a flat, command-based configuration syntax where
|
|
9
|
+
* each configuration command is a standalone line. Unlike Cisco-style
|
|
10
|
+
* configs, EXOS uses explicit command keywords (create, configure,
|
|
11
|
+
* enable, disable) rather than indentation-based hierarchy.
|
|
12
|
+
*
|
|
13
|
+
* Key characteristics:
|
|
14
|
+
* - **Flat structure**: Most commands are standalone (create vlan, configure vlan)
|
|
15
|
+
* - **Explicit actions**: Commands start with verbs (create, configure, enable, disable)
|
|
16
|
+
* - **VLAN-centric**: VLANs are named objects, not just numbers
|
|
17
|
+
* - **Port notation**: Uses slot:port format (e.g., 1:1, 2:24)
|
|
18
|
+
* - **Comments**: Lines starting with # are comments
|
|
19
|
+
*
|
|
20
|
+
* Configuration structure:
|
|
21
|
+
* - No true nested blocks (unlike Cisco interface mode)
|
|
22
|
+
* - VLANs, ports, protocols configured with explicit commands
|
|
23
|
+
* - ACLs defined separately and applied to VLANs/ports
|
|
24
|
+
*
|
|
25
|
+
* Example config:
|
|
26
|
+
* ```
|
|
27
|
+
* # Basic EXOS configuration
|
|
28
|
+
* configure snmp sysname "exos-switch-01"
|
|
29
|
+
* create vlan "Management" tag 10
|
|
30
|
+
* configure vlan Management ipaddress 10.0.10.1/24
|
|
31
|
+
* configure vlan Management add ports 1:1-1:4 untagged
|
|
32
|
+
* enable vlan Management
|
|
33
|
+
* enable sharing 1:1 grouping 1:1-1:2 algorithm address-based L3_L4
|
|
34
|
+
* configure sntp-client primary server 10.0.0.1 vr VR-Default
|
|
35
|
+
* enable sntp-client
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const ExtremeEXOSSchema: VendorSchema = {
|
|
39
|
+
id: 'extreme-exos',
|
|
40
|
+
name: 'Extreme Networks EXOS',
|
|
41
|
+
useBraceHierarchy: false,
|
|
42
|
+
|
|
43
|
+
commentPatterns: [/^#/],
|
|
44
|
+
sectionDelimiter: undefined, // EXOS doesn't use section delimiters
|
|
45
|
+
|
|
46
|
+
blockStarters: [
|
|
47
|
+
// ============ DEPTH 0: Top-level blocks ============
|
|
48
|
+
// EXOS is mostly flat, but some constructs can be treated as logical sections
|
|
49
|
+
|
|
50
|
+
// VLAN configuration (virtual block based on VLAN name)
|
|
51
|
+
// Note: These are conceptual groupings, not actual block syntax
|
|
52
|
+
{ pattern: /^create\s+vlan\s+/i, depth: 0 },
|
|
53
|
+
|
|
54
|
+
// Access-list/ACL (can be multi-line with continuation)
|
|
55
|
+
{ pattern: /^create\s+access-list\s+/i, depth: 0 },
|
|
56
|
+
{ pattern: /^configure\s+access-list\s+/i, depth: 0 },
|
|
57
|
+
|
|
58
|
+
// Policy configuration
|
|
59
|
+
{ pattern: /^create\s+policy\s+/i, depth: 0 },
|
|
60
|
+
{ pattern: /^configure\s+policy\s+/i, depth: 0 },
|
|
61
|
+
|
|
62
|
+
// Routing protocols
|
|
63
|
+
{ pattern: /^configure\s+ospf\s+/i, depth: 0 },
|
|
64
|
+
{ pattern: /^configure\s+ospfv3\s+/i, depth: 0 },
|
|
65
|
+
{ pattern: /^configure\s+bgp\s+/i, depth: 0 },
|
|
66
|
+
{ pattern: /^configure\s+rip\s+/i, depth: 0 },
|
|
67
|
+
{ pattern: /^configure\s+ripng\s+/i, depth: 0 },
|
|
68
|
+
{ pattern: /^configure\s+isis\s+/i, depth: 0 },
|
|
69
|
+
{ pattern: /^configure\s+pim\s+/i, depth: 0 },
|
|
70
|
+
{ pattern: /^configure\s+igmp\s+/i, depth: 0 },
|
|
71
|
+
{ pattern: /^configure\s+mld\s+/i, depth: 0 },
|
|
72
|
+
|
|
73
|
+
// Virtual router (VR) configuration
|
|
74
|
+
{ pattern: /^create\s+vr\s+/i, depth: 0 },
|
|
75
|
+
{ pattern: /^configure\s+vr\s+/i, depth: 0 },
|
|
76
|
+
|
|
77
|
+
// LAG/Sharing groups
|
|
78
|
+
{ pattern: /^enable\s+sharing\s+/i, depth: 0 },
|
|
79
|
+
|
|
80
|
+
// Stacking
|
|
81
|
+
{ pattern: /^enable\s+stacking\s+/i, depth: 0 },
|
|
82
|
+
{ pattern: /^configure\s+stacking\s+/i, depth: 0 },
|
|
83
|
+
|
|
84
|
+
// EAPS (Ethernet Automatic Protection Switching)
|
|
85
|
+
{ pattern: /^create\s+eaps\s+/i, depth: 0 },
|
|
86
|
+
{ pattern: /^configure\s+eaps\s+/i, depth: 0 },
|
|
87
|
+
|
|
88
|
+
// STP configuration
|
|
89
|
+
{ pattern: /^configure\s+stp\s+/i, depth: 0 },
|
|
90
|
+
{ pattern: /^configure\s+stpd\s+/i, depth: 0 },
|
|
91
|
+
|
|
92
|
+
// QoS
|
|
93
|
+
{ pattern: /^create\s+qosprofile\s+/i, depth: 0 },
|
|
94
|
+
{ pattern: /^configure\s+qosprofile\s+/i, depth: 0 },
|
|
95
|
+
|
|
96
|
+
// MLAG/MLAG (Multi-chassis LAG)
|
|
97
|
+
{ pattern: /^create\s+mlag\s+peer\s+/i, depth: 0 },
|
|
98
|
+
{ pattern: /^configure\s+mlag\s+peer\s+/i, depth: 0 },
|
|
99
|
+
|
|
100
|
+
// SNMP configuration
|
|
101
|
+
{ pattern: /^configure\s+snmp\s+/i, depth: 0 },
|
|
102
|
+
{ pattern: /^configure\s+snmpv3\s+/i, depth: 0 },
|
|
103
|
+
|
|
104
|
+
// AAA/RADIUS/TACACS
|
|
105
|
+
{ pattern: /^configure\s+radius\s+/i, depth: 0 },
|
|
106
|
+
{ pattern: /^configure\s+tacacs\s+/i, depth: 0 },
|
|
107
|
+
{ pattern: /^configure\s+aaa\s+/i, depth: 0 },
|
|
108
|
+
|
|
109
|
+
// Management
|
|
110
|
+
{ pattern: /^configure\s+management\s+/i, depth: 0 },
|
|
111
|
+
{ pattern: /^configure\s+ssh2\s+/i, depth: 0 },
|
|
112
|
+
{ pattern: /^configure\s+telnet\s+/i, depth: 0 },
|
|
113
|
+
|
|
114
|
+
// SNTP/NTP
|
|
115
|
+
{ pattern: /^configure\s+sntp-client\s+/i, depth: 0 },
|
|
116
|
+
{ pattern: /^configure\s+ntp\s+/i, depth: 0 },
|
|
117
|
+
|
|
118
|
+
// Syslog
|
|
119
|
+
{ pattern: /^configure\s+syslog\s+/i, depth: 0 },
|
|
120
|
+
{ pattern: /^configure\s+log\s+/i, depth: 0 },
|
|
121
|
+
|
|
122
|
+
// Port mirroring
|
|
123
|
+
{ pattern: /^create\s+mirror\s+/i, depth: 0 },
|
|
124
|
+
{ pattern: /^configure\s+mirror\s+/i, depth: 0 },
|
|
125
|
+
|
|
126
|
+
// VLAN stacking (QinQ)
|
|
127
|
+
{ pattern: /^configure\s+vlan\s+\S+\s+add\s+ports\s+/i, depth: 0 },
|
|
128
|
+
|
|
129
|
+
// VPLS
|
|
130
|
+
{ pattern: /^create\s+vpls\s+/i, depth: 0 },
|
|
131
|
+
{ pattern: /^configure\s+vpls\s+/i, depth: 0 },
|
|
132
|
+
|
|
133
|
+
// MPLS
|
|
134
|
+
{ pattern: /^configure\s+mpls\s+/i, depth: 0 },
|
|
135
|
+
|
|
136
|
+
// Port configuration
|
|
137
|
+
{ pattern: /^configure\s+ports?\s+\S+/i, depth: 0 },
|
|
138
|
+
|
|
139
|
+
// VLAN IP address configuration
|
|
140
|
+
{ pattern: /^configure\s+vlan\s+\S+\s+ipaddress\s+/i, depth: 0 },
|
|
141
|
+
|
|
142
|
+
// ============ DEPTH 1: Inside conceptual blocks ============
|
|
143
|
+
// EXOS doesn't really have nested syntax, but some ACL/policy rules
|
|
144
|
+
// can span multiple lines with entry numbers
|
|
145
|
+
|
|
146
|
+
{ pattern: /^entry\s+\d+\s+/i, depth: 1 },
|
|
147
|
+
],
|
|
148
|
+
|
|
149
|
+
blockEnders: [
|
|
150
|
+
// EXOS doesn't have block enders in the traditional sense
|
|
151
|
+
// Commands are standalone
|
|
152
|
+
// Including these for compatibility with the parser
|
|
153
|
+
],
|
|
154
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// packages/core/src/parser/vendors/extreme-voss.ts
|
|
2
|
+
|
|
3
|
+
import type { VendorSchema } from '../VendorSchema';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extreme Networks VOSS (VSP Operating System Software) configuration schema.
|
|
7
|
+
*
|
|
8
|
+
* VOSS is used on Extreme Networks VSP (Virtual Services Platform) switches.
|
|
9
|
+
* It uses a Cisco-like CLI syntax with indentation-based hierarchy and
|
|
10
|
+
* multiple command modes (User EXEC, Privileged EXEC, Global Configuration,
|
|
11
|
+
* Interface Configuration, etc.).
|
|
12
|
+
*
|
|
13
|
+
* Key characteristics:
|
|
14
|
+
* - **Mode-based**: Similar to Cisco IOS with different CLI modes
|
|
15
|
+
* - **Indentation-based hierarchy**: Nested configuration under blocks
|
|
16
|
+
* - **Interface naming**: Uses GigabitEthernet slot/port (e.g., 1/1, 1/2)
|
|
17
|
+
* - **Comments**: Lines starting with # or ! are comments
|
|
18
|
+
* - **VLAN creation**: vlan create <id> type port-mstprstp <instance>
|
|
19
|
+
* - **SPB/SPBM**: Shortest Path Bridging support
|
|
20
|
+
*
|
|
21
|
+
* Configuration structure:
|
|
22
|
+
* - Global Configuration: configure terminal
|
|
23
|
+
* - Interface mode: interface GigabitEthernet 1/1
|
|
24
|
+
* - VLAN mode: vlan create, vlan members
|
|
25
|
+
* - Router mode: router isis, router bgp
|
|
26
|
+
*
|
|
27
|
+
* Example config:
|
|
28
|
+
* ```
|
|
29
|
+
* !
|
|
30
|
+
* ! VOSS Configuration
|
|
31
|
+
* !
|
|
32
|
+
* snmp-server name "vsp-switch-01"
|
|
33
|
+
* !
|
|
34
|
+
* vlan create 10 type port-mstprstp 0
|
|
35
|
+
* vlan create 20 type port-mstprstp 0
|
|
36
|
+
* vlan members 10 1/1-1/4 portmember
|
|
37
|
+
* !
|
|
38
|
+
* interface GigabitEthernet 1/1
|
|
39
|
+
* no shutdown
|
|
40
|
+
* default-vlan-id 10
|
|
41
|
+
* exit
|
|
42
|
+
* !
|
|
43
|
+
* router isis
|
|
44
|
+
* spbm 1 b-vid 4051-4052 primary 4051
|
|
45
|
+
* no shutdown
|
|
46
|
+
* exit
|
|
47
|
+
* !
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const ExtremeVOSSSchema: VendorSchema = {
|
|
51
|
+
id: 'extreme-voss',
|
|
52
|
+
name: 'Extreme Networks VOSS',
|
|
53
|
+
useBraceHierarchy: false,
|
|
54
|
+
|
|
55
|
+
commentPatterns: [/^!/, /^#/],
|
|
56
|
+
sectionDelimiter: '!',
|
|
57
|
+
|
|
58
|
+
blockStarters: [
|
|
59
|
+
// ============ DEPTH 0: Top-level blocks ============
|
|
60
|
+
|
|
61
|
+
// Interface blocks
|
|
62
|
+
{ pattern: /^interface\s+GigabitEthernet\s+\S+/i, depth: 0 },
|
|
63
|
+
{ pattern: /^interface\s+Port-Channel\s+\S+/i, depth: 0 },
|
|
64
|
+
{ pattern: /^interface\s+Loopback\s+\S+/i, depth: 0 },
|
|
65
|
+
{ pattern: /^interface\s+Vlan\s+\d+/i, depth: 0 },
|
|
66
|
+
{ pattern: /^interface\s+mgmtEthernet\s+\S+/i, depth: 0 },
|
|
67
|
+
{ pattern: /^interface\s+mlt\s+\d+/i, depth: 0 },
|
|
68
|
+
|
|
69
|
+
// Routing protocols
|
|
70
|
+
{ pattern: /^router\s+isis/i, depth: 0 },
|
|
71
|
+
{ pattern: /^router\s+bgp\s+\d+/i, depth: 0 },
|
|
72
|
+
{ pattern: /^router\s+ospf/i, depth: 0 },
|
|
73
|
+
{ pattern: /^router\s+rip/i, depth: 0 },
|
|
74
|
+
{ pattern: /^router\s+vrf\s+\S+/i, depth: 0 },
|
|
75
|
+
|
|
76
|
+
// VLAN configuration
|
|
77
|
+
{ pattern: /^vlan\s+create\s+\d+/i, depth: 0 },
|
|
78
|
+
{ pattern: /^vlan\s+i-sid\s+\d+/i, depth: 0 },
|
|
79
|
+
{ pattern: /^vlan\s+members\s+\d+/i, depth: 0 },
|
|
80
|
+
|
|
81
|
+
// MLT (Multi-Link Trunking)
|
|
82
|
+
{ pattern: /^mlt\s+\d+/i, depth: 0 },
|
|
83
|
+
|
|
84
|
+
// LACP
|
|
85
|
+
{ pattern: /^lacp\s+\S+/i, depth: 0 },
|
|
86
|
+
|
|
87
|
+
// SPBM (Shortest Path Bridging MAC)
|
|
88
|
+
{ pattern: /^spbm\s+\d+/i, depth: 0 },
|
|
89
|
+
|
|
90
|
+
// I-SID (Instance Service ID)
|
|
91
|
+
{ pattern: /^i-sid\s+\d+/i, depth: 0 },
|
|
92
|
+
|
|
93
|
+
// IP routing
|
|
94
|
+
{ pattern: /^ip\s+route\s+/i, depth: 0 },
|
|
95
|
+
{ pattern: /^ip\s+prefix-list\s+\S+/i, depth: 0 },
|
|
96
|
+
{ pattern: /^ip\s+route-map\s+\S+/i, depth: 0 },
|
|
97
|
+
|
|
98
|
+
// AAA and Security
|
|
99
|
+
{ pattern: /^aaa\s+\S+/i, depth: 0 },
|
|
100
|
+
{ pattern: /^radius\s+server\s+\S+/i, depth: 0 },
|
|
101
|
+
{ pattern: /^tacacs\s+server\s+\S+/i, depth: 0 },
|
|
102
|
+
|
|
103
|
+
// ACLs
|
|
104
|
+
{ pattern: /^filter\s+acl\s+\S+/i, depth: 0 },
|
|
105
|
+
{ pattern: /^ip\s+access-list\s+\S+/i, depth: 0 },
|
|
106
|
+
{ pattern: /^ipv6\s+access-list\s+\S+/i, depth: 0 },
|
|
107
|
+
|
|
108
|
+
// QoS
|
|
109
|
+
{ pattern: /^qos\s+\S+/i, depth: 0 },
|
|
110
|
+
|
|
111
|
+
// Spanning Tree
|
|
112
|
+
{ pattern: /^spanning-tree\s+\S+/i, depth: 0 },
|
|
113
|
+
|
|
114
|
+
// SNMP
|
|
115
|
+
{ pattern: /^snmp-server\s+\S+/i, depth: 0 },
|
|
116
|
+
|
|
117
|
+
// NTP
|
|
118
|
+
{ pattern: /^ntp\s+server\s+/i, depth: 0 },
|
|
119
|
+
|
|
120
|
+
// Logging
|
|
121
|
+
{ pattern: /^logging\s+\S+/i, depth: 0 },
|
|
122
|
+
|
|
123
|
+
// SSH/Telnet
|
|
124
|
+
{ pattern: /^ssh\s+\S+/i, depth: 0 },
|
|
125
|
+
|
|
126
|
+
// System
|
|
127
|
+
{ pattern: /^sys\s+\S+/i, depth: 0 },
|
|
128
|
+
{ pattern: /^boot\s+\S+/i, depth: 0 },
|
|
129
|
+
|
|
130
|
+
// Fabric Connect/DVR
|
|
131
|
+
{ pattern: /^dvr\s+\S+/i, depth: 0 },
|
|
132
|
+
{ pattern: /^cfm\s+\S+/i, depth: 0 },
|
|
133
|
+
|
|
134
|
+
// VRRP
|
|
135
|
+
{ pattern: /^ip\s+vrrp\s+\S+/i, depth: 0 },
|
|
136
|
+
|
|
137
|
+
// Line/Console
|
|
138
|
+
{ pattern: /^line\s+\S+/i, depth: 0 },
|
|
139
|
+
|
|
140
|
+
// LLDP
|
|
141
|
+
{ pattern: /^lldp\s+\S+/i, depth: 0 },
|
|
142
|
+
|
|
143
|
+
// ============ DEPTH 1: Inside blocks ============
|
|
144
|
+
|
|
145
|
+
// Address family inside BGP
|
|
146
|
+
{ pattern: /^address-family\s+\S+/i, depth: 1 },
|
|
147
|
+
|
|
148
|
+
// Area inside OSPF/ISIS
|
|
149
|
+
{ pattern: /^area\s+\S+/i, depth: 1 },
|
|
150
|
+
|
|
151
|
+
// SPBM config inside ISIS
|
|
152
|
+
{ pattern: /^spbm\s+\d+/i, depth: 1 },
|
|
153
|
+
|
|
154
|
+
// Neighbor inside BGP
|
|
155
|
+
{ pattern: /^neighbor\s+\S+/i, depth: 1 },
|
|
156
|
+
|
|
157
|
+
// ============ DEPTH 2: Deeper nesting ============
|
|
158
|
+
|
|
159
|
+
{ pattern: /^redistribute\s+\S+/i, depth: 2 },
|
|
160
|
+
],
|
|
161
|
+
|
|
162
|
+
blockEnders: [
|
|
163
|
+
/^exit$/i,
|
|
164
|
+
/^end$/i,
|
|
165
|
+
/^back$/i,
|
|
166
|
+
],
|
|
167
|
+
};
|