Documentation ¶
Index ¶
- Constants
- Variables
- func IdentityHandlers() *mux.Router
- func ReadyPayload(uuid string, memTotal int, memAvail int) payloads.Ready
- func RoleToTestCert(role ssntp.Role) string
- func StartIdentityServer(config IdentityConfig) *httptest.Server
- func StatsPayload(uuid string, name string, instances []payloads.InstanceStat, ...) payloads.Stat
- type IdentityConfig
- type Result
- type SsntpTestClient
- func (client *SsntpTestClient) AddCmdChan(cmd ssntp.Command) *chan Result
- func (client *SsntpTestClient) AddErrorChan(error ssntp.Error) *chan Result
- func (client *SsntpTestClient) AddEventChan(evt ssntp.Event) *chan Result
- func (client *SsntpTestClient) AddStatusChan(status ssntp.Status) *chan Result
- func (client *SsntpTestClient) CommandNotify(command ssntp.Command, frame *ssntp.Frame)
- func (client *SsntpTestClient) ConnectNotify()
- func (client *SsntpTestClient) DisconnectNotify()
- func (client *SsntpTestClient) ErrorNotify(error ssntp.Error, frame *ssntp.Frame)
- func (client *SsntpTestClient) EventNotify(event ssntp.Event, frame *ssntp.Frame)
- func (client *SsntpTestClient) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
- func (client *SsntpTestClient) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
- func (client *SsntpTestClient) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
- func (client *SsntpTestClient) GetStatusChanResult(c *chan Result, status ssntp.Status) (result Result, err error)
- func (client *SsntpTestClient) SendConcentratorAddedEvent(instanceUUID string, tenantUUID string, ip string, vnicMAC string)
- func (client *SsntpTestClient) SendDeleteEvent(uuid string)
- func (client *SsntpTestClient) SendPublicIPAssignedEvent()
- func (client *SsntpTestClient) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
- func (client *SsntpTestClient) SendResultAndDelErrorChan(error ssntp.Error, result Result)
- func (client *SsntpTestClient) SendResultAndDelEventChan(evt ssntp.Event, result Result)
- func (client *SsntpTestClient) SendResultAndDelStatusChan(status ssntp.Status, result Result)
- func (client *SsntpTestClient) SendStatsCmd()
- func (client *SsntpTestClient) SendStatus(memTotal int, memAvail int)
- func (client *SsntpTestClient) SendTenantAddedEvent()
- func (client *SsntpTestClient) SendTenantRemovedEvent()
- func (client *SsntpTestClient) SendTrace()
- func (client *SsntpTestClient) Shutdown()
- func (client *SsntpTestClient) StatusNotify(status ssntp.Status, frame *ssntp.Frame)
- type SsntpTestController
- func (ctl *SsntpTestController) AddCmdChan(cmd ssntp.Command) *chan Result
- func (ctl *SsntpTestController) AddErrorChan(error ssntp.Error) *chan Result
- func (ctl *SsntpTestController) AddEventChan(evt ssntp.Event) *chan Result
- func (ctl *SsntpTestController) CommandNotify(command ssntp.Command, frame *ssntp.Frame)
- func (ctl *SsntpTestController) ConnectNotify()
- func (ctl *SsntpTestController) DisconnectNotify()
- func (ctl *SsntpTestController) ErrorNotify(error ssntp.Error, frame *ssntp.Frame)
- func (ctl *SsntpTestController) EventNotify(event ssntp.Event, frame *ssntp.Frame)
- func (ctl *SsntpTestController) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
- func (ctl *SsntpTestController) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
- func (ctl *SsntpTestController) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
- func (ctl *SsntpTestController) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
- func (ctl *SsntpTestController) SendResultAndDelErrorChan(error ssntp.Error, result Result)
- func (ctl *SsntpTestController) SendResultAndDelEventChan(evt ssntp.Event, result Result)
- func (ctl *SsntpTestController) Shutdown()
- func (ctl *SsntpTestController) StatusNotify(status ssntp.Status, frame *ssntp.Frame)
- type SsntpTestServer
- func (server *SsntpTestServer) AddCmdChan(cmd ssntp.Command) *chan Result
- func (server *SsntpTestServer) AddErrorChan(error ssntp.Error) *chan Result
- func (server *SsntpTestServer) AddEventChan(evt ssntp.Event) *chan Result
- func (server *SsntpTestServer) AddStatusChan(status ssntp.Status) *chan Result
- func (server *SsntpTestServer) CommandForward(uuid string, command ssntp.Command, frame *ssntp.Frame) (dest ssntp.ForwardDestination)
- func (server *SsntpTestServer) CommandNotify(uuid string, command ssntp.Command, frame *ssntp.Frame)
- func (server *SsntpTestServer) ConnectNotify(uuid string, role ssntp.Role)
- func (server *SsntpTestServer) DisconnectNotify(uuid string, role ssntp.Role)
- func (server *SsntpTestServer) ErrorNotify(uuid string, error ssntp.Error, frame *ssntp.Frame)
- func (server *SsntpTestServer) EventForward(uuid string, event ssntp.Event, frame *ssntp.Frame) ssntp.ForwardDestination
- func (server *SsntpTestServer) EventNotify(uuid string, event ssntp.Event, frame *ssntp.Frame)
- func (server *SsntpTestServer) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
- func (server *SsntpTestServer) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
- func (server *SsntpTestServer) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
- func (server *SsntpTestServer) GetStatusChanResult(c *chan Result, status ssntp.Status) (result Result, err error)
- func (server *SsntpTestServer) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
- func (server *SsntpTestServer) SendResultAndDelErrorChan(error ssntp.Error, result Result)
- func (server *SsntpTestServer) SendResultAndDelEventChan(evt ssntp.Event, result Result)
- func (server *SsntpTestServer) SendResultAndDelStatusChan(error ssntp.Status, result Result)
- func (server *SsntpTestServer) Shutdown()
- func (server *SsntpTestServer) StatusNotify(uuid string, status ssntp.Status, frame *ssntp.Frame)
Constants ¶
const AgentIP = "10.2.3.4"
AgentIP is a test agent IP address
const AgentUUID = "4cb19522-1e18-439a-883a-f9b2a3a95f5e"
AgentUUID is a node UUID for coordinated stop/restart/delete tests
const AssignIPYaml = `assign_public_ip: concentrator_uuid: ` + CNCIUUID + ` tenant_uuid: ` + TenantUUID + ` instance_uuid: ` + InstanceUUID + ` public_ip: ` + InstancePublicIP + ` private_ip: ` + InstancePrivateIP + ` vnic_mac: ` + VNICMAC + ` `
AssignIPYaml is a sample AssignPublicIP ssntp.Command payload for test cases
const AssignedIPYaml = `public_ip_assigned: concentrator_uuid: ` + CNCIUUID + ` instance_uuid: ` + InstanceUUID + ` public_ip: ` + InstancePublicIP + ` private_ip: ` + InstancePrivateIP + ` `
AssignedIPYaml is a sample PublicIPAssigned ssntp.Event payload for test cases
const AttachVolumeFailureYaml = `instance_uuid: ` + InstanceUUID + ` volume_uuid: ` + VolumeUUID + ` reason: attach_failure `
AttachVolumeFailureYaml is a sample AttachVolumeFailure ssntp.Error payload for test cases
const AttachVolumeYaml = `attach_volume: instance_uuid: ` + InstanceUUID + ` volume_uuid: ` + VolumeUUID + ` workload_agent_uuid: ` + AgentUUID + ` `
AttachVolumeYaml is a sample yaml payload for the ssntp Attach Volume command.
const BadAttachVolumeYaml = `attach_volume: volume_uuid: ` + VolumeUUID + ` `
BadAttachVolumeYaml is a corrupt yaml payload for the ssntp Attach Volume command.
const BadDetachVolumeYaml = `detach_volume: instance_uuid: ` + InstanceUUID + ` `
BadDetachVolumeYaml is a corrupt yaml payload for the ssntp Detach Volume command.
const CNCIAddedYaml = `concentrator_instance_added: instance_uuid: ` + CNCIUUID + ` tenant_uuid: ` + TenantUUID + ` concentrator_ip: ` + CNCIIP + ` concentrator_mac: ` + CNCIMAC + ` `
CNCIAddedYaml is a sample ConcentratorInstanceAdded ssntp.Event payload for test cases
const CNCIIP = "10.1.2.3"
CNCIIP is a test CNCI instance IP address
const CNCIInstanceData = `scheduler_addr: 192.168.42.5
`
CNCIInstanceData is a sample CNCIInstanceConfig payload for test cases
const CNCIInstanceUUID = "c6beb8b5-0bfc-43fd-9638-7dd788179fd8"
CNCIInstanceUUID is a CNCI instance UUID for use in start/stop/restart/delete tests
const CNCIMAC = "CA:FE:C0:00:01:02"
CNCIMAC is a test CNCI instance MAC address
const CNCIStartYaml = `start: instance_uuid: ` + CNCIInstanceUUID + ` image_uuid: ` + ImageUUID + ` fw_type: efi persistence: host vm_type: qemu requested_resources: - type: vcpus value: 4 mandatory: true - type: mem_mb value: 4096 mandatory: true - type: network_node value: 1 mandatory: true networking: vnic_mac: ` + VNICMAC + ` vnic_uuid: ` + VNICUUID + ` concentrator_uuid: ` + CNCIUUID + ` concentrator_ip: ` + CNCIIP + ` subnet: ` + TenantSubnet + ` subnet_key: ` + SubnetKey + ` subnet_uuid: "" private_ip: "" public_ip: false `
CNCIStartYaml is a sample CNCI workload START ssntp.Command payload for test cases
const CNCIUUID = "7e84c2d6-5a84-4f9b-98e3-38980f722d1b"
CNCIUUID is a test CNCI instance UUID
const ComputeAPIPort = "8774"
ComputeAPIPort is the compute service port the testutil identity service will use by default
const ComputeNet = "192.168.1.110"
ComputeNet is a test compute network
const ComputePort = "443"
ComputePort is a test port for the compute service
const ConfigureYaml = `configure: scheduler: storage_uri: ` + StorageURI + ` storage: ceph_id: ` + ManagementID + ` controller: volume_port: ` + VolumePort + ` compute_port: ` + ComputePort + ` compute_ca: ` + HTTPSCACert + ` compute_cert: ` + HTTPSKey + ` identity_user: ` + IdentityUser + ` identity_password: ` + IdentityPassword + ` launcher: compute_net: - ` + ComputeNet + ` mgmt_net: - ` + MgmtNet + ` disk_limit: false mem_limit: false image_service: type: glance url: ` + GlanceURL + ` identity_service: type: keystone url: ` + KeystoneURL + ` `
ConfigureYaml is a sample CONFIGURE ssntp.Command payload for test cases
const DeleteFailureYaml = `instance_uuid: ` + InstanceUUID + `
reason: no_instance
`
DeleteFailureYaml is a sample workload DeleteFailure ssntp.Error payload for test cases
const DeleteYaml = `delete: instance_uuid: ` + InstanceUUID + ` workload_agent_uuid: ` + AgentUUID + ` `
DeleteYaml is a sample workload DELETE ssntp.Command payload for test cases
const DetachVolumeFailureYaml = `instance_uuid: ` + InstanceUUID + ` volume_uuid: ` + VolumeUUID + ` reason: detach_failure `
DetachVolumeFailureYaml is a sample DetachVolumeFailure ssntp.Error payload for test cases
const DetachVolumeYaml = `detach_volume: instance_uuid: ` + InstanceUUID + ` volume_uuid: ` + VolumeUUID + ` workload_agent_uuid: ` + AgentUUID + ` `
DetachVolumeYaml is a sample yaml payload for the ssntp Detach Volume command.
const DockerImage = "docker/latest"
DockerImage is a docker image name for use in start/restart tests
const EvacuateYaml = `evacuate: workload_agent_uuid: ` + AgentUUID + ` `
EvacuateYaml is a sample node EVACUATE ssntp.Command payload for test cases
const GlanceURL = "http://glance.example.com"
GlanceURL is a test Glance image server url
const HTTPSCACert = "/etc/pki/ciao/compute_ca.pem"
HTTPSCACert is a path to the CA cert used to sign the HTTPSKey
const HTTPSKey = "/etc/pki/ciao/compute_key.pem"
HTTPSKey is a path to a key for the compute service
const IdentityPassword = "ciao"
IdentityPassword is a test password for the test identity server
const IdentityUser = "controller"
IdentityUser is a test user for the test identity server
const ImageAPIPort = "9292"
ImageAPIPort is the image service port the testutil identity service will use by default
const ImageUUID = "59460b8a-5f53-4e3e-b5ce-b71fed8c7e64"
ImageUUID is a disk image UUID for use in start/restart tests
const InsDelYaml = `instance_deleted: instance_uuid: ` + InstanceUUID + ` `
InsDelYaml is a sample workload InstanceDeleted ssntp.Event payload for test cases
const InstancePrivateIP = "192.168.1.2"
InstancePrivateIP is a test instance private IP
const InstancePublicIP = "10.1.2.3"
InstancePublicIP is a test instance public IP
const InstanceUUID = "3390740c-dce9-48d6-b83a-a717417072ce"
InstanceUUID is an instance UUID for use in start/stop/restart/delete tests
const KeystoneURL = "http://keystone.example.com"
KeystoneURL is a test Keystone identity server url
const ManagementID = "ciao"
ManagementID is a test identifier for a Ceph ID
const MgmtNet = "192.168.1.111"
MgmtNet is a test management network
const NetAgentUUID = "6be56328-92e2-4ecd-b426-8fe529c04e0c"
NetAgentUUID is a network node UUID for coordinated tests
const NodeConnectedYaml = `node_connected: node_uuid: ` + AgentUUID + ` node_type: ` + payloads.NetworkNode + ` `
NodeConnectedYaml is a sample node NodeConnected ssntp.Event payload for test cases
const NodeOnlyStatsYaml = `node_uuid: ` + AgentUUID + `
mem_total_mb: 3896
mem_available_mb: 3896
disk_total_mb: 500000
disk_available_mb: 256000
load: 0
cpus_online: 4
hostname: test
networks:
- ip: 192.168.1.1
mac: 02:00:15:03:6f:49
`
NodeOnlyStatsYaml is a sample minimal node STATS ssntp.Command payload for test cases with no per-instance statistics
const PartialReadyYaml = `node_uuid: ` + AgentUUID + `
load: 1
`
PartialReadyYaml is a sample minimal node READY ssntp.Status payload for test cases
const PartialRestartYaml = `restart: instance_uuid: ` + InstanceUUID + ` workload_agent_uuid: ` + AgentUUID + ` fw_type: efi persistence: host requested_resources: - type: vcpus value: 2 mandatory: true `
PartialRestartYaml is a sample minimal workload RESTART ssntp.Command payload for test cases
const PartialStartYaml = `start: instance_uuid: ` + InstanceUUID + ` image_uuid: ` + ImageUUID + ` docker_image: ` + DockerImage + ` fw_type: efi persistence: host vm_type: qemu requested_resources: - type: vcpus value: 2 mandatory: true `
PartialStartYaml is a sample minimal workload START ssntp.Command payload for test cases
const PartialStatsYaml = `node_uuid: ` + AgentUUID + `
load: 1
`
PartialStatsYaml is a sample minimal node STATS ssntp.Command payload for test cases with limited node statistics and no per-instance statistics
const ReadyYaml = `node_uuid: ` + AgentUUID + `
mem_total_mb: 3896
mem_available_mb: 3896
disk_total_mb: 500000
disk_available_mb: 256000
load: 0
cpus_online: 4
`
ReadyYaml is a sample node READY ssntp.Status payload for test cases
const ReleaseIPYaml = `release_public_ip: concentrator_uuid: ` + CNCIUUID + ` tenant_uuid: ` + TenantUUID + ` instance_uuid: ` + InstanceUUID + ` public_ip: ` + InstancePublicIP + ` private_ip: ` + InstancePrivateIP + ` vnic_mac: ` + VNICMAC + ` `
ReleaseIPYaml is a sample ReleasePublicIP ssntp.Command payload for test cases
const RestartFailureYaml = `instance_uuid: ` + InstanceUUID + `
reason: already_running
`
RestartFailureYaml is a sample workload RestartFailure ssntp.Error payload for test cases
const RestartYaml = `restart: tenant_uuid: ` + TenantUUID + ` instance_uuid: ` + InstanceUUID + ` image_uuid: ` + ImageUUID + ` workload_agent_uuid: ` + AgentUUID + ` fw_type: efi persistence: host requested_resources: - type: vcpus value: 2 mandatory: true - type: mem_mb value: 4096 mandatory: true - type: disk_mb value: 10000 mandatory: true estimated_resources: - type: vcpus value: 1 - type: mem_mb value: 128 - type: disk_mb value: 4096 networking: vnic_mac: "" vnic_uuid: "" concentrator_uuid: "" concentrator_ip: "" subnet: "" subnet_key: "" subnet_uuid: "" private_ip: "" public_ip: false `
RestartYaml is a sample workload RESTART ssntp.Command payload for test cases
const SchedulerAddr = "192.168.42.5"
SchedulerAddr is a test scheduler address
const StartFailureYaml = `instance_uuid: ` + InstanceUUID + `
reason: full_cloud
`
StartFailureYaml is a sample workload StartFailure ssntp.Error payload for test cases
const StartYaml = `start: tenant_uuid: ` + TenantUUID + ` instance_uuid: ` + InstanceUUID + ` image_uuid: ` + ImageUUID + ` docker_image: ` + DockerImage + ` fw_type: efi persistence: host vm_type: qemu requested_resources: - type: vcpus value: 2 mandatory: true - type: mem_mb value: 4096 mandatory: true - type: disk_mb value: 10000 mandatory: true estimated_resources: - type: vcpus value: 1 - type: mem_mb value: 128 - type: disk_mb value: 4096 networking: vnic_mac: "" vnic_uuid: "" concentrator_uuid: "" concentrator_ip: "" subnet: "" subnet_key: "" subnet_uuid: "" private_ip: "" public_ip: false `
StartYaml is a sample workload START ssntp.Command payload for test usage
const StatsYaml = `node_uuid: ` + AgentUUID + `
status: READY
mem_total_mb: 3896
mem_available_mb: 3896
disk_total_mb: 500000
disk_available_mb: 256000
load: 0
cpus_online: 4
hostname: test
networks:
- ip: 192.168.1.1
mac: 02:00:15:03:6f:49
- ip: 10.168.1.1
mac: 02:00:8c:ba:f9:45
instances:
- instance_uuid: fe2970fa-7b36-460b-8b79-9eb4745e62f2
state: active
ssh_ip: ""
ssh_port: 0
memory_usage_mb: 40
disk_usage_mb: 2
cpu_usage: 90
volumes: []
- instance_uuid: cbda5bd8-33bd-4d39-9f52-ace8c9f0b99c
state: active
ssh_ip: 172.168.2.2
ssh_port: 8768
memory_usage_mb: 50
disk_usage_mb: 10
cpu_usage: 0
volumes: []
- instance_uuid: 1f5b2fe6-4493-4561-904a-8f4e956218d9
state: exited
ssh_ip: ""
ssh_port: 0
memory_usage_mb: -1
disk_usage_mb: 2
cpu_usage: -1
volumes:
- 67d86208-b46c-4465-9018-e14187d4010
`
StatsYaml is a sample node STATS ssntp.Command payload for test cases
const StopFailureYaml = `instance_uuid: ` + InstanceUUID + `
reason: already_stopped
`
StopFailureYaml is a sample workload StopFailure ssntp.Error payload for test cases
const StopYaml = `stop: instance_uuid: ` + InstanceUUID + ` workload_agent_uuid: ` + AgentUUID + ` `
StopYaml is a sample workload STOP ssntp.Command payload for test cases
const StorageURI = "/etc/ciao/ciao.json"
StorageURI is a test storage URI
const SubnetKey = "8"
SubnetKey is a test tenant subnet key
const TenantAddedYaml = `tenant_added: agent_uuid: ` + AgentUUID + ` agent_ip: ` + AgentIP + ` tenant_uuid: ` + TenantUUID + ` tenant_subnet: ` + TenantSubnet + ` concentrator_uuid: ` + CNCIUUID + ` concentrator_ip: ` + CNCIIP + ` subnet_key: ` + SubnetKey + ` `
TenantAddedYaml is a sample TenantAdded ssntp.Event payload for test cases
const TenantRemovedYaml = `tenant_removed: agent_uuid: ` + AgentUUID + ` agent_ip: ` + AgentIP + ` tenant_uuid: ` + TenantUUID + ` tenant_subnet: ` + TenantSubnet + ` concentrator_uuid: ` + CNCIUUID + ` concentrator_ip: ` + CNCIIP + ` subnet_key: ` + SubnetKey + ` `
TenantRemovedYaml is a sample TenantRemove ssntp.Event payload for test cases
const TenantSubnet = "10.2.0.0/16"
TenantSubnet is a test tenant subnet
const TenantUUID = "2491851d-dce9-48d6-b83a-a717417072ce"
TenantUUID is a test tenant UUID
const TestCACert = `` /* 1131-byte string literal not displayed */
TestCACert is a snake oil Certificate Authority for test automation.
const TestCACertSchedulerMultiHomed = `` /* 1164-byte string literal not displayed */
TestCACertSchedulerMultiHomed is a snake oil SSNTP multihomed scheduler role Certificate Authority for test automation.
const TestCertAgent = `` /* 2802-byte string literal not displayed */
TestCertAgent is a snake oil SSNTP Agent role certificate for test automation.
const TestCertAgentNetAgent = `` /* 2818-byte string literal not displayed */
TestCertAgentNetAgent is a snake oil SSNTP AGENT|NETAGENT role certificate for test automation.
const TestCertCNCIAgent = `` /* 2806-byte string literal not displayed */
TestCertCNCIAgent is a snake oil SSNTP CNCIAgent role certificate for test automation.
const TestCertController = `` /* 2806-byte string literal not displayed */
TestCertController is a snake oil SSNTP Controller role certificate for test automation.
const TestCertNetAgent = `` /* 2806-byte string literal not displayed */
TestCertNetAgent is a snake oil SSNTP NetAgent role certificate for test automation.
const TestCertScheduler = `` /* 2810-byte string literal not displayed */
TestCertScheduler is a snake oil SSNTP Scheduler role certificate for test automation.
const TestCertServer = `` /* 2802-byte string literal not displayed */
TestCertServer is a snake oil SSNTP Server role certificate for test automation.
const TestCertUnknown = `` /* 2790-byte string literal not displayed */
TestCertUnknown is a snake oil SSNTP Unknown role certificate for test automation.
const VNICMAC = "aa:bb:cc:01:02:03"
VNICMAC is a test instance VNIC MAC address
const VNICUUID = "7f49d00d-1995-4156-8c79-5f5ab24ce138"
VNICUUID is a test instance VNIC UUID
const VolumeAPIPort = "8776"
VolumeAPIPort is the volume service port the testutil identity service will use by default
const VolumePort = "446"
VolumePort is a test port for the compute service
const VolumeUUID = "67d86208-b46c-4465-9018-e14187d4010"
VolumeUUID is a node UUID for storage tests
Variables ¶
var ComputeURL = "https://localhost:" + ComputeAPIPort
ComputeURL is the compute service URL the testutil identity service will use by default
var ComputeUser = "f452bbc7-5076-44d5-922c-3b9d2ce1503f"
ComputeUser is the test user/tenant name the testutil identity service will use by default
var IdentityURL string
IdentityURL is the URL for the testutil identity service
var ImageURL = "https://localhost:" + ImageAPIPort
ImageURL is the image service URL the testutil identity service will use by default
var InstanceStat001 = payloads.InstanceStat{ InstanceUUID: "fe2970fa-7b36-460b-8b79-9eb4745e62f2", State: payloads.Running, MemoryUsageMB: 40, DiskUsageMB: 2, CPUUsage: 90, SSHIP: "", SSHPort: 0, }
InstanceStat001 is a sample payloads.InstanceStat
var InstanceStat002 = payloads.InstanceStat{ InstanceUUID: "cbda5bd8-33bd-4d39-9f52-ace8c9f0b99c", State: payloads.Running, MemoryUsageMB: 50, DiskUsageMB: 10, CPUUsage: 0, SSHIP: "172.168.2.2", SSHPort: 8768, }
InstanceStat002 is a sample payloads.InstanceStat
var InstanceStat003 = payloads.InstanceStat{ InstanceUUID: "1f5b2fe6-4493-4561-904a-8f4e956218d9", State: payloads.Exited, MemoryUsageMB: -1, DiskUsageMB: 2, CPUUsage: -1, Volumes: []string{VolumeUUID}, }
InstanceStat003 is a sample payloads.InstanceStat
var NetworkStat001 = payloads.NetworkStat{
NodeIP: "192.168.1.1",
NodeMAC: "02:00:15:03:6f:49",
}
NetworkStat001 is a sample payloads.NetworkStat
var NetworkStat002 = payloads.NetworkStat{
NodeIP: "10.168.1.1",
NodeMAC: "02:00:8c:ba:f9:45",
}
NetworkStat002 is a sample payloads.NetworkStat
var VolumeURL = "https://localhost:" + VolumeAPIPort
VolumeURL is the volume service URL the testutil identity service will use by default
Functions ¶
func IdentityHandlers ¶
IdentityHandlers creates a mux.Router for identity POST and GET handlers
func ReadyPayload ¶
ReadyPayload is a helper to craft a mostly fixed ssntp.READY status payload, with parameters to specify the source node uuid and memory metrics
func RoleToTestCert ¶
RoleToTestCert returns a string containing the testutil certificate matching the specified ssntp.Role
func StartIdentityServer ¶
func StartIdentityServer(config IdentityConfig) *httptest.Server
StartIdentityServer starts a fake keystone service for unit testing ciao. Caller must call Close() on the returned *httptest.Server.
func StatsPayload ¶
func StatsPayload(uuid string, name string, instances []payloads.InstanceStat, networks []payloads.NetworkStat) payloads.Stat
StatsPayload is a factory function for a node STATS ssntp.Command payload for test cases The StatsPayload() factory function returns a payloads.Stat object. If passed uuid==AgentUUID, instances==[InstanceStat001,InstanceStat002,InstanceStat003] and networks==[NetworkStat001,NetworkStat002], then StatsPayload() will return a payloads.Stat matching the StatsYaml string.
Types ¶
type IdentityConfig ¶
IdentityConfig contains the URL of the ciao compute and volume services, and the TenantID of the tenant you want tokens to be sent for. The test Identity service only supports authentication of a single tenant, and gives the token an admin role.
type Result ¶
type Result struct { InstanceUUID string Err error NodeUUID string TenantUUID string CNCI bool VolumeUUID string }
Result is a common result structure for tests spanning between controller client, scheduler server, and the various (eg: Agent, NetAgent, CNCIAgent) agent roles.
type SsntpTestClient ¶
type SsntpTestClient struct { Ssntp ssntp.Client Name string UUID string Role ssntp.Role StartFail bool StartFailReason payloads.StartFailureReason StopFail bool StopFailReason payloads.StopFailureReason RestartFail bool RestartFailReason payloads.RestartFailureReason DeleteFail bool DeleteFailReason payloads.DeleteFailureReason AttachFail bool AttachVolumeFailReason payloads.AttachVolumeFailureReason DetachFail bool DetachVolumeFailReason payloads.DetachVolumeFailureReason CmdChans map[ssntp.Command]chan Result CmdChansLock *sync.Mutex EventChans map[ssntp.Event]chan Result EventChansLock *sync.Mutex ErrorChans map[ssntp.Error]chan Result ErrorChansLock *sync.Mutex StatusChans map[ssntp.Status]chan Result StatusChansLock *sync.Mutex // contains filtered or unexported fields }
SsntpTestClient is global state for the testutil SSNTP client worker
func NewSsntpTestClientConnection ¶
func NewSsntpTestClientConnection(name string, role ssntp.Role, uuid string) (*SsntpTestClient, error)
NewSsntpTestClientConnection creates an SsntpTestClient and dials the server. Calling with a unique name parameter string for inclusion in the SsntpTestClient.Name field aides in debugging. The role parameter is mandatory. The uuid string parameter allows tests to specify a known uuid for simpler tests.
func (*SsntpTestClient) AddCmdChan ¶
func (client *SsntpTestClient) AddCmdChan(cmd ssntp.Command) *chan Result
AddCmdChan adds an ssntp.Command to the SsntpTestClient command channel
func (*SsntpTestClient) AddErrorChan ¶
func (client *SsntpTestClient) AddErrorChan(error ssntp.Error) *chan Result
AddErrorChan adds a ssntp.Error to the SsntpTestClient error channel
func (*SsntpTestClient) AddEventChan ¶
func (client *SsntpTestClient) AddEventChan(evt ssntp.Event) *chan Result
AddEventChan adds a ssntp.Event to the SsntpTestClient event channel
func (*SsntpTestClient) AddStatusChan ¶
func (client *SsntpTestClient) AddStatusChan(status ssntp.Status) *chan Result
AddStatusChan adds an ssntp.Status to the SsntpTestClient status channel
func (*SsntpTestClient) CommandNotify ¶
func (client *SsntpTestClient) CommandNotify(command ssntp.Command, frame *ssntp.Frame)
CommandNotify implements the SSNTP client CommandNotify callback for SsntpTestClient
func (*SsntpTestClient) ConnectNotify ¶
func (client *SsntpTestClient) ConnectNotify()
ConnectNotify implements the SSNTP client ConnectNotify callback for SsntpTestClient
func (*SsntpTestClient) DisconnectNotify ¶
func (client *SsntpTestClient) DisconnectNotify()
DisconnectNotify implements the SSNTP client ConnectNotify callback for SsntpTestClient
func (*SsntpTestClient) ErrorNotify ¶
func (client *SsntpTestClient) ErrorNotify(error ssntp.Error, frame *ssntp.Frame)
ErrorNotify is an SSNTP callback stub for SsntpTestClient
func (*SsntpTestClient) EventNotify ¶
func (client *SsntpTestClient) EventNotify(event ssntp.Event, frame *ssntp.Frame)
EventNotify is an SSNTP callback stub for SsntpTestClient
func (*SsntpTestClient) GetCmdChanResult ¶
func (client *SsntpTestClient) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
GetCmdChanResult gets a Result from the SsntpTestClient command channel
func (*SsntpTestClient) GetErrorChanResult ¶
func (client *SsntpTestClient) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
GetErrorChanResult gets a Result from the SsntpTestClient error channel
func (*SsntpTestClient) GetEventChanResult ¶
func (client *SsntpTestClient) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
GetEventChanResult gets a Result from the SsntpTestClient event channel
func (*SsntpTestClient) GetStatusChanResult ¶
func (client *SsntpTestClient) GetStatusChanResult(c *chan Result, status ssntp.Status) (result Result, err error)
GetStatusChanResult gets a Result from the SsntpTestClient status channel
func (*SsntpTestClient) SendConcentratorAddedEvent ¶
func (client *SsntpTestClient) SendConcentratorAddedEvent(instanceUUID string, tenantUUID string, ip string, vnicMAC string)
SendConcentratorAddedEvent allows an SsntpTestClient to push an ssntp.ConcentratorInstanceAdded event frame
func (*SsntpTestClient) SendDeleteEvent ¶
func (client *SsntpTestClient) SendDeleteEvent(uuid string)
SendDeleteEvent allows an SsntpTestClient to push an ssntp.InstanceDeleted event frame
func (*SsntpTestClient) SendPublicIPAssignedEvent ¶
func (client *SsntpTestClient) SendPublicIPAssignedEvent()
SendPublicIPAssignedEvent allows an SsntpTestClient to push an ssntp.PublicIPAssigned event frame
func (*SsntpTestClient) SendResultAndDelCmdChan ¶
func (client *SsntpTestClient) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
SendResultAndDelCmdChan deletes an ssntp.Command from the SsntpTestClient command channel
func (*SsntpTestClient) SendResultAndDelErrorChan ¶
func (client *SsntpTestClient) SendResultAndDelErrorChan(error ssntp.Error, result Result)
SendResultAndDelErrorChan deletes an ssntp.Error from the SsntpTestClient error channel
func (*SsntpTestClient) SendResultAndDelEventChan ¶
func (client *SsntpTestClient) SendResultAndDelEventChan(evt ssntp.Event, result Result)
SendResultAndDelEventChan deletes an ssntp.Event from the SsntpTestClient event channel
func (*SsntpTestClient) SendResultAndDelStatusChan ¶
func (client *SsntpTestClient) SendResultAndDelStatusChan(status ssntp.Status, result Result)
SendResultAndDelStatusChan deletes an ssntp.Status from the SsntpTestClient status channel
func (*SsntpTestClient) SendStatsCmd ¶
func (client *SsntpTestClient) SendStatsCmd()
SendStatsCmd pushes an ssntp.STATS command frame from the SsntpTestClient
func (*SsntpTestClient) SendStatus ¶
func (client *SsntpTestClient) SendStatus(memTotal int, memAvail int)
SendStatus pushes an ssntp status frame from the SsntpTestClient with the indicated total and available memory statistics
func (*SsntpTestClient) SendTenantAddedEvent ¶
func (client *SsntpTestClient) SendTenantAddedEvent()
SendTenantAddedEvent allows an SsntpTestClient to push an ssntp.TenantAdded event frame
func (*SsntpTestClient) SendTenantRemovedEvent ¶
func (client *SsntpTestClient) SendTenantRemovedEvent()
SendTenantRemovedEvent allows an SsntpTestClient to push an ssntp.TenantRemoved event frame
func (*SsntpTestClient) SendTrace ¶
func (client *SsntpTestClient) SendTrace()
SendTrace allows an SsntpTestClient to push an ssntp.TraceReport event frame
func (*SsntpTestClient) Shutdown ¶
func (client *SsntpTestClient) Shutdown()
Shutdown shuts down the testutil.SsntpTestClient and cleans up state
func (*SsntpTestClient) StatusNotify ¶
func (client *SsntpTestClient) StatusNotify(status ssntp.Status, frame *ssntp.Frame)
StatusNotify implements the SSNTP client StatusNotify callback for SsntpTestClient
type SsntpTestController ¶
type SsntpTestController struct { Ssntp ssntp.Client Name string UUID string CmdChans map[ssntp.Command]chan Result CmdChansLock *sync.Mutex EventChans map[ssntp.Event]chan Result EventChansLock *sync.Mutex ErrorChans map[ssntp.Error]chan Result ErrorChansLock *sync.Mutex }
SsntpTestController is global state for the testutil SSNTP controller
func NewSsntpTestControllerConnection ¶
func NewSsntpTestControllerConnection(name string, uuid string) (*SsntpTestController, error)
NewSsntpTestControllerConnection creates an SsntpTestController and dials the server. Calling with a unique name parameter string for inclusion in the SsntpTestClient.Name field aides in debugging. The uuid string parameter allows tests to specify a known uuid for simpler tests.
func (*SsntpTestController) AddCmdChan ¶
func (ctl *SsntpTestController) AddCmdChan(cmd ssntp.Command) *chan Result
AddCmdChan adds an ssntp.Command to the SsntpTestController command channel
func (*SsntpTestController) AddErrorChan ¶
func (ctl *SsntpTestController) AddErrorChan(error ssntp.Error) *chan Result
AddErrorChan adds an ssntp.Error to the SsntpTestController error channel
func (*SsntpTestController) AddEventChan ¶
func (ctl *SsntpTestController) AddEventChan(evt ssntp.Event) *chan Result
AddEventChan adds an ssntp.Event to the SsntpTestController event channel
func (*SsntpTestController) CommandNotify ¶
func (ctl *SsntpTestController) CommandNotify(command ssntp.Command, frame *ssntp.Frame)
CommandNotify implements the SSNTP client CommandNotify callback for SsntpTestController
func (*SsntpTestController) ConnectNotify ¶
func (ctl *SsntpTestController) ConnectNotify()
ConnectNotify implements the SSNTP client ConnectNotify callback for SsntpTestController
func (*SsntpTestController) DisconnectNotify ¶
func (ctl *SsntpTestController) DisconnectNotify()
DisconnectNotify implements the SSNTP client DisconnectNotify callback for SsntpTestController
func (*SsntpTestController) ErrorNotify ¶
func (ctl *SsntpTestController) ErrorNotify(error ssntp.Error, frame *ssntp.Frame)
ErrorNotify implements the SSNTP client ErrorNotify callback for SsntpTestController
func (*SsntpTestController) EventNotify ¶
func (ctl *SsntpTestController) EventNotify(event ssntp.Event, frame *ssntp.Frame)
EventNotify implements the SSNTP client EventNotify callback for SsntpTestController
func (*SsntpTestController) GetCmdChanResult ¶
func (ctl *SsntpTestController) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
GetCmdChanResult gets a Result from the SsntpTestController command channel
func (*SsntpTestController) GetErrorChanResult ¶
func (ctl *SsntpTestController) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
GetErrorChanResult gets a Result from the SsntpTestController error channel
func (*SsntpTestController) GetEventChanResult ¶
func (ctl *SsntpTestController) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
GetEventChanResult gets a Result from the SsntpTestController event channel
func (*SsntpTestController) SendResultAndDelCmdChan ¶
func (ctl *SsntpTestController) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
SendResultAndDelCmdChan deletes an ssntp.Command from the SsntpTestController command channel
func (*SsntpTestController) SendResultAndDelErrorChan ¶
func (ctl *SsntpTestController) SendResultAndDelErrorChan(error ssntp.Error, result Result)
SendResultAndDelErrorChan deletes an ssntp.Error from the SsntpTestController error channel
func (*SsntpTestController) SendResultAndDelEventChan ¶
func (ctl *SsntpTestController) SendResultAndDelEventChan(evt ssntp.Event, result Result)
SendResultAndDelEventChan deletes an ssntpEvent from the SsntpTestController event channel
func (*SsntpTestController) Shutdown ¶
func (ctl *SsntpTestController) Shutdown()
Shutdown shuts down the testutil.SsntpTestClient and cleans up state
func (*SsntpTestController) StatusNotify ¶
func (ctl *SsntpTestController) StatusNotify(status ssntp.Status, frame *ssntp.Frame)
StatusNotify implements the SSNTP client StatusNotify callback for SsntpTestController
type SsntpTestServer ¶
type SsntpTestServer struct { Ssntp ssntp.Server CmdChans map[ssntp.Command]chan Result CmdChansLock *sync.Mutex EventChans map[ssntp.Event]chan Result EventChansLock *sync.Mutex ErrorChans map[ssntp.Error]chan Result ErrorChansLock *sync.Mutex StatusChans map[ssntp.Status]chan Result StatusChansLock *sync.Mutex // contains filtered or unexported fields }
SsntpTestServer is global state for the testutil SSNTP server
func StartTestServer ¶
func StartTestServer() *SsntpTestServer
StartTestServer starts a go routine for based on a testutil.SsntpTestServer configuration with standard ssntp.FrameRorwardRules
func (*SsntpTestServer) AddCmdChan ¶
func (server *SsntpTestServer) AddCmdChan(cmd ssntp.Command) *chan Result
AddCmdChan adds an ssntp.Command to the SsntpTestServer command channel
func (*SsntpTestServer) AddErrorChan ¶
func (server *SsntpTestServer) AddErrorChan(error ssntp.Error) *chan Result
AddErrorChan adds an ssntp.Error to the SsntpTestServer error channel
func (*SsntpTestServer) AddEventChan ¶
func (server *SsntpTestServer) AddEventChan(evt ssntp.Event) *chan Result
AddEventChan adds an ssntp.Event to the SsntpTestServer event channel
func (*SsntpTestServer) AddStatusChan ¶
func (server *SsntpTestServer) AddStatusChan(status ssntp.Status) *chan Result
AddStatusChan adds an ssntp.Status to the SsntpTestServer status channel
func (*SsntpTestServer) CommandForward ¶
func (server *SsntpTestServer) CommandForward(uuid string, command ssntp.Command, frame *ssntp.Frame) (dest ssntp.ForwardDestination)
CommandForward implements an SSNTP CommandForward callback for SsntpTestServer
func (*SsntpTestServer) CommandNotify ¶
func (server *SsntpTestServer) CommandNotify(uuid string, command ssntp.Command, frame *ssntp.Frame)
CommandNotify implements an SSNTP CommandNotify callback for SsntpTestServer
func (*SsntpTestServer) ConnectNotify ¶
func (server *SsntpTestServer) ConnectNotify(uuid string, role ssntp.Role)
ConnectNotify implements an SSNTP ConnectNotify callback for SsntpTestServer
func (*SsntpTestServer) DisconnectNotify ¶
func (server *SsntpTestServer) DisconnectNotify(uuid string, role ssntp.Role)
DisconnectNotify implements an SSNTP DisconnectNotify callback for SsntpTestServer
func (*SsntpTestServer) ErrorNotify ¶
ErrorNotify is an SSNTP callback stub for SsntpTestServer
func (*SsntpTestServer) EventForward ¶
func (server *SsntpTestServer) EventForward(uuid string, event ssntp.Event, frame *ssntp.Frame) ssntp.ForwardDestination
EventForward implements and SSNTP EventForward callback for SsntpTestServer
func (*SsntpTestServer) EventNotify ¶
EventNotify implements an SSNTP EventNotify callback for SsntpTestServer
func (*SsntpTestServer) GetCmdChanResult ¶
func (server *SsntpTestServer) GetCmdChanResult(c *chan Result, cmd ssntp.Command) (result Result, err error)
GetCmdChanResult gets a Result from the SsntpTestServer command channel
func (*SsntpTestServer) GetErrorChanResult ¶
func (server *SsntpTestServer) GetErrorChanResult(c *chan Result, error ssntp.Error) (result Result, err error)
GetErrorChanResult gets a CmdResult from the SsntpTestServer error channel
func (*SsntpTestServer) GetEventChanResult ¶
func (server *SsntpTestServer) GetEventChanResult(c *chan Result, evt ssntp.Event) (result Result, err error)
GetEventChanResult gets a Result from the SsntpTestServer event channel
func (*SsntpTestServer) GetStatusChanResult ¶
func (server *SsntpTestServer) GetStatusChanResult(c *chan Result, status ssntp.Status) (result Result, err error)
GetStatusChanResult gets a Result from the SsntpTestServer status channel
func (*SsntpTestServer) SendResultAndDelCmdChan ¶
func (server *SsntpTestServer) SendResultAndDelCmdChan(cmd ssntp.Command, result Result)
SendResultAndDelCmdChan deletes an ssntp.Command from the SsntpTestServer command channel
func (*SsntpTestServer) SendResultAndDelErrorChan ¶
func (server *SsntpTestServer) SendResultAndDelErrorChan(error ssntp.Error, result Result)
SendResultAndDelErrorChan deletes an ssntp.Error from the SsntpTestServer error channel
func (*SsntpTestServer) SendResultAndDelEventChan ¶
func (server *SsntpTestServer) SendResultAndDelEventChan(evt ssntp.Event, result Result)
SendResultAndDelEventChan deletes an ssntp.Event from the SsntpTestServer event channel
func (*SsntpTestServer) SendResultAndDelStatusChan ¶
func (server *SsntpTestServer) SendResultAndDelStatusChan(error ssntp.Status, result Result)
SendResultAndDelStatusChan deletes an ssntp.Status from the SsntpTestServer status channel
func (*SsntpTestServer) Shutdown ¶
func (server *SsntpTestServer) Shutdown()
Shutdown shuts down the testutil.SsntpTestServer and cleans up state
func (*SsntpTestServer) StatusNotify ¶
StatusNotify is an SSNTP callback stub for SsntpTestServer