Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
23b14020
Commit
23b14020
authored
Feb 23, 2005
by
Mike Hibler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -m option to print MAC address
parent
72ae5b5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
db/if2port.in
db/if2port.in
+19
-8
No files found.
db/if2port.in
View file @
23b14020
...
...
@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2002
, 2005
University of Utah and the Flux Group.
# All rights reserved.
#
use
Getopt::
Std
;
...
...
@@ -45,10 +45,11 @@ my %cards = ( 'pc600' => [ 'second from left','third from left',
my
%wires
=
(
Node
=>
'
yellow
',
Control
=>
'
red
',
Power
=>
'
green
',
Serial
=>
'
white
'
);
# Options: v = verbose, d = debug
my
%opt
=
(
v
=>
0
,
d
=>
0
);
# Options: v = verbose, d = debug
, m = show mac
my
%opt
=
(
v
=>
0
,
d
=>
0
,
m => 0
);
getopts
('
vd
',
\
%opt
);
getopts('vdm',\%opt);
$opt{m} =
0
if
(
$opt
{
v
});
if
(
@ARGV
<
1
)
{
...
...
@@ -60,11 +61,21 @@ while (my $arg = shift @ARGV) {
&debug
("
Node is
$node
");
&debug
("
Card is
$card
")
if
(
defined
$card
);
my
$query
=
qq|SELECT node_id1,card1,node_id2,card2,port2,cable,len|
.
qq|,wires.type,nodes.type FROM wires LEFT JOIN nodes |
.
qq|ON node_id1 = node_id WHERE node_id1="$node"|
;
my
$query
;
if
(
$opt
{
m}) {
$query = "SELECT w.node_id1,w.card1,i.mac,w.node_id2,".
"w.card2,w.port2,w.cable,w.len,w.type,n.type ".
"FROM wires AS w,nodes AS n,interfaces AS i ".
"WHERE w.node_id1=n.node_id AND ".
"w.node_id1=i.node_id AND w.card1=i.card";
}
else
{
$query
=
"
SELECT w.node_id1,w.card1,w.node_id2,w.card2,w.port2,
"
.
"
w.cable,w.len,w.type,n.type
"
.
"
FROM wires AS w,nodes AS n WHERE w.node_id1=n.node_id
";
}
$query
.=
"
AND node_id1='
$node
'
";
if
(
defined
$card
)
{
$query
.=
qq|AND card1="$card"|
;
$query
.=
"
AND card1='
$card
'
"
;
}
&debug
("
Sending query
$query
\n
");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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