emaclee | 7c46808 | 2022-08-09 09:03:57 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ============LICENSE_START======================================================= |
| 3 | * Copyright (C) 2022 Nordix Foundation |
| 4 | * ================================================================================ |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | * SPDX-License-Identifier: Apache-2.0 |
| 18 | * ============LICENSE_END========================================================= |
| 19 | */ |
| 20 | |
| 21 | *** Settings *** |
| 22 | Documentation NCMP |
| 23 | |
| 24 | Library Collections |
| 25 | Library OperatingSystem |
| 26 | Library RequestsLibrary |
| 27 | Library BuiltIn |
| 28 | |
| 29 | Suite Setup Create Session CPS_URL http://${CPS_CORE_HOST}:${CPS_CORE_PORT} |
| 30 | |
| 31 | *** Variables *** |
| 32 | |
| 33 | ${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE= |
| 34 | ${ncmpBasePath} /ncmp |
| 35 | |
| 36 | *** Test Cases *** |
| 37 | Operational state goes to UNSYNCHRONIZED when data sync (flag) is enabled |
| 38 | ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data-sync |
| 39 | ${params}= Create Dictionary dataSyncEnabled=true |
| 40 | ${headers}= Create Dictionary Authorization=${auth} |
| 41 | ${response}= PUT On Session CPS_URL ${uri} params=${params} headers=${headers} |
| 42 | Should Be Equal As Strings ${response.status_code} 200 |
| 43 | ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/state |
| 44 | ${verifyHeaders}= Create Dictionary Authorization=${auth} |
| 45 | ${verifyResponse}= GET On Session CPS_URL ${verifyUri} headers=${verifyHeaders} |
| 46 | ${verifyResponseJson}= Set Variable ${verifyResponse.json()['state']['dataSyncState']['operational']} |
| 47 | Should Be Equal As Strings ${verifyResponseJson['syncState']} UNSYNCHRONIZED |
| 48 | Sleep 5 |
| 49 | |
| 50 | Operational state goes to SYNCHRONIZED after sometime when data sync (flag) is enabled |
| 51 | ${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/state |
| 52 | ${headers}= Create Dictionary Authorization=${auth} |
| 53 | ${response}= GET On Session CPS_URL ${uri} headers=${headers} |
| 54 | ${responseJson}= Set Variable ${response.json()['state']['dataSyncState']['operational']} |
| 55 | Should Be Equal As Strings ${responseJson['syncState']} SYNCHRONIZED |