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
c622f31f
Commit
c622f31f
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
NBI Component:
- Unit test cosmetic cleanup
parent
16c36229
No related branches found
No related tags found
2 merge requests
!235
Release TeraFlowSDN 3.0
,
!186
Resolve "(CTTC) Improve NBI unitary tests framework and integration with GitLab CI/CD pipeline"
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nbi/tests/test_ietf_l2vpn.py
+6
-6
6 additions, 6 deletions
src/nbi/tests/test_ietf_l2vpn.py
src/nbi/tests/test_ietf_network.py
+3
-3
3 additions, 3 deletions
src/nbi/tests/test_ietf_network.py
with
9 additions
and
9 deletions
src/nbi/tests/test_ietf_l2vpn.py
+
6
−
6
View file @
c622f31f
...
@@ -33,7 +33,7 @@ DESCRIPTOR_FILE = 'nbi/tests/data/topology-7router-emu-dummy.json'
...
@@ -33,7 +33,7 @@ DESCRIPTOR_FILE = 'nbi/tests/data/topology-7router-emu-dummy.json'
JSON_ADMIN_CONTEXT_ID
=
json_context_id
(
DEFAULT_CONTEXT_NAME
)
JSON_ADMIN_CONTEXT_ID
=
json_context_id
(
DEFAULT_CONTEXT_NAME
)
ADMIN_CONTEXT_ID
=
ContextId
(
**
JSON_ADMIN_CONTEXT_ID
)
ADMIN_CONTEXT_ID
=
ContextId
(
**
JSON_ADMIN_CONTEXT_ID
)
def
test_
ietf_l2vpn_
prepare_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
def
test_prepare_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
validate_empty_scenario
(
context_client
)
validate_empty_scenario
(
context_client
)
descriptor_loader
=
DescriptorLoader
(
descriptors_file
=
DESCRIPTOR_FILE
,
context_client
=
context_client
)
descriptor_loader
=
DescriptorLoader
(
descriptors_file
=
DESCRIPTOR_FILE
,
context_client
=
context_client
)
results
=
descriptor_loader
.
process
()
results
=
descriptor_loader
.
process
()
...
@@ -46,22 +46,22 @@ def test_ietf_l2vpn_prepare_environment(context_client : ContextClient) -> None:
...
@@ -46,22 +46,22 @@ def test_ietf_l2vpn_prepare_environment(context_client : ContextClient) -> None:
assert
len
(
response
.
service_ids
)
==
0
assert
len
(
response
.
service_ids
)
==
0
assert
len
(
response
.
slice_ids
)
==
0
assert
len
(
response
.
slice_ids
)
==
0
def
test_
ietf_l2vpn_
create_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
def
test_create_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
osm_wim
.
create_connectivity_service
(
SERVICE_TYPE
,
SERVICE_CONNECTION_POINTS_1
)
osm_wim
.
create_connectivity_service
(
SERVICE_TYPE
,
SERVICE_CONNECTION_POINTS_1
)
def
test_
ietf_l2vpn_
get_service_status
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
def
test_get_service_status
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
osm_wim
.
get_connectivity_service_status
(
service_uuid
)
osm_wim
.
get_connectivity_service_status
(
service_uuid
)
def
test_
ietf_l2vpn_
edit_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
def
test_edit_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
osm_wim
.
edit_connectivity_service
(
service_uuid
,
SERVICE_CONNECTION_POINTS_2
)
osm_wim
.
edit_connectivity_service
(
service_uuid
,
SERVICE_CONNECTION_POINTS_2
)
def
test_
ietf_l2vpn_
delete_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
def
test_delete_service
(
osm_wim
:
MockOSM
):
# pylint: disable=redefined-outer-name
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
service_uuid
=
list
(
osm_wim
.
conn_info
.
keys
())[
0
]
# this test adds a single service
osm_wim
.
delete_connectivity_service
(
service_uuid
)
osm_wim
.
delete_connectivity_service
(
service_uuid
)
def
test_
ietf_l2vpn_
cleanup_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
def
test_cleanup_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
# Verify the scenario has no services/slices
# Verify the scenario has no services/slices
response
=
context_client
.
GetContext
(
ADMIN_CONTEXT_ID
)
response
=
context_client
.
GetContext
(
ADMIN_CONTEXT_ID
)
assert
len
(
response
.
topology_ids
)
==
1
assert
len
(
response
.
topology_ids
)
==
1
...
...
This diff is collapsed.
Click to expand it.
src/nbi/tests/test_ietf_network.py
+
3
−
3
View file @
c622f31f
...
@@ -34,7 +34,7 @@ TARGET_DATA_FILE = 'nbi/tests/data/test-ietf-network.json'
...
@@ -34,7 +34,7 @@ TARGET_DATA_FILE = 'nbi/tests/data/test-ietf-network.json'
JSON_ADMIN_CONTEXT_ID
=
json_context_id
(
DEFAULT_CONTEXT_NAME
)
JSON_ADMIN_CONTEXT_ID
=
json_context_id
(
DEFAULT_CONTEXT_NAME
)
ADMIN_CONTEXT_ID
=
ContextId
(
**
JSON_ADMIN_CONTEXT_ID
)
ADMIN_CONTEXT_ID
=
ContextId
(
**
JSON_ADMIN_CONTEXT_ID
)
def
test_
ietf_network_
prepare_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
def
test_prepare_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
validate_empty_scenario
(
context_client
)
validate_empty_scenario
(
context_client
)
descriptor_loader
=
DescriptorLoader
(
descriptors_file
=
DESCRIPTOR_FILE
,
context_client
=
context_client
)
descriptor_loader
=
DescriptorLoader
(
descriptors_file
=
DESCRIPTOR_FILE
,
context_client
=
context_client
)
results
=
descriptor_loader
.
process
()
results
=
descriptor_loader
.
process
()
...
@@ -74,7 +74,7 @@ def sort_data(data : Dict) -> None:
...
@@ -74,7 +74,7 @@ def sort_data(data : Dict) -> None:
key
=
operator
.
itemgetter
(
'
link-id
'
)
key
=
operator
.
itemgetter
(
'
link-id
'
)
)
)
def
test_
ietf_network_
rest_get_networks
(
nbi_service_rest
:
RestServer
):
# pylint: disable=redefined-outer-name, unused-argument
def
test_rest_get_networks
(
nbi_service_rest
:
RestServer
):
# pylint: disable=redefined-outer-name, unused-argument
with
open
(
TARGET_DATA_FILE
,
'
r
'
,
encoding
=
'
UTF-8
'
)
as
f
:
with
open
(
TARGET_DATA_FILE
,
'
r
'
,
encoding
=
'
UTF-8
'
)
as
f
:
target_data
=
json
.
load
(
f
)
target_data
=
json
.
load
(
f
)
URL
=
'
/restconf/data/ietf-network:networks
'
URL
=
'
/restconf/data/ietf-network:networks
'
...
@@ -85,7 +85,7 @@ def test_ietf_network_rest_get_networks(nbi_service_rest : RestServer): # pylint
...
@@ -85,7 +85,7 @@ def test_ietf_network_rest_get_networks(nbi_service_rest : RestServer): # pylint
LOGGER
.
error
(
'
Differences:
\n
{:s}
'
.
format
(
str
(
diff_data
.
pretty
())))
LOGGER
.
error
(
'
Differences:
\n
{:s}
'
.
format
(
str
(
diff_data
.
pretty
())))
assert
len
(
diff_data
)
==
0
assert
len
(
diff_data
)
==
0
def
test_
ietf_network_
cleanup_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
def
test_cleanup_environment
(
context_client
:
ContextClient
)
->
None
:
# pylint: disable=redefined-outer-name
# Verify the scenario has no services/slices
# Verify the scenario has no services/slices
response
=
context_client
.
GetContext
(
ADMIN_CONTEXT_ID
)
response
=
context_client
.
GetContext
(
ADMIN_CONTEXT_ID
)
assert
len
(
response
.
topology_ids
)
==
1
assert
len
(
response
.
topology_ids
)
==
1
...
...
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