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.
- 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
Use the cisconf.Unmarshal
function to parse a Cisco configuration string into a Go struct.
var vlan cisconf.Vlan
config := "vlan 300\n name office\n!"
err := cisconf.Unmarshal(config, &vlan)
if err != nil {
panic(err)
}
Use the cisconf.Marshal
function to generate a Cisco configuration string from a Go struct.
generated, err := cisconf.Marshal(vlan)
if err != nil {
panic(err)
}
Use the cisconf.Diff
function to compare two Cisco configuration strings and generate a diff.
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)
Run the test suite to validate the library's functionality:
go test ./test
This project is built upon the work of Johannes Bindriem in Jap.
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a detailed description of your changes.