Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
92dae219
Commit
92dae219
authored
Apr 27, 2011
by
Weibin Sun
Browse files
isswitchport to recognize node.card/port format
parent
2f02f934
Changes
3
Hide whitespace changes
Inline
Side-by-side
db/Port.pm
View file @
92dae219
...
...
@@ -797,6 +797,17 @@ sub toNodeCardString($) {
return
Tokens2IfaceString
(
$_
[
0
]
->
node_id
(),
$_
[
0
]
->
card
());
}
sub
getEndByNode
($$)
{
my
(
$self
,
$n
)
=
@_
;
if
(
$n
eq
$self
->
node_id
())
{
return
$self
;
}
elsif
(
$n
eq
$self
->
other_end_node_id
())
{
return
$self
->
getOtherEndPort
();
}
else
{
return
undef
;
}
}
sub
getOtherEndTripleString
($)
{
return
Tokens2TripleString
(
$_
[
0
]
->
other_end_node_id
(),
$_
[
0
]
->
other_end_card
(),
$_
[
0
]
->
other_end_port
());
}
...
...
tbsetup/new_snmpit_apcon.pm
View file @
92dae219
...
...
@@ -229,12 +229,13 @@ sub toApconPort($$)
{
my
(
$self
,
$p
)
=
@_
;
if
(
$p
->
node_id
()
ne
$self
->
{
NAME
})
{
return
$p
;
my
$apcport
=
$p
->
getEndByNode
(
$self
->
{
NAME
});
if
(
!
defined
(
$apcport
))
{
return
$p
;
}
my
$card
=
chr
(
ord
('
A
')
+
int
(
$
p
->
card
())
-
1
);
my
$port
=
sprintf
("
%02d
",
int
(
$
p
->
port
()));
my
$card
=
chr
(
ord
('
A
')
+
int
(
$
apcport
->
card
())
-
1
);
my
$port
=
sprintf
("
%02d
",
int
(
$
apcport
->
port
()));
return
"
$card
"
.
"
$port
";
}
...
...
tbsetup/snmpit_lib.pm
View file @
92dae219
...
...
@@ -688,7 +688,7 @@ sub convertPortFromIface($;$) {
sub
isSwitchPort
($)
{
my
$port
=
shift
;
if
(
$port
=~
/^(.+):(.+)/
)
{
if
(
$port
=~
/^(.+):(.+)/
||
$port
=~
/^(.+)\.(.+)\/(.+)$/
)
{
my
$node
=
$
1
;
my
$result
=
DBQueryFatal
("
SELECT isswitch FROM node_types WHERE type IN
"
.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment