+def validate_layer(blueprint, layer):
+ """validates a layer by validating all testcases under that layer
+ """
+ print('## Layer {}'.format(layer))
+ for testcase in blueprint[layer]:
+ testcase['layer'] = layer
+ run_testcase(testcase)
+
+
+def validate_blueprint(yaml_loc, layer):
+ """Parse yaml file and validates given layer. If no layer given all layers
+ validated
+ """
+ with open(yaml_loc) as yaml_file:
+ yamldoc = yaml.safe_load(yaml_file)
+ blueprint = yamldoc['blueprint']
+ if layer is None:
+ for each_layer in blueprint['layers']:
+ validate_layer(blueprint, each_layer)
+ else:
+ validate_layer(blueprint, layer)
+
+
+@click.command()
+@click.argument('blueprint')
+@click.option('--layer', '-l')
+def main(blueprint, layer):
+ """Takes blueprint name and optional layer. Validates inputs and derives
+ yaml location from blueprint name. Invokes validate on blue print.