unsigned upProfileId() const throw() { return _upProfileId; }
unsigned downProfileId() const throw() { return _downProfileId; }
+ size_t maxACLPerPDU() const throw() { return _maxACLPerPDU; }
+
const std::string & dataURL() const throw() { return _dataURL; }
// Setters
void setUpProfileId(unsigned value) throw() { _upProfileId = value; }
void setDownProfileId(unsigned value) throw() { _downProfileId = value; }
+ void setMaxACLPerPDU(size_t value) throw() { _maxACLPerPDU = value; }
+
void setDataURL(const std::string & value) throw() { _dataURL = value; }
private:
unsigned _upProfileId;
unsigned _downProfileId;
+ size_t _maxACLPerPDU;
+
std::string _dataURL;
friend class SettingsParser;
_switchSyncInterval(180),
_infoSyncInterval(60),
_upProfileId(1),
- _downProfileId(2)
+ _downProfileId(2),
+ _maxACLPerPDU(50),
+ _dataURL()
{
}
_infoSyncInterval(rvalue._infoSyncInterval),
_upProfileId(rvalue._upProfileId),
_downProfileId(rvalue._downProfileId),
+ _maxACLPerPDU(rvalue._maxACLPerPDU),
_dataURL(rvalue._dataURL)
{
}
_infoSyncInterval = rvalue._infoSyncInterval;
_upProfileId = rvalue._upProfileId;
_downProfileId = rvalue._downProfileId;
+ _maxACLPerPDU = rvalue._maxACLPerPDU;
_dataURL = rvalue._dataURL;
return *this;
}
("info-sync-interval,i", po::value<time_t>(), "info synchronization interval")
("up-profile-id", po::value<unsigned>(), "switch's upload profile id")
("down-profile-id", po::value<unsigned>(), "switch's download profile id")
+ ("max-acl-per-pdu", po::value<size_t>(), "maximum ACL's per PDU")
("data-url", po::value<std::string>(), "data access URL")
("version,v", "show gssmd version and exit")
;
_settings._downProfileId = vm["down-profile-id"].as<unsigned>();
}
+ if (vm.count("max-acl-per-pdu")) {
+ _settings._downProfileId = vm["max-acl-per-pdu"].as<unsigned>();
+ }
+
if (vm.count("data-url")) {
_settings._dataURL = vm["data-url"].as<std::string>();
}
if (fieldValue(data, "sync", "down_profile_id", res)){
_settings._downProfileId = boost::lexical_cast<unsigned>(res);
}
+ if (fieldValue(data, "sync", "max_acl_per_pdu", res)){
+ _settings._maxACLPerPDU = boost::lexical_cast<size_t>(res);
+ }
if (fieldValue(data, "sync", "data_url", res)){
_settings._dataURL = res;
}
dropACLOidPrefix += ".";
dropACLOidPrefix += boost::lexical_cast<std::string>(profileId);
SNMPList aclsList(table.getList());
- Pdu pdu;
- SNMPList::const_iterator it;
- for (it = aclsList.begin(); it != aclsList.end(); ++it) {
- int id;
- if (int c = it->get_value(id) != SNMP_CLASS_SUCCESS) {
- logger << "Switch::dropACLsByTable() - failed to get ACL id for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
+ SNMPList::const_iterator it(aclsList.begin());
+ size_t chunks = aclsList.size() / _settings.maxACLPerPDU() + 1;
+ for (size_t i = 0; i < chunks && it != aclsList.end(); ++i) {
+ Pdu pdu;
+ for (size_t j = 0; j < _settings.maxACLPerPDU() && it != aclsList.end(); ++j, ++it) {
+ int id;
+ if (int c = it->get_value(id) != SNMP_CLASS_SUCCESS) {
+ logger << "Switch::dropACLsByTable() - failed to get ACL id for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
+ return false;
+ }
+ std::string dropACLOid(dropACLOidPrefix);
+ dropACLOid += ".";
+ dropACLOid += boost::lexical_cast<std::string>(id);
+ Vb vb(Oid(dropACLOid.c_str()));
+ vb.set_value(int(6));
+ pdu += vb;
+ }
+ if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
+ logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
return false;
}
- std::string dropACLOid(dropACLOidPrefix);
- dropACLOid += ".";
- dropACLOid += boost::lexical_cast<std::string>(id);
- Vb vb(Oid(dropACLOid.c_str()));
- vb.set_value(int(6));
- pdu += vb;
- }
- if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
- logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
- return false;
}
return true;
}