Parse the text output from the BIRD Routing Daemon's OSPF link database into machine readable JSON
Project description
Bird OSFP Link Database Parser
Parses the output of the BIRD Routing Daemon's birdc show ospf state
command into a machine-readable JSON string.
> birdc show ospf state | parse-bird-link-db - | jq | less
{
"areas": {
"0.0.0.0": {
"routers": {
"10.68.29.50": {
"links": {
"router": [
{
"id": "10.69.7.31",
"metric": 10
}
],
"stubnet": [
{
"id": "10.69.29.50/32",
"metric": 0
},
{
"id": "10.68.29.50/32",
"metric": 0
}
],
"external": [
{
"id": "10.70.174.0/24",
"metric": 20
}
]
}
},
"10.68.73.125": {
"links": {
"router": [
{
"id": "10.69.73.25",
"metric": 10
},
{
"id": "10.69.52.83",
"metric": 30
},
{
"id": "10.69.73.25",
"metric": 30
}
],
"stubnet": [
{
"id": "10.69.73.125/32",
"metric": 0
},
{
"id": "10.68.73.125/32",
"metric": 0
}
]
}
},
...
}
}
}
}
Output Format
The output format is detailed using JSON Schema in src/bird_parser/output_schema.json
Usage
Pre-requisites: python3
available via the shell
First, install the CLI via pip:
pip install bird-ospf-link-db-parser
then invoke the tool with the CLI command:
birdc show ospf state | parse-bird-link-db -
But you probably want to use jq
and less
to make this output a bit more manageable:
sudo apt update && sudo apt install jq less
birdc show ospf state | parse-bird-link-db - | jq | less
Dev Setup
Pre-requisites: python3
available via the shell
Setup by cloning, creating a virtual env, and installing the application
git clone https://github.com/Andrew-Dickinson/bird-ospf-link-db-parser
cd bird-ospf-link-db-parser
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
then invoke the tool with the CLI command:
birdc show ospf link state > parse-bird-link-db -
Running the unit tests
Follow the instructions under "Dev Setup" above, to clone a local copy of this application and activate the virtual environment. Then installing the test dependencies with:
pip install -e ".[test,dev]"
Finally, invoke the test suite using pytest:
pytest test/
Building to PyPi
Follow the instructions above to clone a local copy of this application, activate the virtual environment, and run the tests.
Then, build & upload the application with
rm -rf dist/*
python -m build .
twine upload dist/*
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Acknowledgments
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bird-ospf-link-db-parser-1.1.3.tar.gz
.
File metadata
- Download URL: bird-ospf-link-db-parser-1.1.3.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff38aafa3a6a24637b21f2cb405e3a925368d16207d22a9d4dbcd59b6161e4a3 |
|
MD5 | cd2fc203f6d4b66d15237fd623a86577 |
|
BLAKE2b-256 | e9b4d5fa8af0ef80c212dbcddd756a681e1e355689a463f443772777e228b879 |
File details
Details for the file bird_ospf_link_db_parser-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: bird_ospf_link_db_parser-1.1.3-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b8a383c40f192764422755cc807421159a023034a433fe8f9b388b4c4c2745a |
|
MD5 | 3a8864dc23a7e0df7694589d1f14722d |
|
BLAKE2b-256 | 8fa3e4ffbf9160116d4dd59127c4877b8c45fe88fd2a3dc5579ae14c5f6417a2 |