Skip to content
Snippets Groups Projects

Add basic application framework and example application to show interaction between events an NBI

Merged Ghost User requested to merge istaester/init-application-framework into develop
2 files
+ 8
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -5,16 +5,18 @@ import (
@@ -5,16 +5,18 @@ import (
"net"
"net"
)
)
 
// IPConfig represents an interface configuration for a cEOS instance
type IPConfig struct {
type IPConfig struct {
IP net.IP `json:"ip,omitempty"`
IP net.IP `bson:"ip,omitempty"`
PrefixLength int `json:"prefix_length,omitempty"`
PrefixLength int `bson:"prefix_length,omitempty"`
}
}
 
// New creates a new IPConfig
func New(ip string, prefixLength int) (IPConfig, error) {
func New(ip string, prefixLength int) (IPConfig, error) {
newIPConfig := IPConfig{}
newIPConfig := IPConfig{}
parsedIP := net.ParseIP(ip)
parsedIP := net.ParseIP(ip)
if parsedIP == nil {
if parsedIP == nil {
return newIPConfig, fmt.Errorf("%s can not be parsed to an IP.", ip)
return newIPConfig, fmt.Errorf("%s can not be parsed to an IP", ip)
}
}
newIPConfig.IP = parsedIP
newIPConfig.IP = parsedIP
Loading