mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-06-23 20:25:28 +08:00
add schema bootstrap
This commit is contained in:
parent
73706cfdce
commit
8efd1feb80
9 changed files with 28 additions and 3 deletions
9
data/.rpsl
Normal file
9
data/.rpsl
Normal 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
|
|
@ -3,6 +3,6 @@ remarks: test
|
||||||
contact: xmpp:xuu@xmpp.dn42
|
contact: xmpp:xuu@xmpp.dn42
|
||||||
contact: mail:xuu@dn42.us
|
contact: mail:xuu@dn42.us
|
||||||
pgp-fingerprint: 20AE2F310A74EA7CEC3AE69F8B3B0604F164E04F
|
pgp-fingerprint: 20AE2F310A74EA7CEC3AE69F8B3B0604F164E04F
|
||||||
nic-hdl: XU0-DN42
|
nic-hdl: XUU-DN42
|
||||||
mnt-by: XUU-MNT
|
mnt-by: XUU-MNT
|
||||||
source: DN42
|
source: DN42
|
|
@ -18,5 +18,8 @@ key: mnt-routes optional multiple lookup=dn42.mntner
|
||||||
key: org optional single lookup=dn42.organisation
|
key: org optional single lookup=dn42.organisation
|
||||||
key: remarks optional multiple
|
key: remarks optional multiple
|
||||||
key: source required single lookup=dn42.registry
|
key: source required single lookup=dn42.registry
|
||||||
|
network-owner: inet6num
|
||||||
|
network-owner: inetnum
|
||||||
|
network-owner: route6
|
||||||
mnt-by: DN42-MNT
|
mnt-by: DN42-MNT
|
||||||
source: DN42
|
source: DN42
|
||||||
|
|
|
@ -18,5 +18,7 @@ key: mnt-routes optional multiple lookup=dn42.mntner
|
||||||
key: org optional single lookup=dn42.organisation
|
key: org optional single lookup=dn42.organisation
|
||||||
key: remarks optional multiple
|
key: remarks optional multiple
|
||||||
key: source required single lookup=dn42.registry
|
key: source required single lookup=dn42.registry
|
||||||
|
network-owner: inetnum
|
||||||
|
network-owner: route
|
||||||
mnt-by: DN42-MNT
|
mnt-by: DN42-MNT
|
||||||
source: DN42
|
source: DN42
|
||||||
|
|
9
data/schema/NAMESPACE-SCHEMA
Normal file
9
data/schema/NAMESPACE-SCHEMA
Normal 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
|
|
@ -9,6 +9,7 @@ key: key required multiple > [key-name]
|
||||||
key: mnt-by required multiple lookup=dn42.mntner > [mntner]
|
key: mnt-by required multiple lookup=dn42.mntner > [mntner]
|
||||||
key: remarks optional multiple > [text]...
|
key: remarks optional multiple > [text]...
|
||||||
key: source required single lookup=dn42.registry
|
key: source required single lookup=dn42.registry
|
||||||
|
key: network-owner optional multiple > [child-schema]
|
||||||
mnt-by: DN42-MNT
|
mnt-by: DN42-MNT
|
||||||
source: DN42
|
source: DN42
|
||||||
remarks: # option descriptions
|
remarks: # option descriptions
|
||||||
|
|
0
data/schema/key
Normal file
0
data/schema/key
Normal file
|
@ -148,8 +148,8 @@ class FileDOM:
|
||||||
@property
|
@property
|
||||||
def schema(self) -> str:
|
def schema(self) -> str:
|
||||||
"""return the schema name for file"""
|
"""return the schema name for file"""
|
||||||
if len(self.dom) < 0:
|
if len(self.dom) < 1:
|
||||||
return "none"
|
return None
|
||||||
|
|
||||||
return self.dom[0].key
|
return self.dom[0].key
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ def run(path: str = "."):
|
||||||
s = schemas.get(dom.rel)
|
s = schemas.get(dom.rel)
|
||||||
if s is None:
|
if s is None:
|
||||||
print(f"{dom.src} schema not found for {dom.rel}")
|
print(f"{dom.src} schema not found for {dom.rel}")
|
||||||
|
continue
|
||||||
|
|
||||||
status = s.check_file(dom, lookups)
|
status = s.check_file(dom, lookups)
|
||||||
status.print()
|
status.print()
|
||||||
|
|
Loading…
Add table
Reference in a new issue