Beispiel #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))
Beispiel #2
0
 def __init__(self, uuid, obj_dict=None):
     self.uuid = uuid
     self.virtual_networks = set()
     self.logical_routers = set()
     self.bgp_router = None
     self.config_manager = None
     self.nc_q = queue.Queue(maxsize=1)
     self.vn_ip_map = {'irb': {}, 'lo0': {}}
     self.config_sent = False
     self.init_cs_state()
     self.update(obj_dict)
     plugin_params = {"physical_router": self}
     self.config_manager = DeviceConf.plugin(self.vendor, self.product,
                                             plugin_params, self._logger)
     if self.config_manager:
         self.set_conf_sent_state(False)
         self.config_repush_interval = PushConfigState.get_repush_interval()
         self.nc_handler_gl = vnc_greenlets.VncGreenlet(
             "VNC Device Manager", self.nc_handler)
         self.uve_send()
Beispiel #3
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