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
6cdab1b6
Commit
6cdab1b6
authored
May 12, 2011
by
Weibin Sun
Browse files
bug fix: getInterfaceSettings in snmpit_lib used port for card
parent
4e41c69e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/snmpit_test/snmpit_lib.pm
View file @
6cdab1b6
...
...
@@ -116,7 +116,6 @@ sub convertPortFromString($;$)
$p
=
Port
->
LookupByTriple
(
$str
);
return
$p
if
$p
;
if
(
defined
(
$dev
))
{
$p
=
Port
->
LookupByIface
(
Port
->
Tokens2IfaceString
(
$dev
,
$str
));
return
$p
if
$p
;
...
...
@@ -126,6 +125,23 @@ sub convertPortFromString($;$)
$p
=
Port
->
LookupByTriple
(
Port
->
Tokens2TripleString
(
$dev
,
$card
,
$port
));
return
$p
if
$p
;
}
}
elsif
(
$str
~=
/^(.+):(.+)$/
)
{
my
$node
=
$
1
;
my
$card
=
$
2
;
my
$result
=
DBQueryFatal
("
SELECT isswitch FROM node_types WHERE type IN
"
.
"
(SELECT type FROM nodes WHERE node_id='
$node
')
");
#
# Make sure this is not switch port
#
if
(
$result
->
numrows
()
!=
1
||
(
$result
->
fetchrow
())[
0
]
!=
1
)
{
#
# deal with old node:card format
#
$p
=
Port
->
LookupByTriple
(
Port
->
Tokens2TripleString
(
$node
,
$card
,
"
1
"));
return
$p
if
$p
;
}
}
return
undef
;
...
...
@@ -740,6 +756,7 @@ sub getInterfaceSettings ($) {
}
my
$node
=
$interface
->
node_id
();
my
$card
=
$interface
->
card
();
my
$port
=
$interface
->
port
();
my
$result
=
...
...
@@ -748,7 +765,8 @@ sub getInterfaceSettings ($) {
"
left join interface_capabilities as ic on
"
.
"
ic.type=i.interface_type and
"
.
"
capkey='noportcontrol'
"
.
"
WHERE i.node_id='
$node
' and i.card=
$port
");
"
WHERE i.node_id='
$node
' and i.card=
$card
"
.
"
and i.port=
$port
");
# Sanity check - make sure the interface exists
if
(
$result
->
numrows
()
!=
1
)
{
...
...
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