This project demonstrates the use of Go for automating network tasks, specifically interacting with Cisco devices via SSH. The application connects to a network device, enters enable mode, and saves the running configuration to the startup configuration, ensuring that changes made to the device are persistent.
- Establishes an SSH connection to a network device.
- Automates sending commands like entering enable mode and saving configurations.
- Verifies configuration changes.
- Uses Go's powerful concurrency and networking capabilities.
To run this project, you need:
- Go 1.18 or later installed.
- A Cisco device accessible over SSH.
- The
golang.org/x/crypto/ssh
package installed.
-
Install Go: If you haven't installed Go yet, download it from here.
-
Clone the repository:
git clone https://github.com/sojoudian/NetworkAutomationWithGolang.git cd NetworkAutomationWithGolang
-
Install dependencies: Install the necessary Go package by running:
go get golang.org/x/crypto/ssh
-
Open the
main.go
file and replace the placeholder values for the device's IP address, username, and password with your actual network device credentials. -
Run the Go application:
go run main.go
-
The application will connect to the Cisco device, enter enable mode, and save the running configuration to the startup configuration.
You can easily modify this code to execute other network automation tasks such as:
- Backing up configurations.
- Pushing configuration changes.
- Gathering operational data from network devices.
This project is licensed under the MIT License.
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.
For any inquiries, please contact Me.