add schema bootstrap

This commit is contained in:
Jonathan Lundy 2020-06-13 10:40:01 -06:00
parent 73706cfdce
commit 8efd1feb80
No known key found for this signature in database
GPG Key ID: C63E6D61F3035024
9 changed files with 28 additions and 3 deletions

9
data/.rpsl Normal file
View File

@ -0,0 +1,9 @@
namespace: dn42
schema: schema
owner: mntner
default-owner: DN42-MNT
network-owner: inet6num inet6num
network-owner: inet6num route
network-owner: inet6num inetnum
network-owner: inetnum inetnum
network-owner: inetnum route

View File

@ -3,6 +3,6 @@ remarks: test
contact: xmpp:xuu@xmpp.dn42
contact: mail:xuu@dn42.us
pgp-fingerprint: 20AE2F310A74EA7CEC3AE69F8B3B0604F164E04F
nic-hdl: XU0-DN42
nic-hdl: XUU-DN42
mnt-by: XUU-MNT
source: DN42

View File

@ -18,5 +18,8 @@ key: mnt-routes optional multiple lookup=dn42.mntner
key: org optional single lookup=dn42.organisation
key: remarks optional multiple
key: source required single lookup=dn42.registry
network-owner: inet6num
network-owner: inetnum
network-owner: route6
mnt-by: DN42-MNT
source: DN42

View File

@ -18,5 +18,7 @@ key: mnt-routes optional multiple lookup=dn42.mntner
key: org optional single lookup=dn42.organisation
key: remarks optional multiple
key: source required single lookup=dn42.registry
network-owner: inetnum
network-owner: route
mnt-by: DN42-MNT
source: DN42

View File

@ -0,0 +1,9 @@
schema: NAMESPACE-SCHEMA
ref: dn42.schema
key: namespace required single primary schema > [name]
key: ns-schema required single > [schema]
key: ns-owner required single > [schema]
key: default-owner optional single lookup=dn42.mntner > [mntner]
key: network-owner optional multiple > [parent-schema] [child-schema]
mnt-by: DN42-MNT
source: DN42

View File

@ -9,6 +9,7 @@ key: key required multiple > [key-name]
key: mnt-by required multiple lookup=dn42.mntner > [mntner]
key: remarks optional multiple > [text]...
key: source required single lookup=dn42.registry
key: network-owner optional multiple > [child-schema]
mnt-by: DN42-MNT
source: DN42
remarks: # option descriptions

0
data/schema/key Normal file
View File

View File

@ -148,8 +148,8 @@ class FileDOM:
@property
def schema(self) -> str:
"""return the schema name for file"""
if len(self.dom) < 0:
return "none"
if len(self.dom) < 1:
return None
return self.dom[0].key

View File

@ -62,6 +62,7 @@ def run(path: str = "."):
s = schemas.get(dom.rel)
if s is None:
print(f"{dom.src} schema not found for {dom.rel}")
continue
status = s.check_file(dom, lookups)
status.print()