From e952f7fd8b07305209ee80b7787985427371eb44 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Thu, 28 Nov 2024 10:30:48 +0100 Subject: [PATCH] Fix showing network type Signed-off-by: Ondra Machacek --- api/v1alpha1/agent/spec.gen.go | 45 ++++++++++++------------ api/v1alpha1/openapi.yaml | 4 ++- api/v1alpha1/spec.gen.go | 62 +++++++++++++++++----------------- api/v1alpha1/types.gen.go | 7 ++-- cmd/planner-agent/COLLECTOR.md | 2 +- internal/agent/collector.go | 31 ++++++++++------- 6 files changed, 82 insertions(+), 69 deletions(-) diff --git a/api/v1alpha1/agent/spec.gen.go b/api/v1alpha1/agent/spec.gen.go index b711e82..62432be 100644 --- a/api/v1alpha1/agent/spec.gen.go +++ b/api/v1alpha1/agent/spec.gen.go @@ -19,28 +19,29 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+RYTXPbNhD9Kxy0R0qU3fSim+3mQ5Mm9diT5JDRYU2uRMQkwAJLa9wM/3sHACFSIkQp", - "bpxppzeJWOwuHt7uW/IrS2VZSYGCNJt/ZTrNsQT782KNgm4JqNYfqgwIzcNKyQoVcbQmqcIMBXEoPqjC", - "PKDHCtmcaVJcrFkTM54FH2vrdmRpIVYyuPyASnMpAmtNzBT+WXOFGZt/9iF2HMZ7Gdv8Op/L2PuUd18w", - "JRPvpVJSDU9eotawtpBkqFPFK7JZOfvIL8dHkvR2yyZmC7FSMIyUAYEmqdw/TljqodFKIV5BBSmnx9eX", - "PXC4IFyjMichSVAcNbJPjmFrV4ce4/08QoC2D0ApeDT/c6npWm5QGaq500CWcQMnFNc7pzyUbs+78aav", - "UV0VtSZUO5Ad3L7NRSBtpLofQ1pAiUFieuRQ1GXLP5GBMvzKuDG7qwmzHiTj2No4p+DnLsEdV4/c/BuD", - "TGh9P35nvO98CO/w+nogxn3uho6yEA8oSKrHIczcF8PPCldszn5Kuj6VtE0qcRVjmkKKor3tMfuPV87M", - "7HB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npcc/RfPR7/DtDsMaEKHUm96XL+jjtAefsTnuxs0DpJLjXCfyY3o+8+5IbnWUIbHnm9U", + "75KLj1BUGLY2hGqElO2c1Du8IIWbnhW6AfV8JbXv6HBX4Fi7T5zyT6AFF2szvOe9pGH3BydrwW5SD+Z5", + "MqljGYRZEBCvVFVXzTw7LKZ9Cm3dNHV/1QjcE/f78fcJm8tGort3NOTnUNOtRHRhu0EwUjzFjfyns7L6", + "blO3hvLJiJ6qolElNL5+QpMr64eKW5Y2x9sxp0tBdw37UB654BB3+iWzdZ3f63DBUxQG27cOdqEgzTE6", + "n86sTtpXbpYTKTNPks1mMwW3PJV6ndR7TfL74url+9uXk/PpbJpTWTjIOFk023kzui5ACNTRxfUimkRO", + "KyIUmZLcnXH30s0qkeGKC8wcAxUKUJzN2S/T2fTM4gCUO9gTUDx5OEv8wJd85dk2acccVVH/zdnrfuSt", + "IrmKKEefCnOhav5nbM68vnY+ULjQGkr0LzSfD30vftvzxu0zm2szl8y9xLfMIF1hXH8NGTMvLP1mNHQp", + "MyfZqRRUz+egVMFTl37yxfiPF63roZrpf4PZbj2FjZL2fq2D89msj+Yfb+0Nnc/Oji298Lu+S5r+I4nL", + "bD/UJWTRjcfFxzx7/pgfBFSUS83/8ix9cfYDDvpaCrTBfv0RqC7stCagiG5RP6COGsOYEdiu99lPe2xp", + "HzWV6FvvuFLUqApID2vRKEz5imMWeV+9srzx27qT8IjCbLw3Pv8zxRmY+Lf7+mITPVKt3zGDEEX+bzU+", + "e/H8Qd9LeiUrkf2L6rwuGl/oOUJBuY22xkBR++UozTG975XuG793rLJ0UqijLl3+xiXqC93PJwnbLrd/", + "BwAA//8aO8BWZhgAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/v1alpha1/openapi.yaml b/api/v1alpha1/openapi.yaml index dd7c484..ffecf17 100644 --- a/api/v1alpha1/openapi.yaml +++ b/api/v1alpha1/openapi.yaml @@ -458,9 +458,11 @@ components: properties: type: type: string - enum: [standard, distributed] + enum: [standard, distributed, dvswitch, unsupported] name: type: string + vlanId: + type: string datastores: type: array items: diff --git a/api/v1alpha1/spec.gen.go b/api/v1alpha1/spec.gen.go index 6f3f421..8e986af 100644 --- a/api/v1alpha1/spec.gen.go +++ b/api/v1alpha1/spec.gen.go @@ -18,37 +18,37 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xYUXPbNhL+Kxj0Zu6FkpxcbuZGb4qbNJo2iSdu3YfED2twRaImAQZY2uPL6L/fACAl", - "SoQo2k3cXMdvEgEsdr/9FvsBX7jQZaUVKrJ8/oVbkWMJ/uciQ0XuR2V0hYYk+s9grRYSCFP3j+4q5HN+", - "pXWBoPg64cKgG1z4pSttSiA+5ykQTkiWyJN2jSUjVdYsSVGRhOI3U3SsbmekWOA9jco0asnq2ghcHhgk", - "oNpHiaou+fwjV5omQiuFwgWc8FuQJFU2WWkz2bptecLRGG14wjOgHJ3BiVTSDU6kukFF2tzxhNfVhPTE", - "Oc5bXyaZVsgvk0PuLNVKR72tq/S+SN+gsVKriLl1wg1+rqVxef3o0NvAsePIfra6Ce+6lHSJst14G6a+", - "+gMFOac80X6R1schCUufgX8YXPE5/2G2JeisYecsUHO9sQXGwJ37/8onocfZEq2FDN3PFK0wsiKPQpjP", - "2uHkCCjtvMt1wpdqZaC/UwoElrQJ/zbB7E5aGcRTqEBIuvvpZScZUhFmaHxkmqA4Osl/OZZLP9q3mOz7", - "EcvNPsC5tnSmb9GcE1BzIKSpdHBCcbYT5SF3O9adNXuG5rSoLaHZgezg8o0vCulWm+shpBWUGK2dFrm2", - "zi2BSsE4qqbSTbuqHXEvk3HY+n3G4BeSEMK1A5l/45CJje/vv528b7wPbz99HRCTLndjoSw3x1gPZtkW", - "w1DRhopxh5BA1WR7aP7FaZjmVhw/Ei7e2h447UbBQNK4GYvtrcwMOBIvra0HaxesRWvLpjX2W5mud0Y6", - "eS3gCovj1RqmJd2NWrNjCHbue0rE76xt8a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QHLC4aJdnOUZ+dQ+nplEwbtnBsPcSM/rNXuvKrXQ4NFA9G9FQVDSqh4fUTu2Dx7lbJjqVN", + "eFvmtCno07AP5ZEEx7jTLZmN18dBLuZSoLK4Uzl8VoLIkD0fnzk5Z3I+5U0TWa/XY/DDY22Wk3qtnfwy", + "P3/17vLV6Pn4bJxRkXvIJDk0d9cidpGDUmjY7GLeegGa8kqluJAKU0+4EhWUkk/5v8Zn42cubKDMo+xa", + "0WT1bLK7hiyRup0zl5ZYPcfbqzmd8il3GmzWDBm0pXb+OxvPz878saEV1fcyKMtcCr928kctTgLNBj1H", + "ebnnod537/3PLswXZ8++2nbhkSuy1W8KKsq0kf8N2P77K8Z4dNO56/IKcnaJZoWGNRMTTuCq5WO4RvJr", + "92k/pZMvMt2EhOZIEdkZvjvRFWwcpvdHPz6rx0owUGB4JPl4aGr+Y6OtGlPSfXZka64703Bz2FUymQqT", + "Fj6nriHX35pjffx6hFS/hJR9wM8VWvrLOP3i7MW33/Sdpte6Ut95EcmivqtFj8Ulkqf7+6sZCzMPq+cn", + "pHk90Fs6ZXWTS8EuL9+wW7xrKudzhf6xoi6d+sGkXS5/rjy0IKSRJYNByUfK8EYq8D4c7tTBd6ZaODyV", + "y9+/XEKmrzcJzxDSbnW4ryfK4w1C+j3UxyAmD2HeIKaczOxDM9E6uIJgt0M6PxM6z1E0jz/NyrgQuNyO", + "frM2XL/GfU86r4V1gMfT/rhUPoahE7CPgeDucfR7R7FL2cGKtUa5l6jDJevW2P+XZm0etZ9E6+N24Xuc", + "CKbpg7ZEIRcS02PM/YCQPvH2ibePzFt3BmcIOWVHbzphmIkMxW1MxeWedqellUtuy4V612vvsvXyJrA9", + "vJFN+OZ6878AAAD//6qEH0E/JwAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/v1alpha1/types.gen.go b/api/v1alpha1/types.gen.go index 585e479..64aed06 100644 --- a/api/v1alpha1/types.gen.go +++ b/api/v1alpha1/types.gen.go @@ -22,7 +22,9 @@ const ( // Defines values for InfraNetworksType. const ( Distributed InfraNetworksType = "distributed" + Dvswitch InfraNetworksType = "dvswitch" Standard InfraNetworksType = "standard" + Unsupported InfraNetworksType = "unsupported" ) // Defines values for SourceStatus. @@ -70,8 +72,9 @@ type Infra struct { HostPowerStates map[string]int `json:"hostPowerStates"` HostsPerCluster []int `json:"hostsPerCluster"` Networks []struct { - Name string `json:"name"` - Type InfraNetworksType `json:"type"` + Name string `json:"name"` + Type InfraNetworksType `json:"type"` + VlanId *string `json:"vlanId,omitempty"` } `json:"networks"` TotalClusters int `json:"totalClusters"` TotalHosts int `json:"totalHosts"` diff --git a/cmd/planner-agent/COLLECTOR.md b/cmd/planner-agent/COLLECTOR.md index 1fe22be..6a81d5e 100644 --- a/cmd/planner-agent/COLLECTOR.md +++ b/cmd/planner-agent/COLLECTOR.md @@ -26,7 +26,7 @@ EOF Create VMware credentials file. ``` -cat < /tmp/data/creds.json +cat < /tmp/data/credentials.json { "username": "user@example.com", "password": "userpassword", diff --git a/internal/agent/collector.go b/internal/agent/collector.go index 75a182a..6ffef06 100644 --- a/internal/agent/collector.go +++ b/internal/agent/collector.go @@ -305,12 +305,14 @@ func histogram(d []int) struct { } func getNetworks(collector *vsphere.Collector) []struct { - Name string `json:"name"` - Type apiplanner.InfraNetworksType `json:"type"` + Name string `json:"name"` + Type apiplanner.InfraNetworksType `json:"type"` + VlanId *string `json:"vlanId,omitempty"` } { r := []struct { - Name string `json:"name"` - Type apiplanner.InfraNetworksType `json:"type"` + Name string `json:"name"` + Type apiplanner.InfraNetworksType `json:"type"` + VlanId *string `json:"vlanId,omitempty"` }{} networks := &[]vspheremodel.Network{} err := collector.DB().List(networks, libmodel.FilterOptions{Detail: 1}) @@ -318,22 +320,27 @@ func getNetworks(collector *vsphere.Collector) []struct { return nil } for _, n := range *networks { + vlanId := "" // TODO: use: https://github.com/kubev2v/forklift/pull/1225 r = append(r, struct { - Name string `json:"name"` - Type apiplanner.InfraNetworksType `json:"type"` - }{Name: n.Name, Type: apiplanner.InfraNetworksType(getNetworkType(&n))}) + Name string `json:"name"` + Type apiplanner.InfraNetworksType `json:"type"` + VlanId *string `json:"vlanId,omitempty"` + }{Name: n.Name, Type: apiplanner.InfraNetworksType(getNetworkType(&n)), VlanId: &vlanId}) } return r } -// FIXME: func getNetworkType(n *vspheremodel.Network) string { - if n.Key == "hosted" { - return "standard" - } else { - return "distributed" + if n.Variant == vspheremodel.NetDvPortGroup { + return string(apiplanner.Distributed) + } else if n.Variant == vspheremodel.NetStandard { + return string(apiplanner.Standard) + } else if n.Variant == vspheremodel.NetDvSwitch { + return string(apiplanner.Dvswitch) } + + return string(apiplanner.Unsupported) } func getHostsPerCluster(clusters []vspheremodel.Cluster) []int {