ItmProvider implements BindingAwareProvider, AutoCloseable, IITMProvider { @Override public void onSessionInitiated(ProviderContext session) { LOG.info("ItmProvider Session Initiated"); itmStatusMonitor.reportStatus("STARTING"); try { dataBroker = session.getSALService(DataBroker.class); idManager = getRpcProviderRegistry().getRpcService(IdManagerService.class); itmManager = new ITMManager(dataBroker); tzChangeListener = new TransportZoneListener(dataBroker, idManager) ; itmRpcService = new ItmManagerRpcService(dataBroker, idManager); vtepConfigSchemaListener = new VtepConfigSchemaListener(dataBroker); this.ifStateListener = new InterfaceStateListener(dataBroker); tnlToggleListener = new TunnelMonitorChangeListener(dataBroker); tnlIntervalListener = new TunnelMonitorIntervalListener(dataBroker); tepCommandHelper = new TepCommandHelper(dataBroker); final BindingAwareBroker.RpcRegistration<ItmRpcService> rpcRegistration = getRpcProviderRegistry().addRpcImplementation(ItmRpcService.class, itmRpcService); itmRpcService.setMdsalManager(mdsalManager); itmManager.setMdsalManager(mdsalManager); itmManager.setNotificationPublishService(notificationPublishService); itmManager.setMdsalManager(mdsalManager); tzChangeListener.setMdsalManager(mdsalManager); tzChangeListener.setItmManager(itmManager); tzChangeListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker); tnlIntervalListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker); tnlToggleListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker); tepCommandHelper = new TepCommandHelper(dataBroker); tepCommandHelper.setInterfaceManager(interfaceManager); itmStateListener =new ItmTunnelEventListener(dataBroker); createIdPool(); itmStatusMonitor.reportStatus("OPERATIONAL"); } catch (Exception e) { LOG.error("Error initializing services", e); itmStatusMonitor.reportStatus("ERROR"); } } ItmProvider(); void setRpcProviderRegistry(RpcProviderRegistry rpcProviderRegistry); RpcProviderRegistry getRpcProviderRegistry(); @Override void onSessionInitiated(ProviderContext session); void setInterfaceManager(IInterfaceManager interfaceManager); void setNotificationPublishService(NotificationPublishService notificationPublishService); void setMdsalApiManager(IMdsalApiManager mdsalMgr); void setNotificationService(NotificationService notificationService); @Override void close(); @Override DataBroker getDataBroker(); @Override void createLocalCache(BigInteger dpnId, String portName, Integer vlanId, String ipAddress, String subnetMask,
                    String gatewayIp, String transportZone); @Override void commitTeps(); @Override void showTeps(); void showState(TunnelList tunnels); void deleteVtep(BigInteger dpnId, String portName, Integer vlanId, String ipAddress, String subnetMask,
            String gatewayIp, String transportZone); @Override void configureTunnelType(String transportZone, String tunnelType); @Override void addVtepConfigSchema(VtepConfigSchema vtepConfigSchema); @Override VtepConfigSchema getVtepConfigSchema(String schemaName); @Override List<VtepConfigSchema> getAllVtepConfigSchemas(); @Override void updateVtepSchema(String schemaName, List<BigInteger> lstDpnsForAdd, List<BigInteger> lstDpnsForDelete); @Override void deleteAllVtepSchemas(); void configureTunnelMonitorEnabled(boolean monitorEnabled); void configureTunnelMonitorInterval(int interval);  }
@Test public void testOnSessionInitiated() { ItmProvider provider = new ItmProvider(); provider.onSessionInitiated(mock(BindingAwareBroker.ProviderContext.class)); }