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
995e02e6
Commit
995e02e6
authored
2 years ago
by
famelis
Browse files
Options
Downloads
Patches
Plain Diff
fix: add None checks to endpoint names
parent
fc618f65
No related branches found
No related tags found
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!57
fix: Change p4_service_handler and test scripts for rel2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/service/service/service_handlers/p4/p4_service_handler.py
+13
-0
13 additions, 0 deletions
...service/service/service_handlers/p4/p4_service_handler.py
src/tests/p4/tests/test_functional_bootstrap.py
+1
-1
1 addition, 1 deletion
src/tests/p4/tests/test_functional_bootstrap.py
with
14 additions
and
1 deletion
src/service/service/service_handlers/p4/p4_service_handler.py
+
13
−
0
View file @
995e02e6
...
@@ -71,6 +71,7 @@ def create_rule_del(endpoint_a, endpoint_b):
...
@@ -71,6 +71,7 @@ def create_rule_del(endpoint_a, endpoint_b):
)
)
def
find_names
(
uuid_a
,
uuid_b
,
device_endpoints
):
def
find_names
(
uuid_a
,
uuid_b
,
device_endpoints
):
endpoint_a
,
endpoint_b
=
None
,
None
for
endpoint
in
device_endpoints
:
for
endpoint
in
device_endpoints
:
if
endpoint
.
endpoint_id
.
endpoint_uuid
.
uuid
==
uuid_a
:
if
endpoint
.
endpoint_id
.
endpoint_uuid
.
uuid
==
uuid_a
:
endpoint_a
=
endpoint
.
name
endpoint_a
=
endpoint
.
name
...
@@ -139,6 +140,12 @@ class P4ServiceHandler(_ServiceHandler):
...
@@ -139,6 +140,12 @@ class P4ServiceHandler(_ServiceHandler):
# Find names from uuids
# Find names from uuids
(
endpoint_a
,
endpoint_b
)
=
find_names
(
matched_endpoint_uuid
,
endpoint_uuid
,
device
.
device_endpoints
)
(
endpoint_a
,
endpoint_b
)
=
find_names
(
matched_endpoint_uuid
,
endpoint_uuid
,
device
.
device_endpoints
)
if
endpoint_a
is
None
:
LOGGER
.
exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
matched_endpoint_uuid
)))
raise
Exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
matched_endpoint_uuid
)))
if
endpoint_b
is
None
:
LOGGER
.
exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
endpoint_uuid
)))
raise
Exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
endpoint_uuid
)))
# One way
# One way
rule
=
create_rule_set
(
endpoint_a
,
endpoint_b
)
rule
=
create_rule_set
(
endpoint_a
,
endpoint_b
)
...
@@ -203,6 +210,12 @@ class P4ServiceHandler(_ServiceHandler):
...
@@ -203,6 +210,12 @@ class P4ServiceHandler(_ServiceHandler):
# Find names from uuids
# Find names from uuids
(
endpoint_a
,
endpoint_b
)
=
find_names
(
matched_endpoint_uuid
,
endpoint_uuid
,
device
.
device_endpoints
)
(
endpoint_a
,
endpoint_b
)
=
find_names
(
matched_endpoint_uuid
,
endpoint_uuid
,
device
.
device_endpoints
)
if
endpoint_a
is
None
:
LOGGER
.
exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
matched_endpoint_uuid
)))
raise
Exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
matched_endpoint_uuid
)))
if
endpoint_b
is
None
:
LOGGER
.
exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
endpoint_uuid
)))
raise
Exception
(
'
Unable to find name of endpoint({:s})
'
.
format
(
str
(
endpoint_uuid
)))
# One way
# One way
rule
=
create_rule_del
(
endpoint_a
,
endpoint_b
)
rule
=
create_rule_del
(
endpoint_a
,
endpoint_b
)
...
...
This diff is collapsed.
Click to expand it.
src/tests/p4/tests/test_functional_bootstrap.py
+
1
−
1
View file @
995e02e6
...
@@ -106,7 +106,7 @@ def test_devices_bootstraping(
...
@@ -106,7 +106,7 @@ def test_devices_bootstraping(
link_uuid
=
link
[
'
link_id
'
][
'
link_uuid
'
][
'
uuid
'
]
link_uuid
=
link
[
'
link_id
'
][
'
link_uuid
'
][
'
uuid
'
]
LOGGER
.
info
(
'
Adding Link {:s}
'
.
format
(
link_uuid
))
LOGGER
.
info
(
'
Adding Link {:s}
'
.
format
(
link_uuid
))
response
=
context_client
.
SetLink
(
Link
(
**
link
))
response
=
context_client
.
SetLink
(
Link
(
**
link
))
assert
link_uuid
==
link_uuid
assert
response
.
name
==
link_uuid
context_client
.
SetLink
(
Link
(
**
link
))
context_client
.
SetLink
(
Link
(
**
link
))
def
test_devices_bootstrapped
(
context_client
:
ContextClient
):
# pylint: disable=redefined-outer-name
def
test_devices_bootstrapped
(
context_client
:
ContextClient
):
# pylint: disable=redefined-outer-name
...
...
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