Commit 2b07aaae authored by Robert Ricci's avatar Robert Ricci

Revert "Modified the command line parameters to accept a format for the ptop/vtop"

This reverts commit df603900.

Breaks the build
parent 6643d12b
...@@ -429,40 +429,38 @@ void print_help() { ...@@ -429,40 +429,38 @@ void print_help() {
cout << " -v <viz> - Produce graphviz files with given prefix." << cout << " -v <viz> - Produce graphviz files with given prefix." <<
endl; endl;
#endif #endif
cout << " -r - Don't allow trivial links." << endl; cout << " -r - Don't allow trivial links." << endl;
cout << " -p - Disable pclasses." << endl; cout << " -p - Disable pclasses." << endl;
cout << " -d - Enable dynamic pclasses." << endl; cout << " -d - Enable dynamic pclasses." << endl;
#ifdef PER_VNODE_TT #ifdef PER_VNODE_TT
cout << " -P - Prune unusable pclasses." << endl; cout << " -P - Prune unusable pclasses." << endl;
#endif #endif
cout << " -T - Doing some scoring self-testing." << endl; cout << " -T - Doing some scoring self-testing." << endl;
cout << " -H <float> - Try <float> times harder." << endl; cout << " -H <float> - Try <float> times harder." << endl;
cout << " -o - Allow overloaded pnodes to be considered." << endl; cout << " -o - Allow overloaded pnodes to be considered." << endl;
cout << " -t <float> - Start the temperature at <float> instead of melting." cout << " -t <float> - Start the temperature at <float> instead of melting."
<< endl; << endl;
cout << " -u - Print a summary of the solution." << endl; cout << " -u - Print a summary of the solution." << endl;
cout << " -c <float> - Use the 'connected' pnode finding algorithm " << cout << " -c <float> - Use the 'connected' pnode finding algorithm " <<
"<float>*100%" << endl << " of the time." << endl; "<float>*100%" << endl << " of the time." << endl;
cout << " -n - Don't anneal - just do the prechecks." << endl; cout << " -n - Don't anneal - just do the prechecks." << endl;
cout << " -x <file> - Specify a text ptop file" << endl; cout << " -x <file> - Specify a text ptop file" << endl;
// #ifdef WITH_XML #ifdef WITH_XML
// cout << " -X <file> - Specify a XML ptop file" << endl; cout << " -X <file> - Specify a XML ptop file" << endl;
// #endif #endif
cout << " -y <file> - Specify a text top file" << endl; cout << " -y <file> - Specify a text top file" << endl;
// #ifdef WITH_XML
// cout << " -Y <file> - Specify a XML vtop file" << endl;
// #endif
#ifdef WITH_XML #ifdef WITH_XML
// cout << " -q <file> - Specify a rspec ptop file" << endl; cout << " -Y <file> - Specify a XML vtop file" << endl;
// cout << " -w <file> - Specify a rspec vtop file" << endl;
cout << " -W <file> - Specify the output rspec file" << endl;
cout << " -f <T>[/<T>] - Specify the ptop and vtop file formats ";
cout << "(text|xml|rspec-<ver>)" << endl;
#endif #endif
cout << " -F - Apply additional checking to fixed nodes" << endl; #ifdef WITH_XML
cout << " -D - Dump configuration options" << endl; cout << " -q <file> - Specify a rspec ptop file" << endl;
cout << " cparams - You probably don't want to touch these!" << endl; cout << " -w <file> - Specify a rspec vtop file" << endl;
cout << " -W <file> - Specify the output rspec file" << endl;
#endif
cout << " -F - Apply additional checking to fixed nodes" << endl;
cout << " -D - Dump configuration options" << endl;
cout << " cparams - You probably don't want to touch these!" << endl;
cout << " If you must, see config.h in the source for a list" cout << " If you must, see config.h in the source for a list"
<< endl; << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
...@@ -852,12 +850,8 @@ int main(int argc,char **argv) { ...@@ -852,12 +850,8 @@ int main(int argc,char **argv) {
char* ptopFilename = ""; char* ptopFilename = "";
char* vtopFilename = ""; char* vtopFilename = "";
char* vtopOutputFilename = 0; char* vtopOutputFilename = 0;
const char* delims = "/";
char* ptopFileFormat = "";
char* vtopFileFormat = "";
while ((ch = getopt(argc,argv,"s:v:l:t:rpPTdH:oguc:nx:y:W:FDf:")) != -1) { while ((ch = getopt(argc,argv,"s:v:l:t:rpPTdH:oguc:nx:X:y:Y:q:w:W:FD")) != -1) {
switch (ch) { switch (ch) {
case 's': case 's':
if (sscanf(optarg,"%d",&seed) != 1) { if (sscanf(optarg,"%d",&seed) != 1) {
...@@ -924,15 +918,15 @@ int main(int argc,char **argv) { ...@@ -924,15 +918,15 @@ int main(int argc,char **argv) {
dump_config = true; dump_config = true;
break; break;
case 'x': case 'x':
/*#ifdef WITH_XML #ifdef WITH_XML
ptop_xml_input = false; ptop_xml_input = false;
#endif*/ #endif
if (strcmp(optarg, "") == 0) { if (strcmp(optarg, "") == 0) {
print_help(); print_help();
} }
ptopFilename = optarg; ptopFilename = optarg;
break; break;
/*#ifdef WITH_XML #ifdef WITH_XML
case 'X': case 'X':
ptop_xml_input = true; ptop_xml_input = true;
if (strcmp(optarg, "") == 0) { if (strcmp(optarg, "") == 0) {
...@@ -940,42 +934,42 @@ int main(int argc,char **argv) { ...@@ -940,42 +934,42 @@ int main(int argc,char **argv) {
} }
ptopFilename = optarg; ptopFilename = optarg;
break; break;
#endif*/ #endif
case 'y': case 'y':
/*#ifdef WITH_XML #ifdef WITH_XML
vtop_xml_input = false; vtop_xml_input = false;
#endif*/ #endif
if (strcmp(optarg, "") == 0) {
print_help();
}
vtopFilename = optarg;
break;
#ifdef WITH_XML
case 'Y':
vtop_xml_input = true;
if (strcmp(optarg, "") == 0) { if (strcmp(optarg, "") == 0) {
print_help(); print_help();
} }
vtopFilename = optarg; vtopFilename = optarg;
break; break;
// #ifdef WITH_XML #endif
// case 'Y':
// vtop_xml_input = true;
// if (strcmp(optarg, "") == 0) {
// print_help();
// }
// vtopFilename = optarg;
// break;
// #endif
// #ifdef WITH_XML
// case 'q':
// ptop_rspec_input = true;
// if (strcmp(optarg, "") == 0) {
// print_help();
// }
// ptopFilename = optarg;
// break;
//
// case 'w':
// vtop_rspec_input = true;
// if (strcmp(optarg, "") == 0) {
// print_help();
// }
// vtopFilename = optarg;
// break;
#ifdef WITH_XML #ifdef WITH_XML
case 'q':
ptop_rspec_input = true;
if (strcmp(optarg, "") == 0) {
print_help();
}
ptopFilename = optarg;
break;
case 'w':
vtop_rspec_input = true;
if (strcmp(optarg, "") == 0) {
print_help();
}
vtopFilename = optarg;
break;
case 'W': case 'W':
if (strcmp(optarg, "") == 0) { if (strcmp(optarg, "") == 0) {
print_help(); print_help();
...@@ -987,48 +981,7 @@ int main(int argc,char **argv) { ...@@ -987,48 +981,7 @@ int main(int argc,char **argv) {
check_fixed_nodes = true; check_fixed_nodes = true;
break; break;
case 'f': default:
if (strcmp(optarg, "") == 0) {
print_help();
}
ptopFileFormat = strtok(optarg, delims);
vtopFileFormat = strtok(NULL, delims);
if (strcmp(ptopFileFormat, "text") == 0) {
ptop_xml_input = false;
}
#ifdef WITH_XML
else if (strstr(ptopFileFormat, "rspec") != NULL) {
ptop_rspec_input = true;
}
else {
ptop_xml_input = true;
}
#endif
if (vtopFileFormat == NULL)
{
vtop_xml_input = ptop_xml_input;
vtop_rspec_input = ptop_rspec_input;
}
else
{
if (strcmp(vtopFileFormat, "text") == 0) {
vtop_xml_input = false;
}
#ifdef WITH_XML
else if (strstr(vtopFileFormat, "rspec") != NULL) {
vtop_rspec_input = true;
}
else {
vtop_xml_input = true;
}
#endif
}
break;
default:
print_help(); print_help();
} }
} }
......
...@@ -86,16 +86,21 @@ int parse_ptop_rspec(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -86,16 +86,21 @@ int parse_ptop_rspec(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
/* /*
* Enable some of the features we'll be using: validation, namespaces, etc. * Enable some of the features we'll be using: validation, namespaces, etc.
*/ */
/* XXX: The schema to validate against is specificed in the xml document
* This could lead to security problems. There are some ways around it,
* but they aren't exactly elegant. But we do need to take care of it at
* some point
*/
parser->setValidationScheme(XercesDOMParser::Val_Always); parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setDoNamespaces(true); parser->setDoNamespaces(true);
parser->setDoSchema(true); parser->setDoSchema(true);
parser->setValidationSchemaFullChecking(true); parser->setValidationSchemaFullChecking(true);
/*
* Must validate against the ptop schema
*/
parser -> setExternalSchemaLocation ("http://www.protogeni.net/resources/rspec/0.1 " SCHEMA_LOCATION);
/*
* Just use a custom error handler - must admin it's not clear to me why
* we are supposed to use a SAX error handler for this, but this is what
* the docs say....
*/
ParseErrorHandler* errHandler = new ParseErrorHandler(); ParseErrorHandler* errHandler = new ParseErrorHandler();
parser->setErrorHandler(errHandler); parser->setErrorHandler(errHandler);
...@@ -126,8 +131,8 @@ int parse_ptop_rspec(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -126,8 +131,8 @@ int parse_ptop_rspec(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
XStr type (advertisement_root->getAttribute(XStr("type").x())); XStr type (advertisement_root->getAttribute(XStr("type").x()));
if (strcmp(type.c(), "advertisement") == 0) if (strcmp(type.c(), "advertisement") == 0)
is_physical = true; is_physical = true;
else if (strcmp(type.c(), "request") == 0) else if (strcmp(type.c(), "request") == 0)
is_physical = false; is_physical = false;
// XXX: Not sure what to do with the datetimes, so they are strings for now // XXX: Not sure what to do with the datetimes, so they are strings for now
XStr generated (advertisement_root->getAttribute(XStr("generated").x())); XStr generated (advertisement_root->getAttribute(XStr("generated").x()));
...@@ -137,21 +142,23 @@ int parse_ptop_rspec(tb_pgraph &pg, tb_sgraph &sg, char *filename) { ...@@ -137,21 +142,23 @@ int parse_ptop_rspec(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
*/ */
// clock_t startNode = clock();
XMLDEBUG("starting node population" << endl); XMLDEBUG("starting node population" << endl);
if (!populate_nodes_rspec(advertisement_root,pg,sg,unavailable)) { if (!populate_nodes_rspec(advertisement_root,pg,sg,unavailable)) {
cerr << "Error reading nodes from physical topology " cerr << "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);
// //cerr << "Time taken : " << (clock() - startNode) / CLOCKS_PER_SEC << endl;
// clock_t startLink = clock();
XMLDEBUG("starting link population" << endl); XMLDEBUG("starting link population" << endl);
if (!populate_links_rspec(advertisement_root,pg,sg,unavailable)) { if (!populate_links_rspec(advertisement_root,pg,sg,unavailable)) {
cerr << "Error reading links from physical topology " cerr << "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);
// //cerr << "Time taken : " << (clock() - startLink) / CLOCKS_PER_SEC << endl;
// TODO: We need to do something about these policies // TODO: We need to do something about these policies
//populate_policies(root); //populate_policies(root);
......
...@@ -89,16 +89,21 @@ int parse_vtop_rspec(tb_vgraph &vg, char *filename) { ...@@ -89,16 +89,21 @@ int parse_vtop_rspec(tb_vgraph &vg, char *filename) {
/* /*
* Enable some of the features we'll be using: validation, namespaces, etc. * Enable some of the features we'll be using: validation, namespaces, etc.
*/ */
/* XXX: The schema to validate against is specificed in the xml document
* This could lead to security problems. There are some ways around it,
* but they aren't exactly elegant. But we do need to take care of it at
* some point
*/
parser->setValidationScheme(XercesDOMParser::Val_Always); parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setDoNamespaces(true); parser->setDoNamespaces(true);
parser->setDoSchema(true); parser->setDoSchema(true);
parser->setValidationSchemaFullChecking(true); parser->setValidationSchemaFullChecking(true);
/*
* Must validate against the ptop schema
*/
parser -> setExternalSchemaLocation ("http://www.protogeni.net/resources/rspec/0.1 " SCHEMA_LOCATION);
/*
* Just use a custom error handler - must admin it's not clear to me why
* we are supposed to use a SAX error handler for this, but this is what
* the docs say....
*/
ParseErrorHandler* errHandler = new ParseErrorHandler(); ParseErrorHandler* errHandler = new ParseErrorHandler();
parser->setErrorHandler(errHandler); parser->setErrorHandler(errHandler);
...@@ -112,9 +117,7 @@ int parse_vtop_rspec(tb_vgraph &vg, char *filename) { ...@@ -112,9 +117,7 @@ int parse_vtop_rspec(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 " << parser -> getErrorCount () cerr << "There were " << parser -> getErrorCount () << " errors in your file. Please correct the errors and try again." << endl;
<< " errors in your file."
<< "Please correct the errors and try again." << endl;
exit(EXIT_FATAL); exit(EXIT_FATAL);
} }
else { else {
...@@ -133,35 +136,39 @@ int parse_vtop_rspec(tb_vgraph &vg, char *filename) { ...@@ -133,35 +136,39 @@ int parse_vtop_rspec(tb_vgraph &vg, char *filename) {
exit (EXIT_FATAL); exit (EXIT_FATAL);
} }
// XXX: Not sure what to do with the datetimes, they are strings for now // XXX: Not sure what to do with the datetimes, so they are strings for now
XStr generated (request_root->getAttribute(XStr("generated").x())); XStr generated (request_root->getAttribute(XStr("generated").x()));
XStr valid_until(request_root->getAttribute(XStr("valid_until").x())); XStr valid_until(request_root->getAttribute(XStr("valid_until").x()));
map< pair<string, string>, pair<string, string> > fixed_interfaces; map< pair<string, string>, pair<string, string> > fixed_interfaces;
//map< pair<string, string>, pair<string, string> >(); //map< pair<string, string>, pair<string, string> >();
/* /*
* 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); // clock_t startNode = clock();
if (!populate_nodes_rspec(request_root,vg, &fixed_interfaces)) { XMLDEBUG("starting node population" << endl);
cerr << "Error reading nodes from virtual topology " << filename << endl; if (!populate_nodes_rspec(request_root,vg, &fixed_interfaces)) {
exit(EXIT_FATAL); cerr << "Error reading nodes from virtual topology " << filename << endl;
} exit(EXIT_FATAL);
XMLDEBUG("finishing node population" << endl); }
XMLDEBUG("finishing node population" << endl);
XMLDEBUG("starting link population" << endl); // //cerr << "Time taken : " << (clock() - startNode) / CLOCKS_PER_SEC << endl;
if (!populate_links_rspec(request_root,vg, &fixed_interfaces)) {
cerr << "Error reading links from virtual topology " << filename << endl; // clock_t startLink = clock();
exit(EXIT_FATAL); XMLDEBUG("starting link population" << endl);
} if (!populate_links_rspec(request_root,vg, &fixed_interfaces)) {
XMLDEBUG("finishing link population" << endl); cerr << "Error reading links from virtual topology " << filename << endl;
exit(EXIT_FATAL);
/* TODO: We need to do something about policies at some point. */ }
XMLDEBUG("finishing link population" << endl);
// //cerr << "Time taken : " << (clock() - startLink) / CLOCKS_PER_SEC << endl;
/* TODO: We need to do something about policies at some point. */
//populate_policies(root); //populate_policies(root);
cerr << "RSpec parsing finished" << endl; cerr << "RSpec parsing finished" << endl;
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment