示例#1
0
 def push_config(self):
     if not self.config_manager:
         self._logger.info(
             "plugin not found for vendor family(%s:%s), \
               ip: %s, not pushing netconf message" %
             (str(self.vendor), str(self.product), self.management_ip))
         return
     if self.delete_config() or not self.is_vnc_managed():
         return
     self.config_manager.initialize()
     if not self.config_manager.validate_device():
         self._logger.error("physical router: %s, device config validation failed. "
               "device configuration=%s" % (self.uuid, \
                        str(self.config_manager.get_device_config())))
         return
     config_size = self.config_manager.push_conf()
     if not config_size:
         return
     self.set_conf_sent_state(True)
     self.uve_send()
     if self.config_manager.retry():
         # failed commit: set repush interval upto max value
         self.config_repush_interval = min([
             2 * self.config_repush_interval,
             PushConfigState.get_repush_max_interval()
         ])
         self.block_and_set_config_state(self.config_repush_interval)
     else:
         # successful commit: reset repush interval to base
         self.config_repush_interval = PushConfigState.get_repush_interval()
         if PushConfigState.get_push_delay_enable():
             # sleep, delay=compute max delay between two successive commits
             gevent.sleep(self.get_push_config_interval(config_size))
示例#2
0
 def delete_config(self):
     if self.is_conf_sent() and (not self.is_vnc_managed() or not self.bgp_router):
         if not self.config_manager:
             self.uve_send()
             return False
         # user must have unset the vnc managed property
         self.config_manager.push_conf(is_delete=True)
         if self.config_manager.retry():
             # failed commit: set repush interval upto max value
             self.config_repush_interval = min([2 * self.config_repush_interval,
                                                PushConfigState.get_repush_max_interval()])
             self.block_and_set_config_state(self.config_repush_interval)
             return True
         # succesful commit: reset repush interval
         self.config_repush_interval = PushConfigState.get_repush_interval()
         self.set_conf_sent_state(False)
         self.uve_send()
         self.config_manager.clear()
         return True
     return False