YAML parser for shumoku network topology definitions
npm install @shumoku/parser-yamlYAML parser for Shumoku network topology definitions.
``bash`
npm install @shumoku/parser-yaml @shumoku/core
`typescript
import { YamlParser } from '@shumoku/parser-yaml'
const yaml =
name: "Simple Network"
settings:
direction: TB
theme: light
nodes:
- id: rt-01
label: "Router 01"
type: router
- id: sw-01
label: "Switch 01"
type: l2-switch
links:
- from:
node: rt-01
port: lan1
to:
node: sw-01
port: ge-0/0/0
bandwidth: 10G
const parser = new YamlParser()
const graph = parser.parse(yaml)
`
`yaml`
nodes:
- id: router-01
label: "Core Router"
type: router # router, l2-switch, l3-switch, firewall, server, etc.
vendor: yamaha # Optional: yamaha, aruba, aws, juniper
model: rtx3510 # Optional: vendor-specific model
parent: core-layer # Optional: subgraph ID
`yaml`
links:
- from:
node: router-01
port: lan1
to:
node: switch-01
port: ge-0/0/0
bandwidth: 10G # Optional
label: "Uplink" # Optional
`yaml`
subgraphs:
- id: core-layer
label: "Core Layer"
- @shumoku/core - Core library
- @shumoku/icons` - Vendor icons
- YAML Reference - Full syntax reference
- Playground - Interactive demo
MIT