Skip to content

Commit

Permalink
Merge pull request #60 from open-traffic-generator/stats-refactor
Browse files Browse the repository at this point in the history
Allow requesting traffic generator metrics using same API endpoint (`api.get_metrics()`)
  • Loading branch information
ashutshkumr authored Feb 3, 2021
2 parents 153ac33 + 6ad6ca5 commit d83b217
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 69 deletions.
92 changes: 23 additions & 69 deletions api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,29 @@ paths:
'590':
$ref: '../result/request.yaml#/components/responses/Fail'

/results/metrics:
description: >-
Traffic metrics API
post:
tags: [Results]
operationId: get_metrics
requestBody:
description: >-
Request to traffic generator for metrics of choice
required: true
content:
application/json:
schema:
$ref: '../result/metrics.yaml#/components/schemas/Metrics.Request'
responses:
'200':
description: >-
Response from traffic generator for chosen metrics
content:
application/json:
schema:
$ref: '../result/metrics.yaml#/components/schemas/Metrics.Response'

/results/state:
post:
tags: [Results]
Expand Down Expand Up @@ -174,29 +197,6 @@ paths:
schema:
$ref: '../result/capability.yaml#/components/schemas/Capabilities'

/results/port:
description: >-
Port results API
post:
tags: [Results]
operationId: get_port_metrics
requestBody:
description: >-
Port results request to the traffic generator.
required: true
content:
application/json:
schema:
$ref: '../result/port.yaml#/components/schemas/Port.Metrics.Request'
responses:
'200':
description: >-
Port results response from the traffic generator
content:
application/json:
schema:
$ref: '../result/port.yaml#/components/schemas/Port.Metrics'

/results/capture:
description: >-
Capture results API
Expand All @@ -220,49 +220,3 @@ paths:
schema:
type: string
format: binary

/results/flow:
description: >-
Flow results API
post:
tags: [Results]
operationId: get_flow_metrics
requestBody:
description: >-
Flow results request to the traffic generator.
required: true
content:
application/json:
schema:
$ref: '../result/flow.yaml#/components/schemas/Flow.Metrics.Request'
responses:
'200':
description: >-
Flow results response from the traffic generator
content:
application/json:
schema:
$ref: '../result/flow.yaml#/components/schemas/Flow.Metrics'

/results/bgpv4:
description: >-
BGP results API
post:
tags: [Results]
operationId: get_bgpv4_metrics
requestBody:
description: >-
The request to retrieve BGP Router statistics and learned routing information.
required: true
content:
application/json:
schema:
$ref: '../result/bgpv4.yaml#/components/schemas/Bgpv4.Metrics.Request'
responses:
'200':
description: >-
BGP Router statistics and learned routing information
content:
application/json:
schema:
$ref: '../result/bgpv4.yaml#/components/schemas/Bgpv4.Metrics'
39 changes: 39 additions & 0 deletions result/metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
openapi: 3.1.0

info:
title: Metrics models
version: ^0.0.0

components:
schemas:
Metrics.Request:
description: >-
Request to traffic generator for metrics of choice
type: object
required: [choice]
properties:
choice:
type: string
enum: [port, flow, bgpv4]
port:
$ref: './port.yaml#/components/schemas/Port.Metrics.Request'
flow:
$ref: './flow.yaml#/components/schemas/Flow.Metrics.Request'
bgpv4:
$ref: './bgpv4.yaml#/components/schemas/Bgpv4.Metrics.Request'

Metrics.Response:
description: >-
Response containing chosen traffic generator metrics
type: object
required: [choice]
properties:
choice:
type: string
enum: [port_metrics, flow_metrics, bgpv4_metrics]
port_metrics:
$ref: './port.yaml#/components/schemas/Port.Metrics'
flow_metrics:
$ref: './flow.yaml#/components/schemas/Flow.Metrics'
bgpv4_metrics:
$ref: './bgpv4.yaml#/components/schemas/Bgpv4.Metrics'

0 comments on commit d83b217

Please sign in to comment.