Search in sources :

Example 6 with AbstractRegistration

use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.

the class ActionsRegistryImpl method registerBgpActionAugmentationPolicy.

public AbstractRegistration registerBgpActionAugmentationPolicy(final Class<? extends Augmentation<BgpActions>> bgpActionPolicyClass, final BgpActionAugPolicy bgpActionPolicy) {
    synchronized (this.bgpAugActionsRegistry) {
        final BgpActionAugPolicy prev = this.bgpAugActionsRegistry.putIfAbsent(bgpActionPolicyClass, bgpActionPolicy);
        Preconditions.checkState(prev == null, "Action Policy %s already registered %s", bgpActionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (ActionsRegistryImpl.this.bgpAugActionsRegistry) {
                    ActionsRegistryImpl.this.bgpAugActionsRegistry.remove(bgpActionPolicyClass);
                }
            }
        };
    }
}
Also used : BgpActionAugPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionAugPolicy) AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration)

Example 7 with AbstractRegistration

use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.

the class BgpConditionsRegistry method registerBgpConditionsPolicy.

public <T extends ChildOf<BgpMatchConditions>, N> AbstractRegistration registerBgpConditionsPolicy(final Class<T> conditionPolicyClass, final BgpConditionsPolicy<T, N> conditionPolicy) {
    synchronized (this.bgpConditionsRegistry) {
        final BgpConditionsPolicy prev = this.bgpConditionsRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
        Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (BgpConditionsRegistry.this.bgpConditionsRegistry) {
                    BgpConditionsRegistry.this.bgpConditionsRegistry.remove(conditionPolicyClass);
                }
            }
        };
    }
}
Also used : BgpConditionsPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsPolicy) AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration)

Example 8 with AbstractRegistration

use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.

the class BgpConditionsRegistry method registerBgpConditionsAugmentationPolicy.

public AbstractRegistration registerBgpConditionsAugmentationPolicy(final Class<? extends Augmentation<BgpConditions>> conditionPolicyClass, final BgpConditionsAugmentationPolicy conditionPolicy) {
    synchronized (this.bgpConditionsAugRegistry) {
        final BgpConditionsAugmentationPolicy prev = this.bgpConditionsAugRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
        Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (BgpConditionsRegistry.this.bgpConditionsAugRegistry) {
                    BgpConditionsRegistry.this.bgpConditionsAugRegistry.remove(conditionPolicyClass);
                }
            }
        };
    }
}
Also used : AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration) BgpConditionsAugmentationPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy)

Example 9 with AbstractRegistration

use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.

the class ConditionsRegistryImpl method registerConditionPolicy.

AbstractRegistration registerConditionPolicy(final Class<? extends Augmentation<Conditions>> conditionPolicyClass, final ConditionsAugPolicy conditionPolicy) {
    synchronized (this.conditionsRegistry) {
        final ConditionsAugPolicy prev = this.conditionsRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
        Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (ConditionsRegistryImpl.this.conditionsRegistry) {
                    ConditionsRegistryImpl.this.conditionsRegistry.remove(conditionPolicyClass);
                }
            }
        };
    }
}
Also used : AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration) ConditionsAugPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.ConditionsAugPolicy)

Example 10 with AbstractRegistration

use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.

the class SimpleBGPTableTypeRegistryProvider method registerBGPTableType.

@Override
public synchronized AbstractRegistration registerBGPTableType(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final Class<? extends AfiSafiType> afiSafiType) {
    final BgpTableType tableType = new BgpTableTypeImpl(afi, safi);
    final Class<? extends AfiSafiType> prev = this.tableTypes.putIfAbsent(tableType, afiSafiType);
    Preconditions.checkState(prev == null, "AFI %s SAFI %s is already registered with %s", afi, safi, prev);
    final TablesKey tableKey = new TablesKey(tableType.getAfi(), tableType.getSafi());
    this.tableKeys.put(tableKey, afiSafiType);
    return new AbstractRegistration() {

        @Override
        protected void removeRegistration() {
            synchronized (SimpleBGPTableTypeRegistryProvider.this) {
                SimpleBGPTableTypeRegistryProvider.this.tableTypes.remove(tableType);
                SimpleBGPTableTypeRegistryProvider.this.tableKeys.remove(tableKey);
            }
        }
    };
}
Also used : BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration) BgpTableTypeImpl(org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)

Aggregations

AbstractRegistration (org.opendaylight.yangtools.concepts.AbstractRegistration)10 File (java.io.File)1 RandomAccessFile (java.io.RandomAccessFile)1 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 Test (org.junit.Test)1 TopologyReference (org.opendaylight.bgpcep.topology.TopologyReference)1 ClusterSingletonServiceRegistration (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration)1 ActionsAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.ActionsAugPolicy)1 BgpActionAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionAugPolicy)1 BgpActionPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy)1 BgpConditionsAugmentationPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy)1 BgpConditionsPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsPolicy)1 ConditionsAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.ConditionsAugPolicy)1 BgpTableTypeImpl (org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)1 BgpTableType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType)1 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)1 NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)1 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)1