Search in sources :

Example 1 with PolicyDefinitionKey

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey in project bgpcep by opendaylight.

the class AbstractStatementRegistryConsumerTest method loadStatement.

protected List<Statement> loadStatement(final String policyName) throws ExecutionException, InterruptedException {
    final ReadWriteTransaction rt = getDataBroker().newReadWriteTransaction();
    final PolicyDefinition policy = rt.read(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID.child(PolicyDefinitions.class).child(PolicyDefinition.class, new PolicyDefinitionKey(policyName))).get().get();
    return policy.getStatements().getStatement();
}
Also used : PolicyDefinition(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition) ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) PolicyDefinitionKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey)

Example 2 with PolicyDefinitionKey

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey in project bgpcep by opendaylight.

the class AbstractStatementRegistryTest method loadStatement.

protected List<Statement> loadStatement(final String policyName) throws ExecutionException, InterruptedException {
    final ReadWriteTransaction rt = getDataBroker().newReadWriteTransaction();
    final PolicyDefinition policy = rt.read(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID.child(PolicyDefinitions.class).child(PolicyDefinition.class, new PolicyDefinitionKey(policyName))).get().get();
    return policy.getStatements().getStatement();
}
Also used : PolicyDefinition(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition) ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) PolicyDefinitionKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey)

Example 3 with PolicyDefinitionKey

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey in project bgpcep by opendaylight.

the class BGPRibPolicyImpl method loadStatements.

private List<Statement> loadStatements(final String key) throws ExecutionException, InterruptedException {
    final ReadOnlyTransaction tr = this.databroker.newReadOnlyTransaction();
    final com.google.common.base.Optional<Statements> result = tr.read(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID.child(PolicyDefinitions.class).child(PolicyDefinition.class, new PolicyDefinitionKey(key)).child(Statements.class)).get();
    if (!result.isPresent()) {
        return Collections.emptyList();
    }
    return result.get().getStatement();
}
Also used : ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) PolicyDefinition(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition) PolicyDefinitionKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey) Statements(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.Statements)

Aggregations

PolicyDefinition (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition)3 PolicyDefinitionKey (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinitionKey)3 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)2 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 Statements (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.Statements)1