Skip to content

Commit 7edb4da

Browse files
committed
Added draft URLs pointing to Yang resources (impact analysis and model metadata) for submissions containing Yang modules.
- Legacy-Id: 14237
1 parent 54088de commit 7edb4da

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

ietf/submit/utils.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,37 @@ def post_submission(request, submission, approvedDesc):
301301
# automatically set state "WG Document"
302302
draft.set_state(State.objects.get(used=True, type="draft-stream-%s" % draft.stream_id, slug="wg-doc"))
303303

304+
# Update yang urls if applicable
305+
for check in submission.checks.all():
306+
# Temporary code -- remove after 6.64.0 release
307+
if not type(check.items) is dict:
308+
continue
309+
if not 'checker' in check.items:
310+
continue
311+
log.assertion('type(check.items) is dict')
312+
check.items['draft'] = draft.name
313+
check.items['rev'] = draft.rev
314+
if 'code' in check.items and check.items['code']:
315+
code = check.items['code']
316+
debug.show('code')
317+
if 'yang' in code:
318+
modules = code['yang']
319+
# Yang impact analysis URL
320+
draft.documenturl_set.filter(tag_id='yang-impact-analysis').delete()
321+
f = settings.SUBMIT_YANG_CATALOG_MODULEARG
322+
moduleargs = '&'.join([ f.format(module=m) for m in modules])
323+
url = settings.SUBMIT_YANG_CATALOG_IMPACT_URL.format(moduleargs=moduleargs, draft=draft.name)
324+
desc = settings.SUBMIT_YANG_CATALOG_IMPACT_DESC.format(modules=','.join(modules), draft=draft.name)
325+
draft.documenturl_set.create(url=url, tag_id='yang-impact-analysis', desc=desc)
326+
# Yang module metadata URLs
327+
old_urls = draft.documenturl_set.filter(tag_id='yang-module-metadata')
328+
debug.show('old_urls')
329+
old_urls.delete()
330+
for module in modules:
331+
url = settings.SUBMIT_YANG_CATALOG_MODULE_URL.format(module=module)
332+
desc = settings.SUBMIT_YANG_CATALOG_MODULE_DESC.format(module=module)
333+
draft.documenturl_set.create(url=url, tag_id='yang-module-metadata', desc=desc)
334+
304335
# save history now that we're done with changes to the draft itself
305336
draft.save_with_history(events)
306337

@@ -667,9 +698,9 @@ def apply_checkers(submission, file_name):
667698
# run submission checkers
668699
def apply_check(submission, checker, method, fn):
669700
func = getattr(checker, method)
670-
passed, message, errors, warnings, items = func(fn)
701+
passed, message, errors, warnings, info = func(fn)
671702
check = SubmissionCheck(submission=submission, checker=checker.name, passed=passed,
672-
message=message, errors=errors, warnings=warnings, items=items,
703+
message=message, errors=errors, warnings=warnings, items=info,
673704
symbol=checker.symbol)
674705
check.save()
675706

0 commit comments

Comments
 (0)