From 744dd6d708e555e7e0623d40a1a48495d21fe5bb Mon Sep 17 00:00:00 2001 From: Rajkumar Date: Mon, 28 Aug 2017 13:02:49 +0530 Subject: [PATCH] YANG: using leaf-list #1204 --- src/lib/yang/test-schema-v1.yang | 16 ++++++++++++++++ src/program/test_yang/test_yang.json | 8 ++++++++ src/program/test_yang/test_yang.lua | 14 ++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/lib/yang/test-schema-v1.yang create mode 100644 src/program/test_yang/test_yang.json create mode 100644 src/program/test_yang/test_yang.lua diff --git a/src/lib/yang/test-schema-v1.yang b/src/lib/yang/test-schema-v1.yang new file mode 100644 index 0000000000..ee06f9ebbc --- /dev/null +++ b/src/lib/yang/test-schema-v1.yang @@ -0,0 +1,16 @@ +module test-schema-v1 { + namespace snabb:test; + prefix test; + + import ietf-inet-types { prefix inet; } + import ietf-yang-types { prefix yang; } + + container test-config { + container ports { + container port-range { + leaf start {type uint16; default 1025;} + leaf end {type uint16; default 32000;} + } + } + } +} diff --git a/src/program/test_yang/test_yang.json b/src/program/test_yang/test_yang.json new file mode 100644 index 0000000000..85873014ad --- /dev/null +++ b/src/program/test_yang/test_yang.json @@ -0,0 +1,8 @@ +test-config { + ports{ + port-range{ + start 1024; + end 32000; + } + } +} diff --git a/src/program/test_yang/test_yang.lua b/src/program/test_yang/test_yang.lua new file mode 100644 index 0000000000..2329fc83b8 --- /dev/null +++ b/src/program/test_yang/test_yang.lua @@ -0,0 +1,14 @@ +module(..., package.seeall) + +local schema = require("lib.yang.schema") +local yang = require('lib.yang.yang') + +function run (parameters) + local schema_name = 'test-schema-v1' + local schema = schema.load_schema_by_name(schema_name) + local conf = yang.load_configuration(parameters[1],{schema_name=schema_name, verbose = true}) + + local c = config.new() + engine.configure(c) + engine.main({duration=1}) +end