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
db9d77f7
Commit
db9d77f7
authored
Aug 11, 2010
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Plain Diff
Merge in master after Taruns changes
parents
dd427042
10c5face
Changes
75
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
6662 additions
and
2856 deletions
+6662
-2856
assign/GNUmakefile.in
assign/GNUmakefile.in
+13
-3
assign/annotate.cc
assign/annotate.cc
+77
-25
assign/annotate.h
assign/annotate.h
+32
-22
assign/annotate_rspec.cc
assign/annotate_rspec.cc
+279
-300
assign/annotate_rspec.h
assign/annotate_rspec.h
+82
-82
assign/annotate_rspec_v2.cc
assign/annotate_rspec_v2.cc
+697
-0
assign/annotate_rspec_v2.h
assign/annotate_rspec_v2.h
+137
-0
assign/assign.cc
assign/assign.cc
+5
-4
assign/common.h
assign/common.h
+1
-0
assign/emulab_extensions_parser.cc
assign/emulab_extensions_parser.cc
+312
-0
assign/emulab_extensions_parser.h
assign/emulab_extensions_parser.h
+132
-0
assign/featuredesire.h
assign/featuredesire.h
+1
-1
assign/fstring.h
assign/fstring.h
+2
-0
assign/parse_advertisement_rspec.cc
assign/parse_advertisement_rspec.cc
+590
-560
assign/parse_advertisement_rspec.h
assign/parse_advertisement_rspec.h
+1
-1
assign/parse_request_rspec.cc
assign/parse_request_rspec.cc
+691
-639
assign/parse_request_rspec.h
assign/parse_request_rspec.h
+1
-2
assign/pclass.h
assign/pclass.h
+1
-1
assign/ptop-top.xsd
assign/ptop-top.xsd
+63
-3
assign/ptop.xsd
assign/ptop.xsd
+0
-85
assign/rspec_parser.cc
assign/rspec_parser.cc
+387
-0
assign/rspec_parser.h
assign/rspec_parser.h
+170
-0
assign/rspec_parser_helper.cc
assign/rspec_parser_helper.cc
+142
-0
assign/rspec_parser_helper.h
assign/rspec_parser_helper.h
+57
-0
assign/rspec_parser_v1.cc
assign/rspec_parser_v1.cc
+179
-0
assign/rspec_parser_v1.h
assign/rspec_parser_v1.h
+57
-0
assign/rspec_parser_v2.cc
assign/rspec_parser_v2.cc
+372
-0
assign/rspec_parser_v2.h
assign/rspec_parser_v2.h
+78
-0
assign/score.cc
assign/score.cc
+12
-10
assign/solution.cc
assign/solution.cc
+128
-121
assign/top.xsd
assign/top.xsd
+0
-297
assign/vtop-top.xsd
assign/vtop-top.xsd
+63
-3
assign/vtop.xsd
assign/vtop.xsd
+0
-211
assign/xmlhelpers.cc
assign/xmlhelpers.cc
+12
-11
assign/xmlhelpers.h
assign/xmlhelpers.h
+47
-22
assign/xstr.h
assign/xstr.h
+1
-1
backend/newimageid.in
backend/newimageid.in
+14
-1
backend/newimageid_ez.in
backend/newimageid_ez.in
+13
-4
configure
configure
+2
-0
configure.in
configure.in
+2
-0
db/Experiment.pm.in
db/Experiment.pm.in
+1
-1
db/libGeni.pm.in
db/libGeni.pm.in
+6
-2
event/DESIGN
event/DESIGN
+7
-1
install/descriptors-v2.xml
install/descriptors-v2.xml
+20
-23
install/load-descriptors.in
install/load-descriptors.in
+34
-27
protogeni/lib/GeniCM.pm.in
protogeni/lib/GeniCM.pm.in
+11
-5
protogeni/lib/GeniCredential.pm.in
protogeni/lib/GeniCredential.pm.in
+4
-1
protogeni/lib/GeniSES.pm.in
protogeni/lib/GeniSES.pm.in
+65
-23
protogeni/rspec/0.1/GNUmakefile.in
protogeni/rspec/0.1/GNUmakefile.in
+3
-3
protogeni/rspec/0.1/common.rnc
protogeni/rspec/0.1/common.rnc
+4
-2
protogeni/rspec/0.2/GNUmakefile.in
protogeni/rspec/0.2/GNUmakefile.in
+33
-0
protogeni/rspec/2/GNUmakefile.in
protogeni/rspec/2/GNUmakefile.in
+33
-0
protogeni/rspec/2/any-extension-schema.xsd
protogeni/rspec/2/any-extension-schema.xsd
+2
-4
protogeni/rspec/2/request.rnc
protogeni/rspec/2/request.rnc
+4
-0
protogeni/rspec/GNUmakefile.in
protogeni/rspec/GNUmakefile.in
+3
-1
protogeni/rspec/ext/emulab/1/ptop_extension.rnc
protogeni/rspec/ext/emulab/1/ptop_extension.rnc
+41
-0
protogeni/rspec/ext/emulab/1/top_extension.rnc
protogeni/rspec/ext/emulab/1/top_extension.rnc
+63
-0
protogeni/rspec/ext/emulab/1/vtop_extension.rnc
protogeni/rspec/ext/emulab/1/vtop_extension.rnc
+64
-0
protogeni/rspec/xsdgen
protogeni/rspec/xsdgen
+11
-0
protogeni/scripts/GNUmakefile.in
protogeni/scripts/GNUmakefile.in
+2
-1
protogeni/scripts/advt-merge.py.in
protogeni/scripts/advt-merge.py.in
+297
-0
protogeni/test/delegate.py
protogeni/test/delegate.py
+12
-8
protogeni/test/getticket.py
protogeni/test/getticket.py
+3
-1
protogeni/xmlrpc/geni-am.pm.in
protogeni/xmlrpc/geni-am.pm.in
+34
-1
protogeni/xmlrpc/protogeni-cm.pm.in
protogeni/xmlrpc/protogeni-cm.pm.in
+6
-1
protogeni/xmlrpc/protogeni-wrapper.pl.in
protogeni/xmlrpc/protogeni-wrapper.pl.in
+26
-10
sql/database-fill-supplemental.sql
sql/database-fill-supplemental.sql
+2
-0
tbsetup/libvtop.pm.in
tbsetup/libvtop.pm.in
+758
-243
tbsetup/mapper.in
tbsetup/mapper.in
+85
-39
tbsetup/pool_daemon.in
tbsetup/pool_daemon.in
+1
-1
tbsetup/ptopgen.in
tbsetup/ptopgen.in
+141
-42
tbsetup/tbreport.in
tbsetup/tbreport.in
+3
-0
tmcd/tmcd.c
tmcd/tmcd.c
+23
-6
www/defs.php3.in
www/defs.php3.in
+5
-0
www/editnodetype.php3
www/editnodetype.php3
+2
-1
No files found.
assign/GNUmakefile.in
View file @
db9d77f7
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-20
09
University of Utah and the Flux Group.
# Copyright (c) 2000-20
10
University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
...
...
@@ -37,11 +37,11 @@ CXXFLAGS += -I/sw/include
ifeq ($(HAVE_XERCES),yes)
CXXFLAGS += -DWITH_XML
LIBS += -L/usr/local/lib -lxerces-c
OBJS += parse_ptop_xml.o parse_vtop_xml.o parse_policy_xml.o parse_error_handler.o xmlhelpers.o parse_advertisement_rspec.o parse_request_rspec.o annotate_rspec
.o annotate_vtop.o annotate
.o
OBJS += parse_ptop_xml.o parse_vtop_xml.o parse_policy_xml.o parse_error_handler.o xmlhelpers.o parse_advertisement_rspec.o parse_request_rspec.o annotate_rspec
_v2.o annotate_rspec.o annotate_vtop.o annotate.o rspec_parser_helper.o rspec_parser.o rspec_parser_v1.o rspec_parser_v2.o emulab_extensions_parser
.o
endif
# Pick either this
CXXFLAGS += -O3
CXXFLAGS += -O3
# or this
#CXXFLAGS += -O0 -g -Wall -DVERBOSE
# and then zero or more of these
...
...
@@ -54,6 +54,10 @@ CXXFLAGS += -O3
# And then, regardless, you can also have this
#CXXFLAGS += -DSTATS
# This is added to disable link mapping while we figure out how to get assign
# to deal with interfaces on switches
#CXXFLAGS += -DDISABLE_LINK_ANNOTATION
# assign now supports a dizzing array of defines, which are as-yet undocumented
# Here are the ones used for a typical build:
# Pick cooling schedule
...
...
@@ -114,12 +118,14 @@ anneal.o: anneal.cc anneal.h port.h delay.h physical.h common.h fstring.h \
solution.h vclass.h neighborhood.h
annotate.o: annotate.cc
annotate_rspec.o: annotate_rspec.cc
annotate_rspec_v2.o: annotate_rspec_v2.cc
annotate_vtop.o: annotate_vtop.cc
assign.o: assign.cc port.h common.h fstring.h delay.h physical.h \
featuredesire.h forwarding.h virtual.h vclass.h pclass.h score.h \
solution.h maps.h anneal.h config.h
config.o: config.cc config.h common.h port.h fstring.h score.h physical.h \
delay.h featuredesire.h forwarding.h virtual.h anneal.h pclass.h
emulab_extensions_parser.o: emulab_extensions_parser.cc
featuredesire.o: featuredesire.cc featuredesire.h common.h port.h \
fstring.h score.h physical.h delay.h forwarding.h virtual.h
forwarding.o: forwarding.cc forwarding.h port.h fstring.h physical.h \
...
...
@@ -143,6 +149,10 @@ parse_vtop_xml.o: parse_vtop_xml.cc
parser.o: parser.cc parser.h port.h
pclass.o: pclass.cc port.h common.h fstring.h delay.h physical.h \
featuredesire.h forwarding.h virtual.h pclass.h
rspec_parser.o: rspec_parser.cc
rspec_parser_helper.o: rspec_parser_helper.cc
rspec_parser_v1.o: rspec_parser_v1.cc
rspec_parser_v2.o: rspec_parser_v2.cc
score.o: score.cc port.h common.h fstring.h vclass.h delay.h physical.h \
featuredesire.h forwarding.h virtual.h pclass.h score.h
solution.o: solution.cc solution.h port.h delay.h physical.h common.h \
...
...
assign/annotate.cc
View file @
db9d77f7
...
...
@@ -13,6 +13,9 @@ static const char rcsid[] = "$Id: annotate.cc,v 1.2 2009-05-20 18:06:07 tarunp E
#ifdef WITH_XML
#include "annotate.h"
#include "common.h"
#include "xstr.h"
#include <string>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
...
...
@@ -24,31 +27,80 @@ using namespace std;
void
annotate
::
write_annotated_file
(
const
char
*
filename
)
{
// Get the current implementation
DOMImplementation
*
impl
=
DOMImplementationRegistry
::
getDOMImplementation
(
NULL
);
// Construct the DOMWriter
DOMWriter
*
writer
=
((
DOMImplementationLS
*
)
impl
)
->
createDOMWriter
();
// Make the output look pretty
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
);
// Set the byte-order-mark feature
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
);
// Construct the LocalFileFormatTarget
XMLFormatTarget
*
outputFile
=
new
xercesc
::
LocalFileFormatTarget
(
filename
);
// Serialize a DOMNode to the local file "<some-file-name>.xml"
writer
->
writeNode
(
outputFile
,
*
dynamic_cast
<
DOMNode
*>
(
this
->
virtual_root
));
// Flush the buffer to ensure all contents are written
outputFile
->
flush
();
// Release the memory
writer
->
release
();
// Get the current implementation
DOMImplementation
*
impl
=
DOMImplementationRegistry
::
getDOMImplementation
(
NULL
);
if
(
!
impl
)
{
cout
<<
"*** Could not create DOMImplementationRegistry"
<<
endl
;
exit
(
EXIT_FATAL
);
}
// Construct the DOMWriter
DOMWriter
*
writer
=
((
DOMImplementationLS
*
)
impl
)
->
createDOMWriter
();
if
(
!
writer
)
{
cout
<<
"*** Could not create DOMWriter"
<<
endl
;
exit
(
EXIT_FATAL
);
}
// Make the output look pretty
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
);
// Set the byte-order-mark feature
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
);
// Set the XML declaration feature
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMXMLDeclaration
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMXMLDeclaration
,
true
);
// Construct the LocalFileFormatTarget
XMLFormatTarget
*
outputFile
=
new
xercesc
::
LocalFileFormatTarget
(
filename
);
if
(
!
outputFile
)
{
cout
<<
"*** Could not create output file "
<<
filename
<<
endl
;
exit
(
EXIT_FATAL
);
}
if
(
!
(
this
->
document
))
{
cout
<<
"*** INTERNAL ERROR: this->document was NULL"
<<
endl
;
exit
(
EXIT_FATAL
);
}
// Serialize a DOMNode to the local file "<some-file-name>.xml"
writer
->
writeNode
(
outputFile
,
*
(
this
->
virtual_root
));
// Flush the buffer to ensure all contents are written
outputFile
->
flush
();
// Release the memory
writer
->
release
();
}
string
annotate
::
printXML
(
const
DOMElement
*
input
)
{
DOMElement
*
tag
=
(
DOMElement
*
)(
input
);
// Get the current implementation
DOMImplementation
*
impl
=
DOMImplementationRegistry
::
getDOMImplementation
(
NULL
);
// Construct the DOMWriter
DOMWriter
*
writer
=
((
DOMImplementationLS
*
)
impl
)
->
createDOMWriter
();
// Make the output look pretty
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTFormatPrettyPrint
,
true
);
// Set the byte-order-mark feature
if
(
writer
->
canSetFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
))
writer
->
setFeature
(
XMLUni
::
fgDOMWRTBOM
,
true
);
// Serialize a DOMNode to the local file "<some-file-name>.xml"
string
rv
=
XStr
(
writer
->
writeToString
(
*
dynamic_cast
<
DOMNode
*>
(
tag
))).
c
();
// Release the memory
writer
->
release
();
return
rv
;
}
#endif
assign/annotate.h
View file @
db9d77f7
...
...
@@ -8,8 +8,6 @@
* Base class for the annotater.
*/
/* This is ugly, but we only really need this file if we are building with XML support */
#ifdef WITH_XML
#ifndef __ANNOTATE_H
...
...
@@ -25,26 +23,38 @@
class
annotate
{
protected:
//xercesc::DOMDocument* doc;
xercesc
::
DOMElement
*
virtual_root
;
std
::
map
<
std
::
string
,
xercesc
::
DOMElement
*>
*
physical_elements
;
public:
// Annotates nodes and direct links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
const
char
*
p_name
)
=
0
;
// Annotates intraswitch and interswitch links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
std
::
list
<
const
char
*>*
links
)
=
0
;
// Creates a hop from a switch till the next end point. Adds the hop to the vlink and returns the hop element that was created
virtual
xercesc
::
DOMElement
*
create_component_hop
(
const
xercesc
::
DOMElement
*
plink
,
xercesc
::
DOMElement
*
vlink
,
int
endpoint_interface
,
const
xercesc
::
DOMElement
*
prev_component_hop
)
=
0
;
// Finds the next link in the path returned by assign
virtual
xercesc
::
DOMElement
*
find_next_link_in_path
(
xercesc
::
DOMElement
*
prev
,
std
::
list
<
const
char
*>*
links
)
=
0
;
// Writes the annotated xml to disk
void
write_annotated_file
(
const
char
*
filename
);
protected:
xercesc
::
DOMDocument
*
document
;
xercesc
::
DOMElement
*
physical_root
;
xercesc
::
DOMElement
*
virtual_root
;
std
::
map
<
std
::
string
,
xercesc
::
DOMElement
*>
*
physical_elements
;
public:
// Annotates nodes and direct links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
const
char
*
p_name
)
=
0
;
// Annotates intraswitch and interswitch links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
std
::
list
<
const
char
*>*
links
)
=
0
;
// Creates a hop from a switch till the next end point.
// Adds the hop to the vlink and returns the hop element that was created
virtual
xercesc
::
DOMElement
*
create_component_hop
(
const
xercesc
::
DOMElement
*
plink
,
xercesc
::
DOMElement
*
vlink
,
int
endpoint_interface
,
const
xercesc
::
DOMElement
*
prev_component_hop
)
=
0
;
// Finds the next link in the path returned by assign
virtual
xercesc
::
DOMElement
*
find_next_link_in_path
(
xercesc
::
DOMElement
*
prev
,
std
::
list
<
const
char
*>*
links
)
=
0
;
// Writes the annotated xml to disk
void
write_annotated_file
(
const
char
*
filename
);
// Writes an XML element to a string
std
::
string
printXML
(
const
xercesc
::
DOMElement
*
tag
);
};
#endif // for __ANNOTATE_H
...
...
assign/annotate_rspec.cc
View file @
db9d77f7
This diff is collapsed.
Click to expand it.
assign/annotate_rspec.h
View file @
db9d77f7
...
...
@@ -25,89 +25,89 @@
class
annotate_rspec
:
public
annotate
{
private:
// Enumeration of which interface in a hop
// is an interface to a link end point
enum
endpoint_interface_enum
{
NEITHER
,
SOURCE
,
DESTINATION
,
BOTH
};
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>
>
lan_links_map
;
public:
annotate_rspec
();
~
annotate_rspec
()
{
;
}
// Annotates nodes and direct links in the rspec
void
annotate_element
(
const
char
*
v_name
,
const
char
*
p_name
);
// Annotates intraswitch and interswitch links in the rspec
void
annotate_element
(
const
char
*
v_name
,
std
::
list
<
const
char
*>*
links
);
// Annotate a trivial link
void
annotate_element
(
const
char
*
v_name
);
// Annotates an interface element on a link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
,
bool
is_trivial_link
);
// Annotates an interface element on a non-trivial link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Annotates an interface element on a trivial link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Creates a hop from a switch till the next end point.
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc
::
DOMElement
*
create_component_hop
(
const
xercesc
::
DOMElement
*
plink
,
xercesc
::
DOMElement
*
vlink
,
int
endpoint_interface
,
const
xercesc
::
DOMElement
*
prev_hop
);
// Creates a component_hop for a trivial link
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc
::
DOMElement
*
create_component_hop
(
xercesc
::
DOMElement
*
vlink
);
// If the interface is the end point of a link/path,
// add two additional attributes to it
void
set_interface_as_link_endpoint
(
xercesc
::
DOMElement
*
interface
,
const
char
*
virtual_node_id
,
const
char
*
virtual_interface_id
);
// Finds the next link in the path returned by assign
xercesc
::
DOMElement
*
find_next_link_in_path
(
xercesc
::
DOMElement
*
prev
,
std
::
list
<
const
char
*>*
links
);
// Copies the component spec from the source to the destination
void
copy_component_spec
(
const
xercesc
::
DOMElement
*
src
,
xercesc
::
DOMElement
*
dst
);
// Copies the component hop from the auto-generated link
// to the requested link
void
copy_component_hop
(
xercesc
::
DOMElement
*
requested_link
,
xercesc
::
DOMElement
*
component_hop
);
// Checks if the link contains an interface with
// virtual_interface_id = id
bool
has_interface_with_id
(
std
::
string
link_id
,
std
::
string
id
);
// Removes all extra tags and generated elements from the XML document
void
cleanup
();
// Checks whether an element of type tag
// with attr_name = attr_value is a generated element
bool
is_generated_element
(
const
char
*
tag
,
const
char
*
attr_name
,
const
char
*
attr_value
);
private:
// Enumeration of which interface in a hop
// is an interface to a link end point
enum
endpoint_interface_enum
{
NEITHER
,
SOURCE
,
DESTINATION
,
BOTH
};
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>
>
lan_links_map
;
public:
annotate_rspec
();
~
annotate_rspec
()
{
;
}
// Annotates nodes and direct links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
const
char
*
p_name
);
// Annotates intraswitch and interswitch links in the rspec
virtual
void
annotate_element
(
const
char
*
v_name
,
std
::
list
<
const
char
*>*
links
);
// Annotate a trivial link
virtual
void
annotate_element
(
const
char
*
v_name
);
// Annotates an interface element on a link
virtual
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
,
bool
is_trivial_link
);
// Annotates an interface element on a non-trivial link
virtual
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Annotates an interface element on a trivial link
virtual
void
annotate_interface
(
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Creates a hop from a switch till the next end point.
// Adds the hop to the vlink
// Returns the hop element that was created
virtual
xercesc
::
DOMElement
*
create_component_hop
(
const
xercesc
::
DOMElement
*
plink
,
xercesc
::
DOMElement
*
vlink
,
int
endpoint_interface
,
const
xercesc
::
DOMElement
*
prev_hop
);
// Creates a component_hop for a trivial link
// Adds the hop to the vlink
// Returns the hop element that was created
virtual
xercesc
::
DOMElement
*
create_component_hop
(
xercesc
::
DOMElement
*
vlink
);
// If the interface is the end point of a link/path,
// add two additional attributes to it
virtual
void
set_interface_as_link_endpoint
(
xercesc
::
DOMElement
*
interface
,
const
char
*
virtual_node_id
,
const
char
*
virtual_interface_id
);
// Finds the next link in the path returned by assign
virtual
xercesc
::
DOMElement
*
find_next_link_in_path
(
xercesc
::
DOMElement
*
prev
,
std
::
list
<
const
char
*>*
links
);
// Copies the component spec from the source to the destination
virtual
void
copy_component_spec
(
const
xercesc
::
DOMElement
*
src
,
xercesc
::
DOMElement
*
dst
);
// Copies the component hop from the auto-generated link
// to the requested link
virtual
void
copy_component_hop
(
xercesc
::
DOMElement
*
requested_link
,
xercesc
::
DOMElement
*
component_hop
);
// Checks if the link contains an interface with
// virtual_interface_id = id
virtual
bool
has_interface_with_id
(
std
::
string
link_id
,
std
::
string
id
);
// Removes all extra tags and generated elements from the XML document
virtual
void
cleanup
();
// Checks whether an element of type tag
// with attr_name = attr_value is a generated element
virtual
bool
is_generated_element
(
const
char
*
tag
,
const
char
*
attr_name
,
const
char
*
attr_value
);
};
#endif //for __ANNOTATE_RSPEC_H
#endif // for WITH_XML
assign/annotate_rspec_v2.cc
0 → 100644
View file @
db9d77f7
This diff is collapsed.
Click to expand it.
assign/annotate_rspec_v2.h
0 → 100644
View file @
db9d77f7
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2008 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* Base class for the annotater.
*/
#ifdef WITH_XML
#ifndef __ANNOTATE_RSPEC_V2_H
#define __ANNOTATE_RSPEC_V2_H
#include "annotate.h"
#include "annotate_rspec.h"
#include <list>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <xercesc/dom/DOM.hpp>
class
annotate_rspec_v2
:
public
annotate_rspec
{
private:
// Enumeration of which interface in a hop
// is an interface to a link end point
enum
endpoint_interface_enum
{
NEITHER
,
SOURCE
,
DESTINATION
,
BOTH
};
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>
>
lan_links_map
;
std
::
map
<
std
::
string
,
std
::
string
>*
vInterfaceMap
;
std
::
map
<
std
::
string
,
std
::
string
>*
pInterfaceMap
;
public:
annotate_rspec_v2
();
~
annotate_rspec_v2
()
{
;
}
// Annotates nodes and direct links in the rspec
void
annotate_element
(
const
char
*
v_name
,
const
char
*
p_name
);
// Annotates intraswitch and interswitch links in the rspec
void
annotate_element
(
const
char
*
v_name
,
std
::
list
<
const
char
*>*
links
);
// Annotate a trivial link
void
annotate_element
(
const
char
*
v_name
);
// Annotates an interface element on a link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
,
bool
is_trivial_link
);
// Annotates an interface element on a non-trivial link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
plink
,
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Annotates an interface element on a trivial link
void
annotate_interface
(
const
xercesc
::
DOMElement
*
vlink
,
int
interface_number
);
// Creates a hop from a switch till the next end point.
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc
::
DOMElement
*
create_component_hop
(
const
xercesc
::
DOMElement
*
plink
,
xercesc
::
DOMElement
*
vlink
,
int
endpoint_interface
,
const
xercesc
::
DOMElement
*
prev_hop
);
// Creates a component_hop for a trivial link
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc
::
DOMElement
*
create_component_hop
(
xercesc
::
DOMElement
*
vlink
);
// Finds the next link in the path returned by assign
xercesc
::
DOMElement
*
find_next_link_in_path
(
xercesc
::
DOMElement
*
prev
,
std
::
list
<
const
char
*>*
links
);
// Copies the component spec from the source to the destination
void
copy_component_spec
(
const
xercesc
::
DOMElement
*
src
,
xercesc
::
DOMElement
*
dst
);
// Copies the component hop from the auto-generated link
// to the requested link
void
copy_component_hop
(
xercesc
::
DOMElement
*
requested_link
,
xercesc
::
DOMElement
*
component_hop
);
// Checks if the link contains an interface with
// virtual_interface_id = id
bool
has_interface_with_id
(
std
::
string
link_id
,
std
::
string
id
);
// Removes all extra tags and generated elements from the XML document
void
cleanup
();
// Checks whether an element of type tag
// with attr_name = attr_value is a generated element
bool
is_generated_element
(
const
char
*
tag
,
const
char
*
attr_name
,
const
char
*
attr_value
);
// Given an interface Id, returns the node on which the interface is present
std
::
string
lookupIface
(
std
::
map
<
std
::
string
,
std
::
string
>*
map
,
std
::
string
ifaceId
,
bool
&
);
// Returns the interface on the physical link
// which is declared on the physical node with component_id, physNodeId
const
xercesc
::
DOMElement
*
getIfaceOnNode
(
const
xercesc
::
DOMElement
*
plink
,
std
::
string
physNodeId
);
// Retuns the component id of the nth interface of a link
std
::
string
getNthInterface
(
const
xercesc
::
DOMElement
*
link
,
int
n
);
// Annotates the end point of a link
bool
annotate_endpoint
(
xercesc
::
DOMElement
*
iface
,
std
::
string
virtId
);
// Extracts the short interface name from the interface URN
std
::
string
getShortInterfaceName
(
std
::
string
interfaceURN
);
// Adds a fixed interface element to an interface
void
addFixedInterface
(
xercesc
::
DOMElement
*
interface
,
std
::
string
shortname
);
// Orders the links in the specified list of links from head to tail
// The first element in the list MUST be the head
// WARNING: This will destroy in the input list
std
::
list
<
const
char
*>*
reorderLinks
(
std
::
list
<
const
char
*>*
links
);
};
#endif //for __ANNOTATE_RSPEC_H
#endif // for WITH_XML
assign/assign.cc
View file @
db9d77f7
...
...
@@ -187,9 +187,10 @@ void read_physical_topology(char *filename) {
#ifdef WITH_XML
if
(
ptop_xml_input
)
{
cout
<<
"Physical Graph: "
<<
parse_ptop_xml
(
PG
,
SG
,
filename
)
<<
endl
;
}
else
if
(
ptop_rspec_input
)
{
cout
<<
"Physical Graph: "
<<
parse_ptop_rspec
(
PG
,
SG
,
filename
)
<<
endl
;
cout
<<
"Physical Graph: "
<<
parse_ptop_xml
(
PG
,
SG
,
filename
)
<<
endl
;
}
else
if
(
ptop_rspec_input
)
{
cout
<<
"Physical Graph: "
<<
parse_advertisement
(
PG
,
SG
,
filename
)
<<
endl
;
}
else
{
cout
<<
"Physical Graph: "
<<
parse_ptop
(
PG
,
SG
,
ptopfile
)
<<
endl
;
...
...
@@ -310,7 +311,7 @@ void read_virtual_topology(char *filename) {
cout
<<
"Virtual Graph: "
<<
parse_vtop_xml
(
VG
,
filename
)
<<
endl
;
}
else
if
(
vtop_rspec_input
){
cout
<<
"Virtual Graph: "
<<
parse_
vtop_rspec
(
VG
,
filename
)
<<
endl
;
cout
<<
"Virtual Graph: "
<<
parse_
request
(
VG
,
filename
)
<<
endl
;
}
else
{
cout
<<
"Virtual Graph: "
<<
parse_top
(
VG
,
topfile
)
<<
endl
;
...
...
assign/common.h
View file @
db9d77f7
...
...
@@ -16,6 +16,7 @@
#ifdef NEW_GCC
#include <ext/hash_map>
#include <ext/hash_fun.h>
using
namespace
__gnu_cxx
;
#define RANDOM() random()
#else
...
...
assign/emulab_extensions_parser.cc
0 → 100644
View file @
db9d77f7
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2008, 2009 University of Utah and the Flux Group.
* All rights reserved.
*/