Metadata-Version: 2.4
Name: napalm-bird2
Version: 0.0.3
Summary: NAPALM driver for BIRD2 with SSH and local socket transports
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: napalm>=5.0
Requires-Dist: paramiko>=3.4
Requires-Dist: PyYAML>=6.0

# napalm-bird2

`napalm-bird2` is a NAPALM driver for BIRD2 with two transports:

- SSH for remote hosts
- Local Unix socket for same-host deployments

It also understands common Pathvector layouts so you can inspect the live BIRD config and the source Pathvector YAML.

## Install

```bash
pip install napalm-bird2
```

For local development:

```bash
pip install -e .
```

## NAPALM usage

```python
from napalm import get_network_driver

driver = get_network_driver("bird2")
device = driver(
	hostname="router1.example.net",
	username="netops",
	password="secret",
	optional_args={"transport": "ssh"},
)
device.open()
print(device.get_interfaces())
device.close()
```

## Peering Manager settings

Set the NAPALM driver field to `bird2`.

For a remote router, use SSH:

```python
optional_args = {
	"transport": "ssh",
	"port": 22,
	"birdc_path": "birdc",
	"key_file": "/opt/peering-manager/.ssh/id_ed25519",
	# "key_passphrase": "...",  # only if the private key is encrypted
}
```

For a local deployment on the router itself, use the Unix socket:

```python
optional_args = {
	"transport": "socket",
	"socket_path": "/run/bird/bird.ctl",
}
```

If `transport` is omitted, the driver falls back to socket mode when the hostname is `localhost`, `127.0.0.1`, or `::1` and the socket exists. Otherwise it uses SSH.

## Pathvector integration

The driver reads these files by default when present:

- `/etc/pathvector.yml`
- `/etc/bird/pathvector.conf`

You can override both paths via `optional_args`:

```python
optional_args = {
	"pathvector_config_path": "/etc/pathvector.yml",
	"bird_config_path": "/etc/bird/pathvector.conf",
	"pathvector_managed": True,
	"pathvector_command": "pathvector",
}
```

When Pathvector management is detected, `commit_config()` uses a Pathvector reload flow instead of a direct `birdc configure` call.

## Tests

```bash
pytest
```
