X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dcaegen2%2Fplatform.git;a=blobdiff_plain;f=adapter%2Facumos%2Faoconversion%2Fdataformat_gen.py;fp=adapter%2Facumos%2Faoconversion%2Fdataformat_gen.py;h=71b16177785f047df48756a3380ea965a25e79e6;hp=a5ead963e89e07d43683ca72fdfb6250e8fb7fe1;hb=711d4eae913f34e78aa10e8cd511f3b8e43cd54f;hpb=a1a37bde3365ebf0aaa543b2f10ebdb13bd4af40 diff --git a/adapter/acumos/aoconversion/dataformat_gen.py b/adapter/acumos/aoconversion/dataformat_gen.py index a5ead96..71b1617 100644 --- a/adapter/acumos/aoconversion/dataformat_gen.py +++ b/adapter/acumos/aoconversion/dataformat_gen.py @@ -1,7 +1,7 @@ # ============LICENSE_START==================================================== # org.onap.dcae # ============================================================================= -# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,22 +19,9 @@ from subprocess import PIPE, Popen import json from jsonschema import validate -import requests from aoconversion import utils, exceptions -def _get_js_schema(): - res = requests.get("http://json-schema.org/draft-04/schema#") - return res.json() - - -def _get_dcae_df_schema(): - res = requests.get( - "https://gerrit.onap.org/r/gitweb?p=dcaegen2/platform/cli.git;a=blob_plain;f=component-json-schemas/data-format/dcae-cli-v1/data-format-schema.json;hb=HEAD" - ) - return res.json() - - def _protobuf_to_js(proto_path): """ Converts a protobuf to jsonschema and returns the generated schema as a JSON object. @@ -52,7 +39,7 @@ def _protobuf_to_js(proto_path): defs[defn.split(".")[1]] = defs.pop(defn) # make sure what we got out is a valid jsonschema - draft4 = _get_js_schema() + draft4 = utils.schema_schema.get() validate(instance=asjson, schema=draft4) return asjson @@ -141,8 +128,8 @@ def generate_dcae_data_formats(model_repo_path, model_name): data_formats = _generate_dcae_data_formats( "{0}/{1}/model.proto".format(model_repo_path, model_name), utils.get_metadata(model_repo_path, model_name), - _get_dcae_df_schema(), - _get_js_schema(), + utils.dataformat_schema.get(), + utils.schema_schema.get() ) # now we iterate over these and write a file to disk for each, since the dcae cli seems to want that