blob: b8ba479e7ce69a921dd440da71990a09241d8df2 [file] [log] [blame]
emaclee7c468082022-08-09 09:03:57 +01001/*
2 * ============LICENSE_START=======================================================
sourabh_sourabh02d8bf82024-01-04 17:01:27 +00003 * Copyright (C) 2022-2024 Nordix Foundation
emaclee7c468082022-08-09 09:03:57 +01004 * ================================================================================
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 ***
22Documentation NCMP
23
24Library Collections
25Library OperatingSystem
26Library RequestsLibrary
27Library BuiltIn
28
29Suite 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 ***
JvD_Ericsson820235c2024-01-22 13:32:34 +000037
emaclee7c468082022-08-09 09:03:57 +010038Operational state goes to UNSYNCHRONIZED when data sync (flag) is enabled
sourabh_sourabh02d8bf82024-01-04 17:01:27 +000039 ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data-sync
emaclee7c468082022-08-09 09:03:57 +010040 ${params}= Create Dictionary dataSyncEnabled=true
41 ${headers}= Create Dictionary Authorization=${auth}
42 ${response}= PUT On Session CPS_URL ${uri} params=${params} headers=${headers}
43 Should Be Equal As Strings ${response.status_code} 200
JvD_Ericsson820235c2024-01-22 13:32:34 +000044 ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state
45 ${verifyHeaders}= Create Dictionary Authorization=${auth}
46 ${verifyResponse}= GET On Session CPS_URL ${verifyUri} headers=${verifyHeaders}
47 Should Be Equal As Strings ${verifyResponse.json()['state']['dataSyncState']['operational']['syncState']} UNSYNCHRONIZED
emaclee7c468082022-08-09 09:03:57 +010048
49Operational state goes to SYNCHRONIZED after sometime when data sync (flag) is enabled
JvD_Ericsson820235c2024-01-22 13:32:34 +000050 ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state
51 ${headers}= Create Dictionary Authorization=${auth}
danielhanrahan7e15c5f2024-07-22 13:46:32 +010052 Wait Until Keyword Succeeds 40sec 100ms Is CM Handle State SYNCHRONIZED ${uri} ${headers}
JvD_Ericsson820235c2024-01-22 13:32:34 +000053
54*** Keywords ***
JvD_Ericsson820235c2024-01-22 13:32:34 +000055
56Is CM Handle State SYNCHRONIZED
57 [Arguments] ${uri} ${headers}
58 ${response}= GET On Session CPS_URL ${uri} headers=${headers}
59 Should Be Equal As Strings ${response.json()['state']['dataSyncState']['operational']['syncState']} SYNCHRONIZED