openapi: 3.0.3 info: title: Network Traffic Analysis description: | Network Insight offers a unified analytical platform for specific networks, such as private networks and slices, focusing exclusively on aggregated network-level data rather than individual device information. It empowers users to both evaluate the overall network health through a comprehensive, component-based scoring system and to analyze service traffic patterns with customizable granularity. By providing a holistic view-from infrastructure health to user traffic trends-this API suite delivers the critical, real-time data needed for comprehensive network monitoring, strategic performance optimization, and effective early warning systems. # Introduction The Network Traffic Analysis API utilizes DPI collection technology to capture communication traffic between all services or terminals within the network. By correlating service-specific data with devices and port resources, it aggregates and calculates the traffic flow for each service, thereby deriving service-based traffic distribution across the entire network. This data helps identify high-traffic services and traffic load conditions during different time periods, facilitating the provision of appropriate bandwidth for critical services through slicing technology, ultimately enabling efficient utilization of network resources. # API functionality The API provides the following functionality: - It allows users to directly query access traffic statistics for all services within a specified time period, including the number of accesses and the cumulative values of uplink and downlink traffic. # Request Parameters Definition: * **networkId**: Unique identifier of the analyzed network (UUID format). * **timePeriod**: Time range for network analysis (start + end time, RFC 3339 with timezone). * **frequency**: Analysis granularity (enumeration: 'DAY', 'HOUR'). # Authorization and authentication The "Camara Security and Interoperability Profile" provides details of how an API consumer requests an access token. Please refer to Identity and Consent Management (https://github.com/camaraproject/IdentityAndConsentManagement/) for the released version of the profile. The specific authorization flows to be used will be agreed upon during the onboarding process, happening between the API consumer and the API provider, taking into account the declared purpose for accessing the API, whilst also being subject to the prevailing legal framework dictated by local legislation. # Additional CAMARA error responses The list of error codes in this API specification is not exhaustive. Therefore the API specification may not document some non-mandatory error statuses as indicated in `CAMARA API Design Guide`. Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified in the `API Readiness Checklist` document associated to this API version. As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible error response if it is explicitly documented in the API. version: wip x-camara-commonalities: "0.7" license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html externalDocs: description: Project documentation at CAMARA url: https://github.com/camaraproject/NetworkInsights servers: - url: "{apiRoot}/network-traffic-analysis/vwip" variables: apiRoot: default: http://localhost:9100 description: API root, defined by the service provider, e.g. `api.example.com` or `api.example.com/somepath` tags: - name: Network Traffic Analysis description: The API allows API consumers to query 5G traffic statistics information for aggregated network-level data. paths: /traffic-analysis: post: tags: - Network Traffic Analysis summary: Get network traffic analysis description: | Query 5G traffic statistics information for aggregated network-level data. operationId: getTrafficAnalysis security: - openId: - network-traffic-analysis:traffic-analysis:read parameters: - $ref: "#/components/parameters/x-correlator" requestBody: required: true content: application/json: schema: type: object required: - networkId - timePeriod - frequency properties: networkId: $ref: "#/components/schemas/NetworkId" timePeriod: $ref: "#/components/schemas/TimePeriod" frequency: $ref: "#/components/schemas/Frequency" examples: ValidRequest: value: networkId: "123e4567-e89b-12d3-a456-426614174000" timePeriod: startDate: "2024-06-01T12:00:00Z" endDate: "2024-07-01T12:00:00Z" frequency: "DAY" responses: "200": description: Successful response with network traffic analysis data headers: x-correlator: $ref: '#/components/headers/x-correlator' content: application/json: schema: $ref: '#/components/schemas/TrafficAnalysisResponse' examples: Success: $ref: '#/components/examples/TrafficAnalysisSuccess' '400': $ref: '#/components/responses/Generic400' '401': $ref: '#/components/responses/Generic401' '403': $ref: '#/components/responses/Generic403' '404': $ref: '#/components/responses/Generic404' components: securitySchemes: openId: description: OpenID Connect authentication type: openIdConnect openIdConnectUrl: https://example.com/.well-known/openid-configuration parameters: x-correlator: name: x-correlator in: header description: Correlation id for the different services schema: $ref: "#/components/schemas/XCorrelator" headers: x-correlator: description: Correlation id for the different services schema: $ref: "#/components/schemas/XCorrelator" schemas: XCorrelator: description: Correlator string, UUID format recommended but any string matching the pattern can be used type: string pattern: '^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$' maxLength: 256 minLength: 1 example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46" NetworkId: description: Network ID in UUID format (unique identifier of the analyzed network) type: string format: uuid example: "123e4567-e89b-12d3-a456-426614174000" TimePeriod: type: object description: Time range for network traffic analysis. A period of time defined by a start date and an end date properties: startDate: type: string format: date-time description: An instant of time, starting of the TimePeriod. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. example: "2024-06-01T12:00:00Z" endDate: type: string format: date-time description: An instant of time, ending of the TimePeriod. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. example: "2024-07-01T12:00:00Z" required: - startDate Frequency: description: Analysis granularity (time interval for aggregation) type: string enum: ["DAY", "HOUR"] example: "DAY" TrafficAnalysisResponse: type: object description: Response schema for traffic analysis required: - message - data properties: message: type: string description: Human-readable status message example: "Network traffic analysis has been completed" maxLength: 256 data: type: object description: Traffic analysis data properties: records: type: array description: Array of traffic records per application minItems: 1 maxItems: 1000 items: type: object properties: app: type: string description: Application name example: "whatsapp" maxLength: 128 ipv4Address: type: string description: Application server IP ipv4 address example: "202.112.17.122" format: ipv4 maxLength: 15 description: type: string description: Application description example: "A free cross-platform app for messaging, calls, and media sharing." maxLength: 512 accessCount: type: integer description: Total number of accesses to the application minimum: 0 example: 150 accessUpFlow: type: integer description: Total upstream traffic (bytes) minimum: 0 example: 102400 # 100 KB accessDownFlow: type: integer description: Total downstream traffic (bytes) minimum: 0 example: 204800 # 200 KB accessFlow: type: integer description: Total traffic (up + down, bytes) minimum: 0 example: 307200 # 300 KB startDate: type: string format: date-time description: Start time of the record interval example: "2024-06-07T00:00:00Z" pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$' maxLength: 30 endDate: type: string format: date-time description: End time of the record interval example: "2024-06-07T23:59:59Z" pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$' maxLength: 30 accessDate: type: string format: date description: Date of the traffic record (YYYY-MM-DD) example: "2024-06-07" pattern: '^\d{4}-\d{2}-\d{2}$' maxLength: 10 total: type: integer description: Total number of application records minimum: 0 example: 22 ErrorInfo: type: object description: A structured error response providing details about a failed request, including the HTTP status code, an error code, and a human-readable message required: - status - code - message properties: status: type: integer format: int32 description: HTTP response status code code: type: string maxLength: 96 description: A human-readable code to describe the error message: type: string maxLength: 512 description: A human-readable description of what the event represents responses: Generic400: description: Bad Request headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 400 code: enum: - INVALID_ARGUMENT - OUT_OF_RANGE examples: GENERIC_400_INVALID_ARGUMENT: description: Invalid Argument. Generic Syntax Exception value: status: 400 code: INVALID_ARGUMENT message: Client specified an invalid argument, request body or query param. GENERIC_400_OUT_OF_RANGE: description: Out of Range. Specific Syntax Exception used when a given field has a pre-defined range or a invalid filter criteria combination is requested value: status: 400 code: OUT_OF_RANGE message: Client specified an invalid range. Generic401: description: Unauthorized headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 401 code: enum: - UNAUTHENTICATED examples: GENERIC_401_UNAUTHENTICATED: description: Request cannot be authenticated and a new authentication is required value: status: 401 code: UNAUTHENTICATED message: Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required. Generic403: description: Forbidden headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 403 code: enum: - PERMISSION_DENIED examples: GENERIC_403_PERMISSION_DENIED: description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security value: status: 403 code: PERMISSION_DENIED message: Client does not have sufficient permissions to perform this action. Generic404: description: Not found headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 404 code: enum: - NOT_FOUND examples: GENERIC_404_NOT_FOUND: description: Resource is not found value: status: 404 code: NOT_FOUND message: The specified resource is not found. examples: TrafficAnalysisSuccess: value: message: "Network traffic analysis has been completed" data: records: - app: "whatsapp" ipv4Address: "202.112.17.122" description: "A free cross-platform app for messaging, calls, and media sharing." accessCount: 150 accessUpFlow: 102400 # 100 KB accessDownFlow: 204800 # 200 KB accessFlow: 307200 # 300 KB startDate: "2024-06-07T00:00:00Z" endDate: "2024-06-07T23:59:59Z" accessDate: "2024-06-07" total: 22