Skip to content
Snippets Groups Projects
Commit 4996042b authored by André Sterba's avatar André Sterba
Browse files

Add basic configuration

parent 31ee679e
No related branches found
No related tags found
5 merge requests!376Add additional example application hostname-checker,!349Northbound refactoring to implement NIB concept for devices,!343Add basic application framework and example application to show interaction between events an NBI,!339Create basic venv-manager for use with arista,!324Provide prototype implementation for topology handling
Pipeline #106150 failed
This commit is part of merge request !343. Comments created here will be created in the context of that merge request.
package configuration
import (
"fmt"
"net"
)
type IPConfig struct {
IP net.IP `json:"ip,omitempty"`
PrefixLength int `json:"prefix_length,omitempty"`
}
func New(ip string, prefixLength int) (IPConfig, error) {
newIPConfig := IPConfig{}
parsedIP := net.ParseIP(ip)
if parsedIP == nil {
return newIPConfig, fmt.Errorf("%s can not be parsed to an IP.", ip)
}
newIPConfig.IP = parsedIP
newIPConfig.PrefixLength = prefixLength
return newIPConfig, nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment