testutil

package
v0.0.0-...-194264a Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const AgentIP = "10.2.3.4"

AgentIP is a test agent IP address

View Source
const AgentUUID = "4cb19522-1e18-439a-883a-f9b2a3a95f5e"

AgentUUID is a node UUID for coordinated stop/restart/delete tests

View Source
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

View Source
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

View Source
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

View Source
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.

View Source
const BadAttachVolumeYaml = `attach_volume:
  volume_uuid: ` + VolumeUUID + `
`

BadAttachVolumeYaml is a corrupt yaml payload for the ssntp Attach Volume command.

View Source
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

View Source
const CNCIIP = "10.1.2.3"

CNCIIP is a test CNCI instance IP address

View Source
const CNCIInstanceData = `scheduler_addr: 192.168.42.5
`

CNCIInstanceData is a sample CNCIInstanceConfig payload for test cases

View Source
const CNCIInstanceUUID = "c6beb8b5-0bfc-43fd-9638-7dd788179fd8"

CNCIInstanceUUID is a CNCI instance UUID for use in start/stop/restart/delete tests

View Source
const CNCIMAC = "CA:FE:C0:00:01:02"

CNCIMAC is a test CNCI instance MAC address

View Source
const CNCINet = "10.10.0.0"

CNCINet is a test CNCI network

View Source
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

View Source
const CNCIUUID = "7e84c2d6-5a84-4f9b-98e3-38980f722d1b"

CNCIUUID is a test CNCI instance UUID

View Source
const CiaoAPIPort = "8889"

CiaoAPIPort is the Ciao API port that API services are running on

View Source
const CiaoPort = "447"

CiaoPort is a test port for ciao's api service

View Source
const ComputeNet = "192.168.1.110"

ComputeNet is a test compute network

View Source
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

View Source
const DeleteFailureYaml = `node_uuid: ` + AgentUUID + `
instance_uuid: ` + InstanceUUID + `
reason: no_instance
`

DeleteFailureYaml is a sample workload DeleteFailure ssntp.Error payload for test cases

View Source
const DeleteYaml = `delete:
  instance_uuid: ` + InstanceUUID + `
  workload_agent_uuid: ` + AgentUUID + `
  stop: false
`

DeleteYaml is a sample workload DELETE ssntp.Command payload for test cases

View Source
const DockerImage = "docker/latest"

DockerImage is a docker image name for use in start/restart tests

View Source
const EvacuateYaml = `evacuate:
  workload_agent_uuid: ` + AgentUUID + `
`

EvacuateYaml is a sample node EVACUATE ssntp.Command payload for test cases

View Source
const HTTPSCACert = "/etc/pki/ciao/compute_ca.pem"

HTTPSCACert is a path to the CA cert used to sign the HTTPSKey

View Source
const HTTPSKey = "/etc/pki/ciao/compute_key.pem"

HTTPSKey is a path to a key for the compute service

View Source
const IdentityPassword = "ciao"

IdentityPassword is a test password for the test identity server

View Source
const IdentityUser = "controller"

IdentityUser is a test user for the test identity server

View Source
const InsDelYaml = `instance_deleted:
  instance_uuid: ` + InstanceUUID + `
`

InsDelYaml is a sample workload InstanceDeleted ssntp.Event payload for test cases

View Source
const InsStopYaml = `instance_stopped:
  instance_uuid: ` + InstanceUUID + `
`

InsStopYaml is a sample workload InstanceStopped ssntp.Event payload for test cases

View Source
const InstancePrivateIP = "172.16.0.2"

InstancePrivateIP is a test instance private IP

View Source
const InstancePublicIP = "10.1.2.3"

InstancePublicIP is a test instance public IP

View Source
const InstanceUUID = "3390740c-dce9-48d6-b83a-a717417072ce"

InstanceUUID is an instance UUID for use in start/stop/restart/delete tests

View Source
const ManagementID = "ciao"

ManagementID is a test identifier for a Ceph ID

View Source
const MgmtNet = "192.168.1.111"

MgmtNet is a test management network

View Source
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.

View Source
const NetAgentUUID = "6be56328-92e2-4ecd-b426-8fe529c04e0c"

NetAgentUUID is a network node UUID for coordinated tests

View Source
const NodeConnectedYaml = `node_connected:
  node_uuid: ` + AgentUUID + `
  node_type: ` + payloads.NetworkNode + `
`

NodeConnectedYaml is a sample node NodeConnected ssntp.Event payload for test cases

View Source
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

View Source
const PartialReadyYaml = `node_uuid: ` + AgentUUID + `
load: 1
`

PartialReadyYaml is a sample minimal node READY ssntp.Status payload for test cases

View Source
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

View Source
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

View Source
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

View Source
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

View Source
const RestoreYaml = `restore:
  workload_agent_uuid: ` + AgentUUID + `
`

RestoreYaml is a sample node Restore ssntp.Command payload for test cases

View Source
const SchedulerAddr = "192.168.42.5"

SchedulerAddr is a test scheduler address

View Source
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

View Source
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

View Source
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

View Source
const StopYaml = `stop:
  instance_uuid: ` + InstanceUUID + `
  workload_agent_uuid: ` + AgentUUID + `
  stop: false
`

StopYaml is a sample workload STOP ssntp.Command payload for test cases

View Source
const StorageURI = "/etc/ciao/ciao.json"

StorageURI is a test storage URI

View Source
const SubnetKey = "8"

SubnetKey is a test tenant subnet key

View Source
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

View Source
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

View Source
const TenantSubnet = "172.16.0.0/16"

TenantSubnet is a test tenant subnet

View Source
const TenantUUID = "2491851d-dce9-48d6-b83a-a717417072ce"

TenantUUID is a test tenant UUID

View Source
const TestCACert = `` /* 1131-byte string literal not displayed */

TestCACert is a snake oil Certificate Authority for test automation.

View Source
const TestCACertSchedulerMultiHomed = `` /* 1164-byte string literal not displayed */

TestCACertSchedulerMultiHomed is a snake oil SSNTP multihomed scheduler role Certificate Authority for test automation.

View Source
const TestCertAgent = `` /* 2806-byte string literal not displayed */

TestCertAgent is a snake oil SSNTP Agent role certificate for test automation.

View Source
const TestCertAgentNetAgent = `` /* 2822-byte string literal not displayed */

TestCertAgentNetAgent is a snake oil SSNTP AGENT|NETAGENT role certificate for test automation.

View Source
const TestCertCNCIAgent = `` /* 2806-byte string literal not displayed */

TestCertCNCIAgent is a snake oil SSNTP CNCIAgent role certificate for test automation.

View Source
const TestCertController = `` /* 2806-byte string literal not displayed */

TestCertController is a snake oil SSNTP Controller role certificate for test automation.

View Source
const TestCertNetAgent = `` /* 2802-byte string literal not displayed */

TestCertNetAgent is a snake oil SSNTP NetAgent role certificate for test automation.

View Source
const TestCertScheduler = `` /* 2806-byte string literal not displayed */

TestCertScheduler is a snake oil SSNTP Scheduler role certificate for test automation.

View Source
const TestCertServer = `` /* 2806-byte string literal not displayed */

TestCertServer is a snake oil SSNTP Server role certificate for test automation.

View Source
const TestCertUnknown = `` /* 2790-byte string literal not displayed */

TestCertUnknown is a snake oil SSNTP Unknown role certificate for test automation.

View Source
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

View Source
const User = "ciao"

User is a user under which non-privileged ciao processes should run.

View Source
const VNICMAC = "aa:bb:cc:01:02:03"

VNICMAC is a test instance VNIC MAC address

View Source
const VNICUUID = "7f49d00d-1995-4156-8c79-5f5ab24ce138"

VNICUUID is a test instance VNIC UUID

View Source
const VolumeUUID = "67d86208-b46c-4465-9018-e14187d4010"

VolumeUUID is a node UUID for storage tests

Variables

View Source
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

View Source
var CNCITunnelID = crc32.ChecksumIEEE([]byte(TenantUUID))

CNCITunnelID is a gre tunnel ID derived from the tenant UUID

View Source
var CNCITunnelIDstr = fmt.Sprint(CNCITunnelID)

CNCITunnelIDstr is the string representation of the CNCITunnelID

View Source
var ComputeURL = "https://localhost:" + CiaoAPIPort

ComputeURL is the compute service URL the testutil identity service will use by default

View Source
var ComputeUser = "f452bbc7-5076-44d5-922c-3b9d2ce1503f"

ComputeUser is the test user/tenant name the testutil identity service will use by default

View Source
var IdentityURL string

IdentityURL is the URL for the testutil identity service

View Source
var ImageURL = "https://localhost:" + CiaoAPIPort

ImageURL is the image service URL the testutil identity service will use by default

View Source
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

View Source
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

View Source
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

View Source
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

View Source
var NetworkStat001 = payloads.NetworkStat{
	NodeIP:  "192.168.1.1",
	NodeMAC: "02:00:15:03:6f:49",
}

NetworkStat001 is a sample payloads.NetworkStat

View Source
var NetworkStat002 = payloads.NetworkStat{
	NodeIP:  "10.168.1.1",
	NodeMAC: "02:00:8c:ba:f9:45",
}

NetworkStat002 is a sample payloads.NetworkStat

View Source
var PartialComputeNetworks = []payloads.NetworkStat{
	computeNetwork002,
}

PartialComputeNetworks is meant to represent a node with partial access to compute networks in the testutil cluster

View Source
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

func RoleToTestCert(role ssntp.Role) string

RoleToTestCert returns a string containing the testutil certificate matching the specified ssntp.Role

func RoleToTestCertPath

func RoleToTestCertPath(role ssntp.Role) (string, string, error)

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

func (server *SsntpTestServer) ErrorNotify(uuid string, error ssntp.Error, frame *ssntp.Frame)

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

func (server *SsntpTestServer) EventNotify(uuid string, event ssntp.Event, frame *ssntp.Frame)

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

func (server *SsntpTestServer) StatusNotify(uuid string, status ssntp.Status, frame *ssntp.Frame)

StatusNotify is an SSNTP callback stub for SsntpTestServer

Jump to

Keyboard shortcuts

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