2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.bgp.rib.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.doReturn;
12 import static org.opendaylight.protocol.util.CheckUtil.readDataOperational;
13 import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
15 import com.google.common.collect.ImmutableList;
16 import com.google.common.collect.Lists;
17 import io.netty.channel.epoll.Epoll;
18 import io.netty.channel.nio.NioEventLoopGroup;
19 import io.netty.util.concurrent.Future;
20 import java.net.InetSocketAddress;
21 import java.util.Collections;
22 import java.util.List;
25 import java.util.concurrent.ExecutionException;
26 import java.util.concurrent.TimeUnit;
27 import org.junit.After;
28 import org.junit.Assert;
29 import org.junit.Before;
30 import org.mockito.Mock;
31 import org.mockito.Mockito;
32 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
33 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
34 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
35 import org.opendaylight.protocol.bgp.inet.RIBActivator;
36 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
37 import org.opendaylight.protocol.bgp.parser.BGPError;
38 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
39 import org.opendaylight.protocol.bgp.parser.impl.BGPActivator;
40 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
41 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
42 import org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer;
43 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
44 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
45 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
46 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
47 import org.opendaylight.protocol.util.InetSocketAddressUtil;
48 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
49 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
50 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
51 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.DestinationIpv4Builder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4Route;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.NotifyBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.Open;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.OpenBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.Update;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.UpdateBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.open.message.BgpParameters;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.AsPathBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.ClusterIdBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.LocalPrefBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDiscBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.OriginBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.OriginatorIdBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.as.path.SegmentsBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.update.message.WithdrawnRoutesBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1Builder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.BgpRib;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerRole;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpId;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpOrigin;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv4NextHopCaseBuilder;
89 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;
90 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
91 import org.opendaylight.yangtools.yang.binding.Notification;
93 public abstract class AbstractAddPathTest extends DefaultRibPoliciesMockTest {
94 private static final int RETRY_TIMER = 10;
95 static final String RIB_ID = "127.0.0.1";
96 static final BgpId BGP_ID = new BgpId(RIB_ID);
97 static final Ipv4Address PEER1 = new Ipv4Address("127.0.0.2");
98 static final Ipv4Address PEER2 = new Ipv4Address("127.0.0.3");
99 static final Ipv4Address PEER3 = new Ipv4Address("127.0.0.4");
100 static final Ipv4Address PEER4 = new Ipv4Address("127.0.0.5");
101 static final Ipv4Address PEER5 = new Ipv4Address("127.0.0.6");
102 static final Ipv4Address PEER6 = new Ipv4Address("127.0.0.7");
103 static final AsNumber AS_NUMBER = new AsNumber(AS);
104 static final int PORT = InetSocketAddressUtil.getRandomPort();
105 static final Ipv4Prefix PREFIX1 = new Ipv4Prefix("1.1.1.1/32");
106 private static final ClusterIdentifier CLUSTER_ID = new ClusterIdentifier(RIB_ID);
107 static final int HOLDTIMER = 2180;
108 private static final Ipv4Address NH1 = new Ipv4Address("2.2.2.2");
109 static final Update UPD_100 = createSimpleUpdate(PREFIX1, new PathId(1L), CLUSTER_ID, 100);
110 static final Update UPD_50 = createSimpleUpdate(PREFIX1, new PathId(2L), CLUSTER_ID, 50);
111 static final Update UPD_200 = createSimpleUpdate(PREFIX1, new PathId(3L), CLUSTER_ID, 200);
112 static final Update UPD_20 = createSimpleUpdate(PREFIX1, new PathId(1L), CLUSTER_ID, 20);
113 static final Update UPD_NA_100 = createSimpleUpdate(PREFIX1, null, CLUSTER_ID, 100);
114 static final Update UPD_NA_100_EBGP = createSimpleUpdateEbgp(PREFIX1);
115 static final Update UPD_NA_200 = createSimpleUpdate(PREFIX1, null, CLUSTER_ID, 200);
116 static final Update UPD_NA_200_EBGP = createSimpleUpdateEbgp(PREFIX1);
117 static final TablesKey TABLES_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
118 static final List<BgpTableType> TABLES_TYPE = ImmutableList.of(new BgpTableTypeImpl(TABLES_KEY.getAfi(),
119 TABLES_KEY.getSafi()));
120 static final Set<TablesKey> AFI_SAFIS_ADVERTIZED = Collections.singleton(TABLES_KEY);
121 private BGPExtensionProviderContext context;
122 static final InstanceIdentifier<BgpRib> BGP_IID = InstanceIdentifier.create(BgpRib.class);
123 static final int GRACEFUL_RESTART_TIME = 5;
125 protected ClusterSingletonServiceProvider clusterSingletonServiceProvider;
126 BGPDispatcherImpl serverDispatcher;
127 RIBExtensionProviderContext ribExtension;
128 private RIBActivator ribActivator;
129 private BGPActivator bgpActivator;
130 private NioEventLoopGroup worker;
131 private NioEventLoopGroup boss;
132 private org.opendaylight.protocol.bgp.inet.BGPActivator inetActivator;
133 protected StrictBGPPeerRegistry serverRegistry;
134 protected CodecsRegistryImpl codecsRegistry;
138 public void setUp() throws Exception {
140 this.ribActivator = new RIBActivator();
141 this.ribExtension = new SimpleRIBExtensionProviderContext();
143 this.ribActivator.startRIBExtensionProvider(this.ribExtension, this.mappingService);
145 this.bgpActivator = new BGPActivator();
146 this.inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
147 this.context = new SimpleBGPExtensionProviderContext();
148 this.bgpActivator.start(this.context);
149 this.inetActivator.start(this.context);
150 if (!Epoll.isAvailable()) {
151 this.worker = new NioEventLoopGroup();
152 this.boss = new NioEventLoopGroup();
154 this.serverRegistry = new StrictBGPPeerRegistry();
155 this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker,
156 this.serverRegistry);
157 doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider)
158 .registerClusterSingletonService(any(ClusterSingletonService.class));
160 this.codecsRegistry = CodecsRegistryImpl.create(this.mappingService.getCodecFactory(),
161 this.ribExtension.getClassLoadingStrategy());
166 public void tearDown() throws ExecutionException, InterruptedException {
167 this.serverDispatcher.close();
168 if (!Epoll.isAvailable()) {
169 this.worker.shutdownGracefully(0, 0, TimeUnit.SECONDS);
170 this.boss.shutdownGracefully(0, 0, TimeUnit.SECONDS);
172 this.mappingService.close();
173 this.ribActivator.close();
174 this.inetActivator.close();
175 this.bgpActivator.close();
178 void sendRouteAndCheckIsOnLocRib(final BGPSessionImpl session, final Ipv4Prefix prefix, final long localPreference,
179 final int expectedRoutesOnDS) throws Exception {
180 waitFutureSuccess(session.writeAndFlush(createSimpleUpdate(prefix, null, null, localPreference)));
181 checkLocRib(expectedRoutesOnDS);
184 void sendWithdrawalRouteAndCheckIsOnLocRib(final BGPSessionImpl session, final Ipv4Prefix prefix,
185 final long localPreference, final int expectedRoutesOnDS) throws Exception {
186 waitFutureSuccess(session.writeAndFlush(createSimpleWithdrawalUpdate(prefix, localPreference)));
187 checkLocRib(expectedRoutesOnDS);
190 void sendNotification(final BGPSessionImpl session) {
191 final Notification notMsg = new NotifyBuilder().setErrorCode(BGPError.OPT_PARAM_NOT_SUPPORTED.getCode())
192 .setErrorSubcode(BGPError.OPT_PARAM_NOT_SUPPORTED.getSubcode()).setData(new byte[] { 4, 9 }).build();
193 waitFutureSuccess(session.writeAndFlush(notMsg));
196 void causeBGPError(final BGPSessionImpl session) {
197 final Open openObj = new OpenBuilder().setBgpIdentifier(new Ipv4Address("1.1.1.1"))
198 .setHoldTimer(50).setMyAsNumber(72).build();
199 waitFutureSuccess(session.writeAndFlush(openObj));
202 private void checkLocRib(final int expectedRoutesOnDS) throws Exception {
203 // FIXME: remove this sleep
205 readDataOperational(getDataBroker(), BGP_IID, bgpRib -> {
206 final Ipv4RoutesCase routes = (Ipv4RoutesCase) bgpRib.getRib().get(0).getLocRib().getTables().get(0)
209 if (routes != null) {
210 final Ipv4Routes routesCase = routes.getIpv4Routes();
211 if (routesCase != null) {
212 final List<Ipv4Route> routeList = routesCase.getIpv4Route();
213 size = routeList == null ? 0 : routeList.size();
221 Assert.assertEquals(expectedRoutesOnDS, size);
226 void checkPeersPresentOnDataStore(final int numberOfPeers) throws Exception {
227 readDataOperational(getDataBroker(), BGP_IID, bgpRib -> {
228 Assert.assertEquals(numberOfPeers, bgpRib.getRib().get(0).getPeer().size());
233 BGPSessionImpl createPeerSession(final Ipv4Address peer, final BgpParameters bgpParameters,
234 final SimpleSessionListener sessionListener) throws InterruptedException {
235 return createPeerSession(peer,bgpParameters, sessionListener, AS_NUMBER);
238 BGPSessionImpl createPeerSession(final Ipv4Address peer, final BgpParameters bgpParameters,
239 final SimpleSessionListener sessionListener,
240 final AsNumber remoteAsNumber) throws InterruptedException {
241 final StrictBGPPeerRegistry clientRegistry = new StrictBGPPeerRegistry();
242 final BGPDispatcherImpl clientDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss,
243 this.worker, clientRegistry);
244 clientRegistry.addPeer(new IpAddress(new Ipv4Address(RIB_ID)), sessionListener,
245 new BGPSessionPreferences(remoteAsNumber, HOLDTIMER, new BgpId(peer),
246 AS_NUMBER, Lists.newArrayList(bgpParameters)));
248 return connectPeer(peer, clientDispatcher);
251 static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry,
252 final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters,
253 final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry) {
254 return configurePeer(tableRegistry, peerAddress, ribImpl, bgpParameters, peerRole, bgpPeerRegistry,
255 AFI_SAFIS_ADVERTIZED, Collections.emptySet());
258 static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry,
259 final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters,
260 final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry, final Set<TablesKey> afiSafiAdvertised,
261 final Set<TablesKey> gracefulAfiSafiAdvertised) {
262 return configurePeer(tableRegistry, peerAddress, ribImpl, bgpParameters, peerRole, bgpPeerRegistry,
263 afiSafiAdvertised, gracefulAfiSafiAdvertised, null);
266 static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry,
267 final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters,
268 final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry,
269 final Set<TablesKey> afiSafiAdvertised, final Set<TablesKey> gracefulAfiSafiAdvertised,
270 final BgpPeer peer) {
271 final IpAddress ipAddress = new IpAddress(peerAddress);
273 final BGPPeer bgpPeer = new BGPPeer(tableRegistry, new IpAddress(peerAddress), null, ribImpl, peerRole,
274 null, null, null, afiSafiAdvertised, gracefulAfiSafiAdvertised, peer);
275 final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
276 bgpPeerRegistry.addPeer(ipAddress, bgpPeer,
277 new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(RIB_ID), AS_NUMBER, tlvs));
278 bgpPeer.instantiateServiceInstance();
282 private static BGPSessionImpl connectPeer(final Ipv4Address localAddress, final BGPDispatcherImpl dispatcherImpl)
283 throws InterruptedException {
284 final Future<BGPSessionImpl> future = dispatcherImpl
285 .createClient(new InetSocketAddress(localAddress.getValue(), PORT),
286 new InetSocketAddress(RIB_ID, PORT), RETRY_TIMER, true);
288 waitFutureSuccess(future);
290 return future.getNow();
293 static BgpParameters createParameter(final boolean addPath) {
294 return createParameter(addPath, false, null);
297 static BgpParameters createParameter(final boolean addPath,
298 final boolean addIpv6,
299 final Map<TablesKey, Boolean> gracefulTables) {
300 final TablesKey ipv4Key = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
301 final List<TablesKey> advertisedTables = Lists.newArrayList(ipv4Key);
303 final TablesKey ipv6Key = new TablesKey(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
304 advertisedTables.add(ipv6Key);
306 final List<TablesKey> addPathTables = Lists.newArrayList();
308 addPathTables.add(ipv4Key);
310 return PeerUtil.createBgpParameters(advertisedTables, addPathTables, gracefulTables, GRACEFUL_RESTART_TIME);
313 private static Update createSimpleUpdate(final Ipv4Prefix prefix, final PathId pathId,
314 final ClusterIdentifier clusterId, final long localPreference) {
315 final AttributesBuilder attBuilder = new AttributesBuilder();
316 attBuilder.setLocalPref(new LocalPrefBuilder().setPref(localPreference).build());
317 attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
318 attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
319 attBuilder.setMultiExitDisc(new MultiExitDiscBuilder().setMed(0L).build());
320 if (clusterId != null) {
321 attBuilder.setClusterId(new ClusterIdBuilder().setCluster(Collections.singletonList(clusterId)).build());
322 attBuilder.setOriginatorId(new OriginatorIdBuilder().setOriginator(new Ipv4Address(clusterId)).build());
324 addAttributeAugmentation(attBuilder, prefix, pathId);
325 return new UpdateBuilder().setAttributes(attBuilder.build()).build();
328 private static Update createSimpleUpdateEbgp(final Ipv4Prefix prefix) {
329 final AttributesBuilder attBuilder = new AttributesBuilder();
330 attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
331 attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(
332 new SegmentsBuilder().setAsSequence(Collections.singletonList(AS_NUMBER)).build())).build());
333 addAttributeAugmentation(attBuilder, prefix, null);
335 return new UpdateBuilder().setAttributes(attBuilder.build()).build();
338 private static void addAttributeAugmentation(final AttributesBuilder attBuilder, final Ipv4Prefix prefix,
339 final PathId pathId) {
340 attBuilder.setUnrecognizedAttributes(Collections.emptyList());
341 attBuilder.addAugmentation(Attributes1.class,
342 new Attributes1Builder().setMpReachNlri(
343 new MpReachNlriBuilder()
344 .setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(NH1)
346 .setAfi(Ipv4AddressFamily.class)
347 .setSafi(UnicastSubsequentAddressFamily.class)
348 .setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
349 new DestinationIpv4CaseBuilder().setDestinationIpv4(
350 new DestinationIpv4Builder().setIpv4Prefixes(Collections.singletonList(
351 new Ipv4PrefixesBuilder().setPathId(pathId).setPrefix(new Ipv4Prefix(prefix)).build()))
357 private static Update createSimpleWithdrawalUpdate(final Ipv4Prefix prefix, final long localPreference) {
358 final AttributesBuilder attBuilder = new AttributesBuilder();
359 attBuilder.setLocalPref(new LocalPrefBuilder().setPref(localPreference).build());
360 attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
361 attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
362 attBuilder.setUnrecognizedAttributes(Collections.emptyList());
363 return new UpdateBuilder()
364 .setWithdrawnRoutes(Collections.singletonList(new WithdrawnRoutesBuilder().setPrefix(prefix).build()))