Example #1
0
File: vlan.py Project: skripkar/noc
 def handler(self):
     self.logger.info("Checking VLANs")
     if not self.object.segment.profile.enable_vlan:
         self.logger.info(
             "VLAN discovery is disabled for segment '%s'. Skipping",
             self.object.segment.name)
         return
     # Get effective border segment
     segment = NetworkSegment.get_border_segment(self.object.segment)
     # Get list of VLANs from equipment
     object_vlans = self.get_vlans(segment)
     # Merge with artifactory ones
     collected_vlans = self.merge_vlans(object_vlans)
     # Check we have collected any VLAN
     if not collected_vlans:
         self.logger.info("No any VLAN collected. Skipping")
         return
     # Refresh vlans in database
     ensured_vlans = self.ensure_vlans(collected_vlans)
     # Refresh discovery timestamps
     self.refresh_discovery_timestamps(ensured_vlans)
     # Send "seen" events
     self.send_seen_events(ensured_vlans)
Example #2
0
 def clean(self):
     super().clean()
     self.segment = NetworkSegment.get_border_segment(self.segment)
     if self.translation_rule and not self.parent:
         self.translation_rule = None