Metadata-Version: 2.1
Name: vrouter-agent
Version: 1.4.1
Summary: USDN vRouter-agent to execute order on each node
Home-page: https://github.com/Unified-Sentinel-Data-Networks/vrouter-agent
License: US Data Networks. All rights reserved.
Keywords: vrouter,networking,agent,multichain,wireguard
Author: Phan Dang
Author-email: phan.dang@usdatanetworks.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Provides-Extra: all
Provides-Extra: monitoring
Provides-Extra: performance
Provides-Extra: testing
Requires-Dist: alembic (>=1.12.1,<2.0.0)
Requires-Dist: asyncio-throttle (>=1.0.2,<2.0.0)
Requires-Dist: cffi
Requires-Dist: cryptography (>=41.0.3,<42.0.0)
Requires-Dist: dataclasses-json (==0.5.7)
Requires-Dist: fastapi (>=0.115.0,<0.116.0)
Requires-Dist: loguru (>=0.7.0,<0.8.0)
Requires-Dist: mcrpc (>=2.0.6.0,<3.0.0.0)
Requires-Dist: psutil (>=5.9.8,<6.0.0)
Requires-Dist: pydantic (>=2.9.0,<3.0.0)
Requires-Dist: pydantic-settings (>=2.5.2,<3.0.0)
Requires-Dist: python-multipart (>=0.0.10,<0.0.11)
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Requires-Dist: setuptools (>=75.8.0,<76.0.0)
Requires-Dist: simplejson (>=3.19.1,<4.0.0)
Requires-Dist: sqlmodel (>=0.0.24,<0.0.25)
Requires-Dist: tenacity (>=8.2.3,<9.0.0)
Requires-Dist: uvicorn (>=0.30.6,<0.31.0)
Requires-Dist: vrouter
Requires-Dist: wgconfig (>=0.2.2,<0.3.0)
Project-URL: Documentation, https://github.com/Unified-Sentinel-Data-Networks/vrouter-agent/blob/main/README.md
Project-URL: Repository, https://github.com/Unified-Sentinel-Data-Networks/vrouter-agent
Description-Content-Type: text/markdown

# vRouter-agent
[![Build and Sync Package to S3](https://github.com/Unified-Sentinel-Data-Networks/vrouter-agent/actions/workflows/publish-vrouter-agent-s3.yml/badge.svg)](https://github.com/Unified-Sentinel-Data-Networks/vrouter-agent/actions/workflows/publish-vrouter-agent-s3.yml)


# Overview 
vRouter-agent is a custom module built by USDN to handle and execute transaction from customer portal to each node. 


# Requirements

- [python][python] >= 3.10
- [vpp][vpp] >= v20.06
- [multichain][multichain] > v2.3.1
- [Fast API][fastapi] > v0.115
- [FRR][frr] > v8.3
- [vrouter][vrouter] > v1.0.6
- [poetry][poetry] > v1.6.1

# Development
This project is managed by poetry. Use poetry to install and run script.
 
```bash
curl -sSL https://install.python-poetry.org | python3 -
poetry install 
poetry run server
```

# Deployment 
### Run vrouter-agent as a service

vRouter depends on different services. In order to run vrouter-agent, these services must be up and running:
- VPP
- vRouter
- multichaind@{{chain}}. Chain is what defined in the nodecontrol 
- FRR

#### Create service file: 

```bash
sudo nano /etc/systemd/system/vrouter_agent.service
```

```bash
Requires=multichaind@{{chain}}
After=network.target multichaind@{{chain}} vpp.service vrouter.service

[Service]
Type=simple
ExecStartPre=/usr/local/bin/poetry/bin/poetry install 
ExecStart=/usr/local/bin/poetry/bin/poetry run server 
Restart=on-failure
RestartSec=30
WorkingDirectory=/opt/vrouter-agent/bin
User={{user}}
ExecStopPost=/bin/bash -c 'echo "$(date) $(hostname) vrouter agent service stopped" >> /var/log/vrouter-agent.log'
ExecRestartPost=/bin/bash -c 'echo "$(date) $(hostname) vrouter agent service restarted" >> /var/log/vrouter-agent.log'
OnFailure=/bin/bash -c 'echo "$(date) $(hostname) vrouter agent service failed" >> /var/log/vrouter-agent.log'

[Install]
WantedBy=multi-user.target

```

#### Enable service at boot and start service:

```bash
sudo systemctl enable vrouter-agent && sudo systemctl start vrouter-agent 
```

# Usage

### Run manually

```bash
cd /opt/vrouter-agent/bin
poetry install && poetry run server
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[US Data Networks](https://usdatanetworks/docs/license)

[python]: https://www.python.org/downloads/release/python-380/
[pip]: https://pip.pypa.io/en/stable/installation/
[vpp]: https://s3-docs.fd.io/vpp/22.06/
[multichain]: https://www.multichain.com/download-community/
[fastapi]: https://fastapi.tiangolo.com/
[frr]: https://gallery.ecr.aws/p6l6k3o9/frr
[vrouter]: https://github.com/Unified-Sentinel-Data-Networks/vrouter-pantheon
[poetry]: https://install.python-poetry.org
