Commit ef766011 authored by Tarun Prabhu's avatar Tarun Prabhu

Added support for set-type-limits in the advertisement. It is implemented as...

Added support for set-type-limits in the advertisement. It is implemented as an extension. There is no support for this in v1. It will only be in v2 and higher. To this end, ptopgen has been modified. ptopgen also now adds type slot information to nodes as an extension. However, support for other extensions still have to be added. Added another annotater class for rspec v2 but this in a very incomplete state as of now and the relevant code has been commented out of solution.cc temporarily. Assign's arguments have also been modified in mapper, so that it expects rspec inputs.
parent fc03e047
......@@ -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
......@@ -35,13 +33,21 @@ class annotate
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;
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;
// 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;
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);
......
......@@ -63,8 +63,8 @@ class annotate_rspec : public annotate
// 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*
create_component_hop (const xercesc::DOMElement* plink,
xercesc::DOMElement* vlink,
int endpoint_interface,
const xercesc::DOMElement* prev_hop);
......
This diff is collapsed.
/*
* 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 <list>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <xercesc/dom/DOM.hpp>
class annotate_rspec_v2 : 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_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);
// 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);
};
#endif //for __ANNOTATE_RSPEC_H
#endif // for WITH_XML
......@@ -31,10 +31,10 @@ emulab_operator emulab_extensions_parser::readOperator(DOMElement* tag)
return op;
}
vector<struct fd> emulab_extensions_parser::readAllFeaturesDesires
(DOMElement* elem)
vector<struct fd>
emulab_extensions_parser::readAllFeaturesDesires (DOMElement* elem)
{
DOMNodeList* fdNodes = elem->getElementsByTagName(XStr("fd").x());
DOMNodeList* fdNodes = elem->getElementsByTagName(XStr("emulab:fd").x());
vector<struct fd> fds;
for (int i = 0; i < fdNodes->getLength(); i++) {
fds.push_back(this->readFeatureDesire
......@@ -46,9 +46,9 @@ vector<struct fd> emulab_extensions_parser::readAllFeaturesDesires
struct fd emulab_extensions_parser::readFeatureDesire (DOMElement* tag)
{
struct fd fdObject = {
this->getAttribute(tag, "fd_name"),
this->getAttribute(tag, "name"),
rspec_parser_helper::stringToNum
(this->getAttribute(tag, "fd_weight")),
(this->getAttribute(tag, "weight")),
this->hasAttribute(tag, "violatable"),
this->readOperator(tag)
};
......@@ -56,7 +56,7 @@ struct fd emulab_extensions_parser::readFeatureDesire (DOMElement* tag)
}
vector<struct property> emulab_extensions_parser::readAllProperties
(DOMElement* elem)
(DOMElement* elem)
{
DOMNodeList* propNodes = elem->getElementsByTagName(XStr("property").x());
vector<struct property> properties;
......@@ -96,15 +96,16 @@ struct hardness emulab_extensions_parser::readHardness (DOMElement* tag)
return hardnessObject;
}
vector<struct vclass> emulab_extensions_parser::readAllVClasses
(DOMElement* elem)
vector<struct vclass>
emulab_extensions_parser::readAllVClasses (DOMElement* elem)
{
DOMNodeList* vclassNodes =
elem->getElementsByTagName(XStr("vtop_vclass").x());
DOMNodeList* vclassNodes
= elem->getElementsByTagName(XStr("emulab:vclass").x());
vector<struct vclass> vclasses;
for (int i = 0; i < vclassNodes->getLength(); i++) {
vclasses.push_back(this->readVClass
(dynamic_cast<DOMElement*>(vclassNodes->item(i))));
(dynamic_cast<DOMElement*>
(vclassNodes->item(i))));
}
return vclasses;
}
......@@ -121,20 +122,44 @@ struct vclass emulab_extensions_parser::readVClass (DOMElement* tag)
string emulab_extensions_parser::readTypeSlots (DOMElement* tag)
{
DOMElement* typeSlotsNode
= dynamic_cast<DOMElement*>
((tag->getElementsByTagName(XStr("emulab:ext_node_type").x()))
->item(0));
DOMNodeList* typeSlotsNodes
= tag->getElementsByTagName(XStr("emulab:node_type").x());
if (typeSlotsNodes->getLength() == 0) {
return "";
}
DOMElement* typeSlotsNode = dynamic_cast<DOMElement*>(typeSlotsNodes->item(0));
return (this->getAttribute(typeSlotsNode, "type_slots"));
}
bool emulab_extensions_parser::readStaticType (DOMElement* tag)
{
DOMElement* typeSlotsNode
= dynamic_cast<DOMElement*>
((tag->getElementsByTagName(XStr("emulab:ext_node_type").x()))
->item(0));
DOMNodeList* typeSlotsNodes
= tag->getElementsByTagName(XStr("emulab:node_type").x());
if (typeSlotsNodes->getLength() == 0) {
return false;
}
DOMElement* typeSlotsNode = dynamic_cast<DOMElement*>(typeSlotsNodes->item(0));
return (typeSlotsNode->hasAttribute(XStr("static").x()));
}
vector<struct type_limit>
emulab_extensions_parser::readTypeLimits (const DOMElement* tag, int& count)
{
vector<struct type_limit> rv;
DOMNodeList* typeLimitNodes
= tag->getElementsByTagName(XStr("emulab:set_type_limit").x());
count = typeLimitNodes->getLength();
for (int i = 0; i < count; i++) {
DOMElement* limitNode = dynamic_cast<DOMElement*>(typeLimitNodes->item(i));
string typeClass = this->getAttribute(limitNode, "typeclass");
string typeCount = this->getAttribute(limitNode, "count");
struct type_limit limit = {
typeClass ,
(int)rspec_parser_helper::stringToNum(typeCount)
};
rv.push_back(limit);
}
return rv;
}
#endif // WITH_XML
......@@ -16,12 +16,12 @@
namespace rspec_emulab_extension {
#define LOCAL_OPERATOR 0
#define GLOBAL_OPERATOR 1
#define NORMAL_OPERATOR 2
#define LOCAL_OPERATOR 0
#define GLOBAL_OPERATOR 1
#define NORMAL_OPERATOR 2
#define HARD_VCLASS 0
#define SOFT_VCLASS 1
#define HARD_VCLASS 0
#define SOFT_VCLASS 1
struct emulab_operator {
std::string op;
......@@ -72,6 +72,11 @@ namespace rspec_emulab_extension {
struct emulab_operator op;
};
struct type_limit {
std::string typeClass;
int typeCount;
};
class emulab_extensions_parser : public rspec_parser_helper {
private:
int type;
......@@ -97,6 +102,8 @@ namespace rspec_emulab_extension {
std::string readHintTo (xercesc::DOMElement* tag);
std::string readTypeSlots (xercesc::DOMElement* tag);
bool readStaticType (xercesc::DOMElement* tag);
std::vector<struct type_limit> readTypeLimits(const xercesc::DOMElement* tag,
int& count);
};
} // namespace rspec_emulab_extension
......
This diff is collapsed.
......@@ -66,10 +66,12 @@ static rspec_parser* rspecParser;
* These are not meant to be used outside of this file,so they are only
* declared in here
*/
static bool populate_nodes(DOMElement *root, tb_vgraph &vg,
static bool populate_nodes(DOMElement *root,
tb_vgraph &vg,
map< pair<string, string>,
pair<string, string> >* fixed_interfaces);
static bool populate_links(DOMElement *root, tb_vgraph &vg,
static bool populate_links(DOMElement *root,
tb_vgraph &vg,
map< pair<string, string>,
pair<string, string> >* fixed_interfaces);
......@@ -128,8 +130,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)
{
if (strcmp(type.c(), "request") != 0) {
cerr << "Error: RSpec type must be \"request\"" << endl;
exit (EXIT_FATAL);
}
......@@ -141,8 +142,7 @@ int parse_request(tb_vgraph &vg, char *filename) {
// Initialize the rspec parser with the correct object depending
// on the version of the rspec.
int rspecVersion = rspec_parser_helper::getRspecVersion(request_root);
switch (rspecVersion)
{
switch (rspecVersion) {
case 1:
rspecParser = new rspec_parser_v1(RSPEC_TYPE_REQ);
break;
......@@ -199,9 +199,6 @@ bool populate_node(DOMElement* elt,
bool hasVirtualId;
string virtualId = rspecParser->readVirtualId(elt, hasVirtualId);
bool available;
string availableString = rspecParser->readAvailable(elt, available);
bool hasComponentId;
bool hasCMId;
string componentId = rspecParser->readPhysicalId(elt, hasComponentId);
......@@ -218,8 +215,7 @@ bool populate_node(DOMElement* elt,
<< "The componentId will be ignored." << endl;
}
if (!hasVirtualId)
{
if (!hasVirtualId) {
cerr << "ERROR: Every node must have a virtual_id" << endl;
return false;
}
......@@ -245,7 +241,6 @@ bool populate_node(DOMElement* elt,
int typeCount;
vector<struct node_type> types = rspecParser->readNodeTypes(elt, typeCount);
cerr << " Here " << endl;
bool no_type = (typeCount == 0);
if (typeCount > 1) {
cerr << "ERROR: Too many node types (" << typeCount << ") on "
......@@ -259,8 +254,6 @@ bool populate_node(DOMElement* elt,
bool isUnlimited = (typeSlots == 1000);
cerr << "Done parsing node types " << endl;
/*
* Make a tb_ptype structure for this guy - or just add this node to
* it if it already exists
......@@ -322,7 +315,8 @@ bool populate_node(DOMElement* elt,
true,featuredesire::FD_TYPE_NORMAL);
node_fd.add_desire_user( 1.0 );
v->desires.push_front( node_fd );
} else if(exclusive != "true" && exclusive != "1"){
}
else if(exclusive != "true" && exclusive != "1"){
static int syntax_error;
if( !syntax_error ) {
......@@ -342,10 +336,8 @@ bool populate_node(DOMElement* elt,
// If a component manager has been specified, then the node must be
// managed by that CM. We implement this as a desire.
if (hasCMId)
{
tb_node_featuredesire node_fd (
XStr(cmId.c_str()).f(),
if (hasCMId) {
tb_node_featuredesire node_fd (XStr(cmId.c_str()).f(),
1.0, true, featuredesire::FD_TYPE_NORMAL);
node_fd.add_desire_user(0);
(v->desires).push_front(node_fd);
......@@ -358,7 +350,9 @@ bool populate_node(DOMElement* elt,
/*
* Pull nodes from the document, and populate assign's own data structures
*/
bool populate_nodes(DOMElement *root, tb_vgraph &vg, map< pair<string, string>, pair<string, string> >* fixed_interfaces) {
bool populate_nodes(DOMElement *root,
tb_vgraph &vg, map< pair<string, string>,
pair<string, string> >* fixed_interfaces) {
bool is_ok = true;
/*
* Get a list of all nodes in this document
......@@ -368,8 +362,7 @@ bool populate_nodes(DOMElement *root, tb_vgraph &vg, map< pair<string, string>,
XMLDEBUG("Found " << nodeCount << " nodes in rspec" << endl);
clock_t times [nodeCount];
for (size_t i = 0; i < nodeCount; i++)
{
for (size_t i = 0; i < nodeCount; i++) {
DOMNode *node = nodes->item(i);
// This should not be able to fail, because all elements in
// this list came from the getElementsByTagName() call
......@@ -388,7 +381,9 @@ bool populate_nodes(DOMElement *root, tb_vgraph &vg, map< pair<string, string>,
return is_ok;
}
bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pair<string,string> >* fixed_interfaces)
bool populate_link (DOMElement* elt,
tb_vgraph &vg, map< pair<string,string>,
pair<string,string> >* fixed_interfaces)
{
bool hasVirtualId;
string virtualId = rspecParser->readVirtualId(elt, hasVirtualId);
......@@ -434,8 +429,7 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
* and then destination and we assume the same ordering.
* If more than two interfaces are provided, the link must be a lan
*/
if (ifaceCount > 2)
{
if (ifaceCount > 2) {
string str_lan_id = generate_virtualNodeId(virtualId);
// NOTE: This is an attribute which is not in the rspec
......@@ -468,18 +462,14 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
// will fail if they are added before the lan node is added.
list<DOMElement*> links;
list<DOMElement*>::iterator it = links.begin();
for (int i = 0; i < ifaceCount; ++i)
{
for (int i = 0; i < ifaceCount; ++i) {
link_interface interface = interfaces[i];
const XMLCh* virtualIfaceId
= XStr(interface.virtualIfaceId.c_str()).x();
const XMLCh* virtualNodeId
= XStr(interface.virtualNodeId.c_str()).x();
string str_lan_interface_id =
generate_virtualIfaceId(str_lan_id, i);
DOMElement* lan_interface =
doc->createElement(XStr("interface").x());
const XMLCh* virtualIfaceId = XStr(interface.virtualIfaceId.c_str()).x();
const XMLCh* virtualNodeId = XStr(interface.virtualNodeId.c_str()).x();
string str_lan_interface_id = generate_virtualIfaceId(str_lan_id, i);
DOMElement* lan_interface = doc->createElement(XStr("interface").x());
lan_node->appendChild(lan_interface);
lan_interface->setAttribute(XStr("virtual_id").x(),
XStr(str_lan_interface_id.c_str()).x());
......@@ -527,13 +517,11 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
populate_link(*it, vg, fixed_interfaces);
return true;
}
else if (ifaceCount == 2)
{
else if (ifaceCount == 2) {
src = interfaces[0];
dst = interfaces[1];
}
else
{
else {
cerr << "ERROR: Too few interfaces found (" << ifaceCount << ")"
<< " on " << virtualId << " at least 2 required ... Aborting"
<< endl;
......@@ -544,14 +532,12 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
string srcIface = src.virtualIfaceId;
string dstNode = dst.virtualNodeId;
string dstIface = dst.virtualIfaceId;
if (srcNode == "" || srcIface == "")
{
if (srcNode == "" || srcIface == "") {
cerr << "No source node found on interface for link "
<< virtualId << endl;
return false;
}
if (dstNode == "" || dstIface == "")
{
if (dstNode == "" || dstIface == "") {
cerr << "No destination node found on interface for link "
<< virtualId << endl;
return false;
......@@ -588,8 +574,7 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
bool fix_srcIface = false;
fstring fixed_srcIface = "";
it = fixed_interfaces->find(pair<string,string>(srcNode, srcIface));
if (it != fixed_interfaces->end())
{
if (it != fixed_interfaces->end()) {
cerr << "Found fixed source interface (" << (it->second).first << ","
<< (it->second).second << ") on (" << (it->first).first << ","
<< (it->first).second << ")" << endl;
......@@ -601,8 +586,7 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
bool fix_dstIface = false;
fstring fixed_dstIface = "";
it = fixed_interfaces->find(make_pair(dstNode, dstIface));
if (it != fixed_interfaces->end())
{
if (it != fixed_interfaces->end()) {
cerr << "Found fixed destination interface (" << (it->second).first
<< "," << (it->second).second << ") on (" << (it->first).first
<< "," << (it->first).second << ")" << endl;
......@@ -610,16 +594,13 @@ bool populate_link (DOMElement* elt, tb_vgraph &vg, map< pair<string,string>, pa
fixed_dstIface = (it->second).second;
}
if (emulated)
{
if (!allow_trivial)
{
if (emulated) {
if (!allow_trivial) {
src_vnode->total_bandwidth += bandwidth;
dst_vnode->total_bandwidth += bandwidth;
}
}
else
{
else {
src_vnode->num_links++;
dst_vnode->num_links++;
src_vnode->link_counts[linkType.c_str()]++;
......
......@@ -68,7 +68,7 @@ string rspec_parser::readVirtualizationType (const DOMElement* tag,
bool& hasVirtualizationType)
{
return(this->getAttribute(tag, "virtualization_type",
hasVirtualizationType));
hasVirtualizationType));
}
//
......@@ -124,7 +124,7 @@ vector<struct node_type> rspec_parser::readNodeTypes (const DOMElement* node,
// Returns any fixed interfaces which are found
map< pair<string, string>, pair<string, string> >
rspec_parser::readInterfacesOnNode (const DOMElement* node,
rspec_parser::readInterfacesOnNode (const DOMElement* node,
bool& allUnique)
{
DOMNodeList* ifaces = node->getElementsByTagName(XStr("interface").x());
......@@ -136,24 +136,20 @@ map< pair<string, string>, pair<string, string> >
bool hasAttr;
string nodeId = "";
string ifaceId = "";
if (this->rspecType == RSPEC_TYPE_ADVT)
{
if (this->rspecType == RSPEC_TYPE_ADVT) {
nodeId = this->readPhysicalId (node, hasAttr);
ifaceId = XStr(iface->getAttribute(XStr("component_id").x())).c();
}
else //(this->rspecType == RSPEC_TYPE_REQ)
{
else { //(this->rspecType == RSPEC_TYPE_REQ)
nodeId = this->readVirtualId (node, hasAttr);
ifaceId = XStr(iface->getAttribute(XStr("client_id").x())).c();
if (iface->hasAttribute(XStr("component_id").x()))
{
if (iface->hasAttribute(XStr("component_id").x())) {
bool hasComponentId;
string componentNodeId =
this->readPhysicalId (node, hasComponentId);
string componentIfaceId =
this->getAttribute(iface, "component_id");
fixedInterfaces.insert
(make_pair
fixedInterfaces.insert (make_pair
(make_pair(nodeId,ifaceId),
make_pair(componentNodeId,componentIfaceId)));
}
......@@ -165,8 +161,8 @@ map< pair<string, string>, pair<string, string> >
}
// Returns a link_characteristics element
struct link_characteristics rspec_parser :: readLinkCharacteristics
(const DOMElement* link,
struct link_characteristics
rspec_parser :: readLinkCharacteristics (const DOMElement* link,
int& count,
int defaultBandwidth,
int unlimitedBandwidth)
......@@ -192,8 +188,8 @@ struct link_characteristics rspec_parser :: readLinkCharacteristics
return rv;
}
vector<struct link_interface> rspec_parser :: readLinkInterface
(const DOMElement* link, int& ifaceCount)
vector<struct link_interface>
rspec_parser :: readLinkInterface (const DOMElement* link, int& ifaceCount)
{
DOMNodeList* ifaceRefs =
link->getElementsByTagName(XStr("interface_ref").x());
......@@ -211,31 +207,23 @@ vector<struct link_interface> rspec_parser :: readLinkInterface
pair<string, string> srcNodeIface;
pair<string, string> dstNodeIface;
if (this->rspecType == RSPEC_TYPE_ADVT)
{
srcNodeIface
= make_pair(srcIface.physicalNodeId, srcIface.physicalIfaceId);
dstNodeIface
= make_pair(dstIface.physicalNodeId, dstIface.physicalIfaceId);
if (this->rspecType == RSPEC_TYPE_ADVT) {
srcNodeIface = make_pair(srcIface.physicalNodeId, srcIface.physicalIfaceId);
dstNodeIface = make_pair(dstIface.physicalNodeId, dstIface.physicalIfaceId);
}
else // (this->rspecType == RSPEC_TYPE_REQ)
{
srcNodeIface
= make_pair(srcIface.virtualNodeId, srcIface.virtualIfaceId);
dstNodeIface
= make_pair(dstIface.virtualNodeId, dstIface.virtualIfaceId);
else {//(this->rspecType == RSPEC_TYPE_REQ)
srcNodeIface = make_pair(srcIface.virtualNodeId, srcIface.virtualIfaceId);
dstNodeIface = make_pair(dstIface.virtualNodeId, dstIface.virtualIfaceId);
}
vector<struct link_interface> rv;
// Check if the node-interface pair has been seen before.
// If it hasn't, it is an error
if ((this->ifacesSeen).find(srcNodeIface) == (this->ifacesSeen).end())
{
if ((this->ifacesSeen).find(srcNodeIface) == (this->ifacesSeen).end()) {
ifaceCount = RSPEC_ERROR_UNSEEN_NODEIFACE_SRC;
return rv;
}
if ((this->ifacesSeen).find(dstNodeIface) == (this->ifacesSeen).end())
{
if ((this->ifacesSeen).find(dstNodeIface) == (this->ifacesSeen).end()) {
ifaceCount = RSPEC_ERROR_UNSEEN_NODEIFACE_DST;
return rv;
}
......@@ -251,8 +239,7 @@ vector<struct link_type> rspec_parser::readLinkTypes (const DOMElement* link,
{
DOMNodeList* linkTypes = link->getElementsByTagName(XStr("link_type").x());
vector<struct link_type> types;
for (int i = 0; i < linkTypes->getLength(); i++)
{
for (int i = 0; i < linkTypes->getLength(); i++) {
DOMElement *tag = dynamic_cast<DOMElement*>(linkTypes->item(i));
string name = XStr(tag->getAttribute(XStr("name").x())).c();
......@@ -280,5 +267,11 @@ string rspec_parser :: readAvailable (const DOMElement* tag, bool& isAvailable)
return (this->readChild(tag, "available", isAvailable));
}
vector<struct type_limit>
rspec_parser::readTypeLimits (const DOMElement* tag, int& count)
{
count = 0;
return vector<struct type_limit>();
}
#endif
......@@ -67,12 +67,7 @@ struct node_interface
class rspec_parser : public rspec_parser_helper
{
private:
// std::string getAttribute (const xercesc::DOMElement*,
// const std::string,
// bool&);
// std::string getAttribute(const xercesc::DOMElement*, const std::string);
// bool hasAttribute (const xercesc::DOMElement*, const std::string);
// std::string readChild (const xercesc::DOMElement*, const char*, bool&);