mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-24 15:16:46 +00:00
440bb06b70
* Add creation of bad base platform certificate. * Adding Base Certificate system test. * Adding Base Certificate system test. * Adding Base Certificate system test. * Adding Base Certificate system test. * Updated script to add faulty components to bad base certificate. * Updated addFaultyComponents script. * Add Base/Delta system tests to .travis.yml * Disable unit tests to decrease CI time. * Cleaned up code. * Cleaned up code. * Delete system_test_Driver.py
29 lines
863 B
Python
29 lines
863 B
Python
# Add faulty components to the PACCOR generated JSON componentsFile.
|
|
# This will be used to create a bad platform certificate.
|
|
# Will not need this once PACCOR supports generation of faulty components.
|
|
|
|
import json
|
|
|
|
print("Adding Faulty components...")
|
|
|
|
try:
|
|
nicComponent = '00090002'
|
|
pc_dir = '/var/hirs/pc_generation/'
|
|
|
|
with open(pc_dir + "componentsFile", "r") as f:
|
|
|
|
data = json.load(f)
|
|
print(data)
|
|
components = data['COMPONENTS']
|
|
for component in components:
|
|
if component['COMPONENTCLASS']['COMPONENTCLASSVALUE'] == nicComponent:
|
|
print("Creating FAULTY component for: " + component['MODEL'])
|
|
component['MODEL'] += "-FAULTY"
|
|
print("New JSON value: " + component['MODEL'])
|
|
|
|
with open(pc_dir + "badComponentsFile", 'w') as outfile:
|
|
json.dump(data, outfile)
|
|
|
|
except Exception:
|
|
print("=== ERROR generating badComponentsFile ===")
|