models

package
v1.1.0-dev-3858 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkConfigVersion2   int    = 2
	RendererNetworkManager  string = "NetworkManager"
	BondModeActiveBackup    string = "active-backup"
	FailoverMacPolicyActive string = "active"
)
View Source
const (
	PostMachinesRequestExpected                        = `` /* 1008-byte string literal not displayed */
	CreateMachineRequestExpected                       = `` /* 784-byte string literal not displayed */
	CreateMachineRequestOneProvisioningNetworkExpected = `` /* 677-byte string literal not displayed */
	CreateMachineRequestBaremetalBondingExpected       = `` /* 891-byte string literal not displayed */
	PostMachinesResponseExample                        = `` /* 2027-byte string literal not displayed */

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

	GetMachineResponseExampleWithTypoInStorageResSpec = `` /* 4862-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 */

	NetworkConfigValidOnboardYaml = `` /* 432-byte string literal not displayed */

	NetworkConfigValidOnboardComposableYaml = `` /* 629-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:   "",
	},
}
View Source
var ExpectedLanportsBaremetalMixed = []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",
		NicType:     NicTypeOnboard,
	},
	{

		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.200",
		NicType:     NicTypeComposable,
	},
	{

		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.50",
		NicType:     NicTypeOnboard,
	},
}

ExpectedLanportsBaremetalMixed represents a scenario where the baremetal subnet has a composable NIC listed before an onboard NIC, to verify the "onboard first" fallback policy: the onboard IP must be preferred over the composable one.

View Source
var ExpectedLanportsBonding = []Lanport{
	{
		LanportUUID: "d8c7b6a5-4321-0987-6543-210fedcba098",
		SubnetUUID:  "78901234-5678-9abc-def0-1234567890ab",
		MACAddress:  "00:11:22:33:44:55",
		LanportIdx:  1,
		IPAddress:   "10.0.0.100",
		NicType:     NicTypeOnboard,
	},
	{
		LanportUUID: "01085c2c-15c4-4957-9ad3-7d1ee481f082",
		SubnetUUID:  "78901234-5678-9abc-def0-1234567890ab",
		MACAddress:  "00:11:22:33:44:66",
		LanportIdx:  2,
		IPAddress:   "10.0.0.101",
		NicType:     NicTypeOnboard,
	},
	{
		LanportUUID: "c7b6a543-2109-8765-4321-0fedcba09876",
		SubnetUUID:  "123e4567-e89b-12d3-a456-426614174000",
		MACAddress:  "00:11:22:33:44:77",
		LanportIdx:  3,
		IPAddress:   "192.168.2.100",
		NicType:     NicTypeOnboard,
	},
}

ExpectedLanportsBonding represents a bonding scenario where: - Baremetal subnet uses onboard NICs (ports 1, 2) for the bond - Provisioning subnet uses an onboard NIC (port 3)

View Source
var ExpectedLanportsWithType = []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",
		NicType:     NicTypeOnboard,
	},
	{
		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",
		NicType:     NicTypeOnboard,
	},
	{
		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",
		NicType:     NicTypeComposable,
	},
	{
		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",
		NicType:     NicTypeComposable,
	},
	{
		LanportUUID: "c7b6a543-2109-8765-4321-0fedcba09876",
		SubnetUUID:  "03aa247b-dd21-4dd0-943c-1b878bb6cccc",
		MACAddress:  "22:22:22:22:22:22",
		LanportIdx:  0,
		IPAddress:   "",
		NicType:     NicTypeComposable,
	},
}

ExpectedLanportsWithType is ExpectedLanports with NicType populated (as returned by GetMachineDetails)

View Source
var ExpectedSubnets = map[string]string{
	"baremetal":    "123e4567-e89b-12d3-a456-426614174000",
	"provisioning": "78901234-5678-9abc-def0-1234567890ab",
}
View Source
var ValidNetworkConfigOnboardComposable = NetworkConfig{
	Network: NetworkSpec{
		SchemaVersion: NetworkConfigVersion2,
		Renderer:      RendererNetworkManager,
		Ethernets: map[string]Ethernet{
			"bare0": {
				Match: Match{
					MACAddress: "00:11:22:33:44:55",
				},
				DHCP4: true,
			},
			"bare1": {
				Match: Match{
					MACAddress: "00:11:22:33:44:66",
				},
				DHCP4: true,
			},
			"prov2": {
				Match: Match{
					MACAddress: "00:11:22:33:44:77",
				},
				DHCP4: true,
			},
			"prov3": {
				Match: Match{
					MACAddress: "11:11:11:11:11:11",
				},
				DHCP4: true,
			},
			"prov4": {
				Match: Match{
					MACAddress: "22:22:22:22:22:22",
				},
				DHCP4: true,
			},
		},
		Bonds: map[string]Bond{
			"bond0": {
				Interfaces: []string{"bare0", "bare1"},
				DHCP4:      true,
				Parameters: BondParameters{
					Mode:              BondModeActiveBackup,
					FailoverMacPolicy: FailoverMacPolicyActive,
				},
			},
		},
	},
}

Functions

This section is empty.

Types

type Bond added in v1.0.0

type Bond struct {
	Interfaces []string       `yaml:"interfaces,omitempty"`
	DHCP4      bool           `yaml:"dhcp4,omitempty"`
	Parameters BondParameters `yaml:"parameters,omitempty"`
}

type BondParameters added in v1.0.0

type BondParameters struct {
	Mode              string `yaml:"mode,omitempty"`
	FailoverMacPolicy string `yaml:"fail-over-mac-policy,omitempty"`
}

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 CreateMachineRequestBodyTenants `json:"tenants"`
}

type CreateMachineRequestBodyTenants added in v1.0.0

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

type CreateMachineResources added in v1.0.0

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

type CreateMachineSpec

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

type Ethernet added in v1.0.0

type Ethernet struct {
	Match Match `yaml:"match,omitempty"`
	DHCP4 bool  `yaml:"dhcp4,omitempty"`
}

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"`
	NetworkClassConfiguration string `json:"nw_class_cu,omitempty"`
	// NicType is not part of the API response; it is populated internally to distinguish NIC types:
	// NicTypeUndetermined, NicTypeOnboard, NicTypeComposable
	NicType NicType `json:"-"`
}

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"`
	TenantUUID          string     `json:"tenant_uuid,omitempty"` // GET response
}

type MachineResponse added in v1.0.0

type MachineResponse struct {
	Data MachineResponseData `json:"data"`
}

type MachineResponseData added in v1.0.0

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

type MachineSpecsArgs

type MachineSpecsArgs struct {
	ComputeConditionsJson     string
	DevicesSpecJson           string
	EnableBaremetalBonding    bool
	NetworkBaremetalUUID      string
	NetworkProvisionUUID      string
	NetworkProvisionDefaultGW string
	NtpServer                 string
	DnsServer                 string
}

MachineSpecsArgs struct holds part of the parameters for populateCreateMachineRequest method

type Match added in v1.0.0

type Match struct {
	MACAddress string `yaml:"macaddress,omitempty"`
}

type Network

type Network struct {
	NicType NicType  `json:"nic_type"`
	Subnets []Subnet `json:"subnets"` // Expected up to 3-elements in arrays: bare-metal, provisioning, iRMC
}

type NetworkConfig added in v1.0.0

type NetworkConfig struct {
	Network NetworkSpec `yaml:"network"`
}

type NetworkSpec added in v1.0.0

type NetworkSpec struct {
	SchemaVersion int                 `yaml:"version"`
	Renderer      string              `yaml:"renderer"`
	Ethernets     map[string]Ethernet `yaml:"ethernets,omitempty"`
	Bonds         map[string]Bond     `yaml:"bonds,omitempty"`
}

type NicType added in v1.0.0

type NicType int

NicType represents the type of a NIC: undetermined, onboard, or composable.

const (
	NicTypeUndetermined NicType = iota // 0 — not determined
	NicTypeOnboard                     // 1 — onboard NIC
	NicTypeComposable                  // 2 — composable NIC
)

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         *ResourceSpecification `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)
	ResourceCollectionID int                    `json:"res_collection_id,omitempty"`  // POST response, GET response
	ConditionUUID        string                 `json:"condition_uuid,omitempty"`     // POST response
	ResourceSerialNumber string                 `json:"res_serial_num,omitempty"`     // POST response, GET response
}

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.

type ResourceSpecification added in v1.0.0

type ResourceSpecification 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 Subnet

type Subnet struct {
	SubnetUUID  string `json:"subnet_uuid"`            // POST request & response
	LanportIdx  int    `json:"lanport_idx"`            // POST request & response
	LanportUUID string `json:"lanport_uuid,omitempty"` // POST response
	MACAddress  string `json:"mac_address,omitempty"`  // POST response
	DefaultGW   string `json:"default_gw,omitempty"`   // POST request
	LeaseTime   string `json:"lease_time,omitempty"`   // POST request
	Ntp         string `json:"ntp,omitempty"`          // POST request
	Dns         string `json:"dns,omitempty"`          // POST request
	Fqdn        string `json:"fqdn,omitempty"`         // POST request
}

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