import java.util.HashMap;
import java.util.Map;
import org.checkerframework.checker.lock.qual.GuardedBy;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes;
import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.ActionsAugPolicy;
import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionAugPolicy;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.LocalPrefBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDiscBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.OriginBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpOrigin;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.CNextHop;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv4NextHopCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv6NextHopCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.LocalPrefBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.MultiExitDiscBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.CNextHop;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv6NextHopCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
import org.opendaylight.yangtools.concepts.AbstractRegistration;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.ChildOf;
if (address.getIpv4Address() != null) {
nhNew = new Ipv4NextHopCaseBuilder()
.setIpv4NextHop(new Ipv4NextHopBuilder()
- .setGlobal(IetfInetUtil.INSTANCE.ipv4AddressNoZoneFor(address.getIpv4Address()))
+ .setGlobal(IetfInetUtil.ipv4AddressNoZoneFor(address.getIpv4Address()))
.build())
.build();
} else {
nhNew = new Ipv6NextHopCaseBuilder()
.setIpv6NextHop(new Ipv6NextHopBuilder()
- .setGlobal(IetfInetUtil.INSTANCE.ipv6AddressNoZoneFor(address.getIpv6Address()))
+ .setGlobal(IetfInetUtil.ipv6AddressNoZoneFor(address.getIpv6Address()))
.build())
.build();
}
attributesUpdated = attributesUpdatedBuilder.build();
}
- final Map<Class<? extends Augmentation<?>>, Augmentation<?>> bgpConditionsAug = BindingReflections
- .getAugmentations(bgpAction);
-
- if (bgpConditionsAug != null) {
- for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry
- : bgpConditionsAug.entrySet()) {
- final BgpActionAugPolicy handler = this.bgpAugActionsRegistry.get(entry.getKey());
- if (handler == null) {
- continue;
- } else if (attributesUpdated == null) {
- return null;
- }
- attributesUpdated = handler.applyExportAction(routeEntryInfo, routeEntryExportParameters,
- attributesUpdated, entry.getValue());
+ for (final Augmentation<BgpActions> action : bgpAction.augmentations().values()) {
+ final BgpActionAugPolicy handler = this.bgpAugActionsRegistry.get(action.implementedInterface());
+ if (handler == null) {
+ continue;
+ } else if (attributesUpdated == null) {
+ return null;
}
+ attributesUpdated = handler.applyExportAction(routeEntryInfo, routeEntryExportParameters,
+ attributesUpdated, action);
}
}
}
// Export Actions Aug
- final Map<Class<? extends Augmentation<?>>, Augmentation<?>> conditionsAug = BindingReflections
- .getAugmentations(actions);
-
- if (conditionsAug == null) {
- return attributes;
- }
-
- for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry : conditionsAug.entrySet()) {
- final ActionsAugPolicy handler = this.actionsRegistry.get(entry.getKey());
+ for (final Augmentation<Actions> entry : actions.augmentations().values()) {
+ final ActionsAugPolicy handler = this.actionsRegistry.get(entry.implementedInterface());
if (attributesUpdated == null) {
return null;
} else if (handler == null) {
continue;
}
- attributesUpdated = handler.applyExportAction(routeEntryInfo, routeEntryExportParameters,
- attributesUpdated, (Augmentation<Actions>) entry.getValue());
+ attributesUpdated = handler.applyExportAction(routeEntryInfo, routeEntryExportParameters, attributesUpdated,
+ entry);
}
return attributesUpdated;
return null;
}
- final Map<Class<? extends Augmentation<?>>, Augmentation<?>> bgpConditionsAug = BindingReflections
- .getAugmentations(bgpAction);
-
- if (bgpConditionsAug == null) {
- return attributes;
- }
-
- for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry
- : bgpConditionsAug.entrySet()) {
- final BgpActionAugPolicy handler = this.bgpAugActionsRegistry.get(entry.getKey());
+ for (final Augmentation<BgpActions> action : bgpAction.augmentations().values()) {
+ final BgpActionAugPolicy handler = this.bgpAugActionsRegistry.get(action.implementedInterface());
if (handler == null) {
continue;
} else if (attributesUpdated == null) {
return null;
}
attributesUpdated = handler.applyImportAction(routeEntryInfo, routeParameters, attributesUpdated,
- entry.getValue());
+ action);
}
if (attributesUpdated == null) {
return null;
}
}
- // Augmented Actions
- final Map<Class<? extends Augmentation<?>>, Augmentation<?>> conditionsAug = BindingReflections
- .getAugmentations(actions);
- if (conditionsAug == null) {
- return attributesUpdated;
- }
- for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry : conditionsAug.entrySet()) {
- final ActionsAugPolicy handler = this.actionsRegistry.get(entry.getKey());
+ // Augmented Actions
+ for (final Augmentation<Actions> action : actions.augmentations().values()) {
+ final ActionsAugPolicy handler = this.actionsRegistry.get(action.implementedInterface());
if (handler == null) {
continue;
} else if (attributesUpdated == null) {
return null;
}
- attributesUpdated = handler.applyImportAction(routeEntryInfo, routeParameters, attributesUpdated,
- (Augmentation<Actions>) entry.getValue());
+ attributesUpdated = handler.applyImportAction(routeEntryInfo, routeParameters, attributesUpdated, action);
}
return attributesUpdated;
}