rfc9644v6.txt   rfc9644.txt 
skipping to change at line 3183 skipping to change at line 3183
import requests_cache import requests_cache
from io import StringIO from io import StringIO
from datetime import datetime from datetime import datetime
# Metadata for the four YANG modules produced by this script # Metadata for the four YANG modules produced by this script
MODULES = [ MODULES = [
{ {
"csv_url": "https://www.iana.org/assignments/ssh-parameters/\ "csv_url": "https://www.iana.org/assignments/ssh-parameters/\
ssh-parameters-17.csv", ssh-parameters-17.csv",
"spaced_name": "encryption", "spaced_name": "encryption",
"hypenated_name": "encryption", "hyphenated_name": "encryption",
"prefix": "sshea", "prefix": "sshea",
"description": """ "This module defines enumerations for \ "description": """ "This module defines enumerations for \
the encryption algorithms the encryption algorithms
defined in the 'Encryption Algorithm Names' registry of the defined in the 'Encryption Algorithm Names' registry of the
'Secure Shell (SSH) Protocol Parameters' registry group 'Secure Shell (SSH) Protocol Parameters' registry group
maintained by IANA.""", maintained by IANA.""",
}, },
{ {
"csv_url": "https://www.iana.org/assignments/ssh-parameters/\ "csv_url": "https://www.iana.org/assignments/ssh-parameters/\
ssh-parameters-19.csv", ssh-parameters-19.csv",
"spaced_name": "public key", "spaced_name": "public key",
"hypenated_name": "public-key", "hyphenated_name": "public-key",
"prefix": "sshpka", "prefix": "sshpka",
"description": """ "This module defines enumerations for \ "description": """ "This module defines enumerations for \
the public key algorithms the public key algorithms
defined in the 'Public Key Algorithm Names' registry of the defined in the 'Public Key Algorithm Names' registry of the
'Secure Shell (SSH) Protocol Parameters' registry group 'Secure Shell (SSH) Protocol Parameters' registry group
maintained by IANA.""" maintained by IANA."""
}, },
{ {
"csv_url": "https://www.iana.org/assignments/ssh-parameters/\ "csv_url": "https://www.iana.org/assignments/ssh-parameters/\
ssh-parameters-18.csv", ssh-parameters-18.csv",
"spaced_name": "mac", "spaced_name": "mac",
"hypenated_name": "mac", "hyphenated_name": "mac",
"prefix": "sshma", "prefix": "sshma",
"description": """ "This module defines enumerations for \ "description": """ "This module defines enumerations for \
the MAC algorithms the MAC algorithms
defined in the 'MAC Algorithm Names' registry of the defined in the 'MAC Algorithm Names' registry of the
'Secure Shell (SSH) Protocol Parameters' registry group 'Secure Shell (SSH) Protocol Parameters' registry group
maintained by IANA.""" maintained by IANA."""
}, },
{ {
"csv_url": "https://www.iana.org/assignments/ssh-parameters/\ "csv_url": "https://www.iana.org/assignments/ssh-parameters/\
ssh-parameters-16.csv", ssh-parameters-16.csv",
"spaced_name": "key exchange", "spaced_name": "key exchange",
"hypenated_name": "key-exchange", "hyphenated_name": "key-exchange",
"prefix": "sshkea", "prefix": "sshkea",
"description": """ "This module defines enumerations for \ "description": """ "This module defines enumerations for \
the key exchange algorithms the key exchange algorithms
defined in the 'Key Exchange Method Names' registry of the defined in the 'Key Exchange Method Names' registry of the
'Secure Shell (SSH) Protocol Parameters' registry group 'Secure Shell (SSH) Protocol Parameters' registry group
maintained by IANA.""" maintained by IANA."""
}, },
] ]
def create_module_begin(module, f): def create_module_begin(module, f):
skipping to change at line 3286 skipping to change at line 3286
} }
typedef ssh-HNAME-algorithm { typedef ssh-HNAME-algorithm {
type enumeration { type enumeration {
""" """
# Replacements # Replacements
rep = { rep = {
"DATE": datetime.today().strftime('%Y-%m-%d'), "DATE": datetime.today().strftime('%Y-%m-%d'),
"YEAR": datetime.today().strftime('%Y'), "YEAR": datetime.today().strftime('%Y'),
"SNAME": module["spaced_name"], "SNAME": module["spaced_name"],
"HNAME": module["hypenated_name"], "HNAME": module["hyphenated_name"],
"PREFIX": module["prefix"], "PREFIX": module["prefix"],
"DESCRIPTION": module["description"] "DESCRIPTION": module["description"]
} }
# Do the replacement # Do the replacement
rep = dict((re.escape(k), v) for k, v in rep.items()) rep = dict((re.escape(k), v) for k, v in rep.items())
pattern = re.compile("|".join(rep.keys())) pattern = re.compile("|".join(rep.keys()))
text = pattern.sub(lambda m: rep[re.escape(m.group(0))], PREAMBL\ text = pattern.sub(lambda m: rep[re.escape(m.group(0))], PREAMBL\
E_TEMPLATE) E_TEMPLATE)
skipping to change at line 3445 skipping to change at line 3445
f.write(" }\n") f.write(" }\n")
f.write('\n') f.write('\n')
f.write('}\n') f.write('}\n')
def create_module(module): def create_module(module):
# Install cache for 8x speedup # Install cache for 8x speedup
requests_cache.install_cache() requests_cache.install_cache()
# Ascertain YANG module's name # Ascertain YANG module's name
yang_module_name = "iana-ssh-" + module["hypenated_name"] + "-al\ yang_module_name = "iana-ssh-" + module["hyphenated_name"] + "-a\
gs.yang" lgs.yang"
# Create YANG module file # Create YANG module file
with open(yang_module_name, "w") as f: with open(yang_module_name, "w") as f:
create_module_begin(module, f) create_module_begin(module, f)
create_module_body(module, f) create_module_body(module, f)
create_module_end(module, f) create_module_end(module, f)
def main(): def main():
for module in MODULES: for module in MODULES:
create_module(module) create_module(module)
 End of changes. 6 change blocks. 
7 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.48.