569f7124c4c0c323be4c4246f2a0843a164f5ef2
[bgpcep.git] / bgp / openconfig-rp-statement / src / main / java / org / opendaylight / protocol / bgp / openconfig / routing / policy / statement / actions / AsPathPrepend.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.bgp.openconfig.routing.policy.statement.actions;
10
11 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes;
12 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy;
13 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters;
14 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters;
15 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.SetAsPathPrepend;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
18
19 /**
20  * Prepend local AS, one time(n times not supported yet).
21  */
22 public final class AsPathPrepend extends AbstractPrependAsPath implements BgpActionPolicy<SetAsPathPrepend> {
23     @Override
24     public Attributes applyImportAction(
25             final RouteEntryBaseAttributes routeEntryInfo,
26             final BGPRouteEntryImportParameters routeEntryImportParameters,
27             final Attributes attributes,
28             final SetAsPathPrepend bgpActions) {
29         return null;
30     }
31
32     @Override
33     public Attributes applyExportAction(
34             final RouteEntryBaseAttributes routeEntryInfo,
35             final BGPRouteEntryExportParameters exportParameters,
36             final Attributes attributes,
37             final SetAsPathPrepend actions) {
38         return prependAS(attributes, new AsNumber(routeEntryInfo.getLocalAs()));
39     }
40 }