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
# Pick either this
CXXFLAGS += -O3
# XXX: Get rid of this once done testing
# CXXFLAGS += -g
# or this
#CXXFLAGS += -O0 -g -Wall -DVERBOSE
# and then zero or more of these
......@@ -56,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
......
......@@ -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
#include "annotate.h"
#include "xstr.h"
#include <string>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
......@@ -55,4 +57,32 @@ void annotate::write_annotated_file (const char* filename)
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
......@@ -52,6 +52,9 @@ class annotate
// 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
......
This diff is collapsed.
......@@ -113,6 +113,19 @@ class annotate_rspec_v2 : public annotate_rspec
// which is declared on the physical node with component_id, physNodeId
const xercesc::DOMElement*
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
......
......@@ -181,6 +181,35 @@ emulab_extensions_parser::readTypeLimits (const DOMElement* tag, int& count)
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,
bool& isSubnode)
{
......@@ -249,4 +278,34 @@ bool emulab_extensions_parser::readTrivialOk (const DOMElement* tag)
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
......@@ -22,6 +22,12 @@ namespace rspec_emulab_extension {
#define HARD_VCLASS 0
#define SOFT_VCLASS 1
struct policy {
std::string type;
std::string name;
std::string limit;
};
struct emulab_operator {
std::string op;
......@@ -111,6 +117,12 @@ namespace rspec_emulab_extension {
virtual std::string readHintTo (const xercesc::DOMElement* tag, bool&);
virtual bool readNoDelay (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
......
......@@ -78,11 +78,11 @@ static rspec_parser* rspecParser;
* declared in here
*/
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,
set<string> &unavailable);
static bool populate_type_limits(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg);
set<string> &unavailable);
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) {
/*
......@@ -141,7 +141,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
rspecParser = new rspec_parser_v2(RSPEC_TYPE_ADVT);
break;
default:
cerr << "*** Unsupported rspec ver. " << rspecVersion
cout << "*** Unsupported rspec ver. " << rspecVersion
<< " ... Aborting " << endl;
exit(EXIT_FATAL);
}
......@@ -150,7 +150,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
bool is_physical;
XStr type (advt_root->getAttribute(XStr("type").x()));
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;
}
......@@ -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
* structures
*/
XMLDEBUG("starting node population" << endl);
XMLDEBUG("Starting node population" << endl);
if (!populate_nodes(advt_root,pg,sg,unavailable)) {
cerr << "*** Error reading nodes from physical topology "
cout << "*** Error reading nodes from physical topology "
<< filename << endl;
exit(EXIT_FATAL);
}
XMLDEBUG("finishing node population" << endl);
XMLDEBUG("starting link population" << endl);
XMLDEBUG("Finishing node population" << endl);
XMLDEBUG("Starting link population" << endl);
if (!populate_links(advt_root,pg,sg,unavailable)) {
cerr << "*** Error reading links from physical topology "
cout << "*** Error reading links from physical topology "
<< filename << endl;
exit(EXIT_FATAL);
}
XMLDEBUG("finishing link population" << endl);
XMLDEBUG("setting type limits" << endl);
XMLDEBUG("Finishing link population" << endl);
XMLDEBUG("Setting type limits" << endl);
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);
}
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;
}
......@@ -199,6 +205,7 @@ int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
*/
bool populate_nodes(DOMElement *root,
tb_pgraph &pg, tb_sgraph &sg, set<string> &unavailable) {
static bool displayedWarning = false;
bool is_ok = true;
pair<map<string, DOMElement*>::iterator, bool> insert_ret;
/*
......@@ -230,7 +237,7 @@ bool populate_nodes(DOMElement *root,
insert_ret = advertisement_elements->insert
(pair<string, DOMElement*>(componentId, elt));
if (insert_ret.second == false) {
cerr << "*** " << componentId << " already exists" << endl;
cout << "*** " << componentId << " already exists" << endl;
is_ok = false;
}
......@@ -239,19 +246,10 @@ bool populate_nodes(DOMElement *root,
rspecParser->readInterfacesOnNode(elt, allUnique);
// XXX: We don't ever do anything with this, so I am commenting it out
// /* Deal with the location tag */
// int locationDataCount;
// vector<string> locationData
// = rspecParser->readLocation(elt, locationDataCount);
// string country = locationData[0];
// string latitude = "";
// string longitude = "";
// if (locationDataCount == 3) {
// latitude = locationData[1];
// longitude = locationData[2];
// }
if (!displayedWarning) {
cout << "WARNING: Country information will be ignored" << endl;
displayedWarning = true;
}
pvertex pv;
......@@ -343,7 +341,7 @@ bool populate_nodes(DOMElement *root,
string subnodeOf = rspecParser->readSubnodeOf (elt, isSubnode, subnodeCnt);
if (isSubnode) {
if (subnodeCnt > 1) {
cerr << "*** Too many \"subnode\" relations found in "
cout << "*** Too many \"subnode\" relations found in "
<< componentId << "Allowed 1 ... " << endl;
is_ok = false;
continue;
......@@ -421,6 +419,10 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
bool is_ok = true;
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?
......@@ -441,7 +443,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
string cmId = rspecParser->readComponentManagerId(elt, 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;
}
else {
......@@ -449,7 +451,7 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
advertisement_elements->insert(pair<string, DOMElement*>
(componentId, elt));
if (insert_ret.second == false) {
cerr << "*** " << componentId << " already exists" << endl;
cout << "*** " << componentId << " already exists" << endl;
is_ok = false;
}
}
......@@ -465,20 +467,20 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
// Error handling
switch (ifaceCount) {
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;
is_ok = false;
continue;
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;
is_ok = false;
continue;
}
if (ifaceCount != 2) {
cerr << "*** Incorrect number of interfaces found on link "
cout << "*** Incorrect number of interfaces found on link "
<< componentId << ". Expected 2 (found "
<< ifaceCount << ")" << endl;
is_ok = false;
......@@ -491,14 +493,14 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
string dst_iface = interfaces[1].physicalIfaceId;
if (src_node == "" || src_iface == "") {
cerr << "*** Physical link " << componentId
cout << "*** Physical link " << componentId
<< " must have a component id and component interface id "
<< " specified for the source node" << endl;
is_ok = false;
continue;
}
if (dst_node == "" || dst_iface == "") {
cerr << "*** Physical link " << componentId
cout << "*** Physical link " << componentId
<< " must have a component id and component interface id"
<< " specified for the destination node" << endl;
is_ok = false;
......@@ -552,7 +554,9 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
new tb_plink(componentId.c_str(),
tb_plink::PLINK_NORMAL, str_first_type,
"(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.delay = latency;
......@@ -634,4 +638,32 @@ bool populate_type_limits(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg)
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
......@@ -123,7 +123,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
* If there are any errors, do not go any further
*/
if (errHandler->sawError()) {
cerr << "*** There were " << domParser -> getErrorCount ()
cout << "*** There were " << domParser -> getErrorCount ()
<< " errors in " << filename << endl;
exit(EXIT_FATAL);
}
......@@ -138,7 +138,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
bool is_physical;
XStr type (request_root->getAttribute(XStr("type").x()));
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;
exit (EXIT_FATAL);
}
......@@ -174,14 +174,14 @@ int parse_request(tb_vgraph &vg, char *filename) {
*/
XMLDEBUG("starting vclass population" << endl);
if (!populate_vclasses (request_root, vg)) {
cerr << "*** Error reading vclasses from virtual topology "
cout << "*** Error reading vclasses from virtual topology "
<< filename << endl;
exit(EXIT_FATAL);
}
XMLDEBUG("finishing vclass population" << endl);
XMLDEBUG("starting node population" << endl);
if (!populate_nodes(request_root,vg, &fixed_interfaces)) {
cerr << "*** Error reading nodes from virtual topology "
cout << "*** Error reading nodes from virtual topology "
<< filename << endl;
exit(EXIT_FATAL);
}
......@@ -189,7 +189,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
XMLDEBUG("starting link population" << endl);
if (!populate_links(request_root,vg, &fixed_interfaces)) {
cerr << "*** Error reading links from virtual topology "
cout << "*** Error reading links from virtual topology "
<< filename << endl;
exit(EXIT_FATAL);
}
......@@ -213,6 +213,7 @@ bool populate_node(DOMElement* elt,
tb_vgraph &vg, map< pair<string,string>,
pair<string,string> >* fixed_interfaces)
{
static bool displayedWarning = false;
bool hasVirtualId;
string virtualId = rspecParser->readVirtualId(elt, hasVirtualId);
......@@ -226,14 +227,14 @@ bool populate_node(DOMElement* elt,
if(hasCMId)
fixed_nodes [virtualId] = componentId;
else
cerr << "WARNING: Virtual node " << virtualId
cout << "WARNING: Virtual node " << virtualId
<< " has a componentId specified "
<< "but no component manager " << endl
<< "The componentId will be ignored." << endl;
}
if (!hasVirtualId) {
cerr << "*** Every node must have a virtual_id" << endl;
cout << "*** Every node must have a virtual_id" << endl;
return false;
}
......@@ -242,14 +243,17 @@ bool populate_node(DOMElement* elt,
// XXX: This should not have to be called manually
fixedIfacesOnNode = rspecParser->readInterfacesOnNode(elt, allUnique);
if (!allUnique) {
cerr << "*** The node-interface pairs in " << virtualId
cout << "*** The node-interface pairs in " << virtualId
<< " were not unique." << endl;
return false;
}
fixed_interfaces->insert(fixedIfacesOnNode.begin(),fixedIfacesOnNode.end());
/* 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
......@@ -305,7 +309,7 @@ bool populate_node(DOMElement* elt,
string subnodeOf = rspecParser->readSubnodeOf(elt, isSubnode, subnodeCnt);
if (isSubnode) {
if (subnodeCnt > 1) {
cerr << "*** To many \"subnode\" relations found in "
cout << "*** To many \"subnode\" relations found in "
<< virtualId << ". Allowed 1 ... " << endl;
return false;
}
......@@ -462,7 +466,7 @@ bool populate_link (DOMElement* elt,
vector<struct link_type> linkTypes = rspecParser->readLinkTypes(elt, count);
string linkType = "ethernet";
if (count > 1) {
cerr << "*** Too many link types specified (" << count
cout << "*** Too many link types specified (" << count
<< ") on " << virtualId << ". Allowed 1 ... Aborting" << endl;
return false;
}
......@@ -476,7 +480,7 @@ bool populate_link (DOMElement* elt,
struct link_characteristics characteristics
= rspecParser->readLinkCharacteristics(elt, count);
if (count != 1) {
cerr << "*** Incorrect number of link properties specified ("
cout << "*** Incorrect number of link properties specified ("
<< count << " on " << virtualId <<". Allowed 1 " << endl;
return false;
}
......@@ -585,7 +589,7 @@ bool populate_link (DOMElement* elt,
dst = interfaces[1];
}
else {
cerr << "*** Too few interfaces found (" << ifaceCount << ")"
cout << "*** Too few interfaces found (" << ifaceCount << ")"
<< " on " << virtualId << " at least 2 required ... Aborting"
<< endl;
return false;
......@@ -597,23 +601,23 @@ bool populate_link (DOMElement* elt,
string dstIface = dst.virtualIfaceId;
if (srcNode == "" || srcIface == "") {
cerr << "*** No source node found on interface for link "
cout << "*** No source node found on interface for link "
<< virtualId << endl;
return false;
}
if (dstNode == "" || dstIface == "") {
cerr << "*** No destination node found on interface for link "
cout << "*** No destination node found on interface for link "
<< virtualId << endl;
return false;
}
if (vname2vertex.find(srcNode.c_str()) == vname2vertex.end()) {
cerr << "*** Bad link " << virtualId
cout << "*** Bad link " << virtualId
<< ", non-existent source node " << srcNode << endl;
return false;
}
if (vname2vertex.find(dstNode.c_str()) == vname2vertex.end()) {
cerr << "*** Bad link " << virtualId
cout << "*** Bad link " << virtualId
<< ", non-existent destination node " << dstNode << endl;
return false;
}
......@@ -628,8 +632,9 @@ bool populate_link (DOMElement* elt,
// XXX: This is obsolete. We need to fix it ASAP
bool emulated = false;
if (virtualizationType == "raw" || virtualizationType == "")
emulated = true;
emulated = rspecParser->readMultiplexOk(elt);
// if (virtualizationType == "raw" || virtualizationType == "")
// emulated = true;
// Emulab extensions
bool allow_delayed = !(rspecParser->readNoDelay(elt));
......@@ -641,9 +646,6 @@ bool populate_link (DOMElement* elt,
fstring fixed_srcIface = "";
it = fixed_interfaces->find(pair<string,string>(srcNode, srcIface));
if (it != fixed_interfaces->end()) {
cerr << "Found fixed source interface (" << (it->second).first << ","
<< (it->second).second << ") on (" << (it->first).first << ","
<< (it->first).second << ")" << endl;
fix_srcIface = true;
fixed_srcIface = (it->second).second;
}
......@@ -653,9 +655,6 @@ bool populate_link (DOMElement* elt,
fstring fixed_dstIface = "";
it = fixed_interfaces->find(make_pair(dstNode, dstIface));
if (it != fixed_interfaces->end()) {
cerr << "Found fixed destination interface (" << (it->second).first
<< "," << (it->second).second << ") on (" << (it->first).first
<< "," << (it->first).second << ")" << endl;
fix_dstIface = true;
fixed_dstIface = (it->second).second;
}
......@@ -677,23 +676,23 @@ bool populate_link (DOMElement* elt,
tb_vlink *virt_link = new tb_vlink();
virt_link-> name = virtualId;
virt_link-> type = fstring(linkType.c_str());
virt_link->name = virtualId;
virt_link->type = fstring(linkType.c_str());
virt_link-> fix_src_iface = fix_srcIface;
virt_link->fix_src_iface = fix_srcIface;
if (fix_srcIface) {
virt_link-> src_iface = (fixed_srcIface);//.f();
virt_link->src_iface = (fixed_srcIface);//.f();
}
virt_link-> fix_dst_iface = fix_dstIface;
virt_link->fix_dst_iface = fix_dstIface;
if (fix_dstIface) {
virt_link-> dst_iface = (fixed_dstIface);//.f();
virt_link->dst_iface = (fixed_dstIface);//.f();
}
virt_link-> emulated = emulated;
virt_link-> allow_delayed = allow_delayed;
virt_link-> allow_trivial = allow_trivial;
virt_link-> no_connection = false;
virt_link->emulated = emulated;
virt_link->allow_delayed = allow_delayed;
virt_link->allow_trivial = allow_trivial;
virt_link->no_connection = false;
virt_link->delay_info.bandwidth = bandwidth;
virt_link->delay_info.delay = latency;
virt_link->delay_info.loss = packetLoss;
......@@ -712,7 +711,6 @@ bool populate_link (DOMElement* elt,
bool populate_links(DOMElement *root, tb_vgraph &vg, map< pair<string, string>, pair<string, string> >* fixed_interfaces) {
bool is_ok = true;
/*
* TODO: Support the "PENALIZE_BANDWIDTH" option?
* TODO: Support the "FIX_PLINK_ENDPOINTS" and "FIX_PLINKS_DEFAULT"?
......
......@@ -259,6 +259,11 @@ vector<struct link_type> rspec_parser::readLinkTypes (const DOMElement* link,
return types;
}
map<string, string> rspec_parser::getShortNames(void)
{
return (this->shortNames);
}
bool rspec_parser::checkIsSwitch (string nodeId)
{
return (((this->switches).find(nodeId)) != (this->switches).end());
......@@ -312,6 +317,13 @@ rspec_parser::readFeaturesDesires (const DOMElement* tag, int& count)
return vector<struct fd>();
}
vector<struct policy>
rspec_parser::readPolicies (const DOMElement* tag, int& count)
{
count = 0;
return vector<struct policy>();
}
bool rspec_parser::readDisallowTrivialMix (const DOMElement* tag)
{
return false;
......@@ -345,5 +357,8 @@ bool rspec_parser::readTrivialOk (const DOMElement* tag)
return false;
}
bool rspec_parser::readMultiplexOk (const DOMElement* tag)
{
return false;
}
#endif
......@@ -73,6 +73,7 @@ class rspec_parser : public rspec_parser_helper
rspec_emulab_extension::emulab_extensions_parser* emulabExtensions;
int rspecType;
std::map< std::string, std::string > shortNames;
std::set< std::pair<std::string, std::string> >ifacesSeen;
std::set< std::string > switches;
virtual void addSwitch (const xercesc::DOMElement*);
......@@ -127,6 +128,10 @@ class rspec_parser : public rspec_parser_helper
std::pair<std::string, std::string> >
readInterfacesOnNode (const xercesc::DOMElement*, bool&);
// Gets a map of the interface URNS to the short names
// that assign needs for fixed interfaces
std::map<std::string, std::string> getShortNames (void);
virtual std::vector<struct rspec_emulab_extension::type_limit>
readTypeLimits (const xercesc::DOMElement*, int&);
......@@ -143,9 +148,12 @@ class rspec_parser : public rspec_parser_helper
virtual bool readDisallowTrivialMix (const xercesc::DOMElement* tag);
virtual bool readUnique (const xercesc::DOMElement* tag);
virtual int readTrivialBandwidth (const xercesc::DOMElement* tag, bool&);
virtual bool readMultiplexOk (const xercesc::DOMElement* tag);
virtual std::string readHintTo (const xercesc::DOMElement* tag, bool&);
virtual bool readNoDelay (const xercesc::DOMElement* tag);
virtual bool readTrivialOk (const xercesc::DOMElement* tag);
virtual std::vector<struct rspec_emulab_extension::policy>
readPolicies (const xercesc::DOMElement* tag, int& count);
};
......
......@@ -124,4 +124,19 @@ string rspec_parser_helper :: convertType (string type)
return (rspec_parser_helper::convertType(hwType, slType));
}
vector<DOMElement*>
rspec_parser_helper::getChildrenByName (const DOMElement* tag,
const char* name)
{
vector<DOMElement*> rv;