Metadata-Version: 2.1
Name: bird-ospf-link-db-parser
Version: 1.1.0
Summary: A simple Python package
Author-email: Andrew Dickinson <andrew.dickinson.0216@gmail.com>
License: MIT License
        
        Copyright (c) 2023 Andrew Dickinson
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Provides-Extra: dev
Requires-Dist: build ; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest (>=6) ; extra == 'test'
Requires-Dist: coverage ; extra == 'test'
Requires-Dist: freezegun ; extra == 'test'


# Bird OSFP Link Database Parser

Parses the output of the BIRD Routing Daemon's `ospf link state` command into a machine-readable JSON string.

```sh
> birdc show ospf link state all > parse-bird-link-dbparse-bird-link-db -
{
  "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
              }
            ]
          }
        },
        ...
      }
    }
  }
}
```


## Usage

Pre-requisites: `python3` available via the shell

Setup by cloning, creating a virtual env, and installing the application
```sh
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:
```sh
birdc show ospf link state all > parse-bird-link-dbparse-bird-link-db -
```

## Running the unit tests

Follow the instructions under "Usage" above, to clone a local copy of this application and activate
the virtual environment. Then installing the test dependencies with:
```sh
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!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request


## Acknowledgments
 * [Best-README-Template](https://github.com/othneildrew/Best-README-Template/)
