Merge pull request #5 from raghavendra-nataraj/vlan_subnet
moving vlan to subnet
This commit is contained in:
Коммит
c1e33e6aa9
4
go.mod
4
go.mod
|
@ -5,11 +5,11 @@ go 1.14
|
|||
require (
|
||||
github.com/Azure/go-autorest/autorest v0.9.0
|
||||
github.com/Azure/go-autorest/autorest/date v0.2.0
|
||||
github.com/golang/protobuf v1.3.3 // indirect
|
||||
github.com/microsoft/moc v0.10.1-alpha.6
|
||||
github.com/microsoft/moc v0.10.1-alpha.7
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/spf13/viper v1.6.2
|
||||
google.golang.org/grpc v1.27.1
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
k8s.io/klog v1.0.0
|
||||
)
|
||||
|
||||
|
|
7
go.sum
7
go.sum
|
@ -91,8 +91,6 @@ github.com/microsoft/moc v0.10.1-alpha.2 h1:LQaxvX00vcNafq0TIXibOLHByybo3T+Olo8g
|
|||
github.com/microsoft/moc v0.10.1-alpha.2/go.mod h1:FXDFQa7/tOXZBMSWpVnzVahSpCDVgdSkEdz9rOmT3G0=
|
||||
github.com/microsoft/moc v0.10.1-alpha.4 h1:5P6UR+2kq+X9dsjVA2OBDPLNBg0YOgGsqqURIej774E=
|
||||
github.com/microsoft/moc v0.10.1-alpha.4/go.mod h1:oK8iLrb4IOdvmokCAgbMWzPj2m7PcARZnCa3g3tNrFI=
|
||||
github.com/microsoft/moc v0.10.1-alpha.6 h1:+RFZLSe5JqZy3BwZeSXoej24R40lN08ZIlBrK9aJsDY=
|
||||
github.com/microsoft/moc v0.10.1-alpha.6/go.mod h1:oK8iLrb4IOdvmokCAgbMWzPj2m7PcARZnCa3g3tNrFI=
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
|
@ -167,10 +165,6 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgP
|
|||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200923182212-328152dc79b1 h1:Iu68XRPd67wN4aRGGWwwq6bZo/25jR6uu52l/j2KkUE=
|
||||
golang.org/x/net v0.0.0-20200923182212-328152dc79b1/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200925080053-05aa5d4ee321 h1:lleNcKRbcaC8MqgLwghIkzZ2JBQAb7QQ9MiwRt1BisA=
|
||||
golang.org/x/net v0.0.0-20200925080053-05aa5d4ee321/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -186,7 +180,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a h1:i47hUS795cOydZI4AwJQCKXOr4BvxzvikwDoDtHhP2Y=
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
|
|
|
@ -289,7 +289,7 @@ func (c *client) getVirtualMachine(vm *wssdcloudcompute.VirtualMachine, group st
|
|||
NetworkProfile: c.getVirtualMachineNetworkProfile(vm.Network),
|
||||
VmType: vmtype,
|
||||
DisableHighAvailability: &vm.DisableHighAvailability,
|
||||
Host: c.getVirtualMachineHostDescription(vm),
|
||||
Host: c.getVirtualMachineHostDescription(vm),
|
||||
},
|
||||
Version: &vm.Status.Version.Number,
|
||||
Location: &vm.LocationName,
|
||||
|
|
|
@ -31,8 +31,8 @@ func getWssdVirtualMachineImage(c *compute.VirtualMachineImage, groupName string
|
|||
// Conversion function from wssdcloudcompute to compute
|
||||
func getVirtualMachineImage(c *wssdcloudcompute.VirtualMachineImage, group string) *compute.VirtualMachineImage {
|
||||
return &compute.VirtualMachineImage{
|
||||
Name: &c.Name,
|
||||
ID: &c.Id,
|
||||
Name: &c.Name,
|
||||
ID: &c.Id,
|
||||
VirtualMachineImageProperties: &compute.VirtualMachineImageProperties{},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,8 @@ type SubnetPropertiesFormat struct {
|
|||
IPConfigurationReferences *[]IPConfigurationReference `json:"ipConfigurationReferences,omitempty"`
|
||||
// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic'
|
||||
IPAllocationMethod IPAllocationMethod `json:"ipAllocationMethod,omitempty"`
|
||||
// Vlan
|
||||
Vlan *uint16 `json:"vlan,omitempty"`
|
||||
}
|
||||
|
||||
// MACRange is associated with MACPool and respresents the start and end addresses.
|
||||
|
@ -518,8 +520,6 @@ type VirtualNetworkPropertiesFormat struct {
|
|||
Subnets *[]Subnet `json:"subnets,omitempty"`
|
||||
// MACPool name - Name of the associated MAC pool (or leave empty to use the default mac pool)
|
||||
MacPoolName *string `json:"macPoolName,omitempty"`
|
||||
// Vlan
|
||||
Vlan *int32 `json:"vlan,omitempty"`
|
||||
// ProvisioningState - The provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.
|
||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
||||
// State - State
|
||||
|
|
|
@ -44,12 +44,6 @@ func getWssdVirtualNetwork(c *network.VirtualNetwork, groupName string) (*wssdcl
|
|||
if c.VirtualNetworkPropertiesFormat.MacPoolName != nil {
|
||||
wssdnetwork.MacPoolName = *c.VirtualNetworkPropertiesFormat.MacPoolName
|
||||
}
|
||||
|
||||
if c.Vlan == nil {
|
||||
wssdnetwork.Vlan = 0
|
||||
} else {
|
||||
wssdnetwork.Vlan = uint32(*c.Vlan)
|
||||
}
|
||||
}
|
||||
|
||||
if c.Type == nil {
|
||||
|
@ -96,12 +90,21 @@ func getWssdNetworkSubnets(subnets *[]network.Subnet) (wssdsubnets []*wssdcloudn
|
|||
wssdsubnet := &wssdcloudnetwork.Subnet{
|
||||
Name: *subnet.Name,
|
||||
}
|
||||
if subnet.SubnetPropertiesFormat == nil || subnet.AddressPrefix == nil {
|
||||
err = errors.Wrapf(errors.InvalidInput, "AddressPrefix is missing")
|
||||
return
|
||||
|
||||
if subnet.SubnetPropertiesFormat != nil && subnet.IPAllocationMethod == network.Static {
|
||||
if subnet.AddressPrefix == nil {
|
||||
err = errors.Wrapf(errors.InvalidInput, "AddressPrefix is missing")
|
||||
return
|
||||
}
|
||||
wssdsubnet.Cidr = *subnet.AddressPrefix
|
||||
}
|
||||
|
||||
if subnet.Vlan == nil {
|
||||
wssdsubnet.Vlan = 0
|
||||
} else {
|
||||
wssdsubnet.Vlan = uint32(*subnet.Vlan)
|
||||
}
|
||||
|
||||
wssdsubnet.Cidr = *subnet.AddressPrefix
|
||||
wssdsubnetRoutes, err1 := getWssdNetworkRoutes(subnet.RouteTable)
|
||||
if err1 != nil {
|
||||
err = err1
|
||||
|
@ -179,7 +182,6 @@ func getVirtualNetwork(c *wssdcloudnetwork.VirtualNetwork, group string) *networ
|
|||
Subnets: getNetworkSubnets(c.Subnets),
|
||||
Statuses: status.GetStatuses(c.GetStatus()),
|
||||
MacPoolName: &c.MacPoolName,
|
||||
Vlan: getVlan(c.Vlan),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -196,6 +198,7 @@ func getNetworkSubnets(wssdsubnets []*wssdcloudnetwork.Subnet) *[]network.Subnet
|
|||
RouteTable: getNetworkRoutetable(subnet.Routes),
|
||||
// TODO: implement something for IPConfigurationReferences
|
||||
IPAllocationMethod: ipAllocationMethodProtobufToSdk(subnet.Allocation),
|
||||
Vlan: getVlan(subnet.Vlan),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -222,8 +225,8 @@ func getNetworkRoutetable(wssdcloudroutes []*wssdcloudnetwork.Route) *network.Ro
|
|||
}
|
||||
}
|
||||
|
||||
func getVlan(wssdvlan uint32) *int32 {
|
||||
vlan := int32(wssdvlan)
|
||||
func getVlan(wssdvlan uint32) *uint16 {
|
||||
vlan := uint16(wssdvlan)
|
||||
return &vlan
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче