Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
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
geant-swd
dashboardv3
inventory-provider
Merge requests
!18
Support ASN dot notation.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Support ASN dot notation.
feature/DBOARD3-719-support-extended-asn-notation
into
develop
Overview
3
Commits
2
Pipelines
0
Changes
2
All threads resolved!
Hide all comments
Merged
Neda Moeini
requested to merge
feature/DBOARD3-719-support-extended-asn-notation
into
develop
1 year ago
Overview
3
Commits
2
Pipelines
0
Changes
2
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Viewing commit
16e4cb93
Prev
Next
Show latest version
2 files
+
26
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
16e4cb93
Fixed review suggestions.
· 16e4cb93
Neda Moeini
authored
1 year ago
inventory_provider/juniper.py
+
16
−
3
Options
@@ -252,12 +252,25 @@ def asn_to_int(asn_string: str) -> int:
Returns:
int: ASN in integer format.
Raises:
ValueError: If the ASN string is not in the expected format or exceeds valid range.
"""
if
'
.
'
in
asn_string
:
high_order
,
low_order
=
map
(
int
,
asn_string
.
split
(
'
.
'
))
dotted_asn_pattern
=
re
.
compile
(
r
'
^(\d+)\.(\d+)$
'
)
match
=
dotted_asn_pattern
.
match
(
asn_string
)
if
match
:
high_order
,
low_order
=
map
(
int
,
match
.
groups
())
if
high_order
>
0xffff
or
low_order
>
0xffff
:
raise
ValueError
(
f
'
Invalid ASN format:
{
asn_string
}
. Both components must be <= 0xffff.
'
)
return
(
high_order
<<
16
)
|
low_order
el
se
:
el
if
asn_string
.
isdigit
()
:
return
int
(
asn_string
)
else
:
raise
ValueError
(
f
'
Unable to parse ASN string:
{
asn_string
}
. Expected either a pure integer or a dot notation.
'
)
def
_system_bgp_peers
(
system_node
):
Loading