2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2022-2024 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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
25 Library OperatingSystem
26 Library RequestsLibrary
29 Suite Setup Create Session CPS_URL http://${CPS_CORE_HOST}:${CPS_CORE_PORT}
33 ${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE=
38 Check if ietfYang-PNFDemo is READY
39 ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo
40 ${headers}= Create Dictionary Authorization=${auth}
41 Wait Until Keyword Succeeds 10sec 100ms Is CM Handle READY ${uri} ${headers} ietfYang-PNFDemo
43 Operational state goes to UNSYNCHRONIZED when data sync (flag) is enabled
44 ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/data-sync
45 ${params}= Create Dictionary dataSyncEnabled=true
46 ${headers}= Create Dictionary Authorization=${auth}
47 ${response}= PUT On Session CPS_URL ${uri} params=${params} headers=${headers}
48 Should Be Equal As Strings ${response.status_code} 200
49 ${verifyUri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state
50 ${verifyHeaders}= Create Dictionary Authorization=${auth}
51 ${verifyResponse}= GET On Session CPS_URL ${verifyUri} headers=${verifyHeaders}
52 Should Be Equal As Strings ${verifyResponse.json()['state']['dataSyncState']['operational']['syncState']} UNSYNCHRONIZED
54 Operational state goes to SYNCHRONIZED after sometime when data sync (flag) is enabled
55 ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state
56 ${headers}= Create Dictionary Authorization=${auth}
57 Wait Until Keyword Succeeds 10sec 100ms Is CM Handle State SYNCHRONIZED ${uri} ${headers}
61 [Arguments] ${uri} ${headers} ${cmHandle}
62 ${response}= GET On Session CPS_URL ${uri} headers=${headers}
63 Should Be Equal As Strings ${response.status_code} 200
64 FOR ${item} IN ${response.json()}
65 IF "${item['cmHandle']}" == "${cmHandle}"
66 Should Be Equal As Strings ${item['state']['cmHandleState']} READY
70 Is CM Handle State SYNCHRONIZED
71 [Arguments] ${uri} ${headers}
72 ${response}= GET On Session CPS_URL ${uri} headers=${headers}
73 Should Be Equal As Strings ${response.json()['state']['dataSyncState']['operational']['syncState']} SYNCHRONIZED