Skip to content

Commit

Permalink
Update route of DeploynemtNetwork entity
Browse files Browse the repository at this point in the history
  • Loading branch information
sufuf3 committed Aug 20, 2018
1 parent bb61706 commit 09969a4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/entity/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,27 @@ const (
DeploymentCustomNetwork = "custom"
)

// DeploymentRoute is the structure for add IP routing table
type DeploymentRoute struct {
// DeploymentRouteGw is the structure for add IP routing table
type DeploymentRouteGw struct {
DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
Gateway string `bson:"gateway" json:"gateway" validate:"omitempty,ipv4"`
}

// DeploymentRouteIntf is the structure for add IP routing table via interface
type DeploymentRouteIntf struct {
DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
}

// DeploymentNetwork is the structure for deployment network info
type DeploymentNetwork struct {
Name string `bson:"name" json:"name" validate:"required"`
IfName string `bson:"ifName" json:"ifName" validate:"required"`
// can not validate nil
VlanTag *int32 `bson:"vlanTag" json:"vlanTag" validate:"-"`
IPAddress string `bson:"ipAddress" json:"ipAddress" validate:"required,ipv4"`
Netmask string `bson:"netmask" json:"netmask" validate:"required,ipv4"`
Routes []DeploymentRoute `bson:"routes,omitempty" json:"routes" validate:"required,dive,required"`
VlanTag *int32 `bson:"vlanTag" json:"vlanTag" validate:"-"`
IPAddress string `bson:"ipAddress" json:"ipAddress" validate:"required,ipv4"`
Netmask string `bson:"netmask" json:"netmask" validate:"required,ipv4"`
RoutesGw []DeploymentRouteGw `bson:"routesGw,omitempty" json:"routesGw" validate:"required,dive,required"`
RoutesIntf []DeploymentRouteIntf `bson:"routesIntf,omitempty" json:"routesIntf" validate:"required,dive,required"`

// It's from the entity.Network entity
BridgeName string `bson:"bridgeName" json:"bridgeName" validate:"-"`
Expand Down

0 comments on commit 09969a4

Please sign in to comment.