Skip to content

Commit

Permalink
Polished toolchain for YANG validation sonata-nfv#73
Browse files Browse the repository at this point in the history
Signed-off-by: peusterm <[email protected]>
  • Loading branch information
peusterm committed Mar 5, 2019
1 parent 906f83d commit 70fbe88
Show file tree
Hide file tree
Showing 10 changed files with 524 additions and 48 deletions.
11 changes: 6 additions & 5 deletions models/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
# partner consortium (www.5gtango.eu).
.DEFAULT_GOAL := all

DOC_DIR="doc"
DOC_DIR := "doc"
PYBINDPLUGIN := $(shell python -c 'import pyangbind; import os; print("{}/plugin".format(os.path.dirname(pyangbind.__file__)))')

validate:
# generate doc
Expand All @@ -38,13 +39,13 @@ validate:

bind:
# generate / compile python model
PYBINDPLUGIN=$(shell python -c 'import pyangbind; import os; print("{}/plugin".format(os.path.dirname(pyangbind.__file__)))')
pyang --plugindir $(PYBINDPLUGIN) -f pybind -o model.py ietf-ped.yang
pyang --plugindir $(PYBINDPLUGIN) -f pybind -o ietf_ped_model.py ietf-ped.yang

test:
python test.py
# test the example ped files against the model
pytest -v

all: validate bind
all: validate bind test

clean:
rm doc/*
28 changes: 28 additions & 0 deletions models/doc/ietf-ped.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,34 @@ <h1> Module: <font color=blue>ietf-ped</font>, Namespace:
<td>?</td>
<td>current</td>
<td nowrap>/pe:ped/pe:version</td</tr>
<tr id="1-1-5" class="a">
<td nowrap>
<div id=9999 class=tier3>
<a class="leaf">&nbsp;</a>
<abbr title="Author of the described experiments."> <em> author </em></abbr>
</div>
</td>
<td>leaf</td>
<td nowrap><abbr title="string
">string</abbr></td>
<td nowrap>config</td>
<td>?</td>
<td>current</td>
<td nowrap>/pe:ped/pe:author</td</tr>
<tr id="1-1-6" class="a">
<td nowrap>
<div id=9999 class=tier3>
<a class="leaf">&nbsp;</a>
<abbr title="Generic description text."> <em> description </em></abbr>
</div>
</td>
<td>leaf</td>
<td nowrap><abbr title="string
">string</abbr></td>
<td nowrap>config</td>
<td>?</td>
<td>current</td>
<td nowrap>/pe:ped/pe:description</td</tr>

</table>
</div>
Expand Down
2 changes: 2 additions & 0 deletions models/doc/ietf-ped.tree
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ module: ietf-ped
+--rw vendor? string
+--rw name? string
+--rw version? string
+--rw author? string
+--rw description? string
6 changes: 4 additions & 2 deletions models/doc/ietf-ped.uml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hide <<leafref>> stereotype
hide <<leafref>> circle
page 1x1
Title ietf-ped
note top of pe_ietf_ped : <b>Namespace: </b> urn:ietf:params:xml:ns:yang:ietf-ped \n<b>Prefix: </b> pe \n<b>Organization : </b>\n \n<b>Contact : </b>\n \n<b>Revision : </b> 2019-02-21 \n
note top of pe_ietf_ped : <b>Namespace: </b> urn:ietf:params:xml:ns:yang:ietf-ped \n<b>Prefix: </b> pe \n<b>Organization : </b>\nPaderborn University \n<b>Contact : </b>\nManuel Peuster <[email protected]> \n<b>Revision : </b> 2019-02-21 \n
package "pe:ietf-ped" as pe_ietf_ped {
class "ietf-ped" as ietf_ped << (M, #33CCFF) module>>
class "ped" as ietf_ped_I_ped <<container>>
Expand All @@ -21,9 +21,11 @@ ietf_ped_I_ped : descriptor-schema : string = https://github.com/mpeuster/tng-
ietf_ped_I_ped : vendor : string
ietf_ped_I_ped : name : string
ietf_ped_I_ped : version : string
ietf_ped_I_ped : author : string
ietf_ped_I_ped : description : string
}

center footer
<size:20> UML Generated : 2019-02-28 22:37 </size>
<size:20> UML Generated : 2019-03-05 14:49 </size>
endfooter
@enduml
6 changes: 0 additions & 6 deletions models/example-instance.yml

This file was deleted.

10 changes: 10 additions & 0 deletions models/examples/basic-ped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
ped:
descriptor-schema: "https://github.com/sonata-nfv/tng-sdk-benchmark/blob/master/models/"
vendor: "com.vendor"
name: "my_example_ped"
version: "0.1"
author: "Manuel Peuster <[email protected]>"
description: "Example PED."


18 changes: 11 additions & 7 deletions models/ietf-ped.yang
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ module ietf-ped
{
namespace "urn:ietf:params:xml:ns:yang:ietf-ped";
prefix "pe";
organization "";
contact "";
description "";
organization "Paderborn University";
contact "Manuel Peuster <[email protected]>";
description "Performance Experiment Descriptor (PED) model.";

revision 2019-02-21 {
description
Expand All @@ -43,26 +43,30 @@ module ietf-ped
container ped {
description
"Performance Experiment Descriptor (PED)";

leaf descriptor-schema {
type string;
default "https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"; // update this
description "Pointer to this data model.";
}

leaf vendor {
type string;
description "Vendor of the described experiments.";
}

leaf name {
type string;
description "Name of the described experiments.";
}

leaf version {
type string;
description "Version of the described experiments.";
}
leaf author {
type string;
description "Author of the described experiments.";
}
leaf description {
type string;
description "Generic description text.";
}
}
}
Loading

0 comments on commit 70fbe88

Please sign in to comment.