diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d8a4a57 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2d26c74 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/npd.iml b/.idea/npd.iml new file mode 100644 index 0000000..6711606 --- /dev/null +++ b/.idea/npd.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..3e79ea0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1474023323997 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/schema.yml b/schema.yml new file mode 100644 index 0000000..ef24994 --- /dev/null +++ b/schema.yml @@ -0,0 +1,25 @@ +type: //rec +required: + protocol: + type: //rec + required: + name: //str + longname: //str + osilayer: //int + fields: &fields + type: //arr + contents: { + type: //rec + required: + field: //str + desc: //str + length: //int + optional: + bitfield: //bool + optional: //bool + nextlayer: //bool + data: //bool + reference: //str + reflenght: //str + subfields: *fields + } diff --git a/validate.py b/validate.py new file mode 100644 index 0000000..b9de05e --- /dev/null +++ b/validate.py @@ -0,0 +1,19 @@ +import Rx +import sys + + +def validate(argv): + rx = Rx.Factory(register_core_types=True) + schemafile = "schema.yaml" + schema = None + data = None + with open(schemafile, "r") as f: + data = f.read() + schema = rx.make_schema(data) + # get all yml files from protocols + # validate with + schema.validate(data) + + +if __name__ == '__main__': + validate(sys.argv)