def __init__(self, rpc=None): self.rpc = rpc or arista_ml2.AristaRPCWrapper() self.db_nets = db.AristaProvisionedNets() self.db_vms = db.AristaProvisionedVms() self.db_tenants = db.AristaProvisionedTenants() self.ndb = db_lib.NeutronNets() confg = cfg.CONF.ml2_arista self.segmentation_type = db_lib.VLAN_SEGMENTATION self.timer = None self.eos = arista_ml2.SyncService(self.rpc, self.ndb) self.sync_timeout = confg['sync_interval'] self.eos_sync_lock = threading.Lock()
def __init__(self, rpc=None): self.ndb = db_lib.NeutronNets() self.db_nets = db.AristaProvisionedNets() self.db_vms = db.AristaProvisionedVms() self.db_tenants = db.AristaProvisionedTenants() confg = cfg.CONF.ml2_arista self.segmentation_type = db_lib.VLAN_SEGMENTATION self.timer = None self.sync_timeout = confg['sync_interval'] self.managed_physnets = confg['managed_physnets'] self.eos_sync_lock = threading.Lock() self.eapi = None if rpc: LOG.info("Using passed in parameter for RPC") self.rpc = rpc self.eapi = rpc else: self.eapi = arista_ml2.AristaRPCWrapperEapi(self.ndb) api_type = confg['api_type'].upper() if api_type == 'EAPI': LOG.info("Using EAPI for RPC") self.rpc = arista_ml2.AristaRPCWrapperEapi(self.ndb) elif api_type == 'JSON': LOG.info("Using JSON for RPC") self.rpc = arista_ml2.AristaRPCWrapperJSON(self.ndb) else: msg = "RPC mechanism %s not recognized" % api_type LOG.error(msg) raise arista_exc.AristaRpcError(msg=msg) self.sync_service = arista_ml2.SyncService(self.rpc, self.ndb) self.rpc.sync_service = self.sync_service
def setUp(self): super(SyncServiceTest, self).setUp() self.rpc = mock.MagicMock() ndb = db_lib.NeutronNets() self.sync_service = arista_ml2.SyncService(self.rpc, ndb) self.sync_service._force_sync = False