-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snabb config test functionality.
Reworks `snabb config` command line parsing somewhat to allow `snabb config test` to work. `snabb config test` loads a schema passed with `-s` either by name (if already known by snabb) or by file path, then validates a passed configuration FILE against the schema. Signed-off-by: Ben Agricola <[email protected]>
- Loading branch information
Ben Agricola
committed
May 10, 2018
1 parent
b9da7ca
commit fe61ae2
Showing
6 changed files
with
88 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Usage: | ||
snabb config test [OPTIONS] [ID] FILE | ||
|
||
Available options: | ||
-s SCHEMA-NAME-OR-FILE-PATH | ||
--schema SCHEMA-NAME-OR-FILE-PATH | ||
--schema-name SCHEMA-NAME | ||
|
||
-r REVISION | ||
--revision REVISION | ||
--revision-date REVISION | ||
|
||
-v | ||
--verbose | ||
|
||
-h | ||
--help | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Usage: | ||
snabb config test [OPTIONS] [ID] FILE | ||
|
||
Available options: | ||
-s SCHEMA-NAME-OR-FILE-PATH | ||
--schema SCHEMA-NAME-OR-FILE-PATH | ||
--schema-name SCHEMA-NAME | ||
|
||
-r REVISION | ||
--revision REVISION | ||
--revision-date REVISION | ||
|
||
-v | ||
--verbose | ||
|
||
-h | ||
--help | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Use of this source code is governed by the Apache 2.0 license; see COPYING. | ||
module(..., package.seeall) | ||
|
||
local yang = require("lib.yang.yang") | ||
local common = require("program.config.common") | ||
|
||
function run(args) | ||
local opts = { command='test', with_config_file=true, is_config = false} | ||
local ret, args = common.parse_command_line(args, opts) | ||
|
||
yang.print_config_for_schema_by_name(ret.schema_name, ret.config, io.stdout) | ||
end |