Skip to content

Latest commit

 

History

History
407 lines (303 loc) · 12.9 KB

sites-synthetic-tests.md

File metadata and controls

407 lines (303 loc) · 12.9 KB

Sites Synthetic Tests

sitesSyntheticTests := client.SitesSyntheticTests()

Class Name

SitesSyntheticTests

Methods

Get Site Device Synthetic Test

Get Device Synthetic Test

GetSiteDeviceSyntheticTest(
    ctx context.Context,
    siteId uuid.UUID,
    deviceId uuid.UUID) (
    models.ApiResponse[models.SynthetictestInfo],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
deviceId uuid.UUID Template, Required -

Response Type

models.SynthetictestInfo

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

apiResponse, err := sitesSyntheticTests.GetSiteDeviceSyntheticTest(ctx, siteId, deviceId)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "device_type": "gateway",
  "mac": "5c5b35584a6f",
  "port_id": "ge-0/0/1.100",
  "start_time": 1675718807,
  "status": "inprogress",
  "type": "speedtest"
}

Errors

HTTP Status Code Error Description Exception Class
400 Device not online / Device not supported / Already in progress ApiError
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Search Site Synthetic Test

Search Site Synthetic Testing

SearchSiteSyntheticTest(
    ctx context.Context,
    siteId uuid.UUID,
    mac *string,
    portId *string,
    vlanId *string,
    by *string,
    reason *string,
    mType *models.SynthetictestTypeEnum,
    protocol *models.SynthetictestProtocolEnum,
    tenant *string) (
    models.ApiResponse[models.ReponseSynthetictestSearch],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
mac *string Query, Optional Device MAC Address
portId *string Query, Optional port_id used to run the test (for SSR only)
vlanId *string Query, Optional VLAN ID
by *string Query, Optional entity who triggers the test
reason *string Query, Optional test failure reason
mType *models.SynthetictestTypeEnum Query, Optional synthetic test type
protocol *models.SynthetictestProtocolEnum Query, Optional connectivity protocol
tenant *string Query, Optional tenant network in which lan_connectivity test was run

Response Type

models.ReponseSynthetictestSearch

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

















apiResponse, err := sitesSyntheticTests.SearchSiteSyntheticTest(ctx, siteId, nil, nil, nil, nil, nil, nil, nil, nil)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "end": 0,
  "limit": 0,
  "next": "string",
  "results": [
    {
      "by": "user",
      "device_type": "gateway",
      "failed": false,
      "latency": 40,
      "mac": "aff827549235",
      "port_id": "ge-0/0/2",
      "rx_mbps": 322,
      "timestamp": 1706824045.059036,
      "tx_mbps": 199,
      "type": "speedtest",
      "vlan_id": 20
    },
    {
      "by": "marvis",
      "device_type": "gateway",
      "failed": true,
      "latency": 0,
      "mac": "8396cd006c8c",
      "port_id": "ge-0/0/2",
      "reason": "interface not ready to perform test",
      "rx_mbps": 0,
      "timestamp": 1706824045.059036,
      "tx_mbps": 0,
      "type": "speedtest",
      "vlan_id": 100
    }
  ],
  "start": 0,
  "total": 0
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Start Site Switch Radius Synthetic Test

Ping test from the AP to confirm ‘reachability’ of the Radius server. Utilize Juniper EX switch(to which an AP is connected to) radius test capabilities to get details on the Radius Server ‘availability’ .

StartSiteSwitchRadiusSyntheticTest(
    ctx context.Context,
    siteId uuid.UUID,
    deviceId uuid.UUID,
    body *models.SynthetictestRadiusServer) (
    models.ApiResponse[models.WebsocketSession],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
deviceId uuid.UUID Template, Required -
body *models.SynthetictestRadiusServer Body, Optional -

Response Type

models.WebsocketSession

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.SynthetictestRadiusServer{
    Password:             "string",
    Profile:              models.ToPointer("dot1x"),
    User:                 "string",
}

apiResponse, err := sitesSyntheticTests.StartSiteSwitchRadiusSyntheticTest(ctx, siteId, deviceId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Trigger Site Device Synthetic Test

Trigger Device Synthetic Test

TriggerSiteDeviceSyntheticTest(
    ctx context.Context,
    siteId uuid.UUID,
    deviceId uuid.UUID,
    body *models.SynthetictestDevice) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
deviceId uuid.UUID Template, Required -
body *models.SynthetictestDevice Body, Optional -

Response Type

``

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.SynthetictestDevice{
    Host:                 models.ToPointer("www.example.com"),
    Hostname:             models.ToPointer("google.com\""),
    Ip:                   models.ToPointer("192.168.3.5"),
    Password:             models.ToPointer("test123"),
    PingCount:            models.ToPointer(10),
    PingDetails:          models.ToPointer(false),
    PingSize:             models.ToPointer(56),
    PortId:               models.ToPointer("wan0"),
    Protocol:             models.ToPointer(models.SynthetictestDeviceProtocolEnum("ping+traceroute")),
    Tenant:               models.ToPointer("lan_network1"),
    TracerouteUdpPort:    models.ToPointer(33434),
    Type:                 models.SynthetictestTypeEnum("radius"),
    Url:                  models.ToPointer("https://www.example.com"),
    Username:             models.ToPointer("user"),
}

resp, err := sitesSyntheticTests.TriggerSiteDeviceSyntheticTest(ctx, siteId, deviceId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Device not online / Device not supported / Already in progress ApiError
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Trigger Site Synthetic Test

Trigger Synthetic Testing

TriggerSiteSyntheticTest(
    ctx context.Context,
    siteId uuid.UUID,
    body *models.Synthetictest) (
    models.ApiResponse[models.ReponseSynthetictest],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
body *models.Synthetictest Body, Optional -

Response Type

models.ReponseSynthetictest

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.Synthetictest{
    Email:                models.ToPointer("test@mist.com"),
}

apiResponse, err := sitesSyntheticTests.TriggerSiteSyntheticTest(ctx, siteId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "id": "a42775f6-edc8-69b5-f979-542fa1b43ff9",
  "message": "Successfully queued synthetic test for the site.",
  "status": "string"
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException