Documentation
¶
Overview ¶
Package config provides test-network-function configuration along with a config pool for aggregating configuration. Configurations registered with the pool are automatically included in the claim. Go structs used for configuration should each be defined in their own files, such as `cnf.go` and `generic.go`. The corresponding configuration yaml/json files should be prefixed with `<filename>_test_configuration`, such as `generic_test_configuration.yaml`.
Index ¶
- Constants
- func ValidateConfigPath(path string) error
- type CNFType
- type CertifiedContainerRequestInfo
- type CertifiedOperatorRequestInfo
- type Cnf
- type Container
- type ContainerIdentifier
- type Crd
- type Deployment
- type Instance
- type Operator
- type Permission
- type Pool
- type TestConfiguration
- type TnfContainerOperatorTestConfig
Constants ¶
const (
// CNFConfigName is the configuration sentinel used to represent container and operator CNF configuration.
CNFConfigName = "cnf"
)
const ( // UseDefaultConfigurationFilePath is the sentinel used to indicate extracting the config filepath from the // environment. UseDefaultConfigurationFilePath = "" )
Variables ¶
This section is empty.
Functions ¶
func ValidateConfigPath ¶
ValidateConfigPath just makes sure, that the path provided is a file, that can be read
Types ¶
type CertifiedContainerRequestInfo ¶
type CertifiedContainerRequestInfo struct {
// Name is the name of the `operator bundle package name` or `image-version` that you want to check if exists in the RedHat catalog
Name string `yaml:"name" json:"name"`
// Repository is the name of the repository `rhel8` of the container
// This is valid for container only and required field
Repository string `yaml:"repository" json:"repository"`
}
CertifiedContainerRequestInfo contains all certified images request info
type CertifiedOperatorRequestInfo ¶
type CertifiedOperatorRequestInfo struct {
// Name is the name of the `operator bundle package name` that you want to check if exists in the RedHat catalog
Name string `yaml:"name" json:"name"`
// Organization as understood by the operator publisher , e.g. `redhat-marketplace`
Organization string `yaml:"organization" json:"organization"`
}
CertifiedOperatorRequestInfo contains all certified operator request info
type Cnf ¶
type Cnf struct {
// Name is the name of the CNF (TODO: This should also take cnf labels in case name is dynamically created)
Name string `yaml:"name" json:"name"`
// Namespace where the CNF is deployed
Namespace string `yaml:"namespace" json:"namespace"`
// Status is the status of the CNF
Status string `yaml:"status" json:"status"`
// Tests this is list of test that need to run against the CNF.
Tests []string `yaml:"tests" json:"tests"`
// CertifiedContainerRequestInfos is list of images (`repo/image-version`)
// that are queried for certificate status
CertifiedContainerRequestInfos []CertifiedContainerRequestInfo `yaml:"certifiedcontainerrequestinfo,omitempty" json:"certifiedcontainerrequestinfo,omitempty"`
}
Cnf defines cloud network function in the cluster
type Container ¶
type Container struct {
// OpenShift Default network interface name (i.e., eth0)
DefaultNetworkDevice string `yaml:"defaultNetworkDevice" json:"defaultNetworkDevice"`
// MultusIPAddresses are the overlay IPs.
MultusIPAddresses []string `yaml:"multusIpAddresses" json:"multusIpAddresses"`
}
Container contains the payload of container facets.
type ContainerIdentifier ¶
type ContainerIdentifier struct {
Namespace string `yaml:"namespace" json:"namespace"`
PodName string `yaml:"podName" json:"podName"`
ContainerName string `yaml:"containerName" json:"containerName"`
}
ContainerIdentifier is a complex key representing a unique container.
func (ContainerIdentifier) MarshalText ¶
func (c ContainerIdentifier) MarshalText() ([]byte, error)
MarshalText is a custom Marshal function needed since ContainerIdentifier is used as a complex (composite) map key.
func (*ContainerIdentifier) UnmarshalJSON ¶
func (c *ContainerIdentifier) UnmarshalJSON(bytes []byte) error
UnmarshalJSON is a custom Unmarshal function that knows how to reconstruct a ContainerIdentifier from raw bytes.
func (*ContainerIdentifier) UnmarshalText ¶
func (c *ContainerIdentifier) UnmarshalText(text []byte) error
UnmarshalText is a custom Unmarshal function needed since ContainerIdentifier is used as a complex (composite) map key.
type Crd ¶
type Crd struct {
// Name is the name of the CRD populated by the operator config generator
Name string `yaml:"name" json:"name"`
// Namespace is the namespace where above CRD is installed(For all namespace this will be ALL_NAMESPACE)
Namespace string `yaml:"namespace" json:"namespace"`
// Instances is the instance of CR matching for the above CRD KIND
Instances []Instance `yaml:"instances" json:"instances"`
}
Crd struct defines Custom Resource Definition of the operator
type Deployment ¶
type Deployment struct {
// Name is the name of the deployment specified in the CSV
Name string `yaml:"name" json:"name"`
// Replicas is no of replicas that are expected for this deployment as specified in the CSV
Replicas string `yaml:"replicas" json:"replicas"`
}
Deployment defines deployment resources
type Instance ¶
type Instance struct {
// Name is the name of the instance of custom resource (Auto populated)
Name string `yaml:"name" json:"name"`
}
Instance defines crd instances in the cluster
type Operator ¶
type Operator struct {
// Name is a required field, Name of the csv .
Name string `yaml:"name" json:"name"`
// Namespace is a required field , namespace is where the csv is installed.
// If its all namespace then you can replace it with ALL_NAMESPACE TODO: add check for ALL_NAMESPACE
Namespace string `yaml:"namespace" json:"namespace"`
// Status is a required field , specified what status of the csv to be checked.
Status string `yaml:"status" json:"status"`
// AutoGenerate if set to true will generate the config with operator related artifacts.
AutoGenerate string `yaml:"autogenerate,omitempty" json:"autogenerate"`
// CRDs If AutoGenerate is set to true, then the program will populate the CRD data from the CSV file.
CRDs []Crd `yaml:"crds" json:"crds"`
// Deployments If AutoGenerate is set to true, then the program will populate the Deployment data from the CSV file.
Deployments []Deployment `yaml:"deployments" json:"deployments"`
// CNFs If AutoGenerate is set to true, then the program will populate the CNFs data from the CSV file.
CNFs []Cnf `yaml:"cnfs" json:"cnfs"`
// Permissions If AutoGenerate is set to true, then the program will populate the Permission data from the CSV file.
Permissions []Permission `yaml:"permissions" json:"permissions"`
// Tests this is list of test that need to run against the operator.
Tests []string `yaml:"tests" json:"tests"`
// CertifiedOperatorRequestInfos is list of operator bundle names (`package-name`)
// that are queried for certificate status
CertifiedOperatorRequestInfos []CertifiedOperatorRequestInfo `yaml:"certifiedoperatorrequestinfo,omitempty" json:"certifiedoperatorrequestinfo,omitempty"`
}
Operator struct defines operator manifest for testing
type Permission ¶
type Permission struct {
// Name is the name of Roles and Cluster Roles that is specified in the CSV
Name string `yaml:"name" json:"name"`
// Role is the role type either CLUSTER_ROLE or ROLE
Role string `yaml:"role" json:"role"`
}
Permission defines roles and cluster roles resources
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool follows the pool design pattern, and contains the named configurations.
func (*Pool) GetConfigurations ¶
GetConfigurations returns the raw configuration map.
func (*Pool) RegisterConfiguration ¶
func (p *Pool) RegisterConfiguration(configurationKey string, configurationPayload interface{}) error
RegisterConfiguration registers a configuration with the Pool. If configurationKey is already contained in the pool, an appropriate error is returned.
type TestConfiguration ¶
type TestConfiguration struct {
ContainersUnderTest map[ContainerIdentifier]Container `yaml:"containersUnderTest" json:"containersUnderTest"`
PartnerContainers map[ContainerIdentifier]Container `yaml:"partnerContainers" json:"partnerContainers"`
TestOrchestrator ContainerIdentifier `yaml:"testOrchestrator" json:"testOrchestrator"`
// ExcludeContainersFromConnectivityTests excludes specific containers from network connectivity tests. This is particularly useful for containers that don't have ping available.
ExcludeContainersFromConnectivityTests []ContainerIdentifier `yaml:"excludeContainersFromConnectivityTests" json:"excludeContainersFromConnectivityTests"`
}
TestConfiguration provides generic test related configuration
func GetConfiguration ¶
func GetConfiguration(filepath string) (*TestConfiguration, error)
GetConfiguration returns the cnf-certification-generic-tests test configuration. GetConfiguration supports reading JSON and YAML configurations.
type TnfContainerOperatorTestConfig ¶
type TnfContainerOperatorTestConfig struct {
// Operator is the lis of operator objects that needs to be tested.
Operator []Operator `yaml:"operators,omitempty" json:"operators,omitempty"`
// CNFs is the list of the CNFs that needs to be tested.
CNFs []Cnf `yaml:"cnfs,omitempty" json:"cnfs,omitempty"`
// CnfAvailableTestCases list the available test cases for reference.
CnfAvailableTestCases []string `yaml:"cnfavailabletestcases,omitempty" json:"cnfavailabletestcases,omitempty"`
}
TnfContainerOperatorTestConfig the main configuration struct for tnf
func GetConfig ¶
func GetConfig() (*TnfContainerOperatorTestConfig, error)
GetConfig returns the Operator TestConfig configuration.
func NewConfig ¶
func NewConfig(configPath string) (*TnfContainerOperatorTestConfig, error)
NewConfig returns a new decoded TnfContainerOperatorTestConfig struct
func (*TnfContainerOperatorTestConfig) SaveConfig ¶
func (c *TnfContainerOperatorTestConfig) SaveConfig(configPath string) (err error)
SaveConfig writes configuration to a file at the given config path
func (*TnfContainerOperatorTestConfig) SaveConfigAsJSON ¶
func (c *TnfContainerOperatorTestConfig) SaveConfigAsJSON(configPath string) (err error)
SaveConfigAsJSON writes configuration to a file in json format