2 * Copyright (c) 2018 AT&T Intellectual Property. 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
8 package org.opendaylight.protocol.bgp.openconfig.routing.policy.spi;
10 import static org.opendaylight.bgpcep.config.loader.routing.policy.OpenconfigRoutingPolicyLoader.ROUTING_POLICY_IID;
12 import java.util.List;
13 import java.util.concurrent.ExecutionException;
14 import org.junit.Before;
15 import org.opendaylight.bgpcep.config.loader.routing.policy.AbstractOpenconfigRoutingPolicyLoaderTest;
16 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
17 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
18 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry;
19 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.PolicyDefinitions;
20 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition;
21 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey;
22 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
26 public class AbstractStatementRegistryTest extends AbstractOpenconfigRoutingPolicyLoaderTest {
27 public static final long LOCAL_AS = 8;
28 public static final Ipv4Address IPV4 = new Ipv4Address("1.2.3.4");
29 public static final ClusterIdentifier CLUSTER = new ClusterIdentifier(IPV4);
30 protected StatementRegistry statementRegistry;
34 public void setUp() throws Exception {
36 this.statementRegistry = new StatementRegistry();
39 protected List<Statement> loadStatement(final String policyName) throws ExecutionException, InterruptedException {
40 final ReadWriteTransaction rt = getDataBroker().newReadWriteTransaction();
41 final PolicyDefinition policy = rt.read(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID
42 .child(PolicyDefinitions.class).child(PolicyDefinition.class, new PolicyDefinitionKey(policyName)))
44 return policy.getStatements().getStatement();