mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-28 17:57:22 +03:00
Feature #662: Delete operator<< from VirtualNetwork. I forgot to do it in e28ad2a69d5a31e6181c6a9a660e615a508743b3
This commit is contained in:
parent
0ac7a78ced
commit
75f590bf66
@ -41,6 +41,13 @@ protected:
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
void request_execute(xmlrpc_c::paramList const& _paramList);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
virtual void to_xml(PoolObjectSQL * object, string& str)
|
||||
{
|
||||
object->to_xml(str);
|
||||
};
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -97,6 +104,13 @@ public:
|
||||
|
||||
~VirtualNetworkInfo(){};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
void to_xml(PoolObjectSQL * object, string& str)
|
||||
{
|
||||
VirtualNetwork * vn = static_cast<VirtualNetwork*>(object);
|
||||
vn->to_xml_extended(str);
|
||||
};
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@ -151,11 +151,6 @@ public:
|
||||
return leases->size;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to write a Virtual Network in an output stream
|
||||
*/
|
||||
friend ostream& operator<<(ostream& os, VirtualNetwork& vn);
|
||||
|
||||
/**
|
||||
* Function to print the VirtualNetwork object into a string in
|
||||
* XML format
|
||||
@ -164,6 +159,14 @@ public:
|
||||
*/
|
||||
string& to_xml(string& xml) const;
|
||||
|
||||
/**
|
||||
* Function to print the VirtualNetwork object into a string in
|
||||
* XML format. The extended XML includes the LEASES
|
||||
* @param xml the resulting XML string
|
||||
* @return a reference to the generated string
|
||||
*/
|
||||
string& to_xml_extended(string& xml) const;
|
||||
|
||||
/**
|
||||
* Modifies the given nic attribute adding the following attributes:
|
||||
* * IP: leased from network
|
||||
|
@ -40,8 +40,7 @@ void RequestManagerInfo::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
object->to_xml(str);
|
||||
to_xml(object, str);
|
||||
|
||||
object->unlock();
|
||||
|
||||
|
@ -461,18 +461,6 @@ int VirtualNetwork::drop(SqlDB * db)
|
||||
/* Virtual Network :: Misc */
|
||||
/* ************************************************************************** */
|
||||
|
||||
ostream& operator<<(ostream& os, VirtualNetwork& vn)
|
||||
{
|
||||
string vnet_xml;
|
||||
|
||||
os << vn.to_xml_extended(vnet_xml,true);
|
||||
|
||||
return os;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& VirtualNetwork::to_xml(string& xml) const
|
||||
{
|
||||
return to_xml_extended(xml,false);
|
||||
@ -481,6 +469,14 @@ string& VirtualNetwork::to_xml(string& xml) const
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& VirtualNetwork::to_xml_extended(string& xml) const
|
||||
{
|
||||
return to_xml_extended(xml,true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& VirtualNetwork::to_xml_extended(string& xml, bool extended) const
|
||||
{
|
||||
ostringstream os;
|
||||
|
@ -193,12 +193,9 @@ protected:
|
||||
CPPUNIT_ASSERT( obj != 0 );
|
||||
|
||||
string xml_str;
|
||||
ostringstream oss;
|
||||
|
||||
((VirtualNetwork*)obj)->to_xml(xml_str);
|
||||
oss << * ((VirtualNetwork*)obj);
|
||||
((VirtualNetwork*)obj)->to_xml_extended(xml_str);
|
||||
|
||||
xml_str = oss.str();
|
||||
/*
|
||||
if( xml_str != xmls[index] )
|
||||
{
|
||||
@ -460,7 +457,7 @@ public:
|
||||
|
||||
string result = oss.str();
|
||||
|
||||
//*
|
||||
/*
|
||||
if( result != xml_dump )
|
||||
{
|
||||
cout << endl << result << endl << "========"
|
||||
@ -491,7 +488,7 @@ public:
|
||||
|
||||
string result = oss.str();
|
||||
|
||||
//*
|
||||
/*
|
||||
if( result != xml_dump_where )
|
||||
{
|
||||
cout << endl << result << endl << "========"
|
||||
@ -820,7 +817,7 @@ public:
|
||||
string mac = "";
|
||||
string bridge = "";
|
||||
|
||||
ostringstream oss;
|
||||
string xml_str;
|
||||
string xpath;
|
||||
|
||||
vector<int> results;
|
||||
@ -854,20 +851,19 @@ public:
|
||||
// First VNet
|
||||
vn = vnpool->get(oid_0, false);
|
||||
CPPUNIT_ASSERT( vn != 0 );
|
||||
oss << *vn;
|
||||
vn->to_xml_extended(xml_str);
|
||||
|
||||
// 0 Used leases
|
||||
ObjectXML::xpath_value(xpath, oss.str().c_str(), "/VNET/TOTAL_LEASES" );
|
||||
ObjectXML::xpath_value(xpath, xml_str.c_str(), "/VNET/TOTAL_LEASES" );
|
||||
CPPUNIT_ASSERT( xpath == "0" );
|
||||
|
||||
// Second VNet
|
||||
vn = vnpool->get(oid_new, false);
|
||||
CPPUNIT_ASSERT( vn != 0 );
|
||||
oss.str("");
|
||||
oss << *vn;
|
||||
vn->to_xml_extended(xml_str);
|
||||
|
||||
// 1 Used leases
|
||||
ObjectXML::xpath_value(xpath, oss.str().c_str(), "/VNET/TOTAL_LEASES" );
|
||||
ObjectXML::xpath_value(xpath, xml_str.c_str(), "/VNET/TOTAL_LEASES" );
|
||||
CPPUNIT_ASSERT( xpath == "1" );
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@ -909,21 +905,19 @@ public:
|
||||
// First VNet
|
||||
vn = vnpool->get(oid_0, false);
|
||||
CPPUNIT_ASSERT( vn != 0 );
|
||||
oss.str("");
|
||||
oss << *vn;
|
||||
vn->to_xml_extended(xml_str);
|
||||
|
||||
// 0 Used leases
|
||||
ObjectXML::xpath_value(xpath, oss.str().c_str(), "/VNET/TOTAL_LEASES" );
|
||||
ObjectXML::xpath_value(xpath, xml_str.c_str(), "/VNET/TOTAL_LEASES" );
|
||||
CPPUNIT_ASSERT( xpath == "0" );
|
||||
|
||||
// Second VNet
|
||||
vn = vnpool->get(oid_new, false);
|
||||
CPPUNIT_ASSERT( vn != 0 );
|
||||
oss.str("");
|
||||
oss << *vn;
|
||||
vn->to_xml_extended(xml_str);
|
||||
|
||||
// 1 Used leases
|
||||
ObjectXML::xpath_value(xpath, oss.str().c_str(), "/VNET/TOTAL_LEASES" );
|
||||
ObjectXML::xpath_value(xpath, xml_str.c_str(), "/VNET/TOTAL_LEASES" );
|
||||
CPPUNIT_ASSERT( xpath == "1" );
|
||||
// ---------------------------------------------------------------------
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user