https://github.com/corentinptrl/cisconf
Parses, generates and compares Cisco configurations
https://github.com/corentinptrl/cisconf
cisco ios ios-xe network networking parser router switch
Last synced: 5 months ago
JSON representation
Parses, generates and compares Cisco configurations
- Host: GitHub
- URL: https://github.com/corentinptrl/cisconf
- Owner: CorentinPtrl
- License: apache-2.0
- Created: 2025-05-11T13:15:29.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-31T16:34:50.000Z (about 1 year ago)
- Last Synced: 2025-06-18T09:17:28.134Z (about 1 year ago)
- Topics: cisco, ios, ios-xe, network, networking, parser, router, switch
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Cisconf
Cisconf is a Go-based library for unmarshalling, marshalling, and comparing Cisco network configurations. It supports various Cisco configuration components such as VLANs, interfaces, OSPF, and EIGRP.
## Features
- Parse Cisco configuration files into Go structs.
- Compare two Cisco configurations and generate a diff.
- Supported components:
- VLANs
- Interfaces (Layer 2 and Layer 3)
- OSPF
- EIGRP
## Usage
### Parsing a Configuration
Use the `cisconf.Unmarshal` function to parse a Cisco configuration string into a Go struct.
```go
var vlan cisconf.Vlan
config := "vlan 300\n name office\n!"
err := cisconf.Unmarshal(config, &vlan)
if err != nil {
panic(err)
}
```
### Generating a Configuration
Use the `cisconf.Marshal` function to generate a Cisco configuration string from a Go struct.
```go
generated, err := cisconf.Marshal(vlan)
if err != nil {
panic(err)
}
```
### Comparing Configurations
Use the `cisconf.Diff` function to compare two Cisco configuration strings and generate a diff.
```go
src := cisconf.Vlan{Id: 300, Name: "office"}
dest := cisconf.Vlan{Id: 300, Name: "new_office"}
diff, err := cisconf.Diff(src, dest)
if err != nil {
panic(err)
}
fmt.Println(diff)
```
## Running Tests
Run the test suite to validate the library's functionality:
```bash
go test ./test
```
## Credits
This project is built upon the work of Johannes Bindriem in [Jap](https://github.com/Letsu/jap).
## Contributing
1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Submit a pull request with a detailed description of your changes.