The commands
Command overview
The table below provides a summary of the API requests that are used to configure the simple test environment:
| Command Group | Request | Purpose |
|---|---|---|
Login |
Login |
Login and obtain access token |
Add Floating IP |
Get Management Group |
Determine the groupId for the management subnet |
Add Floating IP |
Add the floating IP to the management subnet |
|
Configure Layer 7 Service |
Add Real Server 1 |
Add first real server |
Add Real Server 2 |
Add second real server |
|
Add Backend |
Add the backend for the layer 7 service |
|
Add Default ACL |
Add the default ACL to link frontend and backend |
|
Add Frontend |
Add the frontend for the layer 7 service |
|
Reload Services |
Reload Required Services |
Restart services to apply new settings (HAProxy and Nftables) |
Command details
The following sections provide full details of all API requests.
Login
Request
POST https://{{node-0}}:{{port}}/api/v1/token
Body
{
"email": "{{email}}",
"password": "{{password}}"
}
Post Response Script
bru.setEnvVar("token", res.body.data.token);
bru.setEnvVar("localnodeid", res.body.data.appliance_id);
Get Management Group
Request
GET https://{{node-0}}:{{port}}/api/v1/ipgroups/
Auth
Bearer token : {{token}}
Post Response Script
var groupId = ""
for (let i = 0; i < res.body.data.length; i++) {
if (res.body.data[i].name == "Management") {
groupId = res.body.data[i].id
}
}
bru.setEnvVar("groupId", groupId);
Add Floating IP
Request
POST https://{{node-0}}:{{port}}/api/v1/fips
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("fipId", res.body.data.id);
Add Real Server 1
Request
POST https://{{node-0}}:{{port}}/api/v1/haproxy/rips
Body
{
"name": "RS-01",
"ipDomain": "{{real1-Ip}}",
"port": 80,
"weight": 100,
"minconns": 0,
"maxconns": 0,
"enabledCount": false
}
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("real1-Id", res.body.data.id);
Add Real Server 2
Request
POST https://{{node-0}}:{{port}}/api/v1/haproxy/rips
Body
{
"name": "RS-02",
"ipDomain": "{{real2-Ip}}",
"port": 80,
"weight": 100,
"minconns": 0,
"maxconns": 0,
"enabledCount": false
}
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("real2-Id", res.body.data.id);
Add Backend
Request
POST https://{{node-0}}:{{port}}/api/v1/haproxy/backends
Body
{
"name": "BE-01",
"mode": "tcp",
"ripIds": ["{{real1-Id}}","{{real2-Id}}"],
"balanceMode": "leastconn",
"persistenceMode": "none",
"healthCheck": "connectToPort",
"healthCheckPort": 80,
"healthCheckRequestToSend": "/",
"healthCheckResponseExpected": "",
"encryptToBackend": false,
"enableGzipCompression": false,
"headers": "",
"httpPipeline": "httpKeepAlive",
"httpPretendKeepalive": false,
"httpAcceptInvalidResponse": false,
"httpRequestTimeout": true,
"tunnelTimeout": "1h",
"TCPKeepalive": false,
"connectionRedispatch": true,
"abortOnClose": false,
"slowStartTime": "3s",
"backendSourceAddress": "",
"enableServerConnTimeout": true,
"serverTimeout": "43s",
"enableFeedbackAgent": false,
"feedbackAgentPort": 3333,
"feedbackAgentInterval": "2s",
"fallbackPersistence": false,
"enableTProxy": false,
"sendProxyProtocol": "off"
}
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("backend-id", res.body.data.id);
Add Default ACL
Request
POST https://{{node-0}}:{{port}}/api/v1/haproxy/acls
Body
{
"conditionType":"default",
"condition":"eq",
"redirectType":"backend",
"redirectLocation":"{{backend-id}}"
}
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("acl-default-id", res.body.data.id);
Add Frontend
Request
POST https://{{node-0}}:{{port}}/api/v1/haproxy/frontends
Body
{
"name": "Web-Cluster",
"ports": [80],
"mode": "tcp",
"fipID": "{{fipId}}",
"aclIds": ["{{acl-default-id}}"],
"SSLEnable": false,
"SSLTLSv130rttEnable": false,
"tcpKeepalive": false,
"acceptProxyProtocol": false,
"SSLMinVer": "TLSv1.2",
"SSLMaxVer": "TLSv1.3",
"httpsForceToRedirect": false,
"httpsRedirectCode": 301,
"hstsEnable": false,
"hstsTimeout": 6,
"sslCerts": [],
"maximumConnections": 40000,
"enableClientConnTimeout": false,
"clientTimeout": "42s",
"httpPipeLine": "httpKeepAlive",
"httpAcceptInvalidRequest": false,
"httpRequestTimeout": true,
"httpPretendKeepalive": false,
"setXForwardedforHeader": false
}
Auth
Bearer token : {{token}}
Post Response Script
bru.setEnvVar("frontend-id", res.body.data.id);