Commit 2b24afd3 authored by Tarun Prabhu's avatar Tarun Prabhu

Annotations have been disabled for links till we sort out the problem of interfaces on links.

IMP: The change to score.cc undoes the change that Rob made some time ago to correct some fixed interface bug. I am not sure what that bug was but if I leave Rob's changes in, assign fails to honour the fixed interface and maps the link onto some other interface.
parent 5ba820cb
...@@ -42,8 +42,6 @@ endif ...@@ -42,8 +42,6 @@ endif
# Pick either this # Pick either this
CXXFLAGS += -O3 CXXFLAGS += -O3
# XXX: Get rid of this once done testing
# CXXFLAGS += -g
# or this # or this
#CXXFLAGS += -O0 -g -Wall -DVERBOSE #CXXFLAGS += -O0 -g -Wall -DVERBOSE
# and then zero or more of these # and then zero or more of these
...@@ -56,6 +54,10 @@ CXXFLAGS += -O3 ...@@ -56,6 +54,10 @@ CXXFLAGS += -O3
# And then, regardless, you can also have this # And then, regardless, you can also have this
#CXXFLAGS += -DSTATS #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 # assign now supports a dizzing array of defines, which are as-yet undocumented
# Here are the ones used for a typical build: # Here are the ones used for a typical build:
# Pick cooling schedule # Pick cooling schedule
......
...@@ -13,6 +13,8 @@ static const char rcsid[] = "$Id: annotate.cc,v 1.2 2009-05-20 18:06:07 tarunp E ...@@ -13,6 +13,8 @@ static const char rcsid[] = "$Id: annotate.cc,v 1.2 2009-05-20 18:06:07 tarunp E
#ifdef WITH_XML #ifdef WITH_XML
#include "annotate.h" #include "annotate.h"
#include "xstr.h"
#include <string>
#include <xercesc/dom/DOM.hpp> #include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMImplementation.hpp> #include <xercesc/dom/DOMImplementation.hpp>
...@@ -55,4 +57,32 @@ void annotate::write_annotated_file (const char* filename) ...@@ -55,4 +57,32 @@ void annotate::write_annotated_file (const char* filename)
writer->release(); 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 #endif
...@@ -52,6 +52,9 @@ class annotate ...@@ -52,6 +52,9 @@ class annotate
// Writes the annotated xml to disk // Writes the annotated xml to disk
void write_annotated_file(const char* filename); 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 #endif // for __ANNOTATE_H
......
This diff is collapsed.
...@@ -113,6 +113,19 @@ class annotate_rspec_v2 : public annotate_rspec ...@@ -113,6 +113,19 @@ class annotate_rspec_v2 : public annotate_rspec
// which is declared on the physical node with component_id, physNodeId // which is declared on the physical node with component_id, physNodeId
const xercesc::DOMElement* const xercesc::DOMElement*
getIfaceOnNode(const xercesc::DOMElement* plink, std::string physNodeId); getIfaceOnNode(const xercesc::DOMElement* plink, std::string physNodeId);
// Retuns the id of the physical source node
// for the nth interface of a link
std::string getNodeForNthInterface (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);
}; };
#endif //for __ANNOTATE_RSPEC_H #endif //for __ANNOTATE_RSPEC_H
......
...@@ -181,6 +181,35 @@ emulab_extensions_parser::readTypeLimits (const DOMElement* tag, int& count) ...@@ -181,6 +181,35 @@ emulab_extensions_parser::readTypeLimits (const DOMElement* tag, int& count)
return rv; return rv;
} }
string
emulab_extensions_parser::readFixedInterface(const DOMElement* tag,bool& fixed)
{
string rv = "";
DOMNodeList* fixIfaces
= tag->getElementsByTagName(XStr("emulab:fixedinterface").x());
fixed = (fixIfaces->getLength() == 1);
if (fixed) {
DOMElement* fixedIface = dynamic_cast<DOMElement*>(fixIfaces->item(0));
rv = this->getAttribute(fixedIface, "name");
}
return rv;
}
string
emulab_extensions_parser::readShortInterfaceName (const DOMElement* tag,
bool& hasShortName)
{
string rv = "";
DOMNodeList* interfaces
= tag->getElementsByTagName(XStr("emulab:interface").x());
hasShortName = (interfaces->getLength() == 1);
if (hasShortName) {
DOMElement* interface = dynamic_cast<DOMElement*>(interfaces->item(0));
rv = this->getAttribute(interface, "name");
}
return rv;
}
string emulab_extensions_parser::readSubnodeOf (const DOMElement* tag, string emulab_extensions_parser::readSubnodeOf (const DOMElement* tag,
bool& isSubnode) bool& isSubnode)
{ {
...@@ -249,4 +278,34 @@ bool emulab_extensions_parser::readTrivialOk (const DOMElement* tag) ...@@ -249,4 +278,34 @@ bool emulab_extensions_parser::readTrivialOk (const DOMElement* tag)
return (trivial_oks->getLength() > 0); return (trivial_oks->getLength() > 0);
} }
bool emulab_extensions_parser::readMultiplexOk (const DOMElement* tag)
{
DOMNodeList* multiplexOks
= tag->getElementsByTagName(XStr("emulab:multiplex_ok").x());
return (multiplexOks->getLength() > 0);
}
struct policy emulab_extensions_parser::readPolicy(const DOMElement* tag)
{
struct policy policy = {
this->getAttribute(tag, "type"),
this->getAttribute(tag, "name"),
this->getAttribute(tag, "limit")
};
return policy;
}
vector<struct policy>
emulab_extensions_parser::readPolicies (const DOMElement* tag, int& count)
{
vector<struct policy> rv;
DOMNodeList* policies = tag->getElementsByTagName(XStr("emulab:policy").x());
count = policies->getLength();
for (int i = 0; i < count; i++) {
rv.push_back
(this->readPolicy(dynamic_cast<DOMElement*>(policies->item(0))));
}
return rv;
}
#endif // WITH_XML #endif // WITH_XML
...@@ -22,6 +22,12 @@ namespace rspec_emulab_extension { ...@@ -22,6 +22,12 @@ namespace rspec_emulab_extension {
#define HARD_VCLASS 0 #define HARD_VCLASS 0
#define SOFT_VCLASS 1 #define SOFT_VCLASS 1
struct policy {
std::string type;
std::string name;
std::string limit;
};
struct emulab_operator { struct emulab_operator {
std::string op; std::string op;
...@@ -111,6 +117,12 @@ namespace rspec_emulab_extension { ...@@ -111,6 +117,12 @@ namespace rspec_emulab_extension {
virtual std::string readHintTo (const xercesc::DOMElement* tag, bool&); virtual std::string readHintTo (const xercesc::DOMElement* tag, bool&);
virtual bool readNoDelay (const xercesc::DOMElement* tag); virtual bool readNoDelay (const xercesc::DOMElement* tag);
virtual bool readTrivialOk (const xercesc::DOMElement* tag); virtual bool readTrivialOk (const xercesc::DOMElement* tag);
virtual bool readMultiplexOk (const xercesc::DOMElement* tag);
virtual string readFixedInterface (const xercesc::DOMElement*, bool&);
virtual string readShortInterfaceName (const xercesc::DOMElement*, bool&);
virtual struct policy readPolicy (const xercesc::DOMElement*);
virtual std::vector<struct policy>
readPolicies (const xercesc::DOMElement*, int& count);
}; };
} // namespace rspec_emulab_extension } // namespace rspec_emulab_extension
......
...@@ -78,11 +78,11 @@ static rspec_parser* rspecParser; ...@@ -78,11 +78,11 @@ static rspec_parser* rspecParser;
* declared in here * declared in here
*/ */
static bool populate_nodes(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, static bool populate_nodes(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
set<string> &unavailable); set<string> &unavailable);
static bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, static bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
set<string> &unavailable); set<string> &unavailable);
static bool populate_type_limits(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg); static bool populate_type_limits(DOMElement *root,tb_pgraph &pg,tb_sgraph &sg);
static bool populate_policies (DOMElement*root, tb_pgraph &pg, tb_sgraph &sg);
int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) { int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
/* /*
...@@ -141,7 +141,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -141,7 +141,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
rspecParser = new rspec_parser_v2(RSPEC_TYPE_ADVT); rspecParser = new rspec_parser_v2(RSPEC_TYPE_ADVT);
break; break;
default: default:
cerr << "*** Unsupported rspec ver. " << rspecVersion cout << "*** Unsupported rspec ver. " << rspecVersion
<< " ... Aborting " << endl; << " ... Aborting " << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
...@@ -150,7 +150,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -150,7 +150,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
bool is_physical; bool is_physical;
XStr type (advt_root->getAttribute(XStr("type").x())); XStr type (advt_root->getAttribute(XStr("type").x()));
if (strcmp(type.c(), "advertisement") != 0) { if (strcmp(type.c(), "advertisement") != 0) {
cerr << "*** Rspec type must be \"advertisement\" in " << filename cout << "*** Rspec type must be \"advertisement\" in " << filename
<< " (found " << type.c() << ")" << endl; << " (found " << type.c() << ")" << endl;
} }
...@@ -162,27 +162,33 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -162,27 +162,33 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
* These three calls do the real work of populating the assign data * These three calls do the real work of populating the assign data
* structures * structures
*/ */
XMLDEBUG("starting node population" << endl); XMLDEBUG("Starting node population" << endl);
if (!populate_nodes(advt_root,pg,sg,unavailable)) { if (!populate_nodes(advt_root,pg,sg,unavailable)) {
cerr << "*** Error reading nodes from physical topology " cout << "*** Error reading nodes from physical topology "
<< filename << endl; << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
XMLDEBUG("finishing node population" << endl); XMLDEBUG("Finishing node population" << endl);
XMLDEBUG("starting link population" << endl); XMLDEBUG("Starting link population" << endl);
if (!populate_links(advt_root,pg,sg,unavailable)) { if (!populate_links(advt_root,pg,sg,unavailable)) {
cerr << "*** Error reading links from physical topology " cout << "*** Error reading links from physical topology "
<< filename << endl; << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
XMLDEBUG("finishing link population" << endl); XMLDEBUG("Finishing link population" << endl);
XMLDEBUG("setting type limits" << endl); XMLDEBUG("Setting type limits" << endl);
if (!populate_type_limits(advt_root, pg, sg)) { if (!populate_type_limits(advt_root, pg, sg)) {
cerr << "*** Error setting type limits " << filename << endl; cout << "*** Error setting type limits " << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
XMLDEBUG("finishing setting type limits" << endl); XMLDEBUG("Finishing setting type limits" << endl);
XMLDEBUG("Starting policy population" << endl);
if (!populate_policies(advt_root, pg, sg)) {
cout << "*** Error setting policies " << filename << endl;
exit(EXIT_FATAL);
}
XMLDEBUG("Finishing setting policies" << endl);
cerr << "RSpec parsing finished" << endl; cerr << "RSpec parsing finished" << endl;
} }
...@@ -199,6 +205,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -199,6 +205,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
*/ */
bool populate_nodes(DOMElement *root, bool populate_nodes(DOMElement *root,
tb_pgraph &pg, tb_sgraph &sg, set<string> &unavailable) { tb_pgraph &pg, tb_sgraph &sg, set<string> &unavailable) {
static bool displayedWarning = false;
bool is_ok = true; bool is_ok = true;
pair<map<string, DOMElement*>::iterator, bool> insert_ret; pair<map<string, DOMElement*>::iterator, bool> insert_ret;
/* /*
...@@ -230,7 +237,7 @@ bool populate_nodes(DOMElement *root, ...@@ -230,7 +237,7 @@ bool populate_nodes(DOMElement *root,
insert_ret = advertisement_elements->insert insert_ret = advertisement_elements->insert
(pair<string, DOMElement*>(componentId, elt)); (pair<string, DOMElement*>(componentId, elt));
if (insert_ret.second == false) { if (insert_ret.second == false) {
cerr << "*** " << componentId << " already exists" << endl; cout << "*** " << componentId << " already exists" << endl;
is_ok = false; is_ok = false;
} }
...@@ -239,19 +246,10 @@ bool populate_nodes(DOMElement *root, ...@@ -239,19 +246,10 @@ bool populate_nodes(DOMElement *root,
rspecParser->readInterfacesOnNode(elt, allUnique); rspecParser->readInterfacesOnNode(elt, allUnique);
// XXX: We don't ever do anything with this, so I am commenting it out // XXX: We don't ever do anything with this, so I am commenting it out
if (!displayedWarning) {
// /* Deal with the location tag */ cout << "WARNING: Country information will be ignored" << endl;
// int locationDataCount; displayedWarning = true;
// vector<string> locationData }
// = rspecParser->readLocation(elt, locationDataCount);
// string country = locationData[0];
// string latitude = "";
// string longitude = "";
// if (locationDataCount == 3) {
// latitude = locationData[1];
// longitude = locationData[2];
// }
pvertex pv; pvertex pv;
...@@ -343,7 +341,7 @@ bool populate_nodes(DOMElement *root, ...@@ -343,7 +341,7 @@ bool populate_nodes(DOMElement *root,
string subnodeOf = rspecParser->readSubnodeOf (elt, isSubnode, subnodeCnt); string subnodeOf = rspecParser->readSubnodeOf (elt, isSubnode, subnodeCnt);
if (isSubnode) { if (isSubnode) {
if (subnodeCnt > 1) { if (subnodeCnt > 1) {
cerr << "*** Too many \"subnode\" relations found in " cout << "*** Too many \"subnode\" relations found in "
<< componentId << "Allowed 1 ... " << endl; << componentId << "Allowed 1 ... " << endl;
is_ok = false; is_ok = false;
continue; continue;
...@@ -421,6 +419,10 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -421,6 +419,10 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
bool is_ok = true; bool is_ok = true;
pair<map<string, DOMElement*>::iterator, bool> insert_ret; pair<map<string, DOMElement*>::iterator, bool> insert_ret;
// It should be safe to read it now because all the short interface names
// have been populated once all the nodes have been read.
map<string, string> shortNames = rspecParser->getShortNames();
/* /*
* TODO: Support the "PENALIZE_BANDWIDTH" option? * TODO: Support the "PENALIZE_BANDWIDTH" option?
...@@ -441,7 +443,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -441,7 +443,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
string cmId = rspecParser->readComponentManagerId(elt, hasCMId); string cmId = rspecParser->readComponentManagerId(elt, hasCMId);
if (!hasComponentId || !hasCMId) { if (!hasComponentId || !hasCMId) {
cerr << "*** Require component ID and component manager ID" << endl; cout << "*** Require component ID and component manager ID" << endl;
is_ok = false; is_ok = false;
} }
else { else {
...@@ -449,7 +451,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -449,7 +451,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
advertisement_elements->insert(pair<string, DOMElement*> advertisement_elements->insert(pair<string, DOMElement*>
(componentId, elt)); (componentId, elt));
if (insert_ret.second == false) { if (insert_ret.second == false) {
cerr << "*** " << componentId << " already exists" << endl; cout << "*** " << componentId << " already exists" << endl;
is_ok = false; is_ok = false;
} }
} }
...@@ -465,20 +467,20 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -465,20 +467,20 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
// Error handling // Error handling
switch (ifaceCount) { switch (ifaceCount) {
case RSPEC_ERROR_UNSEEN_NODEIFACE_SRC: case RSPEC_ERROR_UNSEEN_NODEIFACE_SRC:
cerr << "*** Unseen node-interface pair on the source interface ref" cout << "*** Unseen node-interface pair on the source interface ref"
<< endl; << endl;
is_ok = false; is_ok = false;
continue; continue;
case RSPEC_ERROR_UNSEEN_NODEIFACE_DST: case RSPEC_ERROR_UNSEEN_NODEIFACE_DST:
cerr << "*** Unseen node-interface pair on the destination interface ref" cout << "*** Unseen node-interface pair on the destination interface ref"
<< endl; << endl;
is_ok = false; is_ok = false;
continue; continue;
} }
if (ifaceCount != 2) { if (ifaceCount != 2) {
cerr << "*** Incorrect number of interfaces found on link " cout << "*** Incorrect number of interfaces found on link "
<< componentId << ". Expected 2 (found " << componentId << ". Expected 2 (found "
<< ifaceCount << ")" << endl; << ifaceCount << ")" << endl;
is_ok = false; is_ok = false;
...@@ -491,14 +493,14 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -491,14 +493,14 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
string dst_iface = interfaces[1].physicalIfaceId; string dst_iface = interfaces[1].physicalIfaceId;
if (src_node == "" || src_iface == "") { if (src_node == "" || src_iface == "") {
cerr << "*** Physical link " << componentId cout << "*** Physical link " << componentId
<< " must have a component id and component interface id " << " must have a component id and component interface id "
<< " specified for the source node" << endl; << " specified for the source node" << endl;
is_ok = false; is_ok = false;
continue; continue;
} }
if (dst_node == "" || dst_iface == "") { if (dst_node == "" || dst_iface == "") {
cerr << "*** Physical link " << componentId cout << "*** Physical link " << componentId
<< " must have a component id and component interface id" << " must have a component id and component interface id"
<< " specified for the destination node" << endl; << " specified for the destination node" << endl;
is_ok = false; is_ok = false;
...@@ -552,7 +554,9 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg, ...@@ -552,7 +554,9 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
new tb_plink(componentId.c_str(), new tb_plink(componentId.c_str(),
tb_plink::PLINK_NORMAL, str_first_type, tb_plink::PLINK_NORMAL, str_first_type,
"(null)", "(null)", "(null)", "(null)",
src_iface.c_str(), dst_iface.c_str()); shortNames[src_iface].c_str(),
shortNames[dst_iface].c_str());
// src_iface.c_str(), dst_iface.c_str());
phys_link->delay_info.bandwidth = bandwidth; phys_link->delay_info.bandwidth = bandwidth;
phys_link->delay_info.delay = latency; phys_link->delay_info.delay = latency;
...@@ -634,4 +638,32 @@ bool populate_type_limits(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg) ...@@ -634,4 +638,32 @@ bool populate_type_limits(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg)
return true; return true;
} }
bool populate_policies (DOMElement* root, tb_pgraph &pg, tb_sgraph &sg)
{
int count;
bool is_ok = true;
vector<struct policy> policies = rspecParser->readPolicies(root, count);
XMLDEBUG ("Found " << count << " policies" << endl);
for (int i = 0; i < count; i++) {
struct policy policy = policies[i];
string name = policy.name;
string limit = policy.limit;
tb_featuredesire *fd
= tb_featuredesire::get_featuredesire_by_name(((fstring)XStr(name).c()));
if (fd == NULL) {
cerr << "*** Desire " << name << " not found" << endl;
is_ok &= false;
}
else {
if (limit == "disallow") {
fd->disallow_desire();
}
else {
fd->limit_desire(rspec_parser_helper::stringToNum(limit));
}
}
}
return is_ok;
}
#endif #endif
...@@ -123,7 +123,7 @@ int parse_request(tb_vgraph &vg, char *filename) { ...@@ -123,7 +123,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
* If there are any errors, do not go any further * If there are any errors, do not go any further
*/ */
if (errHandler->sawError()) { if (errHandler->sawError()) {
cerr << "*** There were " << domParser -> getErrorCount () cout << "*** There were " << domParser -> getErrorCount ()
<< " errors in " << filename << endl; << " errors in " << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
...@@ -138,7 +138,7 @@ int parse_request(tb_vgraph &vg, char *filename) { ...@@ -138,7 +138,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
bool is_physical; bool is_physical;
XStr type (request_root->getAttribute(XStr("type").x())); XStr type (request_root->getAttribute(XStr("type").x()));
if (strcmp(type.c(), "request") != 0) { if (strcmp(type.c(), "request") != 0) {
cerr << "*** RSpec type must be \"request\" in " << filename cout << "*** RSpec type must be \"request\" in " << filename
<< " (found " << type.c() << ")" << endl; << " (found " << type.c() << ")" << endl;
exit (EXIT_FATAL); exit (EXIT_FATAL);
} }
...@@ -174,14 +174,14 @@ int parse_request(tb_vgraph &vg, char *filename) { ...@@ -174,14 +174,14 @@ int parse_request(tb_vgraph &vg, char *filename) {
*/ */
XMLDEBUG("starting vclass population" << endl); XMLDEBUG("starting vclass population" << endl);
if (!populate_vclasses (request_root, vg)) { if (!populate_vclasses (request_root, vg)) {
cerr << "*** Error reading vclasses from virtual topology " cout << "*** Error reading vclasses from virtual topology "
<< filename << endl; << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
XMLDEBUG("finishing vclass population" << endl); XMLDEBUG("finishing vclass population" << endl);
XMLDEBUG("starting node population" << endl); XMLDEBUG("starting node population" << endl);
if (!populate_nodes(request_root,vg, &fixed_interfaces)) { if (!populate_nodes(request_root,vg, &fixed_interfaces)) {
cerr << "*** Error reading nodes from virtual topology " cout << "*** Error reading nodes from virtual topology "
<< filename << endl; << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
...@@ -189,7 +189,7 @@ int parse_request(tb_vgraph &vg, char *filename) { ...@@ -189,7 +189,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
XMLDEBUG("starting link population" << endl); XMLDEBUG("starting link population" << endl);
if (!populate_links(request_root,vg, &fixed_interfaces)) { if (!populate_links(request_root,vg, &fixed_interfaces)) {
cerr << "*** Error reading links from virtual topology " cout << "*** Error reading links from virtual topology "
<< filename << endl; << filename << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
...@@ -213,6 +213,7 @@ bool populate_node(DOMElement* elt, ...@@ -213,6 +213,7 @@ bool populate_node(DOMElement* elt,
tb_vgraph &vg, map< pair<string,string>, tb_vgraph &vg, map< pair<string,string>,
pair<string,string> >* fixed_interfaces) pair<string,string> >* fixed_interfaces)
{ {
static bool displayedWarning = false;
bool hasVirtualId; bool hasVirtualId;
string virtualId = rspecParser->readVirtualId(elt, hasVirtualId); string virtualId = rspecParser->readVirtualId(elt, hasVirtualId);
...@@ -226,14 +227,14 @@ bool populate_node(DOMElement* elt, ...@@ -226,14 +227,14 @@ bool populate_node(DOMElement* elt,
if(hasCMId) if(hasCMId)
fixed_nodes [virtualId] = componentId; fixed_nodes [virtualId] = componentId;
else else
cerr << "WARNING: Virtual node " << virtualId cout << "WARNING: Virtual node " << virtualId
<< " has a componentId specified " << " has a componentId specified "
<< "but no component manager " << endl << "but no component manager " << endl
<< "The componentId will be ignored." << endl; << "The componentId will be ignored." << endl;
} }
if (!hasVirtualId) { if (!hasVirtualId) {
cerr << "*** Every node must have a virtual_id" << endl; cout << "*** Every node must have a virtual_id" << endl;
return false; return false;
} }
...@@ -242,14 +243,17 @@ bool populate_node(DOMElement* elt, ...@@ -242,14 +243,17 @@ bool populate_node(DOMElement* elt,
// XXX: This should not have to be called manually // XXX: This should not have to be called manually
fixedIfacesOnNode = rspecParser->readInterfacesOnNode(elt, allUnique); fixedIfacesOnNode = rspecParser->readInterfacesOnNode(elt, allUnique);
if (!allUnique) { if (!allUnique) {
cerr << "*** The node-interface pairs in " << virtualId cout << "*** The node-interface pairs in " << virtualId
<< " were not unique." << endl; << " were not unique." << endl;
return false; return false;
} }
fixed_interfaces->insert(fixedIfacesOnNode.begin(),fixedIfacesOnNode.end()); fixed_interfaces->insert(fixedIfacesOnNode.begin(),fixedIfacesOnNode.end());
/* Deal with the location tag */ /* Deal with the location tag */
cerr << "WARNING: Country information will be ignored" << endl; if (!displayedWarning) {
cout << "WARNING: Country information will be ignored" << endl;
displayedWarning = true;
}
/* /*
* Add on types * Add on types
...@@ -305,7 +309,7 @@ bool populate_node(DOMElement* elt, ...@@ -305,7 +309,7 @@ bool populate_node(DOMElement* elt,
string subnodeOf = rspecParser->readSubnodeOf(elt, isSubnode, subnodeCnt); string subnodeOf = rspecParser->readSubnodeOf(elt, isSubnode, subnodeCnt);
if (isSubnode) { if (isSubnode) {
if (subnodeCnt > 1) { if (subnodeCnt > 1) {
cerr << "*** To many \"subnode\" relations found in " cout << "*** To many \"subnode\" relations found in "
<< virtualId << ". Allowed 1 ... " << endl; << virtualId << ". Allowed 1 ... " << endl;
return false; return false;
} }
...@@ -462,7 +466,7 @@ bool populate_link (DOMElement* elt, ...@@ -462,7 +466,7 @@ bool populate_link (DOMElement* elt,
vector<struct link_type> linkTypes = rspecParser->readLinkTypes(elt, count); vector<struct link_type> linkTypes = rspecParser->readLinkTypes(elt, count);
string linkType = "ethernet"; string linkType = "ethernet";
if (count > 1) { if (count > 1) {
cerr << "*** Too many link types specified (" << count cout << "*** Too many link types specified (" << count
<< ") on " << virtualId << ". Allowed 1 ... Aborting" << endl; << ") on " << virtualId << ". Allowed 1 ... Aborting" << endl;
return false; return false;
} }
...@@ -476,7 +480,7 @@ bool populate_link (DOMElement* elt, ...@@ -476,7 +480,7 @@ bool populate_link (DOMElement* elt,
struct link_characteristics characteristics struct link_characteristics characteristics
= rspecParser->readLinkCharacteristics(elt, count); = rspecParser->readLinkCharacteristics(elt, count);