BUG-6650: ep-ip/sgt, implement and wire template provider
[groupbasedpolicy.git] / sxp-integration / sxp-ise-adapter / src / main / java / org / opendaylight / groupbasedpolicy / sxp_ise_adapter / impl / GbpIseConfigListenerImpl.java
index 69c1f8d37bfb441cbb44fdd669cd903cbbb20873..d75bd9599f98d96e6aa2a1b9abfbccf7770e03c8 100644 (file)
@@ -48,11 +48,14 @@ public class GbpIseConfigListenerImpl implements GbpIseConfigListener {
 
     private final DataBroker dataBroker;
     private final GbpIseSgtHarvester gbpIseSgtHarvester;
+    @Nonnull private final EPPolicyTemplateProviderFacade templateProviderFacade;
     private final ThreadPoolExecutor pool;
 
-    public GbpIseConfigListenerImpl(@Nonnull final DataBroker dataBroker, @Nonnull final GbpIseSgtHarvester gbpIseSgtHarvester) {
+    public GbpIseConfigListenerImpl(@Nonnull final DataBroker dataBroker, @Nonnull final GbpIseSgtHarvester gbpIseSgtHarvester,
+                                    @Nonnull final EPPolicyTemplateProviderFacade templateProviderFacade) {
         this.dataBroker = dataBroker;
         this.gbpIseSgtHarvester = gbpIseSgtHarvester;
+        this.templateProviderFacade = templateProviderFacade;
         pool = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(10),
                 new ThreadFactoryBuilder().setNameFormat("ise-sgt-harverster-%d").build()) {
             @Override
@@ -69,6 +72,8 @@ public class GbpIseConfigListenerImpl implements GbpIseConfigListener {
     public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<IseSourceConfig>> collection) {
         for (DataTreeModification<IseSourceConfig> modification : collection) {
             final IseSourceConfig iseSourceConfig = modification.getRootNode().getDataAfter();
+            //TODO: separate template provider from harvesting
+            templateProviderFacade.assignIseSourceConfig(iseSourceConfig);
             if (iseSourceConfig != null) {
                 pool.submit(() -> {
                     final ListenableFuture<Integer> harvestResult = gbpIseSgtHarvester.harvest(iseSourceConfig);