Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
b8db5bdf
Commit
b8db5bdf
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Fix OFC'22 test to wait for device activation
parent
2b800e74
No related branches found
No related tags found
1 merge request
!142
Release TeraFlowSDN 2.1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tests/ofc22/tests/test_functional_bootstrap.py
+23
-2
23 additions, 2 deletions
src/tests/ofc22/tests/test_functional_bootstrap.py
with
23 additions
and
2 deletions
src/tests/ofc22/tests/test_functional_bootstrap.py
+
23
−
2
View file @
b8db5bdf
...
...
@@ -14,7 +14,7 @@
import
logging
,
time
from
common.Constants
import
DEFAULT_CONTEXT_NAME
from
common.proto.context_pb2
import
ContextId
,
Empty
from
common.proto.context_pb2
import
ContextId
,
DeviceOperationalStatusEnum
,
Empty
from
common.proto.monitoring_pb2
import
KpiDescriptorList
from
common.tools.descriptor.Loader
import
DescriptorLoader
,
check_descriptor_load_results
,
validate_empty_scenario
from
common.tools.object_factory.Context
import
json_context_id
...
...
@@ -46,6 +46,27 @@ def test_scenario_bootstrap(
assert
len
(
response
.
service_ids
)
==
0
assert
len
(
response
.
slice_ids
)
==
0
def
test_scenario_devices_enabled
(
context_client
:
ContextClient
,
# pylint: disable=redefined-outer-name
)
->
None
:
"""
This test validates that the devices are enabled.
"""
DEVICE_OP_STATUS_ENABLED
=
DeviceOperationalStatusEnum
.
DEVICEOPERATIONALSTATUS_ENABLED
num_devices
=
-
1
num_devices_enabled
,
num_retry
=
0
,
0
while
(
num_devices
!=
num_devices_enabled
)
and
(
num_retry
<
10
):
time
.
sleep
(
1.0
)
response
=
context_client
.
ListDevices
(
Empty
())
num_devices
=
len
(
response
.
devices
)
num_devices_enabled
=
0
for
device
in
response
.
devices
:
if
device
.
device_operational_status
!=
DEVICE_OP_STATUS_ENABLED
:
continue
num_devices_enabled
+=
1
LOGGER
.
info
(
'
Num Devices enabled: {:d}/{:d}
'
.
format
(
num_devices_enabled
,
num_devices
))
num_retry
+=
1
assert
num_devices_enabled
==
num_devices
def
test_scenario_kpis_created
(
context_client
:
ContextClient
,
# pylint: disable=redefined-outer-name
...
...
@@ -67,7 +88,7 @@ def test_scenario_kpis_created(
LOGGER
.
info
(
'
Num KPIs expected: {:d}
'
.
format
(
num_kpis_expected
))
num_kpis_created
,
num_retry
=
0
,
0
while
(
num_kpis_created
!=
num_kpis_expected
)
and
(
num_retry
<
5
):
while
(
num_kpis_created
!=
num_kpis_expected
)
and
(
num_retry
<
10
):
response
:
KpiDescriptorList
=
monitoring_client
.
GetKpiDescriptorList
(
Empty
())
num_kpis_created
=
len
(
response
.
kpi_descriptor_list
)
LOGGER
.
info
(
'
Num KPIs created: {:d}
'
.
format
(
num_kpis_created
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment