Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-7831
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Sep 15, 2023
1 parent 98f37d4 commit 5650e0d
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ add_executable(owprov
src/ProvWebSocketClient.cpp src/ProvWebSocketClient.h
src/Tasks/VenueRebooter.h src/Tasks/VenueUpgrade.h
src/sdks/SDK_fms.cpp src/sdks/SDK_fms.h
src/RESTAPI/RESTAPI_overrides_handler.cpp src/RESTAPI/RESTAPI_overrides_handler.h src/OpenRoamin_GlobalReach.cpp src/OpenRoamin_GlobalReach.h src/storage/storage_glblraccounts.cpp src/storage/storage_glblraccounts.h src/storage/storage_glblrcerts.cpp src/storage/storage_glblrcerts.h src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.h src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.h)
src/RESTAPI/RESTAPI_overrides_handler.cpp src/RESTAPI/RESTAPI_overrides_handler.h src/OpenRoamin_GlobalReach.cpp src/OpenRoamin_GlobalReach.h src/storage/storage_glblraccounts.cpp src/storage/storage_glblraccounts.h src/storage/storage_glblrcerts.cpp src/storage/storage_glblrcerts.h src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.h src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.h src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h)

target_link_libraries(owprov PUBLIC
${Poco_LIBRARIES}
Expand Down
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
4 changes: 2 additions & 2 deletions openapi/openroaming_globalreach.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: OpenWiFi Provisioning Model
description: Definitions and APIs to manages an OpenWiFi network.
title: OpenWiFi OpenRoaming Provisioning Model for Global Reach
description: Definitions and APIs to Open Roaming WiFi.
version: 2.5.0
license:
name: BSD3
Expand Down
195 changes: 195 additions & 0 deletions openapi/openroaming_orion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
openapi: 3.0.1
info:
title: OpenWiFi OpenRoaming Provisioning Model for Google Orion
description: Definitions and APIs to Open Roaming WiFi.
version: 2.5.0
license:
name: BSD3
url: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE

servers:
- url: 'https://localhost:16005/api/v1'

security:
- bearerAuth: []
- ApiKeyAuth: []

components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-KEY
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT

responses:
NotFound:
$ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/NotFound'
Unauthorized:
$ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/Unauthorized'
Success:
$ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/Success'
BadRequest:
$ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/BadRequest'

schemas:
GooglOrionAccountInfo:
type: object
properties:
allOf:
$ref: 'https://github.com/Telecominfraproject/wlan-cloud-owprov/blob/main/openpapi/owprov.yaml#/components/schemas/ObjectInfo'
privateKey:
type: string
certificate:
type: string
cacerts:
type: array
items:
type: string

paths:
/openroaming/orion/accounts:
get:
tags:
- OpenRoaming-Google Orion
operationId: getOpenRoamingGlobalReachAccountList
summary: Retrieve account list.
parameters:
- in: query
description: Pagination start (starts at 1. If not specified, 1 is assumed)
name: offset
schema:
type: integer
required: false
- in: query
description: Maximum number of entries to return (if absent, no limit is assumed)
name: limit
schema:
type: integer
required: false
- in: query
description: return the number of accounts
name: countOnly
schema:
type: boolean
required: false

responses:
200:
description: The list of accounts
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GooglOrionAccountInfo'
$ref: '#/components/responses/Success'
400:
$ref: '#/components/responses/BadRequest'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

/openroaming/globalreach/account/{name}:
get:
tags:
- OpenRoaming-Google Orion
operationId: getOpenRoamingGlobalReachAccount
summary: Retrieve account information.
parameters:
- in: path
description: The account name
name: name
schema:
type: string
required: true
responses:
200:
$ref: '#/components/schemas/GooglOrionAccountInfo'
400:
$ref: '#/components/responses/BadRequest'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

delete:
tags:
- OpenRoaming-Google Orion
operationId: deleteOpenRoamingGlobalReachAccount
summary: Delete account information.
parameters:
- in: path
description: The account name
name: name
schema:
type: string
required: true
responses:
200:
$ref: '#/components/responses/Success'
400:
$ref: '#/components/responses/BadRequest'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

post:
tags:
- OpenRoaming-Google Orion
operationId: createOpenRoamingGlobalReachAccount
summary: Create account information.
parameters:
- in: path
description: The account name
name: name
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GooglOrionAccountInfo'
responses:
200:
$ref: '#/components/schemas/GooglOrionAccountInfo'
400:
$ref: '#/components/responses/BadRequest'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

put:
tags:
- OpenRoaming-Google Orion
operationId: modifyOpenRoamingGlobalReachAccount
summary: Modify account information.
parameters:
- in: path
description: The account name
name: name
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GooglOrionAccountInfo'
responses:
200:
$ref: '#/components/schemas/GooglOrionAccountInfo'
400:
$ref: '#/components/responses/BadRequest'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

8 changes: 8 additions & 0 deletions src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Created by stephane bourque on 2023-09-15.
//

#include "RESTAPI_openroaming_orion_acct_handler.h"

namespace OpenWifi {
} // OpenWifi
16 changes: 16 additions & 0 deletions src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by stephane bourque on 2023-09-15.
//

#ifndef OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H
#define OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H

namespace OpenWifi {

class RESTAPI_openroaming_orion_acct_handler {

};

} // OpenWifi

#endif //OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H
8 changes: 8 additions & 0 deletions src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Created by stephane bourque on 2023-09-15.
//

#include "RESTAPI_openroaming_orion_list_acct_handler.h"

namespace OpenWifi {
} // OpenWifi
16 changes: 16 additions & 0 deletions src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by stephane bourque on 2023-09-15.
//

#ifndef OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H
#define OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H

namespace OpenWifi {

class RESTAPI_openroaming_orion_list_acct_handler {

};

} // OpenWifi

#endif //OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H
21 changes: 21 additions & 0 deletions src/RESTObjects/RESTAPI_ProvObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,4 +1258,25 @@ namespace OpenWifi::ProvObjects {
return false;
}

void GooglOrionAccountInfo::to_json(Poco::JSON::Object &Obj) const {
info.to_json(Obj);
field_to_json(Obj, "privateKey", privateKey);
field_to_json(Obj, "certificate", certificate);
field_to_json(Obj, "cacerts", cacerts);
}

bool GooglOrionAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
try {
info.from_json(Obj);
field_from_json(Obj, "privateKey", privateKey);
field_from_json(Obj, "certificate", certificate);
field_from_json(Obj, "cacerts", cacerts);
return true;
} catch (const Poco::Exception &E) {

}
return false;
}


} // namespace OpenWifi::ProvObjects
10 changes: 10 additions & 0 deletions src/RESTObjects/RESTAPI_ProvObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,4 +773,14 @@ namespace OpenWifi::ProvObjects {
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};

struct GooglOrionAccountInfo {
ObjectInfo info;
std::string privateKey;
std::string certificate;
std::vector<std::string> cacerts;

void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};

}; // namespace OpenWifi::ProvObjects

0 comments on commit 5650e0d

Please sign in to comment.