aboutsummaryrefslogtreecommitdiffstats
path: root/3rd_party/static/testapi-ui/components/guidelines/data/gen.py
blob: 3ecceb960f2eb656c83265b4dd0b715058251ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
##############################################################################
# Copyright (c) 2019 opnfv.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import json

with open('danube.json') as f:
    data = json.load(f)
mapping = {}
for i in data['mandatory']['value']:
    for j in i['value']:
        for k in j['value']:
            mapping[k] = True
for i in data['optional']['value']:
    for j in i['value']:
        for k in j['value']:
            mapping[k] = False

with open('mandatory.json', 'w') as f:
    f.write(json.dumps(mapping))