feat output artifacts to tmp; add bench & profiling; minor fixes
This commit is contained in:
141
README.md
141
README.md
@@ -9,6 +9,7 @@ skyforge was designed to assist in rendering thousands of device configurations
|
||||
- Partitions are groups of regions
|
||||
- Regions are groups of zones
|
||||
- Zones are groups of devices
|
||||
- Fabrics are groups of layers
|
||||
- Layers are groups of common devices and facilitate template mapping
|
||||
|
||||
## Functionality
|
||||
@@ -20,13 +21,13 @@ Skyforge takes a user provided regex pattern, performs a walk on a `./spec` dir,
|
||||
For each "device" matched, skyforge then maps to all consituent files:
|
||||
|
||||
- Layer - from the `common.yaml` file in parent dir and maps the region
|
||||
- Zonal - from the first group of chars in filename up to a `-` which is expected to be region and zone
|
||||
- Regional - from the `<region>/common/<network>.yaml` of containing folder where network matches the layer info
|
||||
- Partitional - from either layer (common.yaml) or regional yaml
|
||||
- Zonal - from the first group of chars in filename up to a `-`
|
||||
- Regional - from value of `common.fabric` field in `Layer` file
|
||||
- Partitional - from value of `regional.partition` field in `Regional` file
|
||||
|
||||
Once all files are found, a compiled specifcation is built.
|
||||
This spec is then passed to Tera as context.
|
||||
Tera then loads the template files for that layer and renders the configuration files.
|
||||
Tera loads the template files for that layer and renders the configuration files.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -47,68 +48,112 @@ Options:
|
||||
-V, --version Print version
|
||||
|
||||
Environment:
|
||||
SF_SPEC_PATH Directory containing templates
|
||||
SF_TMPL_PATH Directory containing specifications
|
||||
SF_OUT_PATH Directory for command output
|
||||
SF_LOG_PATH Directory for log output
|
||||
SKYFORGE_SPECDIR Directory containing templates
|
||||
SKYFORGE_TMPLDIR Directory containing specifications
|
||||
SKYFORGE_OUTDIR Directory for command output
|
||||
SKYFORGE_LOGDIR Directory for log output
|
||||
```
|
||||
|
||||
### Standard
|
||||
|
||||
``` bash
|
||||
$ skyforge -d xyz1-ex-edge-r101
|
||||
Skyforge found 8 renderable devices in /home/lost/workspace/skyforge/demo
|
||||
Skyforge found 9 renderable devices
|
||||
Matched 1 devices against 'xyz1-ex-edge-r101'
|
||||
Rendering xyz1-ex-edge-r101
|
||||
Writing Output
|
||||
| out/xyz1-ex-edge-r101/all.conf
|
||||
Processing templates for 'xyz1-ex-edge-r101'
|
||||
Writing Output:
|
||||
| ./out/xyz1-ex-edge-r101/all.live.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.shifted.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.init.junos
|
||||
```
|
||||
|
||||
### Verbose
|
||||
|
||||
``` bash
|
||||
$ skyforge -d xyz1-ex-edge-r101 -v
|
||||
Skyforge found 8 renderable devices in /home/lost/workspace/skyforge/demo
|
||||
$ skyforge -d xyz1-ex-edge-r101 --verbose
|
||||
Skyforge found 9 renderable devices
|
||||
Matched 1 devices against 'xyz1-ex-edge-r101'
|
||||
| ./spec/xyz/ex-edge-r1/xyz1-ex-edge-r101.yaml
|
||||
Rendering xyz1-ex-edge-r101
|
||||
| ./tmpl/ex-edge-r/system.tmpl
|
||||
| ./tmpl/ex-edge-r/chassis.tmpl
|
||||
| ./tmpl/ex-edge-r/interfaces.tmpl
|
||||
| ./tmpl/ex-edge-r/protocols.tmpl
|
||||
Writing Output
|
||||
| out/xyz1-ex-edge-r101/system.tmpl
|
||||
| out/xyz1-ex-edge-r101/chassis.tmpl
|
||||
| out/xyz1-ex-edge-r101/interfaces.tmpl
|
||||
| out/xyz1-ex-edge-r101/protocols.tmpl
|
||||
| out/xyz1-ex-edge-r101/compiled.spec
|
||||
| out/xyz1-ex-edge-r101/all.conf
|
||||
| ./spec/xyz/ex-edge-r/xyz1-ex-edge-r101.yaml
|
||||
Processing templates for 'xyz1-ex-edge-r101'
|
||||
| ./tmpl/ex-edge-r/system.tera
|
||||
| ./tmpl/ex-edge-r/interfaces.tera
|
||||
| ./tmpl/ex-edge-r/protocols.tera
|
||||
| ./tmpl/ex-edge-r/policy-options.tera
|
||||
Writing Output:
|
||||
| ./out/xyz1-ex-edge-r101/live/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.live.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.shifted.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.init.junos
|
||||
| ./out/xyz1-ex-edge-r101/context.yaml
|
||||
```
|
||||
|
||||
### Debug
|
||||
|
||||
``` bash
|
||||
$ skyforge -d xyz1-ex-edge-r101 --debug
|
||||
devices: xyz1-ex-edge-r101, loglevel: Debug, env: spec_path: ./spec, tmpl_path: ./tmpl, out_path: ./out, log_path: ./log
|
||||
Skyforge found 8 renderable devices in /home/lost/workspace/skyforge/demo
|
||||
Skyforge found 9 renderable devices
|
||||
Matched 1 devices against 'xyz1-ex-edge-r101'
|
||||
| ./spec/xyz/ex-edge-r1/xyz1-ex-edge-r101.yaml
|
||||
Compiled Spec for 'xyz1-ex-edge-r101.yaml'
|
||||
| ./spec/common/us.yaml
|
||||
| ./spec/xyz/common/ex.yaml
|
||||
| ./spec/xyz/ex-edge-r1/common.yaml
|
||||
| ./spec/xyz/ex-edge-r1/xyz1.common.yaml
|
||||
| ./spec/xyz/ex-edge-r1/xyz1-ex-edge-r101.yaml
|
||||
Rendering xyz1-ex-edge-r101
|
||||
| ./tmpl/ex-edge-r/system.tmpl
|
||||
| ./tmpl/ex-edge-r/chassis.tmpl
|
||||
| ./tmpl/ex-edge-r/interfaces.tmpl
|
||||
| ./tmpl/ex-edge-r/protocols.tmpl
|
||||
Writing Output
|
||||
| out/xyz1-ex-edge-r101/system.tmpl
|
||||
| out/xyz1-ex-edge-r101/chassis.tmpl
|
||||
| out/xyz1-ex-edge-r101/interfaces.tmpl
|
||||
| out/xyz1-ex-edge-r101/protocols.tmpl
|
||||
| out/xyz1-ex-edge-r101/compiled.spec
|
||||
| out/xyz1-ex-edge-r101/all.conf
|
||||
| ./spec/xyz/ex-edge-r/xyz1-ex-edge-r101.yaml
|
||||
Components {
|
||||
partitional: "./spec/common/us.yaml",
|
||||
regional: "./spec/xyz/common/ex.yaml",
|
||||
common: "./spec/xyz/ex-edge-r/common.yaml",
|
||||
zonal: "./spec/xyz/ex-edge-r/xyz1.common.yaml",
|
||||
device: "./spec/xyz/ex-edge-r/xyz1-ex-edge-r101.yaml",
|
||||
}
|
||||
Processing templates for 'xyz1-ex-edge-r101'
|
||||
| ./tmpl/ex-edge-r/system.tera
|
||||
| ./tmpl/ex-edge-r/interfaces.tera
|
||||
| ./tmpl/ex-edge-r/protocols.tera
|
||||
| ./tmpl/ex-edge-r/policy-options.tera
|
||||
Rendering templates for xyz1-ex-edge-r101
|
||||
| system.live
|
||||
| interfaces.live
|
||||
| protocols.live
|
||||
| policy-options.live
|
||||
| system.shifted
|
||||
| interfaces.shifted
|
||||
| protocols.shifted
|
||||
| policy-options.shifted
|
||||
| system.init
|
||||
| interfaces.init
|
||||
| protocols.init
|
||||
| policy-options.init
|
||||
Writing Output:
|
||||
| ./out/xyz1-ex-edge-r101/live/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/live/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.live.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/shifted/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.shifted.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/system.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/interfaces.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/protocols.junos
|
||||
| ./out/xyz1-ex-edge-r101/init/policy-options.junos
|
||||
| ./out/xyz1-ex-edge-r101/all.init.junos
|
||||
| ./out/xyz1-ex-edge-r101/context.yaml
|
||||
```
|
||||
|
||||
## Flamegraph
|
||||
|
||||
Assume flamelens is installed, otherwise `cargo install flamelens`
|
||||
|
||||
``` bash
|
||||
cd demo
|
||||
cargo flamegraph --post-process 'flamelens --echo' --profile profiling -- --devices ".*"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user