testresources

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Trace1 = func() *apiv2.AuditTrace {
		return &apiv2.AuditTrace{
			Uuid:      "d1ff7267-2fbb-4a63-a7c1-44f1a83381a7",
			Timestamp: timestamppb.New(e2e.TimeBubbleStartTime()),
			User:      "me",
			Tenant:    "a",
			Project:   new(Project1().Uuid),
			Method:    "/apiv2.Create/",
			Body:      new("request body"),
			SourceIp:  "1.2.3.4",
			Phase:     apiv2.AuditPhase_AUDIT_PHASE_REQUEST,
		}
	}

	Trace2 = func() *apiv2.AuditTrace {
		return &apiv2.AuditTrace{
			Uuid:       "d1ff7267-2fbb-4a63-a7c1-44f1a83381a7",
			Timestamp:  timestamppb.New(e2e.TimeBubbleStartTime()),
			User:       "me",
			Tenant:     "a",
			Project:    new(Project1().Uuid),
			Method:     "/apiv2.List/",
			Body:       new("result body"),
			SourceIp:   "1.2.3.4",
			ResultCode: new(int32(codes.AlreadyExists)),
			Phase:      apiv2.AuditPhase_AUDIT_PHASE_RESPONSE,
		}
	}

	Trace3 = func() *apiv2.AuditTrace {
		return &apiv2.AuditTrace{
			Uuid:      "5091c4e9-e8db-483c-ab6b-fe14f82570a7",
			Timestamp: timestamppb.New(e2e.TimeBubbleStartTime().AddDate(1, 0, 0)),
			User:      "Larry",
			Tenant:    "b",
			Project:   new(Project1().Uuid),
			Method:    "/apiv2.List/",
			Body:      new("result body"),
			SourceIp:  "1.2.3.4",
			Phase:     apiv2.AuditPhase_AUDIT_PHASE_REQUEST,
		}
	}
)
View Source
var (
	Component1 = func() *apiv2.Component {
		return &apiv2.Component{
			Uuid:       "c1a2b3d4-e5f6-7890-abcd-ef1234567890",
			Type:       apiv2.ComponentType_COMPONENT_TYPE_METAL_CORE,
			Identifier: "metal-core-1",
			StartedAt:  timestamppb.New(e2e.TimeBubbleStartTime()),
			ReportedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			Interval:   durationpb.New(10 * time.Second),
			Version: &apiv2.Version{
				Version: "v1.0.0",
			},
			Token: &apiv2.Token{
				Uuid:    "t1a2b3d4-e5f6-7890-abcd-ef1234567890",
				Expires: timestamppb.New(e2e.TimeBubbleStartTime().Add(24 * time.Hour)),
			},
		}
	}
	Component2 = func() *apiv2.Component {
		return &apiv2.Component{
			Uuid:       "d2b3c4e5-f6a7-8901-bcde-f12345678901",
			Type:       apiv2.ComponentType_COMPONENT_TYPE_PIXIECORE,
			Identifier: "pixiecore-1",
			StartedAt:  timestamppb.New(e2e.TimeBubbleStartTime()),
			ReportedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			Interval:   durationpb.New(10 * time.Second),
			Version: &apiv2.Version{
				Version: "v2.0.0",
			},
			Token: &apiv2.Token{
				Uuid:    "t2b3c4e5-f6a7-8901-bcde-f12345678901",
				Expires: timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
			},
		}
	}
	Component3 = func() *apiv2.Component {
		return &apiv2.Component{
			Uuid:       "d2b3c4e5-f6a7-8901-bcde-f12345678903",
			Type:       apiv2.ComponentType_COMPONENT_TYPE_METAL_CONSOLE,
			Identifier: "metal-console-1",
			StartedAt:  timestamppb.New(e2e.TimeBubbleStartTime()),
			ReportedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			Interval:   durationpb.New(10 * time.Second),
			Version: &apiv2.Version{
				Version: "v2.0.0",
			},
			Token: &apiv2.Token{
				Uuid:    "t2b3c4e5-f6a7-8901-bcde-f12345678903",
				Expires: timestamppb.New(e2e.TimeBubbleStartTime().Add(-48 * time.Hour)),
			},
		}
	}
)
View Source
var (
	Image1 = func() *apiv2.Image {
		return &apiv2.Image{
			Id:             "ubuntu-24.04",
			Name:           new("Ubuntu 24.04"),
			Description:    new("Ubuntu 24.04 LTS"),
			Features:       []apiv2.ImageFeature{apiv2.ImageFeature_IMAGE_FEATURE_MACHINE},
			Classification: apiv2.ImageClassification_IMAGE_CLASSIFICATION_SUPPORTED,
			Meta:           &apiv2.Meta{},
		}
	}
	Image2 = func() *apiv2.Image {
		return &apiv2.Image{
			Id:             "firewall-3.0",
			Name:           new("Firewall 3.0"),
			Description:    new("Metal Firewall"),
			Features:       []apiv2.ImageFeature{apiv2.ImageFeature_IMAGE_FEATURE_FIREWALL},
			Classification: apiv2.ImageClassification_IMAGE_CLASSIFICATION_PREVIEW,
			Meta:           &apiv2.Meta{},
		}
	}
)
View Source
var (
	IP1 = func() *apiv2.IP {
		return &apiv2.IP{
			Uuid:        "2e0144a2-09ef-42b7-b629-4263295db6e8",
			Network:     "internet",
			Ip:          "1.1.1.1",
			Name:        "a",
			Description: "a description",
			Project:     "ce19a655-7933-4745-8f3e-9592b4a90488",
			Type:        apiv2.IPType_IP_TYPE_STATIC,
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						tag.ClusterServiceFQN: "<cluster>/default/ingress-nginx",
					},
				},
			},
		}
	}
	IP2 = func() *apiv2.IP {
		return &apiv2.IP{
			Uuid:        "9cef40ec-29c6-4dfa-aee8-47ee1f49223d",
			Network:     "internet",
			Ip:          "4.3.2.1",
			Name:        "b",
			Description: "b description",
			Project:     "46bdfc45-9c8d-4268-b359-b40e3079d384",
			Type:        apiv2.IPType_IP_TYPE_EPHEMERAL,
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"a": "b",
					},
				},
			},
		}
	}
)
View Source
var (
	Machine1 = func() *apiv2.Machine {
		return &apiv2.Machine{
			Uuid: "5fa2bbe1-407c-4142-92d5-e4419daf9646",
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"a": "b",
					},
				},
			},
			Partition: Partition1(),
			Rack:      *Switch1().Rack,
			Room:      *Switch1().Room,
			Size:      Size1(),
			Hardware: &apiv2.MachineHardware{
				Memory: 1024,
				Disks: []*apiv2.MachineBlockDevice{
					{
						Name: "/dev/sda",
						Size: 1,
					},
				},
				Cpus: []*apiv2.MetalCPU{
					{
						Vendor:  "Intel",
						Model:   "Xeon",
						Cores:   4,
						Threads: 4,
					},
				},
				Gpus: []*apiv2.MetalGPU{},
				Nics: []*apiv2.MachineNic{},
			},
			Allocation: nil,
			Status: &apiv2.MachineStatus{
				Condition: &apiv2.MachineCondition{
					State: apiv2.MachineState_MACHINE_STATE_AVAILABLE,
				},
				LedState: &apiv2.MachineChassisIdentifyLEDState{
					Value:       "",
					Description: "",
				},
				Liveliness:         apiv2.MachineLiveliness_MACHINE_LIVELINESS_ALIVE,
				MetalHammerVersion: "1",
			},
			RecentProvisioningEvents: &apiv2.MachineRecentProvisioningEvents{
				Events: []*apiv2.MachineProvisioningEvent{
					{
						Time:    timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
						Event:   apiv2.MachineProvisioningEventType_MACHINE_PROVISIONING_EVENT_TYPE_ALIVE,
						Message: "alive",
					},
				},
				LastEventTime: timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
				LastErrorEvent: &apiv2.MachineProvisioningEvent{
					Time:    timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Hour)),
					Event:   apiv2.MachineProvisioningEventType_MACHINE_PROVISIONING_EVENT_TYPE_WAITING,
					Message: "waiting",
				},
				State: apiv2.MachineProvisioningEventState_MACHINE_PROVISIONING_EVENT_STATE_UNSPECIFIED,
			},
		}
	}
	Machine2 = func() *apiv2.Machine {
		return &apiv2.Machine{
			Uuid: "673fc473-63ca-4ea4-b9dd-b45cb2127a6fd",
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"c": "d",
					},
				},
			},
			Partition: Partition2(),
			Rack:      *Switch2().Rack,
			Room:      *Switch2().Room,
			Size:      Size1(),
			Hardware: &apiv2.MachineHardware{
				Memory: 1024,
				Disks: []*apiv2.MachineBlockDevice{
					{
						Name: "/dev/sda",
						Size: 1,
					},
				},
				Cpus: []*apiv2.MetalCPU{
					{
						Vendor:  "Intel",
						Model:   "Xeon",
						Cores:   4,
						Threads: 4,
					},
				},
				Gpus: []*apiv2.MetalGPU{},
				Nics: []*apiv2.MachineNic{},
			},
			Allocation: &apiv2.MachineAllocation{
				Uuid: "4f94e87b-b08f-4f82-b053-9b8305de60ad",
				Meta: &apiv2.Meta{
					CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
					Labels: &apiv2.Labels{
						Labels: map[string]string{
							"e": "f",
						},
					},
				},
				Name:             "machine-2",
				Description:      "machine 2",
				CreatedBy:        "foo",
				Project:          Project2().Uuid,
				Image:            Image1(),
				FilesystemLayout: &apiv2.FilesystemLayout{},
				Networks: []*apiv2.MachineNetwork{
					{
						Network: Network1().Id,
						Ips:     []string{"4.5.6.7"},
					},
					{
						Network: Network2().Id,
						Ips:     []string{"192.1.1.1"},
					},
				},
				Hostname:       "machine-2",
				SshPublicKeys:  []string{},
				Userdata:       "",
				AllocationType: apiv2.MachineAllocationType_MACHINE_ALLOCATION_TYPE_MACHINE,
				FirewallRules:  nil,
				DnsServers:     []*apiv2.DNSServer{},
				NtpServers:     []*apiv2.NTPServer{},
				Vpn: &apiv2.MachineVPN{
					ControlPlaneAddress: "1.2.3.4",
					AuthKey:             "abc",
					Connected:           true,
					Ips:                 []string{"3.4.5.6"},
				},
			},
			Status: &apiv2.MachineStatus{
				Condition: &apiv2.MachineCondition{
					State: apiv2.MachineState_MACHINE_STATE_AVAILABLE,
				},
				LedState: &apiv2.MachineChassisIdentifyLEDState{
					Value:       "",
					Description: "",
				},
				Liveliness:         apiv2.MachineLiveliness_MACHINE_LIVELINESS_ALIVE,
				MetalHammerVersion: "1",
			},
			RecentProvisioningEvents: &apiv2.MachineRecentProvisioningEvents{
				Events: []*apiv2.MachineProvisioningEvent{
					{
						Time:    timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
						Event:   apiv2.MachineProvisioningEventType_MACHINE_PROVISIONING_EVENT_TYPE_PHONED_HOME,
						Message: "phoned home",
					},
					{
						Time:    timestamppb.New(e2e.TimeBubbleStartTime().Add(-2 * time.Minute)),
						Event:   apiv2.MachineProvisioningEventType_MACHINE_PROVISIONING_EVENT_TYPE_ALIVE,
						Message: "alive",
					},
				},
				LastEventTime: timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
				LastErrorEvent: &apiv2.MachineProvisioningEvent{
					Time:    timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Hour)),
					Event:   apiv2.MachineProvisioningEventType_MACHINE_PROVISIONING_EVENT_TYPE_WAITING,
					Message: "waiting",
				},
				State: apiv2.MachineProvisioningEventState_MACHINE_PROVISIONING_EVENT_STATE_UNSPECIFIED,
			},
		}
	}

	Machine1BmcDetails = &apiv2.MachineBMCDetails{
		Uuid:      Machine1().Uuid,
		Partition: Machine1().Partition.Id,
		Rack:      Machine1().Rack,
		Room:      Machine1().Room,
		Size:      Machine1().Size.Id,
		BmcReport: &apiv2.MachineBMCReport{
			Uuid: Machine1().Uuid,
			Bmc: &apiv2.MachineBMC{
				Address:    "10.0.0.1:623",
				Mac:        "02:00:00:00:00:01",
				User:       "admin",
				Password:   "password",
				Interface:  "lanplus",
				Version:    "3.1.1",
				PowerState: "on",
			},
			Bios: &apiv2.MachineBios{
				Version: "1.5.6",
				Vendor:  "American Megatrends Inc.",
				Date:    "04/01/2024",
			},
			Fru: &apiv2.MachineFRU{
				ChassisPartNumber:   new("Chassis-PN-1"),
				ChassisPartSerial:   new("Chassis-SN-1"),
				BoardMfg:            new("Supermicro"),
				BoardMfgSerial:      new("Board-SN-1"),
				BoardPartNumber:     new("Board-PN-1"),
				ProductManufacturer: new("Dell"),
				ProductPartNumber:   new("Product-PN-1"),
				ProductSerial:       new("Product-SN-1"),
			},
			PowerMetric: &apiv2.MachinePowerMetric{
				AverageConsumedWatts: 120.5,
				IntervalInMin:        5,
				MaxConsumedWatts:     180.2,
				MinConsumedWatts:     95.3,
			},
			PowerSupplies: []*apiv2.MachinePowerSupply{
				{
					Health: "OK",
					State:  "On",
				},
				{
					Health: "OK",
					State:  "On",
				},
			},
			LedState: &apiv2.MachineChassisIdentifyLEDState{
				Value:       "LED-ON",
				Description: "User initiated chassis identify",
			},
			UpdatedAt: timestamppb.New(e2e.TimeBubbleStartTime().Add(-1 * time.Minute)),
		},
	}
	Machine2BmcDetails = &apiv2.MachineBMCDetails{
		Uuid:      Machine2().Uuid,
		Partition: Machine2().Partition.Id,
		Rack:      Machine2().Rack,
		Room:      Machine2().Room,
		Size:      Machine2().Size.Id,
		BmcReport: &apiv2.MachineBMCReport{
			Uuid: Machine2().Uuid,
			Bmc: &apiv2.MachineBMC{
				Address:    "10.0.0.2:623",
				Mac:        "02:00:00:00:00:02",
				User:       "root",
				Password:   "changeme",
				Interface:  "lanplus",
				Version:    "2.4.0",
				PowerState: "off",
			},
			Bios: &apiv2.MachineBios{
				Version: "2.0.0",
				Vendor:  "Supermicro",
				Date:    "10/15/2023",
			},
			Fru: &apiv2.MachineFRU{
				ChassisPartNumber:   new("Chassis-PN-2"),
				ChassisPartSerial:   new("Chassis-SN-2"),
				BoardMfg:            new("Supermicro"),
				BoardMfgSerial:      new("Board-SN-2"),
				BoardPartNumber:     new("Board-PN-2"),
				ProductManufacturer: new("HPE"),
				ProductPartNumber:   new("Product-PN-2"),
				ProductSerial:       new("Product-SN-2"),
			},
			PowerMetric: &apiv2.MachinePowerMetric{
				AverageConsumedWatts: 0,
				IntervalInMin:        0,
				MaxConsumedWatts:     0,
				MinConsumedWatts:     0,
			},
			PowerSupplies: []*apiv2.MachinePowerSupply{
				{
					Health: "Warning",
					State:  "Absent",
				},
			},
			LedState: &apiv2.MachineChassisIdentifyLEDState{
				Value:       "LED-OFF",
				Description: "",
			},
			UpdatedAt: timestamppb.New(e2e.TimeBubbleStartTime().Add(-2 * time.Minute)),
		},
	}
)
View Source
var (
	Network1 = func() *apiv2.Network {
		return &apiv2.Network{
			Id:          "6988ebb0-9531-4f9b-a893-d7868258e2ef",
			Name:        new("internet"),
			Description: new("internet network"),
			Partition:   new(Partition1().Id),
			Project:     new(Project1().Uuid),
			Type:        apiv2.NetworkType_NETWORK_TYPE_EXTERNAL,
			NatType:     apiv2.NATType_NAT_TYPE_NONE,
			Prefixes:    []string{"10.0.0.0/16", "2001:db8::/32"},
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						tag.ClusterServiceFQN: "<cluster>/default/ingress-nginx",
					},
				},
			},
		}
	}
	Network2 = func() *apiv2.Network {
		return &apiv2.Network{
			Id:            "d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0",
			Name:          new("private"),
			Description:   new("private network"),
			Partition:     new(Partition1().Id),
			Project:       new(Project2().Uuid),
			Type:          apiv2.NetworkType_NETWORK_TYPE_CHILD,
			NatType:       apiv2.NATType_NAT_TYPE_IPV4_MASQUERADE,
			Prefixes:      []string{"192.168.1.0/24"},
			Vrf:           new(uint32(100)),
			ParentNetwork: &Network1().Id,
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"a": "b",
					},
				},
			},
		}
	}
)
View Source
var (
	Partition1 = func() *apiv2.Partition {
		return &apiv2.Partition{
			Id:          "partition-1",
			Description: "partition 1",
			MgmtServiceAddresses: []string{
				"192.168.1.1:1234",
			},
			BootConfiguration: &apiv2.PartitionBootConfiguration{
				Commandline: "commandline",
				ImageUrl:    "imageurl",
				KernelUrl:   "kernelurl",
			},
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"a": "b",
					},
				},
			},
		}
	}
	Partition2 = func() *apiv2.Partition {
		return &apiv2.Partition{
			Id:          "partition-2",
			Description: "partition 2",
			MgmtServiceAddresses: []string{
				"192.168.1.2:1234",
			},
			BootConfiguration: &apiv2.PartitionBootConfiguration{
				Commandline: "commandline",
				ImageUrl:    "imageurl",
				KernelUrl:   "kernelurl",
			},
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: nil,
				},
			},
		}
	}
)
View Source
var (
	Project1 = func() *apiv2.Project {
		return &apiv2.Project{
			Uuid:        "0d81bca7-73f6-4da3-8397-4a8c52a0c583",
			Name:        "project-a",
			Description: "first project",
			Tenant:      "metal-stack",
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}
	Project2 = func() *apiv2.Project {
		return &apiv2.Project{
			Uuid:        "f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c",
			Name:        "project-b",
			Description: "second project",
			Tenant:      "metal-stack",
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}

	Project1Invite = func() *apiv2.ProjectInvite {
		return &apiv2.ProjectInvite{
			Secret:      "secret",
			Project:     "0d81bca7-73f6-4da3-8397-4a8c52a0c583",
			Role:        apiv2.ProjectRole_PROJECT_ROLE_EDITOR,
			Joined:      false,
			ProjectName: "project-a",
			TenantName:  "metal-stack",
			ExpiresAt:   timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
		}
	}
	Project2Invite = func() *apiv2.ProjectInvite {
		return &apiv2.ProjectInvite{
			Secret:      "secret",
			Project:     "f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c",
			Role:        apiv2.ProjectRole_PROJECT_ROLE_EDITOR,
			Joined:      false,
			ProjectName: "project-b",
			TenantName:  "metal-stack",
			ExpiresAt:   timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
		}
	}

	Project1Members = func() *apiv2.ProjectMember {
		return &apiv2.ProjectMember{
			Id:                  "16d6e8ba-f574-494f-8d5e-74f6cb2d8db0",
			Role:                apiv2.ProjectRole_PROJECT_ROLE_OWNER,
			InheritedMembership: false,
			CreatedAt:           timestamppb.New(e2e.TimeBubbleStartTime()),
		}
	}
	Project2Members = func() *apiv2.ProjectMember {
		return &apiv2.ProjectMember{
			Id:                  "40c0da4b-9eb9-4371-91aa-1ae62193fa54",
			Role:                apiv2.ProjectRole_PROJECT_ROLE_EDITOR,
			InheritedMembership: true,
			CreatedAt:           timestamppb.New(e2e.TimeBubbleStartTime()),
		}
	}
)
View Source
var (
	Size1 = func() *apiv2.Size {
		return &apiv2.Size{
			Id:          "v1-medium-x86",
			Name:        new("v1-medium-x86"),
			Description: new("Virtual size for mini-lab"),
			Meta: &apiv2.Meta{
				Labels: &apiv2.Labels{
					Labels: map[string]string{
						"a": "b",
					},
				},
			},
			Constraints: []*apiv2.SizeConstraint{
				{
					Type: apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_CORES,
					Min:  4,
					Max:  4,
				},
				{
					Type: apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_MEMORY,
					Min:  500000000,
					Max:  4000000000,
				},
				{
					Type: apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_STORAGE,
					Min:  1000000000,
					Max:  100000000000,
				},
			},
		}
	}
	Size2 = func() *apiv2.Size {
		return &apiv2.Size{
			Id:          "g1-medium-x86",
			Name:        new("g1-medium-x86"),
			Description: new("A medium sized GPU server"),
			Meta:        &apiv2.Meta{},
			Constraints: []*apiv2.SizeConstraint{
				{
					Identifier: new("Intel(R) Xeon(R) Gold 6426Y"),
					Type:       apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_CORES,
					Min:        32,
					Max:        32,
				},
				{

					Type: apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_MEMORY,
					Min:  274877906944,
					Max:  274877906944,
				},
				{
					Identifier: new("/dev/*"),
					Type:       apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_STORAGE,
					Min:        1840378724352,
					Max:        1840378724352,
				},
				{
					Identifier: new("AD102GL [RTX 6000 Ada Generation]"),
					Type:       apiv2.SizeConstraintType_SIZE_CONSTRAINT_TYPE_GPU,
					Min:        1,
					Max:        1,
				},
			},
		}
	}
)
View Source
var (
	Switch1 = func() *apiv2.Switch {
		return &apiv2.Switch{
			Id:             "leaf01",
			Partition:      "fra-equ01",
			Rack:           new("rack-1"),
			Room:           new("room-1"),
			Description:    "leaf switch 1",
			ManagementIp:   "10.0.0.1",
			ManagementUser: new("admin"),
			MachineConnections: []*apiv2.MachineConnection{
				{
					MachineId: "id1",
					Nic:       Nic1(),
				},
			},
			Nics: []*apiv2.SwitchNic{Nic1(), Nic2()},
			Os: &apiv2.SwitchOS{
				Vendor:           apiv2.SwitchOSVendor_SWITCH_OS_VENDOR_SONIC,
				Version:          "4.2.0",
				MetalCoreVersion: "v0.9.1 (abc1234), tags/v0.9.1",
			},
			LastSync: &apiv2.SwitchSync{
				Time:     timestamppb.New(e2e.TimeBubbleStartTime()),
				Duration: durationpb.New(100 * time.Millisecond),
			},
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}
	Switch2 = func() *apiv2.Switch {
		return &apiv2.Switch{
			Id:             "leaf02",
			Partition:      "fra-equ01",
			Rack:           new("rack-1"),
			Room:           new("room-2"),
			Description:    "leaf switch 2",
			ManagementIp:   "10.0.0.2",
			ManagementUser: new("admin"),
			Os: &apiv2.SwitchOS{
				Vendor:           apiv2.SwitchOSVendor_SWITCH_OS_VENDOR_SONIC,
				Version:          "4.2.0",
				MetalCoreVersion: "v0.9.1 (abc1234), tags/v0.9.1",
			},
			LastSync: &apiv2.SwitchSync{
				Time:     timestamppb.New(e2e.TimeBubbleStartTime()),
				Duration: durationpb.New(200 * time.Millisecond),
			},
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}

	Nic1 = func() *apiv2.SwitchNic {
		return &apiv2.SwitchNic{
			Name:       "Ethernet0",
			Identifier: "oid:0x1000000000001",
			Mac:        new("52:54:00:ab:cd:01"),
			Vrf:        new("default"),
			State: &apiv2.NicState{
				Desired: new(apiv2.SwitchPortStatus_SWITCH_PORT_STATUS_UP),
				Actual:  apiv2.SwitchPortStatus_SWITCH_PORT_STATUS_UP,
			},
			BgpFilter: &apiv2.BGPFilter{
				Cidrs: []string{
					"10.0.0.0/24",
					"192.168.100.0/24",
				},
				Vnis: []string{
					"10001",
					"10002",
				},
			},
			BgpPortState: &apiv2.SwitchBGPPortState{
				Neighbor:              "10.0.0.2",
				PeerGroup:             "TOR-LEAFS",
				VrfName:               "default",
				BgpState:              apiv2.BGPState_BGP_STATE_ESTABLISHED,
				BgpTimerUpEstablished: timestamppb.New(time.Now().Add(-2 * time.Hour)),
				SentPrefixCounter:     120,
				AcceptedPrefixCounter: 118,
			},
		}
	}
	Nic2 = func() *apiv2.SwitchNic {
		return &apiv2.SwitchNic{
			Name:       "Ethernet4",
			Identifier: "oid:0x1000000000002",
			Mac:        new("52:54:00:ab:cd:02"),
			State: &apiv2.NicState{
				Desired: new(apiv2.SwitchPortStatus_SWITCH_PORT_STATUS_UP),
				Actual:  apiv2.SwitchPortStatus_SWITCH_PORT_STATUS_DOWN,
			},
			BgpFilter: &apiv2.BGPFilter{
				Cidrs: []string{"10.1.0.0/24"},
				Vnis:  []string{"20001"},
			},
			BgpPortState: &apiv2.SwitchBGPPortState{
				Neighbor:              "10.1.0.2",
				PeerGroup:             "TOR-LEAFS",
				VrfName:               "default",
				BgpState:              apiv2.BGPState_BGP_STATE_IDLE,
				BgpTimerUpEstablished: nil,
				SentPrefixCounter:     0,
				AcceptedPrefixCounter: 0,
			},
		}
	}
	SwitchWithMachines1 = func() *apiv2.SwitchWithMachines {
		return &apiv2.SwitchWithMachines{
			Id:        Switch1().Id,
			Partition: Switch1().Partition,
			Rack:      *Switch1().Rack,
			Connections: []*apiv2.SwitchNicWithMachine{
				{
					Nic: Switch1().Nics[0],
					Machine: &apiv2.Machine{
						Uuid: "id1",
						Partition: &apiv2.Partition{
							Id: Switch1().Partition,
						},
						Rack: *Switch1().Rack,
						Size: &apiv2.Size{
							Id: "m1-small",
						},
					},
					Fru: &apiv2.MachineFRU{
						ProductSerial:     new("ps-1"),
						ChassisPartSerial: new("cs-1"),
					},
				},
			},
		}
	}
)
View Source
var (
	Task1 = func() *adminv2.TaskInfo {
		return &adminv2.TaskInfo{
			Id:            "00dc6a98-bd80-787a-9725-ffb692d83261",
			Queue:         "default",
			Type:          "image-provision",
			Payload:       []byte(`{"machine_id":"machine1"}`),
			State:         adminv2.TaskState_TASK_STATE_ACTIVE,
			MaxRetry:      3,
			Retried:       1,
			LastError:     "connection timeout",
			LastFailedAt:  timestamppb.New(e2e.TimeBubbleStartTime().Add(-5 * time.Minute)),
			Timeout:       durationpb.New(30 * time.Second),
			Deadline:      timestamppb.New(e2e.TimeBubbleStartTime().Add(5 * time.Minute)),
			NextProcessAt: timestamppb.New(e2e.TimeBubbleStartTime().Add(10 * time.Second)),
			Retention:     durationpb.New(24 * time.Hour),
			CompletedAt:   nil,
		}
	}
	Task2 = func() *adminv2.TaskInfo {
		return &adminv2.TaskInfo{
			Id:            "00dc6ab4-34c0-73ce-af77-3e07748d0e0d",
			Queue:         "default",
			Type:          "firewall-update",
			Payload:       []byte(`{"firewall_id":"fw1"}`),
			State:         adminv2.TaskState_TASK_STATE_PENDING,
			MaxRetry:      5,
			Retried:       0,
			LastError:     "",
			LastFailedAt:  nil,
			Timeout:       durationpb.New(60 * time.Second),
			Deadline:      timestamppb.New(e2e.TimeBubbleStartTime().Add(10 * time.Minute)),
			NextProcessAt: timestamppb.New(e2e.TimeBubbleStartTime().Add(2 * time.Second)),
			Retention:     durationpb.New(48 * time.Hour),
			CompletedAt:   nil,
		}
	}
	Task3 = func() *adminv2.TaskInfo {
		return &adminv2.TaskInfo{
			Id:            "00dc6ab5-1f20-7426-a397-8644fb78324e",
			Queue:         "high-priority",
			Type:          "machine-reimage",
			Payload:       []byte(`{"machine_id":"machine2"}`),
			State:         adminv2.TaskState_TASK_STATE_COMPLETED,
			MaxRetry:      3,
			Retried:       0,
			LastError:     "",
			LastFailedAt:  nil,
			Timeout:       durationpb.New(5 * time.Minute),
			Deadline:      timestamppb.New(e2e.TimeBubbleStartTime().Add(30 * time.Minute)),
			NextProcessAt: nil,
			Retention:     durationpb.New(7 * 24 * time.Hour),
			CompletedAt:   timestamppb.New(e2e.TimeBubbleStartTime().Add(-10 * time.Minute)),
			Result:        []byte(`success`),
		}
	}
)
View Source
var (
	Tenant1 = func() *apiv2.Tenant {
		return &apiv2.Tenant{
			Login:       "metal-stack",
			Name:        "Metal Stack",
			Email:       "info@metal-stack.io",
			Description: "a tenant",
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}
	Tenant2 = func() *apiv2.Tenant {
		return &apiv2.Tenant{
			Login:       "acme-corp",
			Name:        "ACME Corp",
			Email:       "admin@acme.io",
			Description: "another tenant",
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}

	Tenant1Invite = func() *apiv2.TenantInvite {
		return &apiv2.TenantInvite{
			Secret:           "secret",
			TargetTenant:     "metal-stack",
			TargetTenantName: "Metal Stack",
			Role:             apiv2.TenantRole_TENANT_ROLE_VIEWER,
			Joined:           false,
			Tenant:           "metal-stack",
			TenantName:       "Metal Stack",
			ExpiresAt:        timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
		}
	}
	Tenant2Invite = func() *apiv2.TenantInvite {
		return &apiv2.TenantInvite{
			Secret:           "secret",
			TargetTenant:     "acme-corp",
			TargetTenantName: "ACME Corp",
			Role:             apiv2.TenantRole_TENANT_ROLE_EDITOR,
			Joined:           false,
			Tenant:           "acme-corp",
			TenantName:       "ACME Corp",
			ExpiresAt:        timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
		}
	}

	Tenant1Members = func() *apiv2.TenantMember {
		return &apiv2.TenantMember{
			Id:        "16d6e8ba-f574-494f-8d5e-74f6cb2d8db0",
			Role:      apiv2.TenantRole_TENANT_ROLE_OWNER,
			CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			Projects:  []string{Project1().Uuid, Project2().Uuid},
		}
	}
	Tenant2Members = func() *apiv2.TenantMember {
		return &apiv2.TenantMember{
			Id:        "40c0da4b-9eb9-4371-91aa-1ae62193fa54",
			Role:      apiv2.TenantRole_TENANT_ROLE_EDITOR,
			CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			Projects:  []string{Project1().Uuid},
		}
	}
)
View Source
var (
	Token1 = func() *apiv2.Token {
		return &apiv2.Token{
			Uuid:        "a3b1f6d2-4e8c-4f7a-9d2e-1b5c8f3a7e90",
			User:        "admin@metal-stack.io",
			Description: "ci token",
			TokenType:   apiv2.TokenType_TOKEN_TYPE_API,
			Expires:     timestamppb.New(e2e.TimeBubbleStartTime().Add(24 * time.Hour)),
			IssuedAt:    timestamppb.New(e2e.TimeBubbleStartTime()),
			Permissions: nil,
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}
	Token2 = func() *apiv2.Token {
		return &apiv2.Token{
			Uuid:        "b4c2e7f3-5a9d-4b8e-a1c3-2d6f9e4b8a01",
			User:        "dev@metal-stack.io",
			Description: "dev token",
			TokenType:   apiv2.TokenType_TOKEN_TYPE_API,
			Expires:     timestamppb.New(e2e.TimeBubbleStartTime().Add(48 * time.Hour)),
			IssuedAt:    timestamppb.New(e2e.TimeBubbleStartTime()),
			Permissions: []*apiv2.MethodPermission{
				{
					Subject: Project1().Uuid,
					Methods: []string{apiv2connect.IPServiceCreateProcedure, apiv2connect.IPServiceDeleteProcedure},
				},
				{
					Subject: Tenant1().Login,
					Methods: []string{apiv2connect.AuditServiceGetProcedure},
				},
			},
			Meta: &apiv2.Meta{
				CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()),
			},
		}
	}
)
View Source
var (
	VpnNode1 = func() *apiv2.VPNNode {
		return &apiv2.VPNNode{
			Id:          1,
			Name:        "node-1",
			Project:     Project1().Uuid,
			IpAddresses: []string{"1.2.3.4", "1.2.3.5"},
			LastSeen:    timestamppb.New(e2e.TimeBubbleStartTime()),
			Online:      false,
		}
	}
	VpnNode2 = func() *apiv2.VPNNode {
		return &apiv2.VPNNode{
			Id:          2,
			Name:        "node-2",
			Project:     Project2().Uuid,
			IpAddresses: []string{"2.3.4.5"},
			LastSeen:    timestamppb.New(e2e.TimeBubbleStartTime().Add(1 * time.Minute)),
			Online:      true,
		}
	}
)
View Source
var (
	User = func() *apiv2.User {
		return &apiv2.User{
			Name:          "Larry",
			Email:         "larry@metal-stack.io",
			Login:         "larry@metal-stack.io@openid-connect",
			AvatarUrl:     "",
			DefaultTenant: Tenant1(),
			Tenants:       []*apiv2.Tenant{Tenant1(), Tenant2()},
			Projects:      []*apiv2.Project{Project1(), Project2()},
		}
	}
)
View Source
var (
	Version = func() *apiv2.Version {
		return &apiv2.Version{
			Version:   "v0.1.8",
			Revision:  "tags/v0.1.8-0-g476edc0",
			GitSha1:   "477edc0b",
			BuildDate: "2026-03-21T15:35:07+00:00",
		}
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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