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
c16ced23
Commit
c16ced23
authored
Jun 11, 2010
by
Leigh B Stoller
Browse files
Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel
parents
e349a63c
a742ea9d
Changes
18
Hide whitespace changes
Inline
Side-by-side
db/GNUmakefile.in
View file @
c16ced23
...
...
@@ -52,14 +52,14 @@ TARGETS = emdb.pm emutil.pm emdbi.pm
SETUID_SBIN_SCRIPTS =
endif
$(SUBBOSS_BIN_SCRIPTS):
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(TARGETS)
$(SUBBOSS_BIN_SCRIPTS):
include $(TESTBED_SRCDIR)/GNUmakerules
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
...
...
db/Lan.pm.in
View file @
c16ced23
...
...
@@ -48,6 +48,93 @@ my %LanTables = ("lans" => ["lanid"],
"lan_member_attributes"
=>
[
"lanid"
,
"memberid"
,
"attrkey"
],
"ifaces"
=>
[
"lanid"
,
"ifaceid"
]);
#
#
Initialize
Openflow
attributes
in
lan_attributes
table
.
#
sub
InitOpenflowAttributes
($$$)
{
my
($
exptidx
,
$
vname
,
$
lanid
)
=
@
_
;
my
$
ofenabled
=
0
;
my
$
ofcontroller
=
""
;
my
$
safe_val
;
#
Add
openflow
arrtibutes
:
my
$
query_result
=
DBQueryWarn
(
"select ofenabled, ofcontroller from virt_lans "
.
"where exptidx='$exptidx' and vname='$vname'"
);
return
0
if
(
!$query_result);
($
ofenabled
,
$
ofcontroller
)
=
$
query_result
->
fetchrow_array
()
if
($
query_result
->
numrows
);
#
#
Firstly
check
if
the
attribuets
are
there
,
if
no
values
,
#
insert
them
.
This
is
because
the
vlan
may
be
created
#
by
Lookup
many
times
.
The
values
can
be
overwritten
by
#
the
later
creation
.
#
#
Process
'ofenabled'
:
$
query_result
=
DBQueryWarn
(
"select attrvalue from lan_attributes "
.
"where lanid='$lanid' and attrkey='ofenabled'"
);
return
0
if
(
!$query_result);
if
(
!$query_result->numrows)
{
$
safe_val
=
DBQuoteSpecial
($
ofenabled
);
$
query_result
=
DBQueryWarn
(
"replace into lan_attributes set "
.
" lanid='$lanid', "
.
" attrkey='ofenabled', "
.
" attrvalue=$safe_val, "
.
" attrtype='integer'"
);
return
0
if
(
!defined($query_result));
}
#
Process
'ofcontroller'
:
$
query_result
=
DBQueryWarn
(
"select attrvalue from lan_attributes "
.
"where lanid='$lanid' and attrkey='ofcontroller'"
);
return
0
if
(
!$query_result);
if
(
!$query_result->numrows)
{
$
safe_val
=
DBQuoteSpecial
($
ofcontroller
);
$
query_result
=
DBQueryWarn
(
"replace into lan_attributes set "
.
" lanid='$lanid', "
.
" attrkey='ofcontroller', "
.
" attrvalue=$safe_val, "
.
" attrtype='string'"
);
return
0
if
(
!defined($query_result));
}
#
Process
'oflistener'
:
$
query_result
=
DBQueryWarn
(
"select attrvalue from lan_attributes "
.
"where lanid='$lanid' and attrkey='oflistener'"
);
return
0
if
(
!$query_result);
if
(
!$query_result->numrows)
{
$
safe_val
=
DBQuoteSpecial
(
""
);
$
query_result
=
DBQueryWarn
(
"replace into lan_attributes set "
.
" lanid='$lanid', "
.
" attrkey='oflistener', "
.
" attrvalue=$safe_val, "
.
" attrtype='string'"
);
return
0
if
(
!defined($query_result));
}
return
1
;
}
#
#
Lookup
and
create
a
class
instance
to
return
.
#
...
...
@@ -107,6 +194,9 @@ sub Lookup($$;$$)
$
self
->{
"ATTRS"
}
=
{};
$
self
->{
"EXPT"
}
=
$
experiment
;
return
undef
if
(
!Lan->InitOpenflowAttributes($self->{'LAN'}->{'exptidx'}, $self->{'LAN'}->{'vname'}, $lanid));
#
#
Grab
the
attributes
for
this
lan
now
.
#
...
...
@@ -188,7 +278,7 @@ sub Create($$$;$$$)
#
Need
the
newly
minted
ID
my
$
lanid
=
$
query_result
->
insertid
();
my
$
lan
=
Lan
->
Lookup
($
lanid
);
print
"Created lan: $lan
\n
"
if
($
debug
&&
$
lan
);
return
$
lan
;
...
...
db/libGeni.pm.in
View file @
c16ced23
...
...
@@ -452,7 +452,7 @@ sub RedeemTickets($$$)
};
print
STDERR
"Redeeming all tickets in parallel ...
\n
"
;
if
(
ParRun
(
undef
,
\@
results
,
$
coderef
,
@
resources
))
{
if
(
ParRun
(
{
'maxwaittime'
=>
300
}
,
\@
results
,
$
coderef
,
@
resources
))
{
print
STDERR
"*** RedeemTickets: Internal error getting tickets
\n
"
;
#
#
Need
to
be
careful
here
;
some
of
the
tickets
might
have
been
...
...
@@ -515,20 +515,25 @@ sub MapNodes($$)
print
STDERR
"$manifest_string
\n
"
if
($
verbose
);
foreach
my
$
ref
(
GeniXML
::
FindNodes
(
"n:node"
,
$
manifest
)->
get_nodelist
())
{
my
$
sliver_urn
=
GeniXML
::
Get
SliverId
(
$
ref
);
my
$
sliver_urn
=
GeniXML
::
Get
Text
(
"sliver_urn"
,
$
ref
);
my
$
vname
=
GeniXML
::
GetVirtualId
($
ref
);
my
$
sshdport
=
GeniXML
::
GetText
(
"sshdport"
,
$
ref
);
my
$
manager_urn
=
GeniXML
::
GetText
(
"component_manager_urn"
,
$
ref
);
#
#
The
manifest
can
include
nodes
from
other
CMs
.
There
will
not
#
be
a
sliver
urn
in
that
case
.
#
my
$
component_manager_urn
=
GeniXML
::
GetManagerId
($
ref
);
next
if
(
!defined($sliver_urn) && !defined($component_manager_urn));
if
(
!defined($sliver_urn));
#
Hmm
,
still
need
to
check
this
.
next
if
(
!defined($manager_urn) ||
$
manager_urn
ne
$
resource
->
manager_urn
());
my
$
node
=
$
experiment
->
VnameToNode
($
vname
);
if
(
!defined($node)) {
...
...
install/boss-install.in
View file @
c16ced23
...
...
@@ -155,6 +155,8 @@ my $TFTPD_PKG = "emulab-tftp-hpa-0.48";
my
$P5DBD_PKG
=
"
p5-DBD-mysql50-3.0002
";
# XXX temporary until fix dependencies in emulab-boss package
my
$PYM2_PKG
=
"
py25-m2crypto-0.19.1
";
# XXX temporary until someone extracts their head from the dark regions
my
$EASYINSTALL
=
"
/usr/local/bin/easy_install
";
#
# Named pid file.
...
...
@@ -603,6 +605,44 @@ Phase "portfixup", "Fixing up packages", sub {
ExecQuietFatal
("
$ENV
PKG_PATH=
$packagedir
$PKG_ADD
$pname
");
};
}
if
(
$FBSD_MAJOR
>
6
)
{
#
# What a crock! First, that the FreeBSD ports system
# defaults to installing the zipped .egg files that have
# to be unzipped per-user before use. Second, that it
# offers no easy way at package creation to override this.
# Third, that there is no easy way that I could find in
# the python eggs system to set a global cache directory
# into which to unpack all eggs; you have to set
# PYTHON_EGG_CACHE in the environment of every script.
# Fourth, that the per-user default value might be in an
# unwritable location.
#
# So, I am reduced to manually unpacking all .egg files
# into the corresponding .egg directories after the
# install! Since this would totally screw any attempt
# to update those packages, I just do it to the one
# package that I know will fail otherwise.
#
Phase
"
m2crypto-egg
",
"
Unpacking python m2crypto .egg
",
sub
{
my
$pydir
=
"
/usr/local/lib/python2.5/site-packages
";
my
$egg
=
`
ls -d
$pydir
/M2Crypto-0.19.1-py2.5-*.egg 2>/dev/null
`;
chomp
(
$egg
);
if
(
!
-
x
$EASYINSTALL
)
{
PhaseSkip
("
python easy_install missing
");
}
if
(
$egg
eq
"")
{
PhaseSkip
("
py25-m2crypto egg not found
");
}
if
(
-
d
"
$egg
")
{
PhaseSkip
("
py25-m2crypto egg already unpacked
");
}
ExecQuietFatal
("
mv
$egg
/var/tmp/
");
$egg
=~
s/$pydir//
;
ExecQuietFatal
("
$EASYINSTALL
-Z /var/tmp
$egg
");
ExecQuietFatal
("
mv /var/tmp
$egg
$pydir
/
$egg
.bak
");
};
}
};
Phase
"
patches
",
"
Applying patches
",
sub
{
...
...
@@ -760,7 +800,7 @@ Phase "syslog", "Setting up syslog", sub {
"
!tftpd
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/tftpd.log
",
"
!capserver
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/capserver.log
",
"
!frisbeed
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/frisbeed.log
",
"
!pubsubd
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/pubsubd.log
",
"
!pubsubd
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/pubsubd.log
",
"
!osselect
",
"
*.*
\t\t\t\t\t\t
$LOGDIR
/osselect.log
",
"
!genlastlog
","
*.*
\t\t\t\t\t\t
$LOGDIR
/genlastlog.log
",
"
!sdcollectd
","
*.*
\t\t\t\t\t\t
$LOGDIR
/sdcollectd.log
",
...
...
@@ -997,7 +1037,8 @@ Phase "rc.conf", "Adding testbed content to $RCCONF", sub {
qq|xntpd_enable="YES"|
,
qq|syslogd_flags=""|
,
qq|tftpd_flags="-lvvvv -C 40 -s /tftpboot"|
,
qq|apache_enable="YES"|
);
qq|apache_enable="YES"|
,
qq|pubsubd_flags="-T 10"|
);
# Starting at FreeBSD 6 we use the default version of bind, not the port.
if
(
$FBSD_MAJOR
<
6
)
{
...
...
install/ops-install.in
View file @
c16ced23
...
...
@@ -74,6 +74,8 @@ my $TBADMINGID = 101;
my
$P5DBD_PKG
=
"
p5-DBD-mysql50-3.0002
";
# XXX temporary until fix dependencies in emulab-ops package
my
$PYM2_PKG
=
"
py25-m2crypto-0.19.1
";
# XXX temporary until someone extracts their head from the dark regions
my
$EASYINSTALL
=
"
/usr/local/bin/easy_install
";
#
# Allow this to work if the library is left in the source directory
...
...
@@ -544,6 +546,44 @@ Phase "portfixup", "Fixing up packages", sub {
ExecQuietFatal
("
$ENV
PKG_PATH=
$packagedir
$PKG_ADD
$pname
");
};
}
if
(
$FBSD_MAJOR
>
6
)
{
#
# What a crock! First, that the FreeBSD ports system
# defaults to installing the zipped .egg files that have
# to be unzipped per-user before use. Second, that it
# offers no easy way at package creation to override this.
# Third, that there is no easy way that I could find in
# the python eggs system to set a global cache directory
# into which to unpack all eggs; you have to set
# PYTHON_EGG_CACHE in the environment of every script.
# Fourth, that the per-user default value might be in an
# unwritable location.
#
# So, I am reduced to manually unpacking all .egg files
# into the corresponding .egg directories after the
# install! Since this would totally screw any attempt
# to update those packages, I just do it to the one
# package that I know will fail otherwise.
#
Phase
"
m2crypto-egg
",
"
Unpacking python m2crypto .egg
",
sub
{
my
$pydir
=
"
/usr/local/lib/python2.5/site-packages
";
my
$egg
=
`
ls -d
$pydir
/M2Crypto-0.19.1-py2.5-*.egg 2>/dev/null
`;
chomp
(
$egg
);
if
(
!
-
x
$EASYINSTALL
)
{
PhaseSkip
("
python easy_install missing
");
}
if
(
$egg
eq
"")
{
PhaseSkip
("
py25-m2crypto egg not found
");
}
if
(
-
d
"
$egg
")
{
PhaseSkip
("
py25-m2crypto egg already unpacked
");
}
ExecQuietFatal
("
mv
$egg
/var/tmp/
");
$egg
=~
s/$pydir//
;
ExecQuietFatal
("
$EASYINSTALL
-Z /var/tmp
$egg
");
ExecQuietFatal
("
mv /var/tmp
$egg
$pydir
/
$egg
.bak
");
};
}
};
Phase
"
patches
",
"
Applying patches
",
sub
{
...
...
@@ -587,7 +627,8 @@ Phase "rc.conf", "Adding testbed content to rc.conf", sub {
((
$ISFS
&&
$WINSUPPORT
)
?
qq|smbd_enable="YES"|
:
()),
qq|apache_enable="YES"|
,
qq|syslogd_flags=""|
,
(
$CVSSUPPORT
?
qq|cvsd_enable="YES"|
:
()));
(
$CVSSUPPORT
?
qq|cvsd_enable="YES"|
:
()),
qq|pubsubd_flags="-T 10"|
);
};
Phase
"
hosts
",
"
Adding boss/ops/fs IP addresses to
$HOSTS
",
sub
{
...
...
protogeni/lib/GeniCM.pm.in
View file @
c16ced23
...
...
@@ -158,7 +158,7 @@ sub Resolve($)
undef
,
"Nothing here by that name"
);
}
my
$
rspec
=
GetAdvertisement
(
0
,
$
node
->
node_id
());
my
$
rspec
=
GetAdvertisement
(
0
,
$
node
->
node_id
()
,
"0.1"
);
if
(
! defined($rspec)) {
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"Could not start avail"
);
...
...
@@ -248,7 +248,7 @@ sub DiscoverResourcesAux($$$)
#
# Acquire the advertisement from ptopgen and compress it if requested.
#
my $xml = GetAdvertisement($available, undef);
my $xml = GetAdvertisement($available, undef
, "0.2"
);
if (! defined($xml)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not start avail");
...
...
@@ -266,12 +266,12 @@ sub DiscoverResourcesAux($$$)
#
# Use ptopgen in xml mode to spit back an xml file.
#
sub GetAdvertisement($$)
sub GetAdvertisement($$
$
)
{
my ($available, $pc) = @_;
my ($available, $pc
, $version
) = @_;
my $xml = undef;
my $invocation = "$PTOPGEN -x -g
0.2
-r -p GeniSlices";
my $invocation = "$PTOPGEN -x -g
$version
-r -p GeniSlices";
$invocation .= " -a" unless $available;
if (defined($pc)) {
$invocation .= " -1 $pc";
...
...
protogeni/lib/GeniCMV2.pm.in
View file @
c16ced23
...
...
@@ -139,7 +139,7 @@ sub Resolve($)
if
($
type
eq
"node"
)
{
my
$
node
=
$
object
;
my
$
rspec
=
GeniCM
::
GetAdvertisement
(
0
,
$
node
->
node_id
());
my
$
rspec
=
GeniCM
::
GetAdvertisement
(
0
,
$
node
->
node_id
()
,
"0.1"
);
if
(
! defined($rspec)) {
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"Error getting advertisement"
);
...
...
protogeni/lib/GeniCredential.pm.in
View file @
c16ced23
...
...
@@ -330,7 +330,8 @@ sub CreateFromSigned($$;$)
return
undef
;
}
if
(
!($target_certificate->hrn() =~ /^[-\w\.]+$/)) {
print
STDERR
"Invalid hrn in credential
\n
"
;
my
$
hrn
=
$
target_certificate
->
hrn
();
print
STDERR
"Invalid hrn $hrn in target of credential
\n
"
;
return
undef
;
}
if
(
!GeniHRN::IsValid($target_certificate->urn())) {
...
...
@@ -353,7 +354,8 @@ sub CreateFromSigned($$;$)
return
undef
;
}
if
(
!($owner_certificate->hrn() =~ /^[-\w\.]+$/)) {
print
STDERR
"Invalid hrn in credential
\n
"
;
my
$
hrn
=
$
owner_certificate
->
hrn
();
print
STDERR
"Invalid hrn $hrn in owner of credential
\n
"
;
return
undef
;
}
if
(
!GeniHRN::IsValid($owner_certificate->urn())) {
...
...
protogeni/lib/GeniTicket.pm.in
View file @
c16ced23
...
...
@@ -337,8 +337,9 @@ sub CreateFromSignedTicket($$;$$)
print STDERR "Invalid target_uuid in credential\n";
return undef;
}
if (!($target_certificate->hrn() =~ /^[\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
if (!($target_certificate->hrn() =~ /^[-\w\.]+$/)) {
my $hrn = $target_certificate->hrn();
print STDERR "Invalid hrn $hrn in target of ticket\n";
return undef;
}
...
...
@@ -358,8 +359,9 @@ sub CreateFromSignedTicket($$;$$)
print STDERR "Invalid target_uuid in credential\n";
return undef;
}
if (!($owner_certificate->hrn() =~ /^[\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
if (!($owner_certificate->hrn() =~ /^[-\w\.]+$/)) {
my $hrn = $owner_certificate->hrn();
print STDERR "Invalid hrn $hrn in owner of ticket\n";
return undef;
}
...
...
sql/database-create.sql
View file @
c16ced23
...
...
@@ -3831,6 +3831,8 @@ CREATE TABLE `virt_lans` (
`layer`
tinyint
(
4
)
NOT
NULL
default
'2'
,
`implemented_by_path`
tinytext
,
`implemented_by_link`
tinytext
,
`ofenabled`
tinyint
(
1
)
default
'0'
,
`ofcontroller`
tinytext
,
PRIMARY
KEY
(
`exptidx`
,
`vname`
,
`vnode`
,
`vport`
),
UNIQUE
KEY
`vport`
(
`pid`
,
`eid`
,
`vname`
,
`vnode`
,
`vport`
),
KEY
`pid`
(
`pid`
,
`eid`
,
`vname`
),
...
...
sql/database-fill.sql
View file @
c16ced23
...
...
@@ -684,6 +684,9 @@ REPLACE INTO table_regex VALUES ('virt_lans','fixed_iface','text','redirect','de
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'modbase'
,
'int'
,
'redirect'
,
'default:boolean'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'compat'
,
'int'
,
'redirect'
,
'default:boolean'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'layer'
,
'int'
,
'redirect'
,
'default:tinyint'
,
1
,
2
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'ofenabled'
,
'int'
,
'redirect'
,
'default:boolean'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'ofcontroller'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_node_desires'
,
'pid'
,
'text'
,
'redirect'
,
'projects:pid'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_node_desires'
,
'eid'
,
'text'
,
'redirect'
,
'experiments:eid'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_node_desires'
,
'vname'
,
'text'
,
'redirect'
,
'virt_nodes:vname'
,
0
,
0
,
NULL
);
...
...
sql/updates/4/211
0 → 100644
View file @
c16ced23
#
# Add virt_paths
#
use strict;
use libdb;
sub DoUpdate($$$)
{
if (!DBSlotExists("virt_lans", "ofenabled")) {
DBQueryFatal("ALTER TABLE virt_lans ADD ".
" `ofenabled` tinyint(1) default '0'");
}
if (!DBSlotExists("virt_lans", "ofcontroller")) {
DBQueryFatal("ALTER TABLE virt_lans ADD ".
" `ofcontroller` tinytext");
}
DBQueryFatal("REPLACE INTO table_regex VALUES" .
" ('virt_lans', 'ofenabled', 'int', 'redirect', ".
" 'default:boolean', 0,0,NULL);");
DBQueryFatal("REPLACE INTO table_regex VALUES" .
" ('virt_lans', 'ofcontroller', 'text', 'redirect', ".
" 'default:tinytext', 0,0,NULL);");
return 0;
}
1;
tbsetup/ns2ir/lanlink.tcl
View file @
c16ced23
...
...
@@ -273,6 +273,11 @@ LanLink instproc init {s nodes bw d type} {
$self instvar iscloud
$self set iscloud 0
$self instvar ofenabled
$self instvar ofcontroller
#$self instvar oflistener # this is not needed
$self set ofenabled 0
foreach node $nodes
{
set nodepair
[
list $node
[
$node
add_lanlink $self
]]
set bandwidth
(
$nodepair
)
$bw
...
...
@@ -296,6 +301,16 @@ LanLink instproc init {s nodes bw d type} {
}
}
#
# Enable Openflow on lan/link and set controller
#
LanLink instproc enable_openflow
{
ofcontrollerstr
}
{
$self instvar ofenabled
$self instvar ofcontroller
set ofenabled 1
set ofcontroller $ofcontrollerstr
}
#
# Set the mustdelay flag.
#
...
...
@@ -753,6 +768,8 @@ Link instproc updatedb {DB} {
$self instvar fixed_iface
$self instvar layer
$self instvar implemented_by
$self instvar ofenabled
$self instvar ofcontroller
$sim spitxml_data
"virt_lan_lans"
[
list
"vname"
]
[
list $self
]
...
...
@@ -882,6 +899,22 @@ Link instproc updatedb {DB} {
if
{
$implemented_by !=
{}
}
{
lappend values $implemented_by
}
# openflow
#
# table: virt_lans
# columns: ofenabled = 0/1
# ofcontroller =
""
/
"controller connection string"
#
lappend fields
"ofenabled"
lappend fields
"ofcontroller"
lappend values $ofenabled
if
{
$ofenabled
== 1
}
{
lappend values $ofcontroller
}
else
{
lappend values
""
}
$sim
spitxml_data
"virt_lans"
$fields
$values
}
...
...
@@ -919,6 +952,8 @@ Lan instproc updatedb {DB} {
$self instvar member_settings
$self instvar mustdelay
$self instvar fixed_iface
$self instvar ofenabled
$self instvar ofcontroller
if
{
$modelnet
_cores > 0 || $modelnet_edges > 0
}
{
perror
"Lans are not allowed when using modelnet; just duplex links."
...
...
@@ -1047,6 +1082,22 @@ Lan instproc updatedb {DB} {
lappend values $fixed_iface
(
$nodeport
)
}
# openflow
#
# table: virt_lans
# columns: ofenabled = 0/1
# ofcontroller =
""
/
"controller connection string"
#
lappend fields
"ofenabled"
lappend fields
"ofcontroller"
lappend values $ofenabled
if
{
$ofenabled
== 1
}
{
lappend values $ofcontroller
}
else
{
lappend values
""
}
$sim
spitxml_data
"virt_lans"
$fields
$values
foreach setting_key
[
array names member_settings
]
{
...
...
tbsetup/ptopgen.in
View file @
c16ced23
...
...
@@ -1655,7 +1655,11 @@ sub print_switch
push
@$interfaces
,
"
(null)
";
}
# XXX
print_node
(
$name
,
["
switch:1
",
"
*lan:*
"],
[]
,
[]
,
$uuid
,
$interfaces
,
my
$types
=
["
switch:1
"];
if
(
$name
ne
"
procurve1
")
{
push
(
@$types
,
"
*lan:*
");
}
print_node
(
$name
,
$types
,
[]
,
[]
,
$uuid
,
$interfaces
,
$country
,
$latitude
,
$longitude
,
undef
);
}
...
...
tbsetup/snmpit.in
View file @
c16ced23
...
...
@@ -1547,6 +1547,36 @@ sub doVlansFromTables($$@) {
}
delete
(
$trunkedPorts
{
$port
});
}
#
# Set openflow
#
# A much more right place for the openflow settings is CreateOneVlan,
# however, it is called by sync vlan function and others, which don't destroy
# the existing vlan_arrtibutes rows.
#
# TODO: Move this part to CreateOneVlan and Make sure the existed
# vlan_attributes rows are deleted
#
my
$ofenabled
;
$vlan
->
GetAttribute
("
ofenabled
",
\
$ofenabled
);
if
(
defined
(
$ofenabled
)
&&
$ofenabled
==
1
)
{
$errors
+=
doOpenflowEnable
(
$stacks
,
$vlanid
);
my
$ofcontroller
;
$vlan
->
GetAttribute
("
ofcontroller
",
\
$ofcontroller
);
if
(
defined
(
$ofcontroller
)
&&
$ofcontroller
ne
"")
{
$errors
+=
doSetOpenflowController
(
$stacks
,
$vlanid
,
$ofcontroller
);
}
$errors
+=
doEnableOpenflowListener
(
$stacks
,
$vlanid
);
# doEnableOpenflowListener updates the lan_arrtibutes table, so vlan
# should refresh itself. But here vlan will not be used any more, so
# maybe we can comment this refresh.
$vlan
->
Refresh
();
}
# Delete this vlan from the list that will be created below.
delete
(
$vlans
{"
$vlanid
"});
}
...
...
@@ -1586,6 +1616,35 @@ sub doVlansFromTables($$@) {
my
@ports
=
getVlanPorts
(
$vlanid
);
$errors
+=
CreateOneVlan
(
$stack
,
$vlanid
,
@ports
);
#
# Set openflow
#
# A much more right place for the openflow settings is CreateOneVlan,
# however, it is called by sync vlan function and others, which don't destroy
# the existing vlan_arrtibutes rows.
#
# TODO: Move this part to CreateOneVlan and Make sure the existed
# vlan_attributes rows are deleted
#
my
$ofenabled
;
$vlan
->
GetAttribute
("
ofenabled
",
\
$ofenabled
);
if
(
defined
(
$ofenabled
)
&&
$ofenabled
==
1
)
{
$errors
+=
doOpenflowEnable
(
$stacks
,
$vlanid
);
my
$ofcontroller
;
$vlan
->
GetAttribute
("
ofcontroller
",
\
$ofcontroller
);
if
(
defined
(
$ofcontroller
)
&&
$ofcontroller
ne
"")
{
$errors
+=
doSetOpenflowController
(
$stacks
,
$vlanid
,
$ofcontroller
);
}
$errors
+=
doEnableOpenflowListener
(
$stacks
,
$vlanid
);
# doEnableOpenflowListener updates the lan_arrtibutes table, so vlan
# should refresh itself. But here vlan will not be used any more, so
# maybe we can comment this refresh.
$vlan
->
Refresh
();
}
}
return
$errors
;
}
...
...
@@ -2688,6 +2747,13 @@ sub doEnableOpenflowListener($$) {
}
ofunlock
();
#
# update the vlan object with the new listener string
# other openflow functions may also need this, especially doOpenflowEnable/doOpenflowDisable