2 # org.onap.vnfrqts/requirements
3 # ============LICENSE_START====================================================
4 # Copyright © 2018 AT&T Intellectual Property. All rights reserved.
6 # Unless otherwise specified, all software contained herein is licensed
7 # under the Apache License, Version 2.0 (the "License");
8 # you may not use this software except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 # Unless otherwise specified, all documentation contained herein is licensed
20 # under the Creative Commons License, Attribution 4.0 Intl. (the "License");
21 # you may not use this documentation except in compliance with the License.
22 # You may obtain a copy of the License at
24 # https://creativecommons.org/licenses/by/4.0/
26 # Unless required by applicable law or agreed to in writing, documentation
27 # distributed under the License is distributed on an "AS IS" BASIS,
28 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 # See the License for the specific language governing permissions and
30 # limitations under the License.
32 # ============LICENSE_END============================================
38 REQUIREMENTS_FILE = "docs/data/needs.json"
43 with open(REQUIREMENTS_FILE, "r") as f:
46 for version in data["versions"]:
47 result.update(data["versions"][version]["needs"].keys())
52 """Generates a stream of unique requirement IDs"""
53 all_ids = load_all_ids()
55 new_id = "R-{:0>5d}".format(random.randint(0, 999999))
57 continue # skip this one and generate another one
62 if __name__ == "__main__":
63 parser = argparse.ArgumentParser(
65 Generate random, unique requirement IDs for use when adding new requirements
66 to the RST documentation.
69 parser.add_argument("num_ids", action="store", nargs="?", type=int, default=1,
70 help="Number of IDs to generate")
71 args = parser.parse_args()
72 for req_id in itertools.islice(generate_ids(), args.num_ids):