aboutsummaryrefslogtreecommitdiffstats
path: root/csit/tests/sdnr/functional/devicemanager/_templates/20_pnfRegistration/pnfRegistration.robot
blob: 669ceb01649746781f4793824a5b6ba2a8002f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
*** Settings ***
Documentation     Set VES collector endpoint details in NTS manager
...  VES endpooint Details and NTS manager information are stored in test environemnt variable file <environment>
...  as dictionary NETWORK_FUNCTIONS = {}, VESCOLLECTOR ={}
...  change number devices on command line with   --variable  DEVICE_TYPE:ORAN
...

Library  ConnectLibrary
Library  String
Library  SDNCBaseLibrary
Library  SDNCRestconfLibrary
Library  NTSimManagerNG
Library  SDNCDataProvider
Library  ConnectApp

Suite Setup  global suite setup    &{GLOBAL_SUITE_SETUP_CONFIG}
Suite Teardown  global suite teardown


*** Variables ***
${DEVICE_TYPE}  DEFINE_IN_INIT
${SIM_COUNT}  1
${CORE_MODEL}  DEFINE_IN_INIT
${DEVICE_TYPE_GUI}  DEFINE_IN_INIT
${PNF_REGISTRATION_TIMEOUT}  180


*** Test Cases ***
Setup NTS function
  [Tags]  nts  bringup
  [Documentation]  configure NTS manager to support restconf registration
  Add Network Element Connection   device_name=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}    is_required=${True}
  ...  host=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['IP']}     port=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PORT']}
  ...  username=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['USER']}    password=${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['PASSWORD']}
  ...  check_connection_status=Connected
  SDNCRestconfLibrary.Should Be Equal Connection Status Until Time    ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}    Connected

Start pnf ves registration from NTS function
  [Tags]  nts  bringup
  [Documentation]  scales number of simulated devices per device type to '0'
  ...              set details for VES endpoint
  ...              scales number of simulated devices per device type
  Stop Network Function Feature    ${NETWORK_FUNCTIONS['O_RAN_FH']['NAME']}    ves-pnf-registration
  NTSimManagerNG.set_ves_endpoint_details_nf  ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
  ...  ves-endpoint-protocol=${VESCOLLECTOR}[SCHEME]
  ...  ves-endpoint-ip=${VESCOLLECTOR}[IP]
  ...  ves-endpoint-port=${VESCOLLECTOR}[PORT]
  ...  ves-endpoint-auth-method=${VESCOLLECTOR}[AUTHMETHOD]
  ...  ves-endpoint-username=${VESCOLLECTOR}[USERNAME]
  ...  ves-endpoint-password=${VESCOLLECTOR}[PASSWORD]
  Start Network Function Feature    ${NETWORK_FUNCTIONS['O_RAN_FH']['NAME']}    ves-pnf-registration
  NTSimManagerNG.set_ves_config_nf  ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
  ...  pnf-registration=${True}
  sleep  10s  reason=Wait before start network function
#  Log  console=True  message=Wait some time ${PNF_REGISTRATION_TIMEOUT} till request sent by NTSim
#  ConnectApp.should_be_equal_connection_status_until_time  ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}  Connected  ${180}


Verify connection status SSH
  [Tags]  pnfregistration  dm-lifecycle  SSH
  sleep  5s  reason=Wait for processing of simulated device
  @{pnf_list}=  NTSimManagerNG.get_simulated_pnfs_nf  ${DEVICE_TYPE}  protocol=SSH
  ${length} =   Get Length  ${pnf_list}
  Should Not Be Equal As Integers   ${length}   0  msg=No network functions created

  Log to console  ${pnf_list}
  FOR    ${device}    IN    @{pnf_list}
    ${node_id}=  set variable  ${device["node-id"]}
    ${port}=  set variable  ${device["port"]}
    Log  console=True  message=Verify connection status: ${node_id}
    Run Keyword And Continue On Failure  ConnectApp.Should Be Equal connection status until time
                                                                     ...  ${node_id}  Connected   ${PNF_REGISTRATION_TIMEOUT}
    SDNCRestconfLibrary.Should Be Equal Connection Status Until Time    ${node_id}  connected  ${5}
    ConnectApp.should_be_equal_network_element_connection_details  ${node_id}
                                                                     ...  node-id=${node_id}
                                                                     ...  is-required=${False}
                                                                     ...  status=Connected
                                                                     ...  port=${port}
                                                                     ...  core-model-capability=${CORE_MODEL}
                                                                     ...  device-type=${DEVICE_TYPE_GUI}
  END

Verify connection status TLS
  [Tags]  pnfregistration  dm-lifecycle  TLS
  @{pnf_list}=  NTSimManagerNG.get_simulated_pnfs_nf  ${DEVICE_TYPE}  protocol=TLS
  Log to console  ${pnf_list}
  ${length} =   Get Length  ${pnf_list}
  Should Not Be Equal As Integers   ${length}   0  msg=No network functions created

  FOR    ${device}    IN    @{pnf_list}
    ${node_id}=  set variable  ${device["node-id"]}
    ${port}=  set variable  ${device["port"]}
    Log  console=True  message=Verify connection status: ${node_id}
    Run Keyword And Continue On Failure  ConnectApp.Should Be Equal connection status until time
                                                                     ...  ${node_id}  Connected   ${PNF_REGISTRATION_TIMEOUT}
    SDNCRestconfLibrary.Should Be Equal Connection Status Until Time    ${node_id}  connected  ${5}
    ConnectApp.should_be_equal_network_element_connection_details  ${node_id}
                                                                     ...  node-id=${node_id}
                                                                     ...  is-required=${False}
                                                                     ...  status=Connected
                                                                     ...  port=${port}
                                                                     ...  core-model-capability=${CORE_MODEL}
                                                                     ...  device-type=${DEVICE_TYPE_GUI}
  END

Remove all networkelement connections
  [Documentation]  Delete all network element connections, should not fail if the connection is not there
  [Tags]  restconf  dm-lifecycle
  Stop Network Function Feature    ${NETWORK_FUNCTIONS['O_RAN_FH']['NAME']}    ves-pnf-registration
  @{pnf_list}=  NTSimManagerNG.get_simulated_pnfs_nf  ${DEVICE_TYPE}
  FOR    ${device}    IN    @{pnf_list}
    ${node_id}=  set variable  ${device["node-id"]}
    Run Keyword And Ignore Error  ConnectApp.remove network element connection filtered  validate=${True}  node-id=${node_id}
  END
  NTSimManagerNG.set_ves_config_nf  ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}
  ...  pnf-registration=${False}
  ConnectApp.Remove Network Element Connection    ${NETWORK_FUNCTIONS['${DEVICE_TYPE}']['NAME']}