Documentation ¶
Index ¶
- Constants
- Variables
- func MakeTestCerts() error
- func ReadyPayload(uuid string, memTotal int, memAvail int, networks []payloads.NetworkStat) payloads.Ready
- func RemoveTestCerts()
- func RoleToTestCert(role ssntp.Role) string
- func RoleToTestCertPath(role ssntp.Role) (string, string, error)
- func StatsPayload(uuid string, name string, instances []payloads.InstanceStat, ...) payloads.Stat
- 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) SendPublicIPUnassignedEvent()
- 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, networks []payloads.NetworkStat)
- func (client *SsntpTestClient) SendStoppedEvent(uuid string)
- 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(status 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 = `node_uuid: ` + AgentUUID + ` 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 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 CNCINet = "10.10.0.0"
CNCINet is a test CNCI network
const CNCIStartYaml = `start: instance_uuid: ` + CNCIInstanceUUID + ` fw_type: efi persistence: host vm_type: qemu requirements: vcpus: 4 mem_mb: 4096 network_node: 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 CiaoAPIPort = "8889"
CiaoAPIPort is the Ciao API port that API services are running on
const CiaoPort = "447"
CiaoPort is a test port for ciao's api service
const ComputeNet = "192.168.1.110"
ComputeNet is a test compute network
const ConfigureYaml = `configure: scheduler: storage_uri: ` + StorageURI + ` storage: ceph_id: ` + ManagementID + ` controller: ciao_port: ` + CiaoPort + ` compute_ca: ` + HTTPSCACert + ` compute_cert: ` + HTTPSKey + ` cnci_vcpus: 0 cnci_mem: 0 cnci_disk: 0 admin_ssh_key: "" client_auth_ca_cert_path: "" cnci_net: 10.10.0.0 launcher: compute_net: - ` + ComputeNet + ` mgmt_net: - ` + MgmtNet + ` disk_limit: false mem_limit: false child_user: ` + User + ` `
ConfigureYaml is a sample CONFIGURE ssntp.Command payload for test cases
const DeleteFailureYaml = `node_uuid: ` + AgentUUID + ` 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 + ` stop: false `
DeleteYaml is a sample workload DELETE ssntp.Command payload for test cases
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 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 InsDelYaml = `instance_deleted: instance_uuid: ` + InstanceUUID + ` `
InsDelYaml is a sample workload InstanceDeleted ssntp.Event payload for test cases
const InsStopYaml = `instance_stopped: instance_uuid: ` + InstanceUUID + ` `
InsStopYaml is a sample workload InstanceStopped ssntp.Event payload for test cases
const InstancePrivateIP = "172.16.0.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 ManagementID = "ciao"
ManagementID is a test identifier for a Ceph ID
const MgmtNet = "192.168.1.111"
MgmtNet is a test management network
const MigrateYaml = `delete: instance_uuid: ` + InstanceUUID + ` workload_agent_uuid: ` + AgentUUID + ` stop: true `
MigrateYaml is a sample workload DELETE ssntp.Command payload for test cases that indicates that an instance is to be migrated rather than deleted.
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 PartialStartYaml = `start: instance_uuid: ` + InstanceUUID + ` docker_image: ` + DockerImage + ` fw_type: efi persistence: host vm_type: qemu requirements: vcpus: 2 `
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
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
hostname: host1
`
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 RestoreYaml = `restore: workload_agent_uuid: ` + AgentUUID + ` `
RestoreYaml is a sample node Restore ssntp.Command payload for test cases
const SchedulerAddr = "192.168.42.5"
SchedulerAddr is a test scheduler address
const StartFailureYaml = `node_uuid: ` + AgentUUID + ` instance_uuid: ` + InstanceUUID + ` reason: full_cloud restart: false `
StartFailureYaml is a sample workload StartFailure ssntp.Error payload for test cases
const StartYaml = `start: tenant_uuid: ` + TenantUUID + ` instance_uuid: ` + InstanceUUID + ` docker_image: ` + DockerImage + ` fw_type: efi persistence: host vm_type: qemu networking: vnic_mac: "" vnic_uuid: "" concentrator_uuid: "" concentrator_ip: "" subnet: "" subnet_key: "" subnet_uuid: "" private_ip: "" public_ip: false requirements: mem_mb: 4096 vcpus: 2 restart: 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 StopYaml = `stop: instance_uuid: ` + InstanceUUID + ` workload_agent_uuid: ` + AgentUUID + ` stop: false `
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 = "172.16.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 = `` /* 2806-byte string literal not displayed */
TestCertAgent is a snake oil SSNTP Agent role certificate for test automation.
const TestCertAgentNetAgent = `` /* 2822-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 = `` /* 2802-byte string literal not displayed */
TestCertNetAgent is a snake oil SSNTP NetAgent role certificate for test automation.
const TestCertScheduler = `` /* 2806-byte string literal not displayed */
TestCertScheduler is a snake oil SSNTP Scheduler role certificate for test automation.
const TestCertServer = `` /* 2806-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 UnassignedIPYaml = `public_ip_unassigned: concentrator_uuid: ` + CNCIUUID + ` instance_uuid: ` + InstanceUUID + ` public_ip: ` + InstancePublicIP + ` private_ip: ` + InstancePrivateIP + ` `
UnassignedIPYaml is a sample PublicIPUnassigned ssntp.Event payload for test cases
const User = "ciao"
User is a user under which non-privileged ciao processes should run.
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 VolumeUUID = "67d86208-b46c-4465-9018-e14187d4010"
VolumeUUID is a node UUID for storage tests
Variables ¶
var CNCIRefreshYaml = `cnci_refresh: cnci_uuid: ` + CNCIUUID + ` cncis: - physical_ip: 10.10.10.1 subnet: 172.16.0.0/24 tunnel_ip: 192.168.0.0 tunnel_id: ` + CNCITunnelIDstr + ` `
CNCIRefreshYaml is a sample ConcentratorInstanceRefresh ssntp.Event payload for test cases
var CNCITunnelID = crc32.ChecksumIEEE([]byte(TenantUUID))
CNCITunnelID is a gre tunnel ID derived from the tenant UUID
var CNCITunnelIDstr = fmt.Sprint(CNCITunnelID)
CNCITunnelIDstr is the string representation of the CNCITunnelID
var ComputeURL = "https://localhost:" + CiaoAPIPort
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:" + CiaoAPIPort
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 MultipleComputeNetworks = []payloads.NetworkStat{
computeNetwork001,
computeNetwork002,
computeNetwork003,
}
MultipleComputeNetworks is meant to represent a node with full access to all compute networks in the testutil cluster
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 PartialComputeNetworks = []payloads.NetworkStat{
computeNetwork002,
}
PartialComputeNetworks is meant to represent a node with partial access to compute networks in the testutil cluster
var VolumeURL = "https://localhost:" + CiaoAPIPort
VolumeURL is the volume service URL the testutil identity service will use by default
Functions ¶
func MakeTestCerts ¶
func MakeTestCerts() error
MakeTestCerts will create test certificate files for all roles that return valid paths from RoleToTestCertPath
func ReadyPayload ¶
func ReadyPayload(uuid string, memTotal int, memAvail int, networks []payloads.NetworkStat) payloads.Ready
ReadyPayload is a helper to craft a mostly fixed ssntp.READY status payload, with parameters to specify the source node uuid and available resources
func RemoveTestCerts ¶
func RemoveTestCerts()
RemoveTestCerts will remove test cert files created by MakeTestCerts
func RoleToTestCert ¶
RoleToTestCert returns a string containing the testutil certificate matching the specified ssntp.Role
func RoleToTestCertPath ¶
RoleToTestCertPath returns a string containing the path to a test ca cert file, a string containing the path to the cert file for the given role
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 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 DeleteFail bool DeleteFailReason payloads.DeleteFailureReason AttachFail bool AttachVolumeFailReason payloads.AttachVolumeFailureReason 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) SendPublicIPUnassignedEvent ¶
func (client *SsntpTestClient) SendPublicIPUnassignedEvent()
SendPublicIPUnassignedEvent allows an SsntpTestClient to push an ssntp.PublicIPUnassigned 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, networks []payloads.NetworkStat)
SendStatus pushes an ssntp status frame from the SsntpTestClient with the indicated total and available memory statistics
func (*SsntpTestClient) SendStoppedEvent ¶
func (client *SsntpTestClient) SendStoppedEvent(uuid string)
SendStoppedEvent allows an SsntpTestClient to push an ssntp.InstanceStopped event frame
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(status 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