This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Script to pull schema information from Infrahub and serialize it to YAML | |
| # infrahubctl run <script> | |
| # Dependencies: infrahub-sdk, pyyaml | |
| # alpha version, need testing | |
| import logging | |
| import yaml | |
| from infrahub_sdk import InfrahubClient, Config | |
| from infrahub_sdk.schema import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://json-schema.org/draft/2020-12/schema", | |
| "$id": "schema/schemas/config.json", | |
| "type": "object", | |
| "$ref": "#/definitions/Configuration", | |
| "definitions": { | |
| "Configuration": { | |
| "type": "object", | |
| "additionalProperties": false, | |
| "properties": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| def dscp_class(dec): | |
| if dec == 46: | |
| return "ef" | |
| major_class = dec >> 3 | |
| drop_preference = dec >> 1 & 3 | |
| if drop_preference == 0: | |
| return f"cs{major_class}" |