コード例 #1
0
 def update(self, obj=None):
     if obj is None:
         obj = self.read_obj(self.uuid)
     self.name = obj['fq_name'][-1]
     self.management_ip = obj.get('physical_router_management_ip')
     self.loopback_ip = obj.get('physical_router_loopback_ip', '')
     self.dataplane_ip = obj.get(
         'physical_router_dataplane_ip') or self.loopback_ip
     self.vendor = obj.get('physical_router_vendor_name', '')
     self.product = obj.get('physical_router_product_name', '')
     self.vnc_managed = obj.get('physical_router_vnc_managed')
     self.physical_router_role = obj.get('physical_router_role')
     self.user_credentials = obj.get('physical_router_user_credentials')
     self.junos_service_ports = obj.get(
         'physical_router_junos_service_ports')
     self.update_single_ref('bgp_router', obj)
     self.update_multiple_refs('virtual_network', obj)
     self.update_multiple_refs('logical_router', obj)
     self.physical_interfaces = set(
         [pi['uuid'] for pi in obj.get('physical_interfaces', [])])
     self.logical_interfaces = set(
         [li['uuid'] for li in obj.get('logical_interfaces', [])])
     plugin_params = {"physical_router": self}
     # reinit plugin, find out new plugin if vendor/product is changed
     if not self.config_manager:
         self.config_manager = DeviceConf.plugin(self.vendor, self.product,
                                                 plugin_params,
                                                 self._logger)
     else:
         if self.config_manager.verify_plugin(self.vendor, self.product):
             self.config_manager.update()
         else:
             self.config_manager.clear()
             self.config_manager = DeviceConf.plugin(
                 self.vendor, self.product, plugin_params, self._logger)
コード例 #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()