Search in sources :

Example 16 with Augmentation

use of org.opendaylight.yangtools.yang.binding.Augmentation in project bgpcep by opendaylight.

the class BgpConditionsRegistry method matchImportConditions.

public boolean matchImportConditions(final RouteEntryBaseAttributes entryInfo, final BGPRouteEntryImportParameters routeEntryImportParameters, final Attributes attributes, final Conditions conditions) {
    final Conditions1 bgpConditionsAug = conditions.getAugmentation(Conditions1.class);
    if (bgpConditionsAug != null) {
        final BgpConditions bgpConditions = bgpConditionsAug.getBgpConditions();
        synchronized (this) {
            if (!matchImportCondition(entryInfo, routeEntryImportParameters, attributes, bgpConditions)) {
                return false;
            }
        }
        final Map<Class<? extends Augmentation<?>>, Augmentation<?>> bgpAug = BindingReflections.getAugmentations(bgpConditions);
        for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry : bgpAug.entrySet()) {
            final BgpConditionsAugmentationPolicy handler = this.bgpConditionsAugRegistry.get(entry.getKey());
            if (handler == null) {
                continue;
            }
            if (!handler.matchImportCondition(entryInfo, routeEntryImportParameters, handler.getConditionParameter(attributes), entry.getValue())) {
                return false;
            }
        }
    }
    return true;
}
Also used : Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) Conditions1(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.Conditions1) BgpConditions(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.conditions.BgpConditions) BgpConditionsAugmentationPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy) HashMap(java.util.HashMap) Map(java.util.Map)

Example 17 with Augmentation

use of org.opendaylight.yangtools.yang.binding.Augmentation in project bgpcep by opendaylight.

the class BgpConditionsRegistry method matchExportConditions.

@SuppressWarnings("unchecked")
public boolean matchExportConditions(final RouteEntryBaseAttributes entryInfo, final BGPRouteEntryExportParameters routeEntryExportParameters, final Attributes attributes, final Conditions conditions) {
    final Conditions1 bgpConditionsAug = conditions.getAugmentation(Conditions1.class);
    if (bgpConditionsAug != null) {
        final BgpConditions bgpConditions = bgpConditionsAug.getBgpConditions();
        if (!matchExportCondition(entryInfo, routeEntryExportParameters, attributes, bgpConditions)) {
            return false;
        }
        final Map<Class<? extends Augmentation<?>>, Augmentation<?>> bgpAug = BindingReflections.getAugmentations(bgpConditions);
        for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry : bgpAug.entrySet()) {
            final BgpConditionsAugmentationPolicy handler = this.bgpConditionsAugRegistry.get(entry.getKey());
            if (handler == null) {
                continue;
            }
            if (!handler.matchExportCondition(entryInfo, routeEntryExportParameters, handler.getConditionParameter(attributes), entry.getValue())) {
                return false;
            }
        }
    }
    return true;
}
Also used : Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) Conditions1(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.Conditions1) BgpConditions(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.conditions.BgpConditions) BgpConditionsAugmentationPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy) HashMap(java.util.HashMap) Map(java.util.Map)

Example 18 with Augmentation

use of org.opendaylight.yangtools.yang.binding.Augmentation in project openflowplugin by opendaylight.

the class ArpShaConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmNxArpShaBuilder nxmNxArpShaBuilder = new NxmNxArpShaBuilder().setMacAddress(MAC_ADDRESS);
    final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder().setNxmNxArpSha(nxmNxArpShaBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    arpShaConvertor = new ArpShaConvertor();
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) NxmNxArpShaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.arp.sha.grouping.NxmNxArpShaBuilder) NxAugMatchRpcAddFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder) Before(org.junit.Before)

Example 19 with Augmentation

use of org.opendaylight.yangtools.yang.binding.Augmentation in project openflowplugin by opendaylight.

the class CtStateConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmNxCtStateBuilder nxmNxCtStateBuilder = new NxmNxCtStateBuilder().setCtState(1L).setMask(2L);
    final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
    nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxCtState(nxmNxCtStateBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    ctStateConvertor = new CtStateConvertor();
}
Also used : NxmNxCtStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.ct.state.grouping.NxmNxCtStateBuilder) Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) NxAugMatchNodesNodeTableFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder) Before(org.junit.Before)

Example 20 with Augmentation

use of org.opendaylight.yangtools.yang.binding.Augmentation in project openflowplugin by opendaylight.

the class ArpTpaConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmOfArpTpaBuilder nxmOfArpTpaBuilder = new NxmOfArpTpaBuilder().setIpv4Address(IPV4_ADDRESS);
    final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder();
    nxAugMatchRpcAddFlowBuilder.setNxmOfArpTpa(nxmOfArpTpaBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    arpTpaConvertor = new ArpTpaConvertor();
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) NxmOfArpTpaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.tpa.grouping.NxmOfArpTpaBuilder) NxAugMatchRpcAddFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder) Before(org.junit.Before)

Aggregations

Augmentation (org.opendaylight.yangtools.yang.binding.Augmentation)27 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)23 Before (org.junit.Before)21 NxAugMatchNodesNodeTableFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder)18 NxAugMatchRpcAddFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 Test (org.junit.Test)2 RouteEntryBaseAttributes (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes)2 ActionsAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.ActionsAugPolicy)2 BgpActionAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionAugPolicy)2 BgpConditionsAugmentationPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy)2 Actions1 (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.Actions1)2 Conditions1 (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.Conditions1)2 BgpActions (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.BgpActions)2 SetAsPathPrepend (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.SetAsPathPrepend)2 SetCommunity (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.SetCommunity)2 SetExtCommunity (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.SetExtCommunity)2 BgpConditions (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.conditions.BgpConditions)2 RejectRoute (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.generic.actions.route.disposition.RejectRoute)2