From 65189ee5d533bcbfb4c729942a3ae5682ebeb75c Mon Sep 17 00:00:00 2001 From: ish Date: Fri, 24 May 2024 16:50:32 +0900 Subject: [PATCH] Fix issue of getting honeybee models --- api/docs.go | 454 +++++++++++++++++- api/swagger.json | 454 +++++++++++++++++- api/swagger.yaml | 306 +++++++++++- pkg/api/rest/model/README.md | 4 +- pkg/api/rest/model/get-onprem-models.sh | 6 +- pkg/api/rest/model/onprem/infra/compute.go | 45 +- pkg/api/rest/model/onprem/infra/gpu.go | 38 +- pkg/api/rest/model/onprem/infra/infra.go | 11 +- pkg/api/rest/model/onprem/infra/storage.go | 19 + pkg/api/rest/model/onprem/network/bonding.go | 47 -- pkg/api/rest/model/onprem/network/csp.go | 44 ++ pkg/api/rest/model/onprem/network/dns.go | 6 + pkg/api/rest/model/onprem/network/firewall.go | 12 + .../rest/model/onprem/network/libvirtNet.go | 15 - .../rest/model/onprem/network/netfilter.go | 16 - pkg/api/rest/model/onprem/network/network.go | 19 +- pkg/api/rest/model/onprem/network/nic.go | 11 +- pkg/api/rest/model/onprem/network/ovs.go | 28 -- pkg/api/rest/model/onprem/software/deb.go | 29 +- 19 files changed, 1331 insertions(+), 233 deletions(-) create mode 100644 pkg/api/rest/model/onprem/infra/storage.go delete mode 100644 pkg/api/rest/model/onprem/network/bonding.go create mode 100644 pkg/api/rest/model/onprem/network/csp.go create mode 100644 pkg/api/rest/model/onprem/network/dns.go create mode 100644 pkg/api/rest/model/onprem/network/firewall.go delete mode 100644 pkg/api/rest/model/onprem/network/libvirtNet.go delete mode 100644 pkg/api/rest/model/onprem/network/netfilter.go delete mode 100644 pkg/api/rest/model/onprem/network/ovs.go diff --git a/api/docs.go b/api/docs.go index de7e94e..1a56db6 100644 --- a/api/docs.go +++ b/api/docs.go @@ -1915,6 +1915,15 @@ const docTemplate = `{ "properties": { "compute": { "$ref": "#/definitions/infra.Compute" + }, + "gpu": { + "$ref": "#/definitions/infra.GPU" + }, + "network": { + "$ref": "#/definitions/network.Network" + }, + "storage": { + "$ref": "#/definitions/infra.Storage" } } }, @@ -2004,13 +2013,13 @@ const docTemplate = `{ "description": "ea", "type": "integer" }, - "model": { - "type": "string" - }, - "speed": { + "max_speed": { "description": "MHz", "type": "integer" }, + "model": { + "type": "string" + }, "threads": { "description": "ea", "type": "integer" @@ -2026,6 +2035,12 @@ const docTemplate = `{ "compute_resource": { "$ref": "#/definitions/infra.ComputeResource" }, + "connection": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Connection" + } + }, "os": { "$ref": "#/definitions/infra.System" } @@ -2037,13 +2052,73 @@ const docTemplate = `{ "cpu": { "$ref": "#/definitions/infra.CPU" }, + "data_disk": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Disk" + } + }, "memory": { "$ref": "#/definitions/infra.Memory" }, - "storage": { + "root_disk": { + "$ref": "#/definitions/infra.Disk" + } + } + }, + "infra.Connection": { + "type": "object", + "properties": { + "keypair": { + "$ref": "#/definitions/infra.Keypair" + } + } + }, + "infra.DRM": { + "type": "object", + "properties": { + "driver_date": { + "type": "string" + }, + "driver_description": { + "type": "string" + }, + "driver_name": { + "type": "string" + }, + "driver_version": { + "type": "string" + } + } + }, + "infra.Disk": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "size": { + "description": "GB", + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "infra.GPU": { + "type": "object", + "properties": { + "drm": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.DRM" + } + }, + "nvidia": { "type": "array", "items": { - "$ref": "#/definitions/infra.Storage" + "$ref": "#/definitions/infra.NVIDIA" } } } @@ -2062,6 +2137,20 @@ const docTemplate = `{ } } }, + "infra.Keypair": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "private_key": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + }, "infra.Memory": { "type": "object", "properties": { @@ -2078,6 +2167,101 @@ const docTemplate = `{ } } }, + "infra.MountPoint": { + "type": "object", + "properties": { + "mounted_information": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.MountedInformation" + } + } + } + }, + "infra.MountedInformation": { + "type": "object", + "properties": { + "destination": { + "type": "string" + }, + "filesystem": { + "type": "string" + }, + "option": { + "type": "string" + }, + "source": { + "type": "string" + } + } + }, + "infra.NVIDIA": { + "type": "object", + "properties": { + "device_attribute": { + "$ref": "#/definitions/infra.NVIDIADeviceAttribute" + }, + "performance": { + "$ref": "#/definitions/infra.NVIDIAPerformance" + } + } + }, + "infra.NVIDIADeviceAttribute": { + "type": "object", + "properties": { + "cuda_version": { + "type": "string" + }, + "driver_version": { + "type": "string" + }, + "gpu_uuid": { + "type": "string" + }, + "product_architecture": { + "type": "string" + }, + "product_brand": { + "type": "string" + }, + "product_name": { + "type": "string" + } + } + }, + "infra.NVIDIAPerformance": { + "type": "object", + "properties": { + "bar1_memory_total": { + "description": "mb", + "type": "integer" + }, + "bar1_memory_usage": { + "description": "percent", + "type": "integer" + }, + "bar1_memory_used": { + "description": "mb", + "type": "integer" + }, + "fb_memory_total": { + "description": "mb", + "type": "integer" + }, + "fb_memory_usage": { + "description": "percent", + "type": "integer" + }, + "fb_memory_used": { + "description": "mb", + "type": "integer" + }, + "gpu_usage": { + "description": "percent", + "type": "integer" + } + } + }, "infra.Node": { "type": "object", "properties": { @@ -2118,52 +2302,276 @@ const docTemplate = `{ "infra.Storage": { "type": "object", "properties": { - "driver": { - "type": "string" + "mount_point": { + "$ref": "#/definitions/infra.MountPoint" + } + } + }, + "infra.System": { + "type": "object", + "properties": { + "kernel": { + "$ref": "#/definitions/infra.Kernel" }, - "model": { + "node": { + "$ref": "#/definitions/infra.Node" + }, + "os": { + "$ref": "#/definitions/infra.OS" + } + } + }, + "model.MyUser": { + "type": "object", + "properties": { + "email": { "type": "string" }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "network.CSP": { + "type": "object", + "properties": { "name": { "type": "string" }, - "serial": { + "nlb": { + "type": "array", + "items": { + "$ref": "#/definitions/network.NLB" + } + }, + "security_group": { + "type": "array", + "items": { + "$ref": "#/definitions/network.SecurityGroup" + } + }, + "vpc": { + "type": "array", + "items": { + "$ref": "#/definitions/network.VPC" + } + } + } + }, + "network.DNS": { + "type": "object", + "properties": { + "dns_server": { + "description": "IPv4 or IPv6 DNS Server Addresses", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "network.FirewallRule": { + "type": "object", + "properties": { + "action": { + "description": "allow, deny", + "type": "string" + }, + "direction": { + "description": "inbound, outbound", "type": "string" }, - "size": { - "description": "GB", + "dst": { + "type": "string" + }, + "dst_ports": { + "type": "string" + }, + "priority": { + "description": "Lower has higher priority", "type": "integer" }, - "vendor": { + "protocol": { + "description": "TCP, UDP, ICMP", + "type": "string" + }, + "src": { + "type": "string" + }, + "src_ports": { "type": "string" } } }, - "infra.System": { + "network.Host": { "type": "object", "properties": { - "kernel": { - "$ref": "#/definitions/infra.Kernel" + "dns": { + "$ref": "#/definitions/network.DNS" }, - "node": { - "$ref": "#/definitions/infra.Node" + "firewall_rule": { + "type": "array", + "items": { + "$ref": "#/definitions/network.FirewallRule" + } }, - "os": { - "$ref": "#/definitions/infra.OS" + "network_interface": { + "type": "array", + "items": { + "$ref": "#/definitions/network.NIC" + } + }, + "route": { + "type": "array", + "items": { + "$ref": "#/definitions/network.Route" + } } } }, - "model.MyUser": { + "network.NIC": { "type": "object", "properties": { - "email": { + "address": { + "type": "array", + "items": { + "type": "string" + } + }, + "gateway": { + "type": "array", + "items": { + "type": "string" + } + }, + "interface": { "type": "string" }, - "id": { + "mac_address": { + "type": "string" + }, + "mtu": { "type": "integer" + } + } + }, + "network.NLB": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "health_checker": { + "type": "string" + }, + "id": { + "type": "string" + }, + "listener": { + "type": "string" }, "name": { "type": "string" + }, + "target_group": { + "type": "string" + } + } + }, + "network.Network": { + "type": "object", + "properties": { + "csp": { + "$ref": "#/definitions/network.CSP" + }, + "host": { + "$ref": "#/definitions/network.Host" + } + } + }, + "network.Route": { + "type": "object", + "properties": { + "destination": { + "type": "string" + }, + "netmask": { + "type": "string" + }, + "next_hop": { + "type": "string" + } + } + }, + "network.SecurityGroup": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "firewall_rule": { + "type": "array", + "items": { + "$ref": "#/definitions/network.FirewallRule" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "vnet_id": { + "type": "string" + } + } + }, + "network.Subnet": { + "type": "object", + "properties": { + "ipv4_cidr": { + "description": "IPv4 Network Address with CIDR Prefix Length", + "type": "string" + }, + "ipv6_cidr": { + "description": "IPv6 Network Address with CIDR Prefix Length", + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "network.VPC": { + "type": "object", + "properties": { + "address_space": { + "description": "IPv4 CIDR or IPv6 CIDR", + "type": "array", + "items": { + "type": "string" + } + }, + "dns_server": { + "type": "array", + "items": { + "$ref": "#/definitions/network.DNS" + } + }, + "id": { + "type": "string" + }, + "region": { + "type": "string" + }, + "subnet": { + "type": "array", + "items": { + "$ref": "#/definitions/network.Subnet" + } } } } diff --git a/api/swagger.json b/api/swagger.json index e32ccc2..190d6fd 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -1908,6 +1908,15 @@ "properties": { "compute": { "$ref": "#/definitions/infra.Compute" + }, + "gpu": { + "$ref": "#/definitions/infra.GPU" + }, + "network": { + "$ref": "#/definitions/network.Network" + }, + "storage": { + "$ref": "#/definitions/infra.Storage" } } }, @@ -1997,13 +2006,13 @@ "description": "ea", "type": "integer" }, - "model": { - "type": "string" - }, - "speed": { + "max_speed": { "description": "MHz", "type": "integer" }, + "model": { + "type": "string" + }, "threads": { "description": "ea", "type": "integer" @@ -2019,6 +2028,12 @@ "compute_resource": { "$ref": "#/definitions/infra.ComputeResource" }, + "connection": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Connection" + } + }, "os": { "$ref": "#/definitions/infra.System" } @@ -2030,13 +2045,73 @@ "cpu": { "$ref": "#/definitions/infra.CPU" }, + "data_disk": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Disk" + } + }, "memory": { "$ref": "#/definitions/infra.Memory" }, - "storage": { + "root_disk": { + "$ref": "#/definitions/infra.Disk" + } + } + }, + "infra.Connection": { + "type": "object", + "properties": { + "keypair": { + "$ref": "#/definitions/infra.Keypair" + } + } + }, + "infra.DRM": { + "type": "object", + "properties": { + "driver_date": { + "type": "string" + }, + "driver_description": { + "type": "string" + }, + "driver_name": { + "type": "string" + }, + "driver_version": { + "type": "string" + } + } + }, + "infra.Disk": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "size": { + "description": "GB", + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "infra.GPU": { + "type": "object", + "properties": { + "drm": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.DRM" + } + }, + "nvidia": { "type": "array", "items": { - "$ref": "#/definitions/infra.Storage" + "$ref": "#/definitions/infra.NVIDIA" } } } @@ -2055,6 +2130,20 @@ } } }, + "infra.Keypair": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "private_key": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + }, "infra.Memory": { "type": "object", "properties": { @@ -2071,6 +2160,101 @@ } } }, + "infra.MountPoint": { + "type": "object", + "properties": { + "mounted_information": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.MountedInformation" + } + } + } + }, + "infra.MountedInformation": { + "type": "object", + "properties": { + "destination": { + "type": "string" + }, + "filesystem": { + "type": "string" + }, + "option": { + "type": "string" + }, + "source": { + "type": "string" + } + } + }, + "infra.NVIDIA": { + "type": "object", + "properties": { + "device_attribute": { + "$ref": "#/definitions/infra.NVIDIADeviceAttribute" + }, + "performance": { + "$ref": "#/definitions/infra.NVIDIAPerformance" + } + } + }, + "infra.NVIDIADeviceAttribute": { + "type": "object", + "properties": { + "cuda_version": { + "type": "string" + }, + "driver_version": { + "type": "string" + }, + "gpu_uuid": { + "type": "string" + }, + "product_architecture": { + "type": "string" + }, + "product_brand": { + "type": "string" + }, + "product_name": { + "type": "string" + } + } + }, + "infra.NVIDIAPerformance": { + "type": "object", + "properties": { + "bar1_memory_total": { + "description": "mb", + "type": "integer" + }, + "bar1_memory_usage": { + "description": "percent", + "type": "integer" + }, + "bar1_memory_used": { + "description": "mb", + "type": "integer" + }, + "fb_memory_total": { + "description": "mb", + "type": "integer" + }, + "fb_memory_usage": { + "description": "percent", + "type": "integer" + }, + "fb_memory_used": { + "description": "mb", + "type": "integer" + }, + "gpu_usage": { + "description": "percent", + "type": "integer" + } + } + }, "infra.Node": { "type": "object", "properties": { @@ -2111,52 +2295,276 @@ "infra.Storage": { "type": "object", "properties": { - "driver": { - "type": "string" + "mount_point": { + "$ref": "#/definitions/infra.MountPoint" + } + } + }, + "infra.System": { + "type": "object", + "properties": { + "kernel": { + "$ref": "#/definitions/infra.Kernel" }, - "model": { + "node": { + "$ref": "#/definitions/infra.Node" + }, + "os": { + "$ref": "#/definitions/infra.OS" + } + } + }, + "model.MyUser": { + "type": "object", + "properties": { + "email": { "type": "string" }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "network.CSP": { + "type": "object", + "properties": { "name": { "type": "string" }, - "serial": { + "nlb": { + "type": "array", + "items": { + "$ref": "#/definitions/network.NLB" + } + }, + "security_group": { + "type": "array", + "items": { + "$ref": "#/definitions/network.SecurityGroup" + } + }, + "vpc": { + "type": "array", + "items": { + "$ref": "#/definitions/network.VPC" + } + } + } + }, + "network.DNS": { + "type": "object", + "properties": { + "dns_server": { + "description": "IPv4 or IPv6 DNS Server Addresses", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "network.FirewallRule": { + "type": "object", + "properties": { + "action": { + "description": "allow, deny", + "type": "string" + }, + "direction": { + "description": "inbound, outbound", "type": "string" }, - "size": { - "description": "GB", + "dst": { + "type": "string" + }, + "dst_ports": { + "type": "string" + }, + "priority": { + "description": "Lower has higher priority", "type": "integer" }, - "vendor": { + "protocol": { + "description": "TCP, UDP, ICMP", + "type": "string" + }, + "src": { + "type": "string" + }, + "src_ports": { "type": "string" } } }, - "infra.System": { + "network.Host": { "type": "object", "properties": { - "kernel": { - "$ref": "#/definitions/infra.Kernel" + "dns": { + "$ref": "#/definitions/network.DNS" }, - "node": { - "$ref": "#/definitions/infra.Node" + "firewall_rule": { + "type": "array", + "items": { + "$ref": "#/definitions/network.FirewallRule" + } }, - "os": { - "$ref": "#/definitions/infra.OS" + "network_interface": { + "type": "array", + "items": { + "$ref": "#/definitions/network.NIC" + } + }, + "route": { + "type": "array", + "items": { + "$ref": "#/definitions/network.Route" + } } } }, - "model.MyUser": { + "network.NIC": { "type": "object", "properties": { - "email": { + "address": { + "type": "array", + "items": { + "type": "string" + } + }, + "gateway": { + "type": "array", + "items": { + "type": "string" + } + }, + "interface": { "type": "string" }, - "id": { + "mac_address": { + "type": "string" + }, + "mtu": { "type": "integer" + } + } + }, + "network.NLB": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "health_checker": { + "type": "string" + }, + "id": { + "type": "string" + }, + "listener": { + "type": "string" }, "name": { "type": "string" + }, + "target_group": { + "type": "string" + } + } + }, + "network.Network": { + "type": "object", + "properties": { + "csp": { + "$ref": "#/definitions/network.CSP" + }, + "host": { + "$ref": "#/definitions/network.Host" + } + } + }, + "network.Route": { + "type": "object", + "properties": { + "destination": { + "type": "string" + }, + "netmask": { + "type": "string" + }, + "next_hop": { + "type": "string" + } + } + }, + "network.SecurityGroup": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "firewall_rule": { + "type": "array", + "items": { + "$ref": "#/definitions/network.FirewallRule" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "vnet_id": { + "type": "string" + } + } + }, + "network.Subnet": { + "type": "object", + "properties": { + "ipv4_cidr": { + "description": "IPv4 Network Address with CIDR Prefix Length", + "type": "string" + }, + "ipv6_cidr": { + "description": "IPv6 Network Address with CIDR Prefix Length", + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "network.VPC": { + "type": "object", + "properties": { + "address_space": { + "description": "IPv4 CIDR or IPv6 CIDR", + "type": "array", + "items": { + "type": "string" + } + }, + "dns_server": { + "type": "array", + "items": { + "$ref": "#/definitions/network.DNS" + } + }, + "id": { + "type": "string" + }, + "region": { + "type": "string" + }, + "subnet": { + "type": "array", + "items": { + "$ref": "#/definitions/network.Subnet" + } } } } diff --git a/api/swagger.yaml b/api/swagger.yaml index 9d39b39..9bf19af 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -626,6 +626,12 @@ definitions: properties: compute: $ref: '#/definitions/infra.Compute' + gpu: + $ref: '#/definitions/infra.GPU' + network: + $ref: '#/definitions/network.Network' + storage: + $ref: '#/definitions/infra.Storage' type: object controller.RecommendInfraResponse: properties: @@ -691,11 +697,11 @@ definitions: cpus: description: ea type: integer - model: - type: string - speed: + max_speed: description: MHz type: integer + model: + type: string threads: description: ea type: integer @@ -706,6 +712,10 @@ definitions: properties: compute_resource: $ref: '#/definitions/infra.ComputeResource' + connection: + items: + $ref: '#/definitions/infra.Connection' + type: array os: $ref: '#/definitions/infra.System' type: object @@ -713,11 +723,50 @@ definitions: properties: cpu: $ref: '#/definitions/infra.CPU' + data_disk: + items: + $ref: '#/definitions/infra.Disk' + type: array memory: $ref: '#/definitions/infra.Memory' - storage: + root_disk: + $ref: '#/definitions/infra.Disk' + type: object + infra.Connection: + properties: + keypair: + $ref: '#/definitions/infra.Keypair' + type: object + infra.DRM: + properties: + driver_date: + type: string + driver_description: + type: string + driver_name: + type: string + driver_version: + type: string + type: object + infra.Disk: + properties: + label: + type: string + size: + description: GB + type: integer + type: + type: string + type: object + infra.GPU: + properties: + drm: items: - $ref: '#/definitions/infra.Storage' + $ref: '#/definitions/infra.DRM' + type: array + nvidia: + items: + $ref: '#/definitions/infra.NVIDIA' type: array type: object infra.Kernel: @@ -729,6 +778,15 @@ definitions: version: type: string type: object + infra.Keypair: + properties: + name: + type: string + private_key: + type: string + public_key: + type: string + type: object infra.Memory: properties: size: @@ -740,6 +798,70 @@ definitions: type: type: string type: object + infra.MountPoint: + properties: + mounted_information: + items: + $ref: '#/definitions/infra.MountedInformation' + type: array + type: object + infra.MountedInformation: + properties: + destination: + type: string + filesystem: + type: string + option: + type: string + source: + type: string + type: object + infra.NVIDIA: + properties: + device_attribute: + $ref: '#/definitions/infra.NVIDIADeviceAttribute' + performance: + $ref: '#/definitions/infra.NVIDIAPerformance' + type: object + infra.NVIDIADeviceAttribute: + properties: + cuda_version: + type: string + driver_version: + type: string + gpu_uuid: + type: string + product_architecture: + type: string + product_brand: + type: string + product_name: + type: string + type: object + infra.NVIDIAPerformance: + properties: + bar1_memory_total: + description: mb + type: integer + bar1_memory_usage: + description: percent + type: integer + bar1_memory_used: + description: mb + type: integer + fb_memory_total: + description: mb + type: integer + fb_memory_usage: + description: percent + type: integer + fb_memory_used: + description: mb + type: integer + gpu_usage: + description: percent + type: integer + type: object infra.Node: properties: hostname: @@ -766,19 +888,8 @@ definitions: type: object infra.Storage: properties: - driver: - type: string - model: - type: string - name: - type: string - serial: - type: string - size: - description: GB - type: integer - vendor: - type: string + mount_point: + $ref: '#/definitions/infra.MountPoint' type: object infra.System: properties: @@ -798,6 +909,165 @@ definitions: name: type: string type: object + network.CSP: + properties: + name: + type: string + nlb: + items: + $ref: '#/definitions/network.NLB' + type: array + security_group: + items: + $ref: '#/definitions/network.SecurityGroup' + type: array + vpc: + items: + $ref: '#/definitions/network.VPC' + type: array + type: object + network.DNS: + properties: + dns_server: + description: IPv4 or IPv6 DNS Server Addresses + items: + type: string + type: array + type: object + network.FirewallRule: + properties: + action: + description: allow, deny + type: string + direction: + description: inbound, outbound + type: string + dst: + type: string + dst_ports: + type: string + priority: + description: Lower has higher priority + type: integer + protocol: + description: TCP, UDP, ICMP + type: string + src: + type: string + src_ports: + type: string + type: object + network.Host: + properties: + dns: + $ref: '#/definitions/network.DNS' + firewall_rule: + items: + $ref: '#/definitions/network.FirewallRule' + type: array + network_interface: + items: + $ref: '#/definitions/network.NIC' + type: array + route: + items: + $ref: '#/definitions/network.Route' + type: array + type: object + network.NIC: + properties: + address: + items: + type: string + type: array + gateway: + items: + type: string + type: array + interface: + type: string + mac_address: + type: string + mtu: + type: integer + type: object + network.NLB: + properties: + description: + type: string + health_checker: + type: string + id: + type: string + listener: + type: string + name: + type: string + target_group: + type: string + type: object + network.Network: + properties: + csp: + $ref: '#/definitions/network.CSP' + host: + $ref: '#/definitions/network.Host' + type: object + network.Route: + properties: + destination: + type: string + netmask: + type: string + next_hop: + type: string + type: object + network.SecurityGroup: + properties: + description: + type: string + firewall_rule: + items: + $ref: '#/definitions/network.FirewallRule' + type: array + id: + type: string + name: + type: string + vnet_id: + type: string + type: object + network.Subnet: + properties: + ipv4_cidr: + description: IPv4 Network Address with CIDR Prefix Length + type: string + ipv6_cidr: + description: IPv6 Network Address with CIDR Prefix Length + type: string + name: + type: string + type: object + network.VPC: + properties: + address_space: + description: IPv4 CIDR or IPv6 CIDR + items: + type: string + type: array + dns_server: + items: + $ref: '#/definitions/network.DNS' + type: array + id: + type: string + region: + type: string + subnet: + items: + $ref: '#/definitions/network.Subnet' + type: array + type: object info: contact: email: contact-to-cloud-barista@googlegroups.com diff --git a/pkg/api/rest/model/README.md b/pkg/api/rest/model/README.md index f10f14e..4874709 100644 --- a/pkg/api/rest/model/README.md +++ b/pkg/api/rest/model/README.md @@ -1,12 +1,12 @@ ## Model synchronization for on-premise ### Synchronization Date -- Date: Wed Apr 24 17:38:13 KST 2024 +- Date: Fri May 24 04:47:39 PM KST 2024 ### Repository Details - Repository: [cloud-barista/cm-honeybee](https://github.com/cloud-barista/cm-honeybee.git) - Branch: main -- Latest Commit Hash: 6092ac7b3e51f9a61dd81a554a51675254b242fc +- Latest Commit Hash: 0963d03537a4bd0eaaf504cb30965b3137a79834 ### Usage Instructions - Update the models with the command below: diff --git a/pkg/api/rest/model/get-onprem-models.sh b/pkg/api/rest/model/get-onprem-models.sh index 57d4616..8e2f0fa 100755 --- a/pkg/api/rest/model/get-onprem-models.sh +++ b/pkg/api/rest/model/get-onprem-models.sh @@ -15,11 +15,11 @@ fi # Then proceed with cloning git clone -b $BRANCH --single-branch $REPO_URL -# Create target directory if it doesn't exist -mkdir -p $TARGET_DIR +# Remove previous target directory +rm -rf $TARGET_DIR # Copy the model directory contents to the target directory -cp -r cm-honeybee/$MODEL_DIR/* $TARGET_DIR +cp -r cm-honeybee/agent/pkg/api/rest/$MODEL_DIR/* $TARGET_DIR/ # Get the latest commit hash cd cm-honeybee diff --git a/pkg/api/rest/model/onprem/infra/compute.go b/pkg/api/rest/model/onprem/infra/compute.go index b85e024..acf0f53 100644 --- a/pkg/api/rest/model/onprem/infra/compute.go +++ b/pkg/api/rest/model/onprem/infra/compute.go @@ -28,13 +28,13 @@ type System struct { } type CPU struct { - Vendor string `json:"vendor"` - Model string `json:"model"` - Speed uint `json:"speed"` // MHz - Cache uint `json:"cache"` // KB - Cpus uint `json:"cpus"` // ea - Cores uint `json:"cores"` // ea - Threads uint `json:"threads"` // ea + Vendor string `json:"vendor"` + Model string `json:"model"` + MaxSpeed uint `json:"max_speed"` // MHz + Cache uint `json:"cache"` // KB + Cpus uint `json:"cpus"` // ea + Cores uint `json:"cores"` // ea + Threads uint `json:"threads"` // ea } type Memory struct { @@ -43,22 +43,33 @@ type Memory struct { Size uint `json:"size"` // MB } -type Storage struct { - Name string `json:"name"` - Driver string `json:"driver"` - Vendor string `json:"vendor"` - Model string `json:"model"` - Serial string `json:"serial"` - Size uint `json:"size"` // GB +type Disk struct { + Label string `json:"label"` + Type string `json:"type"` + Size uint `json:"size"` // GB } type ComputeResource struct { - CPU CPU `json:"cpu"` - Memory Memory `json:"memory"` - Storage []Storage `json:"storage"` + CPU CPU `json:"cpu"` + Memory Memory `json:"memory"` + RootDisk Disk `json:"root_disk"` + DataDisk []Disk `json:"data_disk"` +} + +// Keypair TODO +type Keypair struct { + Name string `json:"name"` + PublicKey string `json:"public_key"` + PrivateKey string `json:"private_key"` +} + +// Connection TODO +type Connection struct { + Keypair Keypair `json:"keypair"` } type Compute struct { OS System `json:"os"` ComputeResource ComputeResource `json:"compute_resource"` + Connection []Connection `json:"connection"` } diff --git a/pkg/api/rest/model/onprem/infra/gpu.go b/pkg/api/rest/model/onprem/infra/gpu.go index 1e9346b..87eac3d 100644 --- a/pkg/api/rest/model/onprem/infra/gpu.go +++ b/pkg/api/rest/model/onprem/infra/gpu.go @@ -1,11 +1,37 @@ package infra -import ( - "github.com/cloud-barista/cm-honeybee/gpu/drm" - "github.com/cloud-barista/cm-honeybee/gpu/nvidia" -) +type NVIDIADeviceAttribute struct { + GPUUUID string `json:"gpu_uuid"` + DriverVersion string `json:"driver_version"` + CUDAVersion string `json:"cuda_version"` + ProductName string `json:"product_name"` + ProductBrand string `json:"product_brand"` + ProductArchitecture string `json:"product_architecture"` +} + +type NVIDIAPerformance struct { + GPUUsage uint32 `json:"gpu_usage"` // percent + FBMemoryUsed uint64 `json:"fb_memory_used"` // mb + FBMemoryTotal uint64 `json:"fb_memory_total"` // mb + FBMemoryUsage uint32 `json:"fb_memory_usage"` // percent + Bar1MemoryUsed uint64 `json:"bar1_memory_used"` // mb + Bar1MemoryTotal uint64 `json:"bar1_memory_total"` // mb + Bar1MemoryUsage uint32 `json:"bar1_memory_usage"` // percent +} + +type NVIDIA struct { + DeviceAttribute NVIDIADeviceAttribute `json:"device_attribute"` + Performance NVIDIAPerformance `json:"performance"` +} + +type DRM struct { + DriverName string `json:"driver_name"` + DriverVersion string `json:"driver_version"` + DriverDate string `json:"driver_date"` + DriverDescription string `json:"driver_description"` +} type GPU struct { - NVIDIA []nvidia.NVIDIA `json:"nvidia"` - DRM []drm.DRM `json:"drm"` + NVIDIA []NVIDIA `json:"nvidia"` + DRM []DRM `json:"drm"` } diff --git a/pkg/api/rest/model/onprem/infra/infra.go b/pkg/api/rest/model/onprem/infra/infra.go index 42fdf84..b230fb4 100644 --- a/pkg/api/rest/model/onprem/infra/infra.go +++ b/pkg/api/rest/model/onprem/infra/infra.go @@ -1,7 +1,12 @@ package infra +import ( + "github.com/cloud-barista/cm-honeybee/agent/pkg/api/rest/model/onprem/network" +) + type Infra struct { - Compute Compute `json:"compute"` - // Network network.Network `json:"network"` - // GPU GPU `json:"gpu"` + Compute Compute `json:"compute"` + Network network.Network `json:"network"` + GPU GPU `json:"gpu"` + Storage Storage `json:"storage"` } diff --git a/pkg/api/rest/model/onprem/infra/storage.go b/pkg/api/rest/model/onprem/infra/storage.go new file mode 100644 index 0000000..bc04c17 --- /dev/null +++ b/pkg/api/rest/model/onprem/infra/storage.go @@ -0,0 +1,19 @@ +package infra + +// MountedInformation TODO +type MountedInformation struct { + Source string `json:"source"` + Destination string `json:"destination"` + Filesystem string `json:"filesystem"` + Option string `json:"option"` +} + +// MountPoint TODO +type MountPoint struct { + MountedInformation []MountedInformation `json:"mounted_information"` +} + +// Storage TODO +type Storage struct { + MountPoint MountPoint `json:"mount_point"` +} diff --git a/pkg/api/rest/model/onprem/network/bonding.go b/pkg/api/rest/model/onprem/network/bonding.go deleted file mode 100644 index d593e49..0000000 --- a/pkg/api/rest/model/onprem/network/bonding.go +++ /dev/null @@ -1,47 +0,0 @@ -package network - -type ActiveAggregatorInfo struct { - AggregatorID string `json:"aggregator_id"` - NumberOfPorts string `json:"number_of_ports"` - ActorKey string `json:"actor_key"` - PartnerKey string `json:"partner_key"` - PartnerMACAddress string `json:"partner_mac_address"` -} - -type ADInfo struct { - LACPActive string `json:"lacp_active"` - LACPRate string `json:"lacp_rate"` - MinLinks string `json:"min_links"` - ADSelect string `json:"ad_select"` - SystemPriority string `json:"system_priority"` - SystemMACAddress string `json:"system_mac_address"` - ActiveAggregatorInfo ActiveAggregatorInfo `json:"active_aggregator_info"` -} - -type SlavesList struct { - Interfaces []string `json:"interfaces"` - PrimarySlave string `json:"primary_slave"` - CurrentlyActiveSlave string `json:"currently_active_slave"` -} - -type SlaveInterface struct { - Name string `json:"name"` - MIIStatus string `json:"mii_status"` - Speed string `json:"speed"` - Duplex string `json:"duplex"` - LinkFailureCount string `json:"link_failure_count"` - PermanentHWAddr string `json:"permanent_hw_addr"` - AggregatorID string `json:"aggregator_id"` -} - -type Bonding struct { - Name string `json:"name"` - BondingMode string `json:"bonding_mode"` - SlavesList SlavesList `json:"slaves_list"` - TransmitHashPolicy string `json:"transmit_hash_policy"` - AddrList []string `json:"addr_list"` - MIIStatus string `json:"mii_status"` - MIIPollingInterval string `json:"mii_polling_interval"` - ADInfo ADInfo `json:"ad_info"` - SlaveInterface []SlaveInterface `json:"slave_interface"` -} diff --git a/pkg/api/rest/model/onprem/network/csp.go b/pkg/api/rest/model/onprem/network/csp.go new file mode 100644 index 0000000..af4aa23 --- /dev/null +++ b/pkg/api/rest/model/onprem/network/csp.go @@ -0,0 +1,44 @@ +package network + +// Subnet TODO +type Subnet struct { + Name string `json:"name"` + IPv4CIDR string `json:"ipv4_cidr"` // IPv4 Network Address with CIDR Prefix Length + IPv6CIDR string `json:"ipv6_cidr"` // IPv6 Network Address with CIDR Prefix Length +} + +// VPC TODO +type VPC struct { + ID string `json:"id"` + Region string `json:"region"` + AddressSpace []string `json:"address_space"` // IPv4 CIDR or IPv6 CIDR + Subnet []Subnet `json:"subnet"` + DNSServer []DNS `json:"dns_server"` +} + +// NLB TODO +type NLB struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Listener string `json:"listener"` + TargetGroup string `json:"target_group"` + HealthChecker string `json:"health_checker"` +} + +// SecurityGroup TODO +type SecurityGroup struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + VnetID string `json:"vnet_id"` + FirewallRule []FirewallRule `json:"firewall_rule"` +} + +// CSP TODO +type CSP struct { + Name string `json:"name"` + VPC []VPC `json:"vpc"` + NLB []NLB `json:"nlb"` + SecurityGroup []SecurityGroup `json:"security_group"` +} diff --git a/pkg/api/rest/model/onprem/network/dns.go b/pkg/api/rest/model/onprem/network/dns.go new file mode 100644 index 0000000..1a6aa87 --- /dev/null +++ b/pkg/api/rest/model/onprem/network/dns.go @@ -0,0 +1,6 @@ +package network + +// DNS TODO +type DNS struct { + DNSServer []string `json:"dns_server"` // IPv4 or IPv6 DNS Server Addresses +} diff --git a/pkg/api/rest/model/onprem/network/firewall.go b/pkg/api/rest/model/onprem/network/firewall.go new file mode 100644 index 0000000..fb33ebd --- /dev/null +++ b/pkg/api/rest/model/onprem/network/firewall.go @@ -0,0 +1,12 @@ +package network + +type FirewallRule struct { + Priority uint `json:"priority"` // Lower has higher priority + Src string `json:"src"` + Dst string `json:"dst"` + SrcPorts string `json:"src_ports"` + DstPorts string `json:"dst_ports"` + Protocol string `json:"protocol"` // TCP, UDP, ICMP + Direction string `json:"direction"` // inbound, outbound + Action string `json:"action"` // allow, deny +} diff --git a/pkg/api/rest/model/onprem/network/libvirtNet.go b/pkg/api/rest/model/onprem/network/libvirtNet.go deleted file mode 100644 index 080338e..0000000 --- a/pkg/api/rest/model/onprem/network/libvirtNet.go +++ /dev/null @@ -1,15 +0,0 @@ -package network - -import ( - libvirtxml "github.com/libvirt/libvirt-go-xml" -) - -type LibvirtDomain struct { - DomainName string `json:"domain_name"` - DomainUUID string `json:"domain_uuid"` - Interfaces []libvirtxml.DomainInterface `json:"interfaces"` -} - -type LibvirtNet struct { - Domains []LibvirtDomain `json:"domains"` -} diff --git a/pkg/api/rest/model/onprem/network/netfilter.go b/pkg/api/rest/model/onprem/network/netfilter.go deleted file mode 100644 index 79f2d32..0000000 --- a/pkg/api/rest/model/onprem/network/netfilter.go +++ /dev/null @@ -1,16 +0,0 @@ -package network - -type Chain struct { - ChainName string `json:"chain_name"` - Rules []string `json:"rules"` -} - -type Table struct { - TableName string `json:"table_name"` - Chains []Chain `json:"chains"` -} - -type Netfilter struct { - IPv4Tables []Table `json:"ipv4_tables"` - IPv6Tables []Table `json:"ipv6_tables"` -} diff --git a/pkg/api/rest/model/onprem/network/network.go b/pkg/api/rest/model/onprem/network/network.go index 1c52c01..3cbff82 100644 --- a/pkg/api/rest/model/onprem/network/network.go +++ b/pkg/api/rest/model/onprem/network/network.go @@ -1,18 +1,13 @@ package network -type _NetworkSubsystem struct { - NetworkInterfaces []NIC `json:"network_interfaces"` - Routes []Route `json:"routes"` - Netfilter Netfilter `json:"netfilter"` - Bonding []Bonding `json:"bonding"` -} - -type VirtualNetwork struct { - OVS []OVSBridge `json:"ovs"` - LibvirtNet LibvirtNet `json:"libvirt_net"` +type Host struct { + NetworkInterface []NIC `json:"network_interface"` + DNS DNS `json:"dns"` + Route []Route `json:"route"` + FirewallRule []FirewallRule `json:"firewall_rule"` } type Network struct { - NetworkSubsystem _NetworkSubsystem `json:"network_subsystem"` - VirtualNetwork VirtualNetwork `json:"virtual_network"` + Host Host `json:"host"` + CSP CSP `json:"csp"` } diff --git a/pkg/api/rest/model/onprem/network/nic.go b/pkg/api/rest/model/onprem/network/nic.go index d9519c8..5b8cf8a 100644 --- a/pkg/api/rest/model/onprem/network/nic.go +++ b/pkg/api/rest/model/onprem/network/nic.go @@ -1,10 +1,9 @@ package network type NIC struct { - Interface string `json:"interface"` - Address []string `json:"address"` - Gateway []string `json:"gateway"` - Route []Route `json:"route"` - MAC string `json:"mac"` - MTU int `json:"mtu"` + Interface string `json:"interface"` + Address []string `json:"address"` + Gateway []string `json:"gateway"` + MACAddress string `json:"mac_address"` + MTU int `json:"mtu"` } diff --git a/pkg/api/rest/model/onprem/network/ovs.go b/pkg/api/rest/model/onprem/network/ovs.go deleted file mode 100644 index 8efc451..0000000 --- a/pkg/api/rest/model/onprem/network/ovs.go +++ /dev/null @@ -1,28 +0,0 @@ -package network - -type OVSBridge struct { - AutoAttach any `json:"auto_attach"` - Controller any `json:"controller"` - DatapathID string `json:"datapath_id"` - DatapathType string `json:"datapath_type"` - DatapathVersion string `json:"datapath_version"` - ExternalIds []any `json:"external_ids"` - FailMode any `json:"fail_mode"` - FloodVlans any `json:"flood_vlans"` - FlowTables []any `json:"flow_tables"` - Ipfix any `json:"ipfix"` - McastSnoopingEnable bool `json:"mcast_snooping_enable"` - Mirrors any `json:"mirrors"` - Name string `json:"name"` - Netflow any `json:"netflow"` - OtherConfig []any `json:"other_config"` - Ports []string `json:"ports"` - Protocols any `json:"protocols"` - RstpEnable bool `json:"rstp_enable"` - RstpStatus []any `json:"rstp_status"` - Sflow any `json:"sflow"` - Status []any `json:"status"` - StpEnable bool `json:"stp_enable"` - UUID string `json:"uuid"` - Version string `json:"version"` -} diff --git a/pkg/api/rest/model/onprem/software/deb.go b/pkg/api/rest/model/onprem/software/deb.go index e106930..1223ad1 100644 --- a/pkg/api/rest/model/onprem/software/deb.go +++ b/pkg/api/rest/model/onprem/software/deb.go @@ -1,18 +1,19 @@ package software type DEB struct { - Package string `json:"package"` - Status string `json:"status"` - Priority string `json:"priority"` - Architecture string `json:"architecture"` - MultiArch string `json:"multi_arch"` - Maintainer string `json:"maintainer"` - Version string `json:"version"` - Section string `json:"section"` - InstalledSize int64 `json:"installed_size"` - Depends string `json:"depends"` - PreDepends string `json:"pre_depends"` - Description string `json:"description"` - Source string `json:"source"` - Homepage string `json:"homepage"` + Package string `json:"package"` + Status string `json:"status"` + Priority string `json:"priority"` + Architecture string `json:"architecture"` + MultiArch string `json:"multi_arch"` + Maintainer string `json:"maintainer"` + Version string `json:"version"` + Section string `json:"section"` + InstalledSize int64 `json:"installed_size"` + Depends string `json:"depends"` + Conffiles []string `json:"conffiles"` + PreDepends string `json:"pre_depends"` + Description string `json:"description"` + Source string `json:"source"` + Homepage string `json:"homepage"` }