Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
d0617eaf
Commit
d0617eaf
authored
4 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Add unittest for create L2Circuit WF.
parent
6a56e70d
No related branches found
No related tags found
1 merge request
!307
Feature/l2circuits
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/workflows/l2_circuit/test_create_layer_2_circuit.py
+70
-0
70 additions, 0 deletions
test/workflows/l2_circuit/test_create_layer_2_circuit.py
with
70 additions
and
0 deletions
test/workflows/l2_circuit/test_create_layer_2_circuit.py
0 → 100644
+
70
−
0
View file @
d0617eaf
import
pytest
from
orchestrator.types
import
SubscriptionLifecycle
from
gso.products
import
ProductName
from
gso.products.product_blocks.layer_2_circuit
import
Layer2CircuitType
from
gso.products.product_types.layer_2_circuit
import
Layer2Circuit
from
gso.services.subscriptions
import
get_product_id_by_name
from
test.workflows
import
assert_complete
,
extract_state
,
run_workflow
@pytest.fixture
()
def
layer_2_circuit_input
(
faker
,
partner_factory
,
edge_port_subscription_factory
,
layer_2_circuit_service_type
):
partner
=
partner_factory
()
product_id
=
get_product_id_by_name
(
layer_2_circuit_service_type
)
edge_port_a
=
edge_port_subscription_factory
(
partner
=
partner
)
edge_port_b
=
edge_port_subscription_factory
(
partner
=
partner
)
policer_enabled
=
faker
.
boolean
()
return
[
{
"
product
"
:
product_id
},
{
"
tt_number
"
:
faker
.
tt_number
(),
"
partner
"
:
partner
[
"
partner_id
"
],
"
layer_2_circuit_type
"
:
Layer2CircuitType
.
TAGGED
,
"
policer_enabled
"
:
policer_enabled
,
},
{
"
vlan_range_lower_bound
"
:
faker
.
vlan_id
(),
"
vlan_range_upper_bound
"
:
faker
.
vlan_id
(),
"
policer_bandwidth
"
:
faker
.
bandwidth
()
if
policer_enabled
else
None
,
"
geant_sid
"
:
faker
.
geant_sid
(),
"
layer_2_circuit_side_a
"
:
{
"
edge_port
"
:
edge_port_a
,
"
vlan_id
"
:
faker
.
vlan_id
()},
"
layer_2_circuit_side_b
"
:
{
"
edge_port
"
:
edge_port_b
,
"
vlan_id
"
:
faker
.
vlan_id
()},
},
]
@pytest.mark.parametrize
(
"
layer_2_circuit_service_type
"
,
[
ProductName
.
GEANT_PLUS
,
ProductName
.
EXPRESSROUTE
]
)
@pytest.mark.workflow
()
def
test_create_layer_2_circuit_success
(
layer_2_circuit_service_type
,
layer_2_circuit_input
,
faker
,
partner_factory
,
data_config_filename
,
):
result
,
process_stat
,
step_log
=
run_workflow
(
"
create_layer_2_circuit
"
,
layer_2_circuit_input
)
assert_complete
(
result
)
state
=
extract_state
(
result
)
subscription
=
Layer2Circuit
.
from_subscription
(
state
[
"
subscription_id
"
])
assert
subscription
.
status
==
SubscriptionLifecycle
.
ACTIVE
assert
subscription
.
layer_2_circuit
.
virtual_circuit_id
is
not
None
assert
len
(
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
)
==
2
assert
(
str
(
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
0
].
sbp
.
edge_port
.
owner_subscription_id
)
==
layer_2_circuit_input
[
2
][
"
layer_2_circuit_side_a
"
][
"
edge_port
"
]
)
assert
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
0
].
sbp
.
is_tagged
is
True
assert
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
0
].
sbp
.
geant_sid
==
layer_2_circuit_input
[
2
][
"
geant_sid
"
]
assert
(
str
(
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
1
].
sbp
.
edge_port
.
owner_subscription_id
)
==
layer_2_circuit_input
[
2
][
"
layer_2_circuit_side_b
"
][
"
edge_port
"
]
)
assert
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
1
].
sbp
.
is_tagged
is
True
assert
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
[
1
].
sbp
.
geant_sid
==
layer_2_circuit_input
[
2
][
"
geant_sid
"
]
assert
subscription
.
layer_2_circuit
.
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
assert
subscription
.
layer_2_circuit
.
policer_enabled
==
layer_2_circuit_input
[
1
][
"
policer_enabled
"
]
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