Example #1
0
 def setUp(self):
     jadn_check(schema_listfield)
     self.tc = Codec(schema_listfield)
from libs.codec.jadn import jadn_load, jadn_dump, jadn_check, jadn_analyze
from libs.convert.tr_jas import jas_load, jas_dump
from libs.convert.tr_tables import table_dump

if __name__ == "__main__":
    for fn in ("openc2", "proto", "relax1", "relax2"):
        ifname = os.path.join("schema", fn)
        ofname = os.path.join("schema_gen", fn)

        # Convert JADN Abstract Syntax (JAS) to JADN

        print(os.path.join(os.getcwd(), ifname + ":"))
        source_s = ifname + ".jas"
        dest = ofname + "_gens"
        schema_s = jas_load(source_s)
        jadn_check(schema_s)
        jadn_dump(schema_s, dest + ".jadn", source_s)
        jadn_analyze(schema_s)

        # Convert JADN to JAS, prettyprinted JADN, and property tables

        source = ifname + ".jadn"
        dest = ofname + "_genj"
        schema = jadn_load(source)
        jas_dump(schema, dest + ".jas", source)
        jadn_dump(schema, dest + ".jadn", source)
        table_dump(schema, dest + ".xlsx", source)

        # Check that they match
        try:
            assert schema == schema_s
Example #3
0
 def setUp(self):
     jadn_check(schema_selectors)
     self.tc = Codec(schema_selectors)
Example #4
0
 def setUp(self):
     jadn_check(schema_compound)
     self.tc = Codec(schema_compound)
Example #5
0
 def setUp(self):
     jadn_check(schema_basic)
     self.tc = Codec(schema_basic)
Example #6
0
 def setUp(self):
     jadn_check(schema_bounds)
     self.tc = Codec(schema_bounds)
Example #7
0
 def setUp(self):
     jadn_check(schema_person)
     jadn_analyze(schema_person)
     self.c = Codec(schema_person, "True",
                    "True")  # Verbose encoding mode (dict/name)