models

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostMachinesRequestExpected                        = `` /* 1008-byte string literal not displayed */
	CreateMachineRequestExpected                       = `` /* 809-byte string literal not displayed */
	CreateMachineRequestOneProvisioningNetworkExpected = `` /* 677-byte string literal not displayed */
	PostMachinesResponseExample                        = `` /* 2027-byte string literal not displayed */

	GetMachineResponseExample = `` /* 4391-byte string literal not displayed */

	GetMachineResponseExampleWithTypoInStorageResSpec = `` /* 4393-byte string literal not displayed */

	GetMachineResponseExampleDeletedMachine = `` /* 442-byte string literal not displayed */

	DeleteMachineResponseExample = `{
		"data":{
			"machines":[
			{
				"mach_uuid":"c7b6a543-2109-8765-4321-0fedcba09876"
			}
			]
		}
	}`
	ImageInstallPutPayloadExample = `` /* 126-byte string literal not displayed */

	ImageInstallPutResponseExample = `{"resources":{"res_uuid_ssd":"c7b6a543-2109-8765-4321-0fedcba09876","bootimg_filename":"my-boot-image-02"}}`

	AccessTokenExample = "" /* 973-byte string literal not displayed */

	TestApiUrl                                = "http://localhost"
	TestPort                                  = "8080"
	TestRealm                                 = "cdi-test"
	TestUserNameNotAllowedToCreateCluster     = "alice"
	TestUserPasswordNotAllowedToCreateCluster = "alice"
	TestUserNameAllowedToCreateCluster        = "james"
	TestUserPasswordAllowedToCreateCluster    = "james"
	TestClientId                              = "test-client"
	TestClientSecret                          = "test-client"

	TestBearerTokenRequestBody = "" /* 134-byte string literal not displayed */
	// TestAccessTokenExpected    = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJjT21qTFYwQVhCWVFycFJBMnh5MVh1akRWX250TTZQY3dyZ2ZWTWJyRGRFIn0.eyJleHAiOjE3MzE1MDk3ODMsImlhdCI6MTczMTUwOTcyMywianRpIjoiNTEzNjRjMTYtNzJjZi00ZmJiLTk0YTctYTE4MzUyZGQwYzM4IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwL3JlYWxtcy9tYXN0ZXIiLCJzdWIiOiIxM2E5MjE3Zi1kYjIzLTQ4YTYtOWVmYS1hYmNkYWM4MWZmZWQiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJhZG1pbi1jbGkiLCJzZXNzaW9uX3N0YXRlIjoiZDA2ZjhkNWYtNDE0Ni00YTc3LTkxNmQtNTA1ODQ2NjZkY2FiIiwiYWNyIjoiMSIsInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsInNpZCI6ImQwNmY4ZDVmLTQxNDYtNGE3Ny05MTZkLTUwNTg0NjY2ZGNhYiIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWRtaW4ifQ.X_sIDgZNKn-3cu-aOS0vwgF2a0DBldP4PjHaJtfnZzq4744C3MSN5YDtYeqNOn3-pgwS-yTKArTLqJZgwGk3Edv4oqVc59uMDWRfATzS9JQh_NMI8ZvxapHCBwIlpkc0xtTqu-bGbuswfH5QhDWwcny5Et3LMOtu6KOVuscdKnFRgQpHOcyeT7LehdAVhbRb1ZGOsTiAsOpR3E8wAU3SzqXQwXbfvK5pixzGxbjjOPc7MN5HWPwXamMoOZQTLsxCAEqe1X138LkPmWXhV4b9bU6hrfmic27C18ME6QbcY45UxnkOMsy0IXhc_d5GLsEZGTIy5za7zlE8QDXZm0pjOw"
	TestAccessTokenExpected  = "" /* 973-byte string literal not displayed */
	TestRefreshTokenExpected = "" /* 685-byte string literal not displayed */
	TestBearerTokenResponse  = `` /* 1896-byte string literal not displayed */

	TestBearerTokenResponseWithoutKeyAccessToken = `` /* 1896-byte string literal not displayed */

	TestBearerTokenResponseWithoutTokenKeys = `` /* 1187-byte string literal not displayed */

	TestPgcdiPrivilegesTenant              = "cdi-test"
	TestPgcdiPrivilegesRequestBody         = "client_id=test-client&client_secret=test-client&token="
	TestPgcdiPrivilegesResponseInvalidRole = `` /* 1117-byte string literal not displayed */

	TestPgcdiPrivilegesResponseValidRole = `` /* 1112-byte string literal not displayed */

	TestPgcdiPrivilegesResponseValidRoleWithoutPriviledges = `` /* 962-byte string literal not displayed */

	ProviderIdDropInCreationScriptExpected = `` /* 229-byte string literal not displayed */

	DeviceSpecsValid = `` /* 417-byte string literal not displayed */

	DeviceSpecsInvalidNoFieldTagsIsBootStorage = `` /* 386-byte string literal not displayed */

	DeviceSpecsInCorrectValueForTagsIsBootStorage = `` /* 418-byte string literal not displayed */

)

Variables

View Source
var ExpectedLanports = []Lanport{
	{
		LanportUUID: "d8c7b6a5-4321-0987-6543-210fedcba098",
		SubnetUUID:  "123e4567-e89b-12d3-a456-426614174000",
		MacAddress:  "00:11:22:33:44:55",
		LanportIdx:  1,
		IPAddress:   "192.168.2.100",
	},
	{
		LanportUUID: "01085c2c-15c4-4957-9ad3-7d1ee481f082",
		SubnetUUID:  "123e4567-e89b-12d3-a456-426614174000",
		MacAddress:  "00:11:22:33:44:66",
		LanportIdx:  2,
		IPAddress:   "192.168.2.150",
	},
	{
		LanportUUID: "c7b6a543-2109-8765-4321-0fedcba09876",
		SubnetUUID:  "78901234-5678-9abc-def0-1234567890ab",
		MacAddress:  "00:11:22:33:44:77",
		LanportIdx:  3,
		IPAddress:   "10.0.0.100",
	},
	{
		LanportUUID: "a7d09755-d5c9-49ae-8f8c-7f53a3ae4f69",
		SubnetUUID:  "78901234-5678-9abc-def0-1234567890ab",
		MacAddress:  "11:11:11:11:11:11",
		LanportIdx:  4,
		IPAddress:   "10.0.0.200",
	},
	{
		LanportUUID: "c7b6a543-2109-8765-4321-0fedcba09876",
		SubnetUUID:  "03aa247b-dd21-4dd0-943c-1b878bb6cccc",
		MacAddress:  "22:22:22:22:22:22",
		LanportIdx:  0,
		IPAddress:   "",
	},
}

Functions

This section is empty.

Types

type BootResource

type BootResource struct {
	SSDResourceUUID string `json:"res_uuid_ssd"`
	BootImageName   string `json:"bootimg_filename"`
}

Structures necesary to handle OS image installation

type Condition

type Condition struct {
	Column   string `json:"column"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

Structures necessary to generate payload of POST /machines requests to fabric manager service

type CreateMachineRequest

type CreateMachineRequest struct {
	Tenants CreateMachineTenantsRequest `json:"tenants"`
}

type CreateMachineSpec

type CreateMachineSpec struct {
	Machine   string     `json:"mach_name"`
	Resources []ResSpecs `json:"resources"` // List containing only 1 element by design of fabric manager
}

type CreateMachineTenantsRequest

type CreateMachineTenantsRequest struct {
	TenantUUID string              `json:"tenant_uuid"`
	Machines   []CreateMachineSpec `json:"machines"` // Many machines allowed but for node driver it is always one
}

type ImageInstallation

type ImageInstallation struct {
	Resources BootResource `json:"resources"`
}

type Lanport

type Lanport struct {
	LanportUUID string `json:"lanport_uuid"`
	SubnetUUID  string `json:"subnet_uuid"`
	MacAddress  string `json:"mac_address"`
	LanportIdx  int    `json:"lanport_idx"`
	IPAddress   string `json:"ip_address"`
}

Structures necessary to deserialize response from POST /machines & GET /machines/<uuid> requests

type MachineDetails

type MachineDetails struct {
	FabricUUID          string     `json:"fabric_uuid,omitempty"`
	FabricID            int        `json:"fabric_id,omitempty"`
	MachineUUID         string     `json:"mach_uuid"`
	MachineIDNonLiqid   int        `json:"mach_id_nonliqid,omitempty"`
	MachineID           int        `json:"mach_id,omitempty"`
	MachineName         string     `json:"mach_name,omitempty"`
	MachineStatus       int        `json:"mach_status,omitempty"`
	MachineOpStatus     string     `json:"mach_op_status,omitempty"`
	MachineStatusDetail string     `json:"mach_status_detail,omitempty"`
	MachineOwner        string     `json:"mach_owner,omitempty"`
	GroupUUID           string     `json:"grp_uuid,omitempty"`
	BootSSD             string     `json:"boot_ssd,omitempty"`
	Lanports            []Lanport  `json:"lanports,omitempty"`
	Resources           []Resource `json:"resources,omitempty"`
}

type MachineSpecsArgs

type MachineSpecsArgs struct {
	ComputeConditionsJson     string
	DevicesSpecJson           string
	NetworkBaremetalPort      int
	NetworkProvisionPort      int
	NetworkBaremetalUUID      string
	NetworkProvisionUUID      string
	NetworkBaremetalDefaultGW string
	NetworkProvisionDefaultGW string
	NtpServer                 string
	DnsServer                 string
}

MachineSpecsArgs struct holds part of the parameters for populateCreateMachineRequest method

type MachinesRequestResponse

type MachinesRequestResponse struct {
	Data MachinesResponseData `json:"data"`
}

type MachinesResponseData

type MachinesResponseData struct {
	Machines []MachineDetails `json:"machines"`
}

type Network

type Network struct {
	NicType int      `json:"nic_type"`
	Subnets []Subnet `json:"subnets"` // Expected 1-element arrays only
}

type ResSpec

type ResSpec struct {
	// TODO: confirm if list below is 1-element only when physical fm environment is available
	Condition []Condition `json:"condition"` // List containing only 1 element by design of fabric manager
}

type ResSpecs

type ResSpecs struct {
	ResourceSpecifications []Resource `json:"res_specs"` // Many resources allowed & expected
}

type ResStorageTags

type ResStorageTags struct {
	IsBootStorage bool `json:"is_bootstorage"`
}

type Resource

type Resource struct {
	ResourceType     string          `json:"res_type"`
	ResourceNum      int             `json:"res_num,omitempty"` // Present only in payload of POST /machines
	ResourceSpec     *ResSpec        `json:"res_spec,omitempty"`
	Tags             *ResStorageTags `json:"tags,omitempty"`
	Network          *Network        `json:"network,omitempty"`            // It's the only localization where network data are processed
	ResourceUUID     string          `json:"res_uuid,omitempty"`           // Present only in responses
	ResourceName     string          `json:"res_name,omitempty"`           // Present only in responses
	ResourceStatus   int             `json:"res_status,omitempty"`         // Present only in responses
	ResourceOpStatus string          `json:"res_op_status,omitempty"`      // Present only in responses
	MinResourceCount int             `json:"min_resource_count,omitempty"` // GPU field (read-only and optional)
	MaxResourceCount int             `json:"max_resource_count,omitempty"` // GPU field (read-only and optional)
}

func (*Resource) MarshalJSON

func (r *Resource) MarshalJSON() ([]byte, error)

Custom Marshaler to omit "tags", "minresourcecount" and "maxresourcecount"

	The reason why a custom marshaller is defined is because some fields
   	are only needed internally - they cannot be serialized in the requests to FM API,
    but are needed to be deserialized from customer's input in GUI
   Specifically:
   - tags: used by the node driver to determine which disk to install the OS on
   - min_resource_count / max_resource_count: GPU fields
     that can be present in customer input JSON, but must never be sent
     to Fabric Manager as they are not part of the API specification.

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(data []byte) error

Custom Unmarshaler to handle both "res_spec" and "res_spcec"

The reason why there is a defined custom unmarshaller is a typo
in the production Fabric Manager code: response for the Get request
returns JSON with field: 'res_spcec' instead of 'res_spec'.
This is only a temporary workaround until the typo is corrected
and merged to the release branch.

TODO: Remove this custom unmarshaller when the typo is fixed

type Subnet

type Subnet struct {
	SubnetUUID string `json:"subnet_uuid"`
	LanportIdx int    `json:"lanport_idx"`
	DefaultGW  string `json:"default_gw,omitempty"`
	LeaseTime  string `json:"lease_time,omitempty"`
	Ntp        string `json:"ntp"`
	Dns        string `json:"dns,omitempty"`
	Fqdn       string `json:"fqdn,omitempty"`
}

type SuseProduct added in v0.1.8

type SuseProduct struct {
	Identifier string `json:"identifier"`
	Version    string `json:"version"`
	Arch       string `json:"arch"`
	Status     string `json:"status"`
}

SuseProduct represents a single product or module reported by SUSEConnect

type VMRequestPayload

type VMRequestPayload struct {
	MachineName string `json:"machine_name"`
	MachineType string `json:"machine_type"`
}

VMRequestPayload struct represents the payload for requesting a new VM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL