2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.renderer.ios_xe_provider.impl.manager;
11 import java.util.ArrayList;
12 import java.util.List;
13 import com.google.common.util.concurrent.CheckedFuture;
14 import com.google.common.util.concurrent.Futures;
15 import com.google.common.util.concurrent.ListenableFuture;
16 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.has.unconfigured.rule.groups.unconfigured.rule.group.UnconfiguredResolvedRule;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.Status;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.renderer.endpoints.RendererEndpoint;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.status.unconfigured.endpoints.UnconfiguredRendererEndpoint;
23 * Purpose: placeholder for
25 * <li>{@link PolicyManagerImpl.PolicyMapLocation}</li>
26 * <li>{@link Status} parts</li>
29 public class PolicyConfigurationContext {
31 private final List<UnconfiguredRendererEndpoint> unconfiguredRendererEPBag;
32 private final List<CheckedFuture<Boolean, TransactionCommitFailedException>> cumulativeResult;
33 private PolicyManagerImpl.PolicyMapLocation policyMapLocation;
34 private RendererEndpoint currentRendererEP;
35 private UnconfiguredResolvedRule currentUnconfiguredRule;
37 public PolicyConfigurationContext() {
38 unconfiguredRendererEPBag = new ArrayList<>();
39 cumulativeResult = new ArrayList<>();
43 * Set transaction result to result pool
45 * @param result current result
47 public void setFutureResult(final CheckedFuture<Boolean, TransactionCommitFailedException> result) {
48 cumulativeResult.add(result);
52 * append given endpoint to collection of not configurable policies
54 * @param endpoint not configurable endpoint
56 public void appendUnconfiguredRendererEP(UnconfiguredRendererEndpoint endpoint) {
57 unconfiguredRendererEPBag.add(endpoint);
61 * @return policy-map location
63 public PolicyManagerImpl.PolicyMapLocation getPolicyMapLocation() {
64 return policyMapLocation;
68 * @param policyMapLocation for actual policy-map/interface location
70 public void setPolicyMapLocation(final PolicyManagerImpl.PolicyMapLocation policyMapLocation) {
71 this.policyMapLocation = policyMapLocation;
75 * @return endpoint currently being configured
77 public RendererEndpoint getCurrentRendererEP() {
78 return currentRendererEP;
82 * @param currentRendererEP endpoint currently being configured
84 public void setCurrentRendererEP(final RendererEndpoint currentRendererEP) {
85 this.currentRendererEP = currentRendererEP;
89 * @return list of not configurable policies
91 List<UnconfiguredRendererEndpoint> getUnconfiguredRendererEPBag() {
92 return unconfiguredRendererEPBag;
96 * @return all unconfigured rules
98 public UnconfiguredResolvedRule getCurrentUnconfiguredRule() {
99 return currentUnconfiguredRule;
103 * Add unconfigured rule to list
105 * @param unconfiguredResolvedRule unconfigured rule
107 public void setCurrentUnconfiguredRule(final UnconfiguredResolvedRule unconfiguredResolvedRule) {
108 this.currentUnconfiguredRule = unconfiguredResolvedRule;
112 * @return get all transaction results as a list
114 ListenableFuture<List<Boolean>> getCumulativeResult() {
115 return Futures.allAsList(cumulativeResult);