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
540807dd
Commit
540807dd
authored
May 13, 2011
by
Jonathon Lynn Duerig
Browse files
Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel
parents
c6791c2f
e5f66520
Changes
912
Expand all
Hide whitespace changes
Inline
Side-by-side
assign/toptools/check-top
View file @
540807dd
...
...
@@ -23,10 +23,11 @@ use strict;
use
Getopt::
Std
;
my
%opt
;
my
$optlist
=
"
ltL:evDnr
s
";
my
$optlist
=
"
ltL:evDnr
Rsa
";
if
(
!
getopts
(
$optlist
,
\
%opt
)){
warn
"
Usage: $0 [-r] [-l] [-e] [-t] [-L limit] [-v] [-D] [-n] [-s]
\n
";
warn
"
Usage: $0 [-r]
[-R]
[-l] [-e] [-t] [-L limit] [-v] [-D] [-n] [-s]
\n
";
warn
"
-r Remove any files that fail the check
\n
";
warn
"
-R Rename any files that fail the check
\n
";
warn
"
-l List files that pass the check to stdout
\n
";
warn
"
-e Print parse errors from failed files to stderr
\n
";
warn
"
-t When finished, dump information about all types and
\n
";
...
...
@@ -38,6 +39,7 @@ if (!getopts($optlist,\%opt)){
warn
"
private information
\n
";
warn
"
-s Strict checking - only pass files that would be parsed by
\n
";
warn
"
latest version of assign
\n
";
warn
"
-a Enable anonymization
\n
";
exit
1
;
}
...
...
@@ -68,6 +70,14 @@ my %top_linkflags = (
#
sub
is_feature_okay
($)
{
my
(
$feature
)
=
@_
;
# If we are not anonymizing, all features are considered okay
if
(
!
$opt
{
a
})
{
return
1
;
}
# If anyonymizing, don't let through OS features that expose the project
# name
if
(
$feature
=~
/^OS-/
)
{
# OSes in the emulab-ops project are okay, as are ones that are just
# specified with a numeric ID
...
...
@@ -160,7 +170,7 @@ sub check_node_type($) {
#
sub
normalize_ptop
($)
{
my
(
$ptop
)
=
@_
;
my
(
$nodes
,
$links
,
$limits
)
=
@$ptop
;
my
(
$nodes
,
$links
,
$limits
,
$policies
)
=
@$ptop
;
foreach
my
$node
(
@$nodes
)
{
#print "Normalizing $node->{name}\n";
if
(
!
$node
->
{
types
})
{
...
...
@@ -209,12 +219,12 @@ sub normalize_ptop($) {
}
}
# Nothing to do for limits, for now
# Nothing to do for limits
or policies
, for now
}
sub
write_normalized_ptop
($$)
{
my
(
$outfile
,
$ptop
)
=
@_
;
my
(
$nodes
,
$links
,
$limits
)
=
@$ptop
;
my
(
$nodes
,
$links
,
$limits
,
$policies
)
=
@$ptop
;
open
(
OF
,"
>
$outfile
")
or
die
"
Unable to open
$outfile
for writing
";
foreach
my
$node
(
@$nodes
)
{
...
...
@@ -260,6 +270,10 @@ sub write_normalized_ptop($$) {
print
OF
"
set-type-limit
$type
$count
\n
";
}
foreach
my
$policy
(
@$policies
)
{
print
OF
"
policy
"
.
join
("
",
@$policy
)
.
"
\n
";
}
close
(
OF
);
}
...
...
@@ -410,7 +424,7 @@ sub parse_ptop($) {
my
%local_seen_link_types
;
my
%local_seen_fds
;
my
(
@nodes
,
@links
,
@limits
);
my
(
@nodes
,
@links
,
@limits
,
@policies
);
my
$line_no
=
0
;
while
(
my
$line
=
<
PT
>
)
{
...
...
@@ -541,6 +555,11 @@ sub parse_ptop($) {
my
%limit
=
(
type
=>
$type
,
limit
=>
$limit
);
push
@limits
,
\
%limit
;
}
elsif
(
$line_type
eq
"
policy
")
{
# For now, we are just going to pass the rest of the string
# along rather than parsing it carefully, since we don't support
# fancy policies in any ptop version yet
push
@policies
,
[
@tokens
];
}
else
{
die
"
Unknown line type '
$line_type
' on
$ptop
line
$line_no
\n
";
}
...
...
@@ -558,7 +577,7 @@ sub parse_ptop($) {
close
PT
;
return
[
\
@nodes
,
\
@links
,
\
@limits
];
return
[
\
@nodes
,
\
@links
,
\
@limits
,
\
@policies
];
}
sub
parse_top
($)
{
...
...
@@ -635,7 +654,14 @@ sub parse_top($) {
check_type
("
string
",
$link
{
dstiface
});
$link
{
bw
}
=
shift
@tokens
;
check_type
("
int
",
$link
{
bw
});
#
# The bandwidth should be either the string '*' (which means
# 'native speed') or an int
#
if
(
$link
{
bw
}
ne
"
*
")
{
check_type
("
int
",
$link
{
bw
});
}
# This is a bit tricky - figure out if there are delay and
# loss present on the line
...
...
@@ -745,22 +771,9 @@ chomp @dirs;
my
$processed_files
=
0
;
my
$passed_files
=
0
;
foreach
my
$dir
(
@dirs
)
{
#my @ptopfiles = `ls -1 $dir/\*.ptop`;
#my @ptopfiles = ();
#my @topfiles = `ls -1 $dir/\*.top`;
my
@topfiles
;
my
@ptopfiles
;
opendir
DIR
,
"
$dir
"
or
die
"
Unable to open
$dir
: $!
\n
";
while
(
my
$file
=
readdir
DIR
)
{
if
(
$file
=~
/\.ptop$/
)
{
push
@ptopfiles
,
"
$dir
/
$file
";
}
if
(
$file
=~
/\.top$/
)
{
push
@topfiles
,
"
$dir
/
$file
";
}
}
my
@topfiles
=
`
find
$dir
/ -name
\
*.vtop
`;
my
@ptopfiles
=
`
find
$dir
/ -name
\
*.ptop
`;
chomp
@ptopfiles
;
chomp
@topfiles
;
...
...
@@ -770,19 +783,26 @@ foreach my $dir (@dirs) {
}
$processed_files
++
;
my
$ptop_data
=
eval
{
parse_ptop
(
$ptop
);
};
#if (eval { parse_ptop($ptop); }) {
if
(
!
$@
)
{
$passed_files
++
;
if
(
$opt
{
l
})
{
print
"
$ptop
\n
";
}
if
(
$opt
{
n
})
{
# Grab timestamps so that we can preserve them
my
(
$atime
,
$mtime
)
=
(
stat
(
$ptop
))[
8
,
9
];
normalize_ptop
(
$ptop_data
);
write_normalized_ptop
(
$ptop
,
$ptop_data
);
# Restore timestamp
utime
$atime
,
$mtime
,
$ptop
;
}
}
else
{
if
(
$opt
{
r
})
{
system
"
rm
$ptop
";
}
elsif
(
$opt
{
R
})
{
system
"
mv
$ptop
$ptop
.failed
";
}
if
(
$opt
{
e
})
{
print
"
*** FAILED:
$ptop
: $@
\n
";
...
...
@@ -799,22 +819,28 @@ foreach my $dir (@dirs) {
if
(
$opt
{
D
})
{
print
"
Checking top file
$top
\n
";
}
#parse_top($top);
$processed_files
++
;
my
$top_data
=
eval
{
parse_top
(
$top
);
};
#if (eval { parse_top($top); }) {
if
(
!
$@
)
{
$passed_files
++
;
if
(
$opt
{
l
})
{
print
"
$top
\n
";
}
if
(
$opt
{
n
})
{
# Grab timestamps so that we can preserve them
my
(
$atime
,
$mtime
)
=
(
stat
(
$top
))[
8
,
9
];
normalize_top
(
$top_data
);
write_normalized_top
(
$top
,
$top_data
);
# Restore timestamp
utime
$atime
,
$mtime
,
$top
;
}
}
else
{
if
(
$opt
{
r
})
{
system
"
rm
$top
";
}
elsif
(
$opt
{
R
})
{
system
"
mv
$top
$top
.failed
";
}
if
(
$opt
{
e
})
{
print
"
*** FAILED:
$top
: $@
\n
";
...
...
backend/editexp.in
View file @
540807dd
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-20
07
University of Utah and the Flux Group.
# Copyright (c) 2000-20
11
University of Utah and the Flux Group.
# All rights reserved.
#
use
English
;
...
...
@@ -381,15 +381,23 @@ if (exists($editexp_args{"noidleswap_reason"})) {
#
# AutoSwap
#
if
(
exists
(
$editexp_args
{"
autoswap
"}))
{
if
(
$editexp_args
{"
autoswap
"}
ne
"
1
")
{
if
(
!
$this_user
->
IsAdmin
())
{
UserError
("
Max Duration:
"
.
"
you must ask testbed operations to disable this
");
}
$editexp_args
{"
autoswap
"}
=
0
;
}
}
if
(
exists
(
$editexp_args
{"
autoswap_timeout
"}))
{
if
(
$editexp_args
{"
autoswap_timeout
"}
<=
0
)
{
UserError
("
Max Duration: Invalid time provided
");
}
}
if
(
exists
(
$editexp_args
{"
autoswap
"}))
{
if
(
$editexp_args
{"
autoswap
"}
ne
"
1
")
{
$editexp_args
{"
autoswap
"}
=
0
;
#XXX $editexp_args{"autoswap_timeout"} = 0;
if
(
$editexp_args
{"
autoswap_timeout
"}
>
(
24
*
5
)
&&
!
$this_user
->
IsAdmin
())
{
UserError
("
Max Duration: 5 days maximum -
"
.
"
you must ask testbed operations for more
");
}
}
...
...
configure
View file @
540807dd
...
...
@@ -1543,6 +1543,7 @@ CLIENT_VARDIR="/var/emulab"
CLIENT_MANDIR
=
"/usr/local/man"
TBSECURECOOKIES
=
1
TBMAINSITE
=
0
TBUSEDBI
=
0
FANCYBANNER
=
0
VIRTNODE_NETWORK
=
172.16.0.0
VIRTNODE_NETMASK
=
255.240.0.0
...
...
@@ -2671,6 +2672,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
backend/editnodetype backend/editsitevars backend/newimageid
\
backend/editgroup backend/newimageid_ez
\
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/spewlogfile
\
tbsetup/snmpit_test/GNUmakefile
\
tbsetup/spewrpmtar tbsetup/gentopofile tbsetup/power_sgmote.pm
\
tbsetup/console_reset tbsetup/bwconfig tbsetup/power_rpc27.pm
\
tbsetup/power_mail.pm tbsetup/power_whol.pm
\
...
...
@@ -3061,6 +3063,7 @@ s%@TBCOOKIESUFFIX@%$TBCOOKIESUFFIX%g
s%@TBAUTHDOMAIN@%
$TBAUTHDOMAIN
%g
s%@TBAUTHTIMEOUT@%
$TBAUTHTIMEOUT
%g
s%@TBMAINSITE@%
$TBMAINSITE
%g
s%@TBUSEDBI@%
$TBUSEDBI
%g
s%@FANCYBANNER@%
$FANCYBANNER
%g
s%@SFSSUPPORT@%
$SFSSUPPORT
%g
s%@ELABINELAB@%
$ELABINELAB
%g
...
...
configure.in
View file @
540807dd
...
...
@@ -221,6 +221,7 @@ AC_SUBST(NOSTACKMIB)
AC_SUBST(EXP_VIS_SUPPORT)
AC_SUBST(NOSHAREDFS)
AC_SUBST(SELFLOADER_DATA)
AC_SUBST(TBUSEDBI)
#
# Offer both versions of the email addresses that have the @ escaped
...
...
@@ -262,6 +263,7 @@ CLIENT_VARDIR="/var/emulab"
CLIENT_MANDIR="/usr/local/man"
TBSECURECOOKIES=1
TBMAINSITE=0
TBUSEDBI=0
FANCYBANNER=0
VIRTNODE_NETWORK=172.16.0.0
VIRTNODE_NETMASK=255.240.0.0
...
...
@@ -901,6 +903,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
backend/editnodetype backend/editsitevars backend/newimageid \
backend/editgroup backend/newimageid_ez \
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/spewlogfile \
tbsetup/snmpit_test/GNUmakefile \
tbsetup/spewrpmtar tbsetup/gentopofile tbsetup/power_sgmote.pm \
tbsetup/console_reset tbsetup/bwconfig tbsetup/power_rpc27.pm \
tbsetup/power_mail.pm tbsetup/power_whol.pm \
...
...
db/EmulabConstants.pm.in
View file @
540807dd
#
!/usr/bin/perl -w
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2000
-
201
0
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
201
1
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
#
Emulab
constants
.
...
...
@@ -21,7 +21,7 @@ use vars qw(@ISA @EXPORT);
NODESTARTSTATUS_NOSTATUS
PROJMEMBERTRUST_NONE
PROJMEMBERTRUST_USER
PROJMEMBERTRUST_ROOT
PROJMEMBERTRUST_GROUPROOT
PROJMEMBERTRUST_PROJROOT
PROJMEMBERTRUST_LOCALROOT
NODEILL_PID
NODEILL_EID
NODEILL_PID
NODEILL_EID
VLAN_PID
VLAN_EID
TBOPSPID
EXPTLOGNAME
PLABMOND_PID
PLABMOND_EID
PLABHOLDING_PID
PLABHOLDING_EID
...
...
@@ -208,6 +208,8 @@ sub PLABHOLDING_PID() { $TBOPSPID; }
sub
PLABHOLDING_EID
()
{
"plabnodes"
;
}
sub
PLABDOWN_PID
()
{
$
TBOPSPID
;
}
sub
PLABDOWN_EID
()
{
"hwdown"
;
}
sub
VLAN_PID
()
{
$
TBOPSPID
;
}
sub
VLAN_EID
()
{
"vlan-holding"
;
}
sub
OLDRESERVED_PID
()
{
$
TBOPSPID
;
}
sub
OLDRESERVED_EID
()
{
"oldreserved"
;
}
sub
NFREELOCKED_PID
()
{
$
TBOPSPID
;
}
...
...
db/Experiment.pm.in
View file @
540807dd
...
...
@@ -138,7 +138,11 @@ $EXPT_RESOURCESHOSED = 0;
"firewall_rules"
,
"elabinelab_attributes"
,
"virt_tiptunnels"
,
"ipsubnets"
);
"ipsubnets"
,
"virt_blobs"
,
"virt_client_service_ctl"
,
"virt_client_service_hooks"
,
"virt_client_service_opts"
);
%
physicalTables
=
(
"delays"
=>
[
"node_id"
,
"vname"
,
"vnode0"
,
"vnode1"
],
"ipport_ranges"
=>
undef
,
...
...
@@ -3507,6 +3511,135 @@ sub SetupProgramAgents($)
return
0
;
}
#
#
Convert
virt_blobs
into
real
blobs
.
We
go
to
some
pain
to
keep
the
same
#
filenames
associated
with
the
same
uuid
to
make
sure
caching
doesn
't get
# needlessly broken on the client (on a modify).
#
sub UploadBlobs($$)
{
my ($self,$update) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $pid = $self->pid();
my $eid = $self->eid();
my $idx = $self->idx();
my $virtexp = $self->GetVirtExperiment();
return -1
if (!defined($virtexp));
my %blobs = ();
my %virt_blobs = ();
#
# Grab the existing blobs tied to our experiment
#
my $qres = DBQueryFatal("select uuid,filename,vblob_id" .
" from blobs where exptidx=$idx");
if (defined($qres) && $qres->numrows()) {
while (my ($uuid,$filename,$vblob_id) = $qres->fetchrow_array()) {
$blobs{$vblob_id} = [ 0,$uuid,$filename ];
}
}
#
# Now grab our experiment virt blobs
#
my $virt_blobs_table = $virtexp->Table("virt_blobs");
foreach my $row ($virt_blobs_table->Rows()) {
my $vblob_id = $row->vblob_id();
my $filename = $row->filename();
$virt_blobs{$vblob_id} = $filename;
}
#
# Make sure each virt_blob is in the blobs table!
#
foreach my $vblob_id (keys(%virt_blobs)) {
my $vfilename = $virt_blobs{$vblob_id};
if (exists($blobs{$vblob_id})
&& $blobs{$vblob_id}->[2] eq $vfilename) {
# this one is a keeper, so mark it!
$blobs{$vblob_id}->[0] = 1;
}
else {
my $found = 0;
foreach my $rvblob_id (keys(%blobs)) {
# if this one'
s
a
keeper
,
skip
it
!
next
if
($
blobs
{$
rvblob_id
}->[
0
]);
#
if
the
filenames
match
,
we
adjust
the
vblob_id
field
#
in
the
blobs
table
to
match
what
we
have
--
this
leaves
#
the
uuid
<->
filename
mapping
intact
if
($
blobs
{$
rvblob_id
}->[
2
]
eq
$
vfilename
)
{
my
$
uuid
=
$
blobs
{$
rvblob_id
}->[
1
];
$
blobs
{$
vblob_id
}
=
[
1
,$
blobs
{$
rvblob_id
}->[
1
],
$
blobs
{$
rvblob_id
}->[
2
]
];
DBQueryFatal
(
"replace into blobs (uuid,vblob_id)"
.
" values ('$uuid','$vblob_id')"
);
$
found
=
1
;
last
;
}
}
if
(
!$found) {
#
need
to
add
this
blob
fresh
!
my
$
swapperuid
=
$
self
->
swapper
();
DBQueryFatal
(
"insert into blobs"
.
" (uuid,filename,owner_uid,vblob_id,exptidx)"
.
" values (UUID(),'$vfilename','$swapperuid',"
.
" '$vblob_id',$idx)"
);
}
}
}
#
#
Only
remove
real
blobs
if
we
're done using them (i.e., on a modify)
#
if ($update) {
foreach my $vblob_id (keys(%blobs)) {
my ($keep,$uuid,$filename) = @{$blobs{$vblob_id}};
if (!$keep) {
DBQueryFatal("delete from blobs" .
" where exptidx=$idx and vblob_id='
${
vblob_id
}
'");
}
}
}
return 0;
}
#
# Remove any real blobs that were a result of a virt blob (i.e., those
# blobs that have our exptidx and a valid vblob_id).
#
sub RemoveBlobs($$)
{
my ($self) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $idx = $self->idx();
my $qres = DBQueryFatal("delete from blobs using blobs" .
" left join virt_blobs as vblobs" .
" on blobs.vblob_id=vblobs.vblob_id" .
" where blobs.exptidx=$idx" .
" and vblobs.vblob_id is not NULL");
# XXX: probably should clean out blob_files stuff too!
return 0;
}
#
# Seed the virt_agents table. Each lan/link needs an agent to handle
# changes to delays or other link parameters, and that agent (might be
...
...
@@ -4147,10 +4280,92 @@ sub UnBindNonLocalUsers($)
my $idx = $self->idx();
DBQueryWarn
(
"delete from nonlocal_user_bindings "
.
"where exptidx='$idx'"
)
#
# Need to delete the pubkeys, so need a list of current bindings.
#
my $query_result =
DBQueryWarn("select uid,uid_idx from nonlocal_user_accounts ".
"where exptidx='
$
idx
'");
return -1
if (!$query_result);
while (my ($uid, $uid_idx) = $query_result->fetchrow_array()) {
DBQueryWarn("delete from nonlocal_user_pubkeys ".
"where uid_idx='
$
uid_idx
'")
or return -1;
DBQueryWarn("delete from nonlocal_user_accounts ".
"where uid_idx='
$
uid_idx
'")
or return -1;
}
return 0;
}
#
# Bind nonlocal user to experiment (slice, in Geni).
#
sub BindNonLocalUser($$$$$$)
{
my ($self, $keys, $uid, $urn, $name, $email) = @_;
return -1
if (! ref($self));
my $exptidx = $self->idx();
my $safe_urn = DBQuoteSpecial($urn)
if (defined($urn));
my $safe_uid = DBQuoteSpecial($uid);
my $safe_name = DBQuoteSpecial($name);
my $safe_email = DBQuoteSpecial($email);
my $uid_idx;
#
# User may already exist, as for updating keys.
#
my $query_result =
DBQueryWarn("select uid_idx from nonlocal_user_accounts ".
"where uid=$safe_uid and exptidx='
$
exptidx
'");
return -1
if (!$query_result);
if ($query_result->numrows) {
($uid_idx) = $query_result->fetchrow_array();
}
else {
my @insert_data = ();
$uid_idx = User->NextIDX();
push(@insert_data, "created=now()");
push(@insert_data, "uid_idx='
$
uid_idx
'");
push(@insert_data, "unix_uid=NULL");
push(@insert_data, "exptidx='
$
exptidx
'");
push(@insert_data, "urn=$safe_urn")
if (defined($urn));
push(@insert_data, "uid=$safe_uid");
push(@insert_data, "name=$safe_name");
push(@insert_data, "email=$safe_email");
push(@insert_data, "uid_uuid=uuid()");
# Insert into DB.
my $insert_result =
DBQueryWarn("insert into nonlocal_user_accounts set " .
join(",", @insert_data));
}
#
# Always replace the entire key set; easier to manage.
#
DBQueryWarn("delete from nonlocal_user_pubkeys ".
"where uid_idx='
$
uid_idx
'")
or return -1;
foreach my $key (@{ $keys }) {
my $safe_key = DBQuoteSpecial($key);
DBQueryWarn("insert into nonlocal_user_pubkeys set ".
" uid=$safe_uid, uid_idx='
$
uid_idx
', ".
" idx=NULL, stamp=now(), pubkey=$safe_key")
or return -1;
}
return 0;
}
...
...
@@ -4383,6 +4598,10 @@ sub ReserveSharedBandwidth($;$$)
$query_result = $previous_result;
$previous_result = $tmp;
}
# Need to do this when we want to seek around inside the results.
$previous_result = $previous_result->WrapForSeek()
if (defined($previous_result));
$query_result = $query_result->WrapForSeek();
#
# This is how much we need to release.
...
...
db/GNUmakefile.in
View file @
540807dd
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-201
0
University of Utah and the Flux Group.
# Copyright (c) 2000-201
1
University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
...
...
@@ -30,7 +30,8 @@ LIB_SCRIPTS = libdb.pm Node.pm libdb.py libadminctrl.pm Experiment.pm \
NodeType.pm Interface.pm User.pm Group.pm Project.pm \
Image.pm OSinfo.pm Archive.pm Logfile.pm Lan.pm emdbi.pm \
emdb.pm emutil.pm Firewall.pm VirtExperiment.pm libGeni.pm \
libEmulab.pm EmulabConstants.pm TraceUse.pm EmulabFeatures.pm
libEmulab.pm EmulabConstants.pm TraceUse.pm EmulabFeatures.pm \
Port.pm
# Stuff installed on plastic.
USERSBINS = genelists.proxy dumperrorlog.proxy backup
...
...
db/Interface.pm.in
View file @
540807dd
#
!/usr/bin/perl -wT
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2005
-
201
0
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
1
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
package
Interface
;
...
...
@@ -59,7 +59,7 @@ sub LookupAll($$$)
my
$
query_result
=
DBQueryWarn
(
"select * from interfaces "
.
"where node_id='$nodeid'"
);
"where node_id='$nodeid'
and logical=0
"
);
return
-
1
if
(
!$query_result);
...
...
@@ -138,6 +138,7 @@ sub mac($) { return field($_[0], 'mac'); }
sub
IP
($)
{
return
field
($
_
[
0
],
'IP'
);
}
sub
role
($)
{
return
field
($
_
[
0
],
'role'
);
}
sub
type
($)
{
return
field
($
_
[
0
],
'interface_type'
);
}
sub
logical
($)
{
return
field
($
_
[
0
],
'logical'
);
}
sub
mask
($)
{
return
field
($
_
[
0
],
'mask'
);
}
sub
uuid
($)
{
return
field
($
_
[
0
],
'uuid'
);
}
#
Wires
table
...
...
@@ -277,12 +278,12 @@ sub Create($$$)
my
$
node_id
=
$
node
->
node_id
();
my
$
MAC
=
$
argref
->{
'MAC'
};
my
$
MAC
=
$
argref
->{
'MAC'
}
||
$
argref
->{
'mac'
}
;
my
$
IP
=
$
argref
->{
'IP'
};
my
$
mask
=
$
argref
->{
'mask'
};
my
$
card
=
$
argref
->{
'card'
};
my
$
port
=
$
argref
->{
'port'
};
my
$
iftype
=
$
argref
->{
'type'
};
my
$
iftype
=
$
argref
->{
'type'
}
||
$
argref
->{
'interface_type'
}
;
my
$
ifrole
=
$
argref
->{
'role'
};
my
$
uuid
=
$
argref
->{
'uuid'
};
my
$
max_speed
=
$
argref
->{
'max_speed'
};
...
...
@@ -294,6 +295,7 @@ sub Create($$$)
my
$
cable
=
$
argref
->{
'cable'
};
my
$
length
=
$
argref
->{
'length'
};
my
$
iface
=
$
argref
->{
'iface'
};
my
$
logical
=
$
argref
->{
'logical'
};
$
iface
=
"eth$card"
if
(
!defined($iface));
...
...
@@ -307,6 +309,8 @@ sub Create($$$)
if
(
!defined($duplex));
$
max_speed
=
0
if
(
!defined($max_speed));
$
logical
=
0
if
(
!defined($logical));