// TODO set the timeout and arp_neighbor_timeout for each dp to the reinvestigation_frequency or 900 seconds
self.logger.info("reinvestigation_freq: " + str(self.reinvestigation_frequency))
self.logger.info("max_concurrent: " + str(self.max_concurrent_reinvestigations))
if action == "mirror" or action == "unmirror":
ok = True
After Change
if action == "mirror":
// TODO make this smarter about more complex configurations (backup original values, etc)
obj_doc["dps"][switch_found]["timeout"] = self.reinvestigation_frequency
obj_doc["dps"][switch_found]["arp_neighbor_timeout"] = self.reinvestigation_frequency
if not port in obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]]["mirror"] and port is not None:
obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]]["mirror"].append(
port)
elif action == "unmirror":
try:
// TODO check for still running captures on this port
obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]]["mirror"].remove(
port)
except ValueError:
self.logger.warning("This port: {0} was not already "
"mirroring on this switch: {1}".format(str(port), str(switch_found)))
else:
self.logger.error("Unable to mirror due to warnings")
return False
elif action == "shutdown":
// TODO
pass
else:
self.logger.warning("Unknown action: {0}".format(action))
try:
if len(obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]]["mirror"]) == 0:
obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]].remove(
"mirror")
// TODO make this smarter about more complex configurations (backup original values, etc)
del obj_doc["dps"][switch_found]["timeout"]
del obj_doc["dps"][switch_found]["arp_neighbor_timeout"]
else:
ports = []
for p in obj_doc["dps"][switch_found]["interfaces"][self.mirror_ports[switch_found]]["mirror"]: