Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
grid5000
reference-repository
Commits
01480990
Commit
01480990
authored
4 years ago
by
RINGOT Patrice
Browse files
Options
Downloads
Patches
Plain Diff
[kavlang5k.rb] allow kavlan pattern to be given at the port level
parent
25c73d8b
No related branches found
No related tags found
1 merge request
!160
[kavlang5k.rb] allow kavlan pattern to be given at the port level
Pipeline
#200733
passed
4 years ago
Stage: validate
Stage: generate
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/refrepo/gen/puppet/kavlang5k.rb
+3
-1
3 additions, 1 deletion
lib/refrepo/gen/puppet/kavlang5k.rb
with
3 additions
and
1 deletion
lib/refrepo/gen/puppet/kavlang5k.rb
+
3
−
1
View file @
01480990
...
...
@@ -4,9 +4,11 @@ def kavlan_switch_port_lookup(switch, node_uid, interface='')
switch
[
"linecards"
].
each_with_index
do
|
lc
,
lc_uid
|
next
if
not
lc
[
"ports"
]
lc
[
"ports"
].
each_with_index
do
|
port
,
port_uid
|
pattern_source
=
lc
if
port
.
is_a?
(
Hash
)
switch_remote_port
=
port
[
"port"
]
||
lc
[
"port"
]
||
""
switch_remote_uid
=
port
[
"uid"
]
pattern_source
=
port
if
port
.
has_key?
(
'snmp_pattern'
)
or
port
.
has_key?
(
'kavlan_pattern'
)
else
switch_remote_port
=
lc
[
"port"
]
||
""
switch_remote_uid
=
port
...
...
@@ -15,7 +17,7 @@ def kavlan_switch_port_lookup(switch, node_uid, interface='')
if
switch_remote_uid
==
node_uid
and
switch_remote_port
==
interface
# Build port name from snmp_naming_pattern
# Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'
pattern
=
lc
.
has_key?
(
"kavlan_pattern"
)
?
lc
[
"kavlan_pattern"
]
:
lc
[
"snmp_pattern"
]
pattern
=
pattern_source
.
has_key?
(
"kavlan_pattern"
)
?
pattern_source
[
"kavlan_pattern"
]
:
pattern_source
[
"snmp_pattern"
]
port_name
=
pattern
.
sub
(
"%LINECARD%"
,
lc_uid
.
to_s
).
sub
(
"%PORT%"
,
port_uid
.
to_s
)
return
port_name
end
...
...
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