From 797a7f20bc0596b4e571951966d6d986c1bfded8 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Tue, 12 Sep 2023 14:24:14 -0700 Subject: [PATCH] https://telecominfraproject.atlassian.net/browse/WIFI-7831 Signed-off-by: stephb9959 --- src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp | 10 +++++++--- test_scripts/curl/cli | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp b/src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp index 1578323..8d21fff 100644 --- a/src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp +++ b/src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp @@ -8,7 +8,7 @@ namespace OpenWifi { void RESTAPI_openroaming_gr_acct_handler::DoGet() { - auto Account = GetBinding("account",""); + auto Account = GetBinding("id",""); if(Account.empty()) { return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters); } @@ -21,7 +21,7 @@ namespace OpenWifi { } void RESTAPI_openroaming_gr_acct_handler::DoDelete() { - auto Account = GetBinding("account",""); + auto Account = GetBinding("id",""); if(Account.empty()) { return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters); } @@ -38,7 +38,7 @@ namespace OpenWifi { } void RESTAPI_openroaming_gr_acct_handler::DoPost() { - auto Account = GetBinding("account",""); + auto Account = GetBinding("id",""); if(Account.empty()) { return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters); } @@ -78,6 +78,10 @@ namespace OpenWifi { return BadRequest(RESTAPI::Errors::CannotCreateCSR); } + NewObject.CSR = R.CSR; + NewObject.CSRPublicKey = R.PublicKey; + NewObject.CSRPrivateKey = R.PrivateKey; + ProvObjects::CreateObjectInfo(RawObject,UserInfo_.userinfo,NewObject.info); if(DB_.CreateRecord(NewObject)) { diff --git a/test_scripts/curl/cli b/test_scripts/curl/cli index a45f37e..98e5f58 100755 --- a/test_scripts/curl/cli +++ b/test_scripts/curl/cli @@ -617,6 +617,18 @@ getsystemconfiguration() { jq < ${result_file} } +creategraccount() { + payload="{ \"name\" : \"Test account\" , \"country\" : \"CA\", \"province\" : \"BC\" , \"city\" : \"Vancouver\", \"organization\" : \"Arilia Wireless Inc.\", \"commonName\" : \"arilia.com\", \"GlobalReachAcctId\" : \"bd63aaa7-b14d-4cdb-85ae-8de6cf2cfa31\", \"privateKey\" : \"-----BEGIN PRIVATE KEY-----MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgl1FpARtuOtw1F9sR2DD82jh6sZFGRn619IY0rmNIFEuhRANCAATB7ji6OF/+heGRCocgVNhw4QGvaL9Kp8F6ZqqZ3aMewRMOfzi3TQaXN12FNBsvXnptx5vk8GAzZk6UAzzvMBVK-----END PRIVATE KEY-----\" }" + echo $payload | jq + + curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/openroaming/globalreach/account/0" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${token}" \ + -H "Accept: application/json" \ + -d "$payload" > ${result_file} + jq < ${result_file} +} + shopt -s nocasematch case "$1" in "login") login; echo "You are logged in..." ; logout ;; @@ -673,6 +685,7 @@ case "$1" in "deleteoverride") login; deleteoverride "$2"; logout;; "venueupgraderevisions") login; venueupgraderevisions "$2"; logout;; "getsystemconfiguration") login; getsystemconfiguration "$2"; logout;; + "creategraccount") login; creategraccount ; logout;; "getvenuesperrrm") login; getvenuesperrrm "$2"; logout;; *) help ;; esac