From 38e9f0f9c6e9d3f9abcb2c0e5fd2da2625e3fbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sterba?= <andre.sterba@stud.h-da.de> Date: Thu, 23 Jun 2022 14:39:52 +0200 Subject: [PATCH] Fix lint errors --- controller/topology/ports/configuration/configuration.go | 8 +++++--- controller/topology/ports/port.go | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/controller/topology/ports/configuration/configuration.go b/controller/topology/ports/configuration/configuration.go index f97abf526..38314e773 100644 --- a/controller/topology/ports/configuration/configuration.go +++ b/controller/topology/ports/configuration/configuration.go @@ -5,16 +5,18 @@ import ( "net" ) +// IPConfig represents an interface configuration for a cEOS instance type IPConfig struct { - IP net.IP `json:"ip,omitempty"` - PrefixLength int `json:"prefix_length,omitempty"` + IP net.IP `bson:"ip,omitempty"` + PrefixLength int `bson:"prefix_length,omitempty"` } +// New creates a new IPConfig 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) + return newIPConfig, fmt.Errorf("%s can not be parsed to an IP", ip) } newIPConfig.IP = parsedIP diff --git a/controller/topology/ports/port.go b/controller/topology/ports/port.go index 466292408..e7456af6f 100644 --- a/controller/topology/ports/port.go +++ b/controller/topology/ports/port.go @@ -7,9 +7,9 @@ import ( // Port is a representation of physical port on a network element type Port struct { - ID uuid.UUID `bson:"_id"` - Name string `bson:"name,omitempty"` - Configuration configuration.IPConfig + ID uuid.UUID `bson:"_id"` + Name string `bson:"name,omitempty"` + Configuration configuration.IPConfig `bson:"configuration,omitempty"` } // GetID returns the id of a port -- GitLab