X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=update_reqs.py;fp=ice_validator%2Ftests%2Ffixtures%2Ftest_neutron_port_addresses%2Fpass%2Fother0.yaml;h=0f7ac3e360e9757abc19d83ba0268d52888331b7;hb=refs%2Fchanges%2F23%2F88023%2F2;hp=e7fa71f5d17f8d7eb762cb8831f27e43e6ff7ed4;hpb=0e2e6cdfb6b659c29ad1a59ac37d3a50191577a0;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml b/update_reqs.py similarity index 67% rename from ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml rename to update_reqs.py index e7fa71f..0f7ac3e 100644 --- a/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml +++ b/update_reqs.py @@ -2,7 +2,7 @@ # ============LICENSE_START==================================================== # org.onap.vvp/validation-scripts # =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# Copyright © 2019 AT&T Intellectual Property. All rights reserved. # =================================================================== # # Unless otherwise specified, all software contained herein is licensed @@ -35,20 +35,34 @@ # # ============LICENSE_END============================================ # -# -# VERSION: '1.0.0' ---- -resources: +""" +This script will refresh the heat_requirements.json file by pulling the +latest version from Nexus. +""" +import os +from urllib import request + +from ice_validator import version + +REQS_URL = ( + f"https://nexus.onap.org/" + f"content/sites/raw/org.onap.vnfrqts.requirements/{version.BRANCH}/needs.json" +) + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def get_requirements(): + """Retrieves the binary JSON content fom REQS_URL""" + return request.urlopen(REQS_URL) + + +def write_file(contents, path): + with open(path, "wb") as f: + f.write(contents) - other_typeX_0_bialy_port_2: - type: OS::Neutron::Port - properties: - allowed_address_pairs: - - ip_address: { get_param: my_ip_1 } - v6_ip_address: { get_param: my_v6_ip_1 } - mac_and_cheese: 0 - - ip_address: { get_param: my_ip_1 } - v6_ip_address: { get_param: my_v6_ip_1 } - mac_and_cheese: 1 +if __name__ == "__main__": + reqs = get_requirements().read() + write_file(reqs, os.path.join(THIS_DIR, "ice_validator/heat_requirements.json"))