checks for previously known hosts
@@ -66,6 +66,7 @@ class Update_Switch_State(Monitor_Helper_Base):
self.reinvestigation_frequency = 900
self.max_concurrent_reinvestigations = 2
+ self.connect_redis()
self.sdnc = None
self.first_time = True
self.endpoints = Endpoint_Wrapper()
@@ -175,7 +176,8 @@ class Update_Switch_State(Monitor_Helper_Base):
next_state = self.endpoints.get_endpoint_next(my_hash)
self.sdnc.mirror_mac(my_mac, messages=messages)
self.endpoints.change_endpoint_state(my_hash)
- self.endpoints.start_mirror_timer(my_hash, self.reinvestigation_frequency)
+ self.endpoints.start_mirror_timer(
+ my_hash, self.reinvestigation_frequency)
self.poseidon_logger.debug(
'endpoint:{0}:{1}:{2}:{3}'.format(my_hash, my_mac, my_ip, next_state))
return True
@@ -221,6 +223,12 @@ class Update_Switch_State(Monitor_Helper_Base):
for machine in machines:
end_point = EndPoint(machine, state='UNKNOWN')
h = end_point.make_hash()
+ if self.r and self.r.exists(h):
+ self.poseidon_logger.info(
+ 'adding address to known systems {0}'.format(machine))
+ end_point = EndPoint(machine, state='KNOWN')
+ self.endpoints.set(end_point)
+ else:
ep = None
if h in self.endpoints.state:
ep = self.endpoints.state[h]
