# Starlyng BCM Connection
A Python library for executing Baseboard Management Controller (BMC) commands on servers using IPMI.
## Features
- Execute BMC commands on remote servers using IPMI via `execute_bcm_command`
- Parallel execution of commands across multiple servers using threading
- Comprehensive error logging and handling
- Support for common IPMI operations:
- Power management (status, on, off, cycle, reset)
- System Event Log (SEL) operations
- Chassis control
- Flexible server configuration through `BCMServer` class
- Secure connection handling with IPMI over LAN (LANPLUS)
- Command output capture and structured response handling
- Utility functions for hostname and IP address management:
- Generate consistent host IDs and hostnames
- Handle both local and public IP configurations
- VLAN-aware IP address management
## Prerequisites
Before you begin, ensure you have:
* Python 3.9 or higher installed
* ipmitool installed on your system:
* Ubuntu: `sudo apt-get install ipmitool`
* macOS: `brew install ipmitool`
* If outside local network, configure port forwarding on your router:
* Forward BCM port 623 to each server's unique port (62300-62399)
* Example: Forward port 62300 to 192.168.50.1:623, port 62301 to 192.168.50.2:623
* Port range must be between 62300-62399
## Installation
```bash
pip install starlyng-bcm-connection
```
## Usage
### Basic Example
```python
from bcm_connection import BCMServer, execute_bcm_command
# Create a BCM server instance
server = BCMServer(
bcm_ip="192.168.1.1",
bcm_user="admin"
bcm_pass="password"
bcm_port=623
)
# Execute a command
# Pass server in a list since execute_bcm_command expects List[BCMServer]
result = execute_bcm_command([server], "power status")
print(result)
```
### Hostname and IP Management
```python
from bcm_connection import get_hostname, get_host_id, get_ip_for_bcm
# Generate a hostname for a local server
hostname = get_hostname("server", "192.168.1.20", 623, public_ip=False)
# Result: "server10" (20 - 10 = 10)
# Generate a hostname for a public server
hostname = get_hostname("server", "203.0.113.1", 62345, public_ip=True)
# Result: "server45" (last two digits of port)
# Get BCM IP address with VLAN
bcm_ip = get_ip_for_bcm("192.168.1.20", vlan_id=50, public_ip=False)
# Result: "192.168.50.20" (VLAN ID injected)
```
## Available BMC Commands
Common IPMI commands you can execute:
- `power status` - Get power status
- `power on` - Power on the server
- `power off` - Power off the server
- `power cycle` - Power cycle the server
- `power reset` - Reset the server
## Contributing
1. Fork the project
2. Create your feature branch (`git checkout -b feature/YourFeature`)
3. Commit your changes (`git commit -am 'Add some YourFeature'`)
4. Push to the branch (`git push origin feature/YourFeature`)
5. Open a pull request
## Contact
If you have any questions, please contact:
- GitHub: [@justinsherwood](https://github.com/justinsherwood)
Raw data
{
"_id": null,
"home_page": "https://github.com/starlyngapp/ssh-connection",
"name": "starlyng-bcm-connection",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "bcm server management",
"author": "Justin Sherwood",
"author_email": "justin@sherwood.fm",
"download_url": "https://files.pythonhosted.org/packages/f3/63/7e5ebda65faa26f51b3759496c3cf8987653ca8dd0dceb4aa8144a4c68a8/starlyng_bcm_connection-0.1.3.tar.gz",
"platform": null,
"description": "# Starlyng BCM Connection\n\nA Python library for executing Baseboard Management Controller (BMC) commands on servers using IPMI.\n\n## Features\n\n- Execute BMC commands on remote servers using IPMI via `execute_bcm_command`\n- Parallel execution of commands across multiple servers using threading\n- Comprehensive error logging and handling\n- Support for common IPMI operations:\n - Power management (status, on, off, cycle, reset)\n - System Event Log (SEL) operations\n - Chassis control\n- Flexible server configuration through `BCMServer` class\n- Secure connection handling with IPMI over LAN (LANPLUS)\n- Command output capture and structured response handling\n- Utility functions for hostname and IP address management:\n - Generate consistent host IDs and hostnames\n - Handle both local and public IP configurations\n - VLAN-aware IP address management\n\n## Prerequisites\n\nBefore you begin, ensure you have:\n* Python 3.9 or higher installed\n* ipmitool installed on your system:\n * Ubuntu: `sudo apt-get install ipmitool`\n * macOS: `brew install ipmitool`\n* If outside local network, configure port forwarding on your router:\n * Forward BCM port 623 to each server's unique port (62300-62399)\n * Example: Forward port 62300 to 192.168.50.1:623, port 62301 to 192.168.50.2:623\n * Port range must be between 62300-62399\n\n## Installation\n\n```bash\npip install starlyng-bcm-connection\n```\n\n## Usage\n\n### Basic Example\n\n```python\nfrom bcm_connection import BCMServer, execute_bcm_command\n\n# Create a BCM server instance\nserver = BCMServer(\n bcm_ip=\"192.168.1.1\",\n bcm_user=\"admin\"\n bcm_pass=\"password\"\n bcm_port=623\n)\n\n# Execute a command\n# Pass server in a list since execute_bcm_command expects List[BCMServer]\nresult = execute_bcm_command([server], \"power status\")\nprint(result)\n```\n\n### Hostname and IP Management\n\n```python\nfrom bcm_connection import get_hostname, get_host_id, get_ip_for_bcm\n\n# Generate a hostname for a local server\nhostname = get_hostname(\"server\", \"192.168.1.20\", 623, public_ip=False)\n# Result: \"server10\" (20 - 10 = 10)\n\n# Generate a hostname for a public server\nhostname = get_hostname(\"server\", \"203.0.113.1\", 62345, public_ip=True)\n# Result: \"server45\" (last two digits of port)\n\n# Get BCM IP address with VLAN\nbcm_ip = get_ip_for_bcm(\"192.168.1.20\", vlan_id=50, public_ip=False)\n# Result: \"192.168.50.20\" (VLAN ID injected)\n```\n\n## Available BMC Commands\n\nCommon IPMI commands you can execute:\n- `power status` - Get power status\n- `power on` - Power on the server\n- `power off` - Power off the server\n- `power cycle` - Power cycle the server\n- `power reset` - Reset the server\n\n## Contributing\n\n1. Fork the project\n2. Create your feature branch (`git checkout -b feature/YourFeature`)\n3. Commit your changes (`git commit -am 'Add some YourFeature'`)\n4. Push to the branch (`git push origin feature/YourFeature`)\n5. Open a pull request\n\n## Contact\n\nIf you have any questions, please contact:\n\n- GitHub: [@justinsherwood](https://github.com/justinsherwood)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library for BCM functionality.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/starlyngapp/ssh-connection"
},
"split_keywords": [
"bcm",
"server",
"management"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "51e67827dc972135e92c368c5a7341ad31c56351788e206bd744b088cfca9517",
"md5": "6bf767df5b1b0e9095e07787f1afd92e",
"sha256": "87874354002355f8f67287396b0d51511ee5f8d8b1a517d942554408d69d1259"
},
"downloads": -1,
"filename": "starlyng_bcm_connection-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6bf767df5b1b0e9095e07787f1afd92e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5830,
"upload_time": "2024-12-13T02:24:32",
"upload_time_iso_8601": "2024-12-13T02:24:32.236468Z",
"url": "https://files.pythonhosted.org/packages/51/e6/7827dc972135e92c368c5a7341ad31c56351788e206bd744b088cfca9517/starlyng_bcm_connection-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f3637e5ebda65faa26f51b3759496c3cf8987653ca8dd0dceb4aa8144a4c68a8",
"md5": "dcb471dfb026f878ba20a7318ab9261c",
"sha256": "d770c7f1bac63495ef01534e623b5657ebcbf5cc91f922c8981b86b27606017d"
},
"downloads": -1,
"filename": "starlyng_bcm_connection-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "dcb471dfb026f878ba20a7318ab9261c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5186,
"upload_time": "2024-12-13T02:24:34",
"upload_time_iso_8601": "2024-12-13T02:24:34.538570Z",
"url": "https://files.pythonhosted.org/packages/f3/63/7e5ebda65faa26f51b3759496c3cf8987653ca8dd0dceb4aa8144a4c68a8/starlyng_bcm_connection-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-13 02:24:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "starlyngapp",
"github_project": "ssh-connection",
"github_not_found": true,
"lcname": "starlyng-bcm-connection"
}