Switcher
The Switcher handles creation and deletion of Layer-2 virtual Infra Segments in the openstack environment. We refer to these as switches, which are essentially networks, subnets, and ports. Due to the nature of the openstack, there are some optional fields in the request message that are mandatory.
Endpoints
The Switcher has two gRPC endpoints:
create
Request
message DeploySwitch {
Switch switch = 1;
MetaInfo metaInfo = 2;
}
For reference, the Switch
, MetaInfo
and Properties
messages are defined as follows:
message Switch {
string name = 1;
repeated string links = 2;
}
message MetaInfo {
string exerciseName = 1;
string deploymentName = 2;
Properties properties = 3;
}
message Properties {
string cidr = 1;
string gateway = 2;
}
Successful Response
message Identifier {
string value = 1;
}
delete
Deletes the virtual switch from the NSX environment.
Request
message Identifier {
string value = 1;
}
Successful Response
message Empty {}
Configuration
The following environment variables are available for the Switcher handler configuration:
Global Settings
Variable | Mandatory | Type | Description |
---|---|---|---|
GLOBAL_HOST | Yes | string | Address where the Switcher handler listens |
GLOBAL_INSECURE | Yes | bool | Enables or disables SSL certificate verification |
Service Ports
Variable | Mandatory | Type | Description |
---|---|---|---|
SWITCHER_PORT | Yes | integer | Port where the Switcher handler listens |
DevStack Credentials
Variable | Mandatory | Type | Description |
---|---|---|---|
AUTH_URL | Yes | string | OpenStack authentication endpoint |
CREDENTIAL_ID | Yes | string | OpenStack credential username |
CREDENTIAL_SECRET | Yes | string | OpenStack credential password |
DOMAIN | Yes | string | OpenStack domain (default: Default ) |
PROJECT | Yes | string | OpenStack project name |
GATEWAY_NETWORK | Yes | string | Gateway network for the OpenStack environment |
REGION | Yes | string | Region name for the OpenStack environment |
HYPERVISOR | Yes | string | OpenStack hypervisor connection URL |
HYPERVISOR_USER | Yes | string | Username for the OpenStack hypervisor |
HYPERVISOR_PASSWORD | Yes | string | Password for the OpenStack hypervisor |
Logging Configuration
Variable | Mandatory | Type | Description |
---|---|---|---|
LOG_LEVEL | No | string | Logging level (e.g., INFO, DEBUG, WARN) |
LOG_DIR | No | string | Directory where logs are stored |
LOG_FILE_NAME | No | string | Name of the log file |
Redis Configuration
Variable | Mandatory | Type | Description |
---|---|---|---|
REDIS_HOST | Yes | string | Redis server address |
REDIS_PORT | Yes | integer | Port where the Redis server is running |
REDIS_PASSWORD | Yes | string | Password for Redis authentication |
Optional Environment Variables
Variable | Mandatory | Type | Description |
---|---|---|---|
HYPERVISOR_WAIT_TIMEOUT | No | integer | Timeout in seconds for the hypervisor to be ready |
HYPERVISOR_WAIT_INTERVAL | No | integer | Interval in seconds to check if the hypervisor is ready |
Example .env
Configuration
# Global Settings
GLOBAL_HOST=0.0.0.0
GLOBAL_INSECURE=True
# Service Ports
SWITCHER_PORT=6000
# DevStack Credentials
AUTH_URL=https://openstack-auth-url:5000/v3
CREDENTIAL_ID=openstack_client_id
CREDENTIAL_SECRET=openstack_application_secret
DOMAIN=openstack_domain
PROJECT=openstack_project
GATEWAY_NETWORK=openstack_gateway_network
REGION=openstack_region
HYPERVISOR=qemu+tcp://hostname/system
HYPERVISOR_USER=openstack_hypervisor_user
HYPERVISOR_PASSWORD=openstack_hypervisor_password
# Logging Configuration
LOG_LEVEL=INFO
LOG_DIR=/var/log
LOG_FILE_NAME=ocr_openstack_plugin
# Redis Configuration
REDIS_HOST=redis-host
REDIS_PORT=6379
REDIS_PASSWORD=redis_password
# Optional
HYPERVISOR_WAIT_TIMEOUT=300
HYPERVISOR_WAIT_INTERVAL=5