package org.opendaylight.netvirt.bgpmanager.api;
import java.util.Collection;
+import java.util.List;
public interface IBgpManager {
* @param importRts
* @param exportRts
*/
- void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts) throws Exception;
+ public void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts) throws Exception;
/**
*
* @param rd
*/
- void deleteVrf(String rd) throws Exception;
+ public void deleteVrf(String rd) throws Exception;
/**
+ * Adds one or more routes, as many as nexthops provided, in a BGP neighbour. It persists VrfEntry in datastore
+ * and sends the BGP message
+ *
+ * @param rd
+ * @param prefix
+ * @param nextHopList
+ * @param vpnLabel
+ */
+ public void addPrefix(String rd, String prefix, List<String> nextHopList, int vpnLabel, RouteOrigin origin) throws Exception;
+
+ /**
+ * Adds a route in a BGP neighbour. It persists the VrfEntry in Datastore and sends the BGP message
*
* @param rd
* @param prefix
* @param nextHop
* @param vpnLabel
*/
- void addPrefix(String rd, String prefix, String nextHop, int vpnLabel) throws Exception;
+ public void addPrefix(String rd, String prefix, String nextHop, int vpnLabel, RouteOrigin origin) throws Exception;
+
/**
*
* @param rd
* @param prefix
*/
- void deletePrefix(String rd, String prefix) throws Exception;
+ public void deletePrefix(String rd, String prefix) throws Exception;
/**
*
* @param fileName
* @param logLevel
*/
- void setQbgpLog(String fileName, String logLevel) throws Exception;
+ public void setQbgpLog(String fileName, String logLevel) throws Exception;
/**
+ * Advertises a Prefix to a BGP neighbour, using several nexthops. Only sends the BGP messages, no writing to
+ * MD-SAL
+ *
* @param rd
* @param prefix
- * @param nextHop
+ * @param nextHopList
+ * @param vpnLabel
+ */
+ public void advertisePrefix(String rd, String prefix, List<String> nextHopList, int vpnLabel) throws Exception;
+
+ /**
+ * Advertises a Prefix to a BGP neighbour. Only sends the BGP messages, no writing to MD-SAL
+ *
+ * @param rd
+ * @param prefix
+ * @param nextHopList
* @param vpnLabel
*/
- void advertisePrefix(String rd, String prefix, String nextHop, int vpnLabel) throws Exception;
+ public void advertisePrefix(String rd, String prefix, String nextHop, int vpnLabel) throws Exception;
/**
*
* @param rd
* @param prefix
*/
- void withdrawPrefix(String rd, String prefix) throws Exception;
+ public void withdrawPrefix(String rd, String prefix) throws Exception;
- String getDCGwIP();
+ public String getDCGwIP();
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.netvirt.bgpmanager.api;
+
+ /* Usage:
+ * RouteOrigin origin = RouteOrigin.value("b");
+ * RouteOrigin origin = RouteOrigin.BGP;
+ */
+
+public enum RouteOrigin {
+ UNDEFINED("undefined", "-"),
+ CONNECTED("directly connected", "c"),
+ STATIC( "static", "s"),
+ INTERVPN( "inter-vpn link", "l"),
+ BGP( "bgp", "b"),
+ IGP( "igp", "i");
+
+
+ final String description;
+ final String value;
+
+ RouteOrigin(String description, String value) {
+ this.description = description;
+ this.value = value;
+ }
+
+
+ public static RouteOrigin value(String value) {
+ RouteOrigin origin = UNDEFINED;
+ switch (value) {
+ case "c":
+ origin = CONNECTED;
+ break;
+ case "s":
+ origin = STATIC;
+ break;
+ case "l":
+ origin = INTERVPN;
+ break;
+ case "b":
+ origin = BGP;
+ break;
+ case "i":
+ origin = IGP;
+ break;
+ }
+
+ return origin;
+ }
+
+ public String getValue(){
+ return value;
+ }
+
+ public String getDescription(){
+ return description;
+ }
+
+}
\ No newline at end of file
<artifactId>vpnmanager-api</artifactId>
<version>${vpnservices.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>itm-api</artifactId>
+ <version>${genius.version}</version>
+ </dependency>
<!--Dependencies for Unit Test -->
<dependency>
-->
<snapshot>
<required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:bgpmanager:api?module=bgpmanager-api&revision=2015-04-20</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:bgpmanager:impl?module=bgpmanager-impl&revision=2015-03-26</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:bgpmanager:impl?module=bgpmanager-impl&revision=2015-03-26</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl?module=opendaylight-sal-binding-broker-impl&revision=2013-10-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:config:distributed-entity-ownership-service?module=distributed-entity-ownership-service&revision=2015-08-10</capability>
</required-capabilities>
<configuration>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
<name>binding-osgi-broker</name>
</broker>
+ <rpcregistry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpcregistry>
+ <notification-service>
+ <type xmlns:bindingimpl="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">bindingimpl:binding-new-notification-service</type>
+ <name>binding-notification-adapter</name>
+ </notification-service>
+ <entity-ownership-service>
+ <type xmlns:entity-ownership="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">entity-ownership:entity-ownership-service</type>
+ <name>entity-ownership-service</name>
+ </entity-ownership-service>
+ <binding-normalized-node-serializer>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-normalized-node-serializer</type>
+ <name>runtime-mapping-singleton</name>
+ </binding-normalized-node-serializer>
+ <!--
+ <broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+ <name>binding-osgi-broker</name>
+ </broker>
+ <entity-ownership-service>
+ <type xmlns:entity-ownership="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">entity-ownership:entity-ownership-service</type>
+ <name>entity-ownership-service</name>
+ </entity-ownership-service>
+
+ <itm>
+ <type xmlns:itm="urn:opendaylight:vpnservice:itm">itm:itm</type>
+ <name>itm</name>
+ </itm> -->
</module>
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
import com.google.common.base.Optional;
+import java.io.*;
import java.util.*;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
import java.lang.reflect.*;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.opendaylight.netvirt.bgpmanager.api.RouteOrigin;
import org.opendaylight.netvirt.bgpmanager.commands.ClearBgpCli;
+import org.opendaylight.netvirt.bgpmanager.thrift.gen.*;
+import org.opendaylight.netvirt.bgpmanager.thrift.client.*;
+import org.opendaylight.netvirt.bgpmanager.thrift.server.*;
+import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.netvirt.bgpmanager.thrift.client.BgpRouter;
-import org.opendaylight.netvirt.bgpmanager.thrift.client.BgpRouterException;
-import org.opendaylight.netvirt.bgpmanager.thrift.client.BgpSyncHandle;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.Routes;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.Update;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_afi;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_safi;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.qbgpConstants;
-import org.opendaylight.netvirt.bgpmanager.thrift.server.BgpThriftService;
+import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
+import org.opendaylight.genius.utils.clustering.EntityOwnerUtils;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.*;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.*;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.neighbors.*;
public class BgpConfigurationManager {
private static final Logger LOG =
- LoggerFactory.getLogger(BgpConfigurationManager.class);
+ LoggerFactory.getLogger(BgpConfigurationManager.class);
private static DataBroker broker;
private static FibDSWriter fib;
- private boolean restarting = false;
private static Bgp config;
private static BgpRouter bgpRouter;
private static BgpThriftService updateServer;
private static final String UPDATE_PORT = "bgp.thrift.service.port";
private static final String CONFIG_HOST = "vpnservice.bgpspeaker.host.name";
private static final String CONFIG_PORT = "vpnservice.bgpspeaker.thrift.port";
- private static final String DEF_UPORT = "7744";
+ private static final String DEF_UPORT = "6644";
private static final String DEF_CHOST = "127.0.0.1";
private static final String DEF_CPORT = "7644";
private static final String SDNC_BGP_MIP = "sdnc_bgp_mip";
private static final String CLUSTER_CONF_FILE = "/cluster/etc/cluster.conf";
private static final Timer ipActivationCheckTimer = new Timer();
+ private static final int STALE_FIB_WAIT = 60;
+ private static final int RESTART_DEFAULT_GR = 90;
+ private long StaleStartTime = 0;
+ private long StaleEndTime = 0;
+ private long CfgReplayStartTime = 0;
+ private long CfgReplayEndTime = 0;
+ private long StaleCleanupTime = 0;
+
+ public long getStaleCleanupTime() {
+ return StaleCleanupTime;
+ }
+
+ public void setStaleCleanupTime(long staleCleanupTime) {
+ StaleCleanupTime = staleCleanupTime;
+ }
+
+ public long getCfgReplayEndTime() {
+ return CfgReplayEndTime;
+ }
+
+ public void setCfgReplayEndTime(long cfgReplayEndTime) {
+ CfgReplayEndTime = cfgReplayEndTime;
+ }
+
+ public long getCfgReplayStartTime() {
+ return CfgReplayStartTime;
+ }
+
+ public void setCfgReplayStartTime(long cfgReplayStartTime) {
+ CfgReplayStartTime = cfgReplayStartTime;
+ }
+
+ public long getStaleEndTime() {
+ return StaleEndTime;
+ }
+
+ public void setStaleEndTime(long staleEndTime) {
+ StaleEndTime = staleEndTime;
+ }
+
+ public long getStaleStartTime() {
+ return StaleStartTime;
+ }
+
+ public void setStaleStartTime(long staleStartTime) {
+ StaleStartTime = staleStartTime;
+ }
+
// to have stale FIB map (RD, Prefix)
// number of seconds wait for route sync-up between ODL and BGP.
private static final int BGP_RESTART_ROUTE_SYNC_SEC = 360;
static String odlThriftIp = "127.0.0.1";
- private static String cHostStartup;
- private static String cPortStartup;
+ private static String cHostStartup;
+ private static String cPortStartup;
private static CountDownLatch initer = new CountDownLatch(1);
//static IITMProvider itmProvider;
public static BgpManager bgpManager;
//map<rd, map<prefix/len, nexthop/label>>
private static Map<String, Map<String, String>> staledFibEntriesMap = new ConcurrentHashMap<>();
- private static final Class[] reactors =
- {
- ConfigServerReactor.class, AsIdReactor.class,
- GracefulRestartReactor.class, LoggingReactor.class,
- NeighborsReactor.class, UpdateSourceReactor.class,
- EbgpMultihopReactor.class, AddressFamiliesReactor.class,
- NetworksReactor.class, VrfsReactor.class, BgpReactor.class
- };
-
+ static final String BGP_ENTITY_TYPE_FOR_OWNERSHIP = "bgp";
+ static final String BGP_ENTITY_NAME = "bgp";
+
+ static int totalStaledCount = 0;
+ static int totalCleared = 0;
+
+ private static final Class[] reactors =
+ {
+ ConfigServerReactor.class, AsIdReactor.class,
+ GracefulRestartReactor.class, LoggingReactor.class,
+ NeighborsReactor.class, UpdateSourceReactor.class,
+ EbgpMultihopReactor.class, AddressFamiliesReactor.class,
+ NetworksReactor.class, VrfsReactor.class, BgpReactor.class
+ };
+
private ListenerRegistration<DataChangeListener>[] registrations;
+ EntityOwnershipService entityOwnershipService;
private Object createListener(Class<?> cls) {
Constructor<?> ctor;
Object obj = null;
try {
- ctor= cls.getConstructor(BgpConfigurationManager.class);
- obj = ctor.newInstance(this);
+ ctor = cls.getConstructor(BgpConfigurationManager.class);
+ obj = ctor.newInstance(this);
} catch (Exception e) {
LOG.error("Failed to create listener object", e);
}
private void registerCallbacks() {
String emsg = "Failed to register listener";
- registrations = (ListenerRegistration<DataChangeListener>[])
- new ListenerRegistration[reactors.length];
+ registrations = new ListenerRegistration[reactors.length];
InstanceIdentifier<?> iid = InstanceIdentifier.create(Bgp.class);
- for (int i = 0; i < reactors.length; i++) {
- DataChangeListener dcl =
- (DataChangeListener) createListener(reactors[i]);
- String dclName = dcl.getClass().getName();
+ for (Class reactor : reactors) {
+ Object obj = createListener(reactor);
+ String dclName = obj.getClass().getName();
try {
- registrations[i] = broker.registerDataChangeListener(
- LogicalDatastoreType.CONFIGURATION,
- iid, dcl, DataChangeScope.SUBTREE);
+ AsyncDataTreeChangeListenerBase dcl = (AsyncDataTreeChangeListenerBase) obj;
+ dcl.registerListener(LogicalDatastoreType.CONFIGURATION, broker);
} catch (Exception e) {
LOG.error(emsg, e);
- throw new IllegalStateException(emsg+" "+dclName, e);
+ throw new IllegalStateException(emsg + " " + dclName, e);
}
}
}
public void close() {
if (updateServer != null) {
updateServer.stop();
- }
+ }
}
- private boolean configExists() {
+ private boolean configExists() throws InterruptedException, ExecutionException, TimeoutException {
InstanceIdentifier.InstanceIdentifierBuilder<Bgp> iib =
- InstanceIdentifier.builder(Bgp.class);
+ InstanceIdentifier.builder(Bgp.class);
InstanceIdentifier<Bgp> iid = iib.build();
- Optional<Bgp> b = BgpUtil.read(broker,
- LogicalDatastoreType.CONFIGURATION, iid);
+ Optional<Bgp> b = BgpUtil.read(broker,
+ LogicalDatastoreType.CONFIGURATION, iid);
return b.isPresent();
}
return (s == null ? def : s);
}
- public BgpConfigurationManager(BgpManager bgpMgr) {
+ static BgpConfigurationManager bgpConfigurationManager;
+
+ public BgpConfigurationManager(BgpManager bgpMgr) throws InterruptedException, ExecutionException, TimeoutException {
broker = bgpMgr.getBroker();
fib = bgpMgr.getFibWriter();
- //itmProvider = bgpMgr.getItmProvider();
- // there must be a good way to detect that we're restarting.
- // but for now infer it from the existance of config
- restarting = configExists();
+
bgpManager = bgpMgr;
bgpRouter = BgpRouter.getInstance();
- String uPort = getProperty(UPDATE_PORT, DEF_UPORT);
+ String uPort = getProperty(UPDATE_PORT, DEF_UPORT);
cHostStartup = getProperty(CONFIG_HOST, DEF_CHOST);
cPortStartup = getProperty(CONFIG_PORT, DEF_CPORT);
VtyshCli.setHostAddr(cHostStartup);
ClearBgpCli.setHostAddr(cHostStartup);
- LOG.info("UpdateServer at localhost:"+uPort+" ConfigServer at "
- +cHostStartup+":"+cPortStartup);
+ LOG.info("UpdateServer at localhost:" + uPort + " ConfigServer at "
+ + cHostStartup + ":" + cPortStartup);
updateServer = new BgpThriftService(Integer.parseInt(uPort), bgpMgr);
updateServer.start();
readOdlThriftIpForBgpCommunication();
registerCallbacks();
- // this shouldn't be done. config client must connect in
- // response to config; but connecting at startup to a default
- // host is legacy behavior.
- if (!restarting) {
- bgpRouter.connect(cHostStartup, Integer.parseInt(cPortStartup));
- }
LOG.info("BGP Configuration manager initialized");
initer.countDown();
+
+ bgpConfigurationManager = this;
+ }
+
+ boolean ignoreClusterDcnEventForFollower() {
+ return !EntityOwnerUtils.amIEntityOwner(BGP_ENTITY_TYPE_FOR_OWNERSHIP, BGP_ENTITY_NAME);
}
public Bgp get() {
+ config = bgpManager.getConfig();
return config;
}
- private static final String addWarn =
- "Config store updated; undo with Delete if needed.";
- private static final String delWarn =
- "Config store updated; undo with Add if needed.";
+ public void setEntityOwnershipService(EntityOwnershipService entityOwnershipService) {
+ this.entityOwnershipService = entityOwnershipService;
+ try {
+ EntityOwnerUtils.registerEntityCandidateForOwnerShip(entityOwnershipService,
+ BGP_ENTITY_TYPE_FOR_OWNERSHIP, BGP_ENTITY_NAME, new EntityOwnershipListener() {
+ @Override
+ public void ownershipChanged(EntityOwnershipChange ownershipChange) {
+ LOG.trace("entity owner change event fired");
+ if (ownershipChange.hasOwner() && ownershipChange.isOwner()) {
+ LOG.trace("This PL is the Owner");
+ activateMIP();
+ bgpRestarted();
+ } else {
+ LOG.error("Not owner: hasOwner: {}, isOwner: {}",ownershipChange.hasOwner(),
+ ownershipChange.isOwner() );
+ }
+ }
+ });
+ } catch (Exception e) {
+ LOG.error("failed to register bgp entity", e);
+ }
+ }
+
+ public EntityOwnershipService getEntityOwnershipService() {
+ return entityOwnershipService;
+ }
+
+ private static final String addWarn =
+ "Config store updated; undo with Delete if needed.";
+ private static final String delWarn =
+ "Config store updated; undo with Add if needed.";
private static final String updWarn =
- "Update operation not supported; Config store updated;"
- +" restore with another Update if needed.";
+ "Update operation not supported; Config store updated;"
+ + " restore with another Update if needed.";
- public class ConfigServerReactor
- extends AbstractDataChangeListener<ConfigServer>
- implements AutoCloseable {
+ public class ConfigServerReactor
+ extends AsyncDataTreeChangeListenerBase<ConfigServer, ConfigServerReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener <ConfigServer> {
private static final String yangObj = "config-server ";
+
public ConfigServerReactor() {
- super(ConfigServer.class);
+ super(ConfigServer.class, ConfigServerReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<ConfigServer> iid, ConfigServer val) {
- LOG.debug("received bgp connect config host {}", val.getHost().getValue());
+ LOG.trace("received bgp connect config host {}", val.getHost().getValue());
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+
try {
initer.await();
} catch (Exception e) {
}
LOG.debug("issueing bgp router connect to host {}", val.getHost().getValue());
- synchronized(BgpConfigurationManager.this) {
- boolean res = bgpRouter.connect(val.getHost().getValue(),
- val.getPort().intValue());
+ synchronized (BgpConfigurationManager.this) {
+ boolean res = bgpRouter.connect(val.getHost().getValue(),
+ val.getPort().intValue());
if (!res) {
- LOG.error(yangObj + "Add failed; "+addWarn);
+ LOG.error(yangObj + "Add failed; " + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected ConfigServerReactor getDataTreeChangeListener() {
+ return ConfigServerReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<ConfigServer> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(ConfigServer.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<ConfigServer> iid, ConfigServer val) {
- LOG.debug("received bgp disconnect");
- synchronized(BgpConfigurationManager.this) {
+ LOG.trace("received bgp disconnect");
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
bgpRouter.disconnect();
}
}
-
+
protected void update(InstanceIdentifier<ConfigServer> iid,
ConfigServer oldval, ConfigServer newval) {
+ LOG.trace("received bgp Connection update");
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == ConfigServerReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
private BgpRouter getClient(String yangObj) {
if (bgpRouter == null) {
- LOG.warn(yangObj+": configuration received when BGP is inactive");
+ LOG.warn(yangObj + ": configuration received when BGP is inactive");
}
return bgpRouter;
- }
+ }
- public class AsIdReactor
- extends AbstractDataChangeListener<AsId>
- implements AutoCloseable {
+ public class AsIdReactor
+ extends AsyncDataTreeChangeListenerBase<AsId, AsIdReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<AsId> {
private static final String yangObj = "as-id ";
public AsIdReactor() {
- super(AsId.class);
+ super(AsId.class, AsIdReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<AsId> iid, AsId val) {
+ LOG.error("received bgp add asid");
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add router config asNum {}", val.getLocalAs().intValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
+ LOG.error("no bgp router client found exiting asid add");
return;
}
int asNum = val.getLocalAs().intValue();
Ipv4Address routerId = val.getRouterId();
- Long spt = val.getStalepathTime();
Boolean afb = val.isAnnounceFbit();
String rid = (routerId == null) ? "" : routerId.getValue();
- int stalepathTime = (spt == null) ? 90 : spt.intValue();
- boolean announceFbit = afb != null && afb.booleanValue();
+ int stalepathTime = (int) getStalePathtime(RESTART_DEFAULT_GR, val);
+ boolean announceFbit = (afb == null) ? false : afb.booleanValue();
try {
- br.startBgp(asNum, rid, stalepathTime, announceFbit);
+ br.startBgp(asNum, rid, stalepathTime, announceFbit);
if (bgpManager.getBgpCounters() == null) {
bgpManager.startBgpCountersTask();
}
} catch (BgpRouterException bre) {
if (bre.getErrorCode() == BgpRouterException.BGP_ERR_ACTIVE) {
- LOG.error(yangObj+"Add requested when BGP is already active");
+ LOG.error(yangObj + "Add requested when BGP is already active");
} else {
- LOG.error(yangObj+"Add received exception: \""
- +bre+"\"; "+addWarn);
+ LOG.error(yangObj + "Add received exception: \""
+ + bre + "\"; " + addWarn);
}
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "+addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; " + addWarn);
}
}
- }
+ }
+
+ @Override
+ protected AsIdReactor getDataTreeChangeListener() {
+ return AsIdReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<AsId> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(AsId.class);
+ }
- protected synchronized void
+ protected synchronized void
remove(InstanceIdentifier<AsId> iid, AsId val) {
- LOG.debug("received delete router config asNum {}", val.getLocalAs().intValue());
- synchronized(BgpConfigurationManager.this) {
+ LOG.error("received delete router config asNum {}", val.getLocalAs().intValue());
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
- int asNum = val.getLocalAs().intValue();
+ int asNum = val.getLocalAs().intValue();
try {
br.stopBgp(asNum);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "+delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; " + delWarn);
}
if (bgpManager.getBgpCounters() != null) {
bgpManager.stopBgpCountersTask();
}
}
}
-
+
protected void update(InstanceIdentifier<AsId> iid,
AsId oldval, AsId newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == AsIdReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class GracefulRestartReactor
- extends AbstractDataChangeListener<GracefulRestart>
- implements AutoCloseable {
+ public class GracefulRestartReactor
+ extends AsyncDataTreeChangeListenerBase<GracefulRestart, GracefulRestartReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<GracefulRestart> {
private static final String yangObj = "graceful-restart ";
public GracefulRestartReactor() {
- super(GracefulRestart.class);
+ super(GracefulRestart.class, GracefulRestartReactor.class);
}
protected synchronized void
add(InstanceIdentifier<GracefulRestart> iid, GracefulRestart val) {
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.addGracefulRestart(val.getStalepathTime().intValue());
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "+addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; " + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected GracefulRestartReactor getDataTreeChangeListener() {
+ return GracefulRestartReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<GracefulRestart> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(GracefulRestart.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<GracefulRestart> iid, GracefulRestart val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received delete GracefulRestart config val {}", val.getStalepathTime().intValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.delGracefulRestart();
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<GracefulRestart> iid,
GracefulRestart oldval, GracefulRestart newval) {
- LOG.debug("received update GracefulRestart config val {}", newval.getStalepathTime().intValue());
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ LOG.debug("received update GracefulRestart config val {}", newval.getStalepathTime().intValue());
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.addGracefulRestart(newval.getStalepathTime().intValue());
} catch (Exception e) {
- LOG.error(yangObj+"update received exception: \""+e+"\"; "+addWarn);
+ LOG.error(yangObj + "update received exception: \"" + e + "\"; " + addWarn);
}
}
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == GracefulRestartReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class LoggingReactor
- extends AbstractDataChangeListener<Logging>
- implements AutoCloseable {
+ public class LoggingReactor
+ extends AsyncDataTreeChangeListenerBase<Logging, LoggingReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<Logging> {
private static final String yangObj = "logging ";
public LoggingReactor() {
- super(Logging.class);
+ super(Logging.class, LoggingReactor.class);
}
protected synchronized void
add(InstanceIdentifier<Logging> iid, Logging val) {
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
try {
- br.setLogging(val.getFile(),val.getLevel());
+ br.setLogging(val.getFile(), val.getLevel());
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected LoggingReactor getDataTreeChangeListener() {
+ return LoggingReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<Logging> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Logging.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<Logging> iid, Logging val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove Logging config val {}", val.getLevel());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.setLogging(DEF_LOGFILE, DEF_LOGLEVEL);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<Logging> iid,
Logging oldval, Logging newval) {
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
try {
- br.setLogging(newval.getFile(),newval.getLevel());
+ br.setLogging(newval.getFile(), newval.getLevel());
} catch (Exception e) {
- LOG.error(yangObj+"newval received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "newval received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == LoggingReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class NeighborsReactor
- extends AbstractDataChangeListener<Neighbors>
- implements AutoCloseable {
+ public class NeighborsReactor
+ extends AsyncDataTreeChangeListenerBase<Neighbors, NeighborsReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<Neighbors> {
private static final String yangObj = "neighbors ";
public NeighborsReactor() {
- super(Neighbors.class);
+ super(Neighbors.class, NeighborsReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<Neighbors> iid, Neighbors val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add Neighbors config val {}", val.getAddress().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
//itmProvider.buildTunnelsToDCGW(new IpAddress(peerIp.toCharArray()));
br.addNeighbor(peerIp, as);
-
+
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected NeighborsReactor getDataTreeChangeListener() {
+ return NeighborsReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<Neighbors> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Neighbors.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<Neighbors> iid, Neighbors val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove Neighbors config val {}", val.getAddress().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
//itmProvider.deleteTunnelsToDCGW(new IpAddress(val.getAddress().getValue().toCharArray()));
br.delNeighbor(peerIp);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<Neighbors> iid,
Neighbors oldval, Neighbors newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
//purposefully nothing to do.
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == NeighborsReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class EbgpMultihopReactor
- extends AbstractDataChangeListener<EbgpMultihop>
- implements AutoCloseable {
+ public class EbgpMultihopReactor
+ extends AsyncDataTreeChangeListenerBase<EbgpMultihop, EbgpMultihopReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<EbgpMultihop> {
private static final String yangObj = "ebgp-multihop ";
public EbgpMultihopReactor() {
- super(EbgpMultihop.class);
+ super(EbgpMultihop.class, EbgpMultihopReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<EbgpMultihop> iid, EbgpMultihop val) {
- LOG.debug("received add EbgpMultihop config val {}", val.getPeerIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ LOG.debug("received add EbgpMultihop config val {}", val.getPeerIp().getValue());
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
String peerIp = val.getPeerIp().getValue();
try {
- br.addEbgpMultihop(peerIp, val.getNhops().intValue());
+ br.addEbgpMultihop(peerIp, val.getNhops().intValue());
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected EbgpMultihopReactor getDataTreeChangeListener() {
+ return EbgpMultihopReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<EbgpMultihop> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(EbgpMultihop.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<EbgpMultihop> iid, EbgpMultihop val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove EbgpMultihop config val {}", val.getPeerIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.delEbgpMultihop(peerIp);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<EbgpMultihop> iid,
EbgpMultihop oldval, EbgpMultihop newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == EbgpMultihopReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class UpdateSourceReactor
- extends AbstractDataChangeListener<UpdateSource>
- implements AutoCloseable {
+ public class UpdateSourceReactor
+ extends AsyncDataTreeChangeListenerBase<UpdateSource, UpdateSourceReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<UpdateSource> {
private static final String yangObj = "update-source ";
public UpdateSourceReactor() {
- super(UpdateSource.class);
+ super(UpdateSource.class, UpdateSourceReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<UpdateSource> iid, UpdateSource val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add UpdateSource config val {}", val.getSourceIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
String peerIp = val.getPeerIp().getValue();
try {
- br.addUpdateSource(peerIp, val.getSourceIp().getValue());
+ br.addUpdateSource(peerIp, val.getSourceIp().getValue());
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected UpdateSourceReactor getDataTreeChangeListener() {
+ return UpdateSourceReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<UpdateSource> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(UpdateSource.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<UpdateSource> iid, UpdateSource val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove UpdateSource config val {}", val.getSourceIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.delUpdateSource(peerIp);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<UpdateSource> iid,
UpdateSource oldval, UpdateSource newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == UpdateSourceReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class AddressFamiliesReactor
- extends AbstractDataChangeListener<AddressFamilies>
- implements AutoCloseable {
+ public class AddressFamiliesReactor
+ extends AsyncDataTreeChangeListenerBase<AddressFamilies, AddressFamiliesReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<AddressFamilies> {
private static final String yangObj = "address-families ";
public AddressFamiliesReactor() {
- super(AddressFamilies.class);
+ super(AddressFamilies.class, AddressFamiliesReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<AddressFamilies> iid, AddressFamilies val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add AddressFamilies config val {}", val.getPeerIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
af_afi afi = af_afi.findByValue(val.getAfi().intValue());
af_safi safi = af_safi.findByValue(val.getSafi().intValue());
try {
- br.addAddressFamily(peerIp, afi, safi);
+ br.addAddressFamily(peerIp, afi, safi);
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected AddressFamiliesReactor getDataTreeChangeListener() {
+ return AddressFamiliesReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<AddressFamilies> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(AddressFamilies.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<AddressFamilies> iid, AddressFamilies val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove AddressFamilies config val {}", val.getPeerIp().getValue());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.delAddressFamily(peerIp, afi, safi);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<AddressFamilies> iid,
AddressFamilies oldval, AddressFamilies newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == AddressFamiliesReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class NetworksReactor
- extends AbstractDataChangeListener<Networks>
- implements AutoCloseable {
+ public class NetworksReactor
+ extends AsyncDataTreeChangeListenerBase<Networks, NetworksReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<Networks> {
private static final String yangObj = "networks ";
public NetworksReactor() {
- super(Networks.class);
+ super(Networks.class, NetworksReactor.class);
+ }
+ @Override
+ public NetworksReactor getDataTreeChangeListener() {
+ return NetworksReactor.this;
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<Networks> iid, Networks val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add Networks config val {}", val.getPrefixLen());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
String nh = val.getNexthop().getValue();
Long label = val.getLabel();
int lbl = (label == null) ? qbgpConstants.LBL_NO_LABEL
- : label.intValue();
+ : label.intValue();
try {
- br.addPrefix(rd, pfxlen, nh, lbl);
+ br.addPrefix(rd, pfxlen, nh, lbl);
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "+addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; " + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected InstanceIdentifier<Networks> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Networks.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<Networks> iid, Networks val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove Networks config val {}", val.getPrefixLen());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
Long label = val.getLabel();
int lbl = (label == null) ? 0 : label.intValue();
if (rd == null && lbl > 0) {
- //LU prefix is being deleted.
+ //LU prefix is being deleted.
rd = Integer.toString(lbl);
}
try {
br.delPrefix(rd, pfxlen);
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
- protected void update(InstanceIdentifier<Networks> iid,
- Networks oldval, Networks newval) {
- LOG.error(yangObj + updWarn);
+
+ protected void update(final InstanceIdentifier<Networks> iid,
+ final Networks oldval, final Networks newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ LOG.debug("received update networks config val {}", newval.getPrefixLen());
+ remove(iid, oldval);
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ add(iid, newval);
+ }
+ }, Integer.getInteger("bgp.nexthop.update.delay.in.secs", 5) * 1000);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == NetworksReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
- public class VrfsReactor
- extends AbstractDataChangeListener<Vrfs>
- implements AutoCloseable {
+ static Timer timer = new Timer();
+
+ public class VrfsReactor
+ extends AsyncDataTreeChangeListenerBase<Vrfs, VrfsReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<Vrfs> {
private static final String yangObj = "vrfs ";
public VrfsReactor() {
- super(Vrfs.class);
+ super(Vrfs.class, VrfsReactor.class);
}
- protected synchronized void
+ protected synchronized void
add(InstanceIdentifier<Vrfs> iid, Vrfs val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received add Vrfs config val {}", val.getRd());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
}
try {
- br.addVrf(val.getRd(), val.getImportRts(),
- val.getExportRts());
+ br.addVrf(val.getRd(), val.getImportRts(),
+ val.getExportRts());
} catch (Exception e) {
- LOG.error(yangObj+"Add received exception: \""+e+"\"; "
- +addWarn);
+ LOG.error(yangObj + "Add received exception: \"" + e + "\"; "
+ + addWarn);
}
}
}
- protected synchronized void
+ @Override
+ protected VrfsReactor getDataTreeChangeListener() {
+ return VrfsReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<Vrfs> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class).child(Vrfs.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<Vrfs> iid, Vrfs val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove Vrfs config val {}", val.getRd());
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
BgpRouter br = getClient(yangObj);
if (br == null) {
return;
try {
br.delVrf(val.getRd());
} catch (Exception e) {
- LOG.error(yangObj+" Delete received exception: \""+e+"\"; "
- +delWarn);
+ LOG.error(yangObj + " Delete received exception: \"" + e + "\"; "
+ + delWarn);
}
}
}
-
+
protected void update(InstanceIdentifier<Vrfs> iid,
Vrfs oldval, Vrfs newval) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ LOG.debug("VRFS: Update getting triggered for VRFS rd {}", oldval.getRd());
LOG.error(yangObj + updWarn);
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == VrfsReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
Future lastCleanupJob;
- AtomicReference<Future> lastCleanupJobReference = new AtomicReference<>();
+ Future lastReplayJobFt = null;
+ protected void activateMIP() {
+ try {
+ LOG.trace("BgpReactor: Executing MIP Activate command");
+ Process process_bgp = Runtime.getRuntime().exec("cluster ip -a sdnc_bgp_mip");
+ Process process_os = Runtime.getRuntime().exec("cluster ip -a sdnc_os_mip");
+ LOG.trace("bgpMIP Activated");
+
+ } catch (IOException io) {
+ LOG.error("IO Exception got while activating mip: ", io);
+ } catch (Exception e) {
+ LOG.error("Exception got while activating mip: ", e);
+ }
+ }
AtomicBoolean started = new AtomicBoolean(false);
- public class BgpReactor
- extends AbstractDataChangeListener<Bgp>
- implements AutoCloseable {
-
+
+ public class BgpReactor
+ extends AsyncDataTreeChangeListenerBase<Bgp, BgpReactor>
+ implements AutoCloseable, ClusteredDataTreeChangeListener<Bgp> {
+
private static final String yangObj = "Bgp ";
public BgpReactor() {
- super(Bgp.class);
+ super(Bgp.class, BgpReactor.class);
}
- protected synchronized void
+
+ protected synchronized void
add(InstanceIdentifier<Bgp> iid, Bgp val) {
- LOG.debug("received add Bgp config replaying the config");
+ LOG.error("received add Bgp config replaying the config");
+
try {
initer.await();
} catch (Exception e) {
}
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
config = val;
- if (restarting) {
- if (isIpAvailable(odlThriftIp)) {
- bgpRestarted();
- } else {
- ipActivationCheckTimer.scheduleAtFixedRate(new TimerTask() {
- public void run() {
- if (isIpAvailable(odlThriftIp)) {
- bgpRestarted();
- ipActivationCheckTimer.cancel();
- }
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ activateMIP();
+ if (isIpAvailable(odlThriftIp)) {
+ bgpRestarted();
+ } else {
+ ipActivationCheckTimer.scheduleAtFixedRate(new TimerTask() {
+ @Override
+ public void run() {
+ if (isIpAvailable(odlThriftIp)) {
+ bgpRestarted();
+ ipActivationCheckTimer.cancel();
+ } else {
+ LOG.trace("waiting for odlThriftIP: {} to be present", odlThriftIp);
}
- }, 10000L, 10000L);
- }
+ }
+ }, 10000L, 10000L);
}
}
}
- protected synchronized void
+ @Override
+ protected BgpReactor getDataTreeChangeListener() {
+ return BgpReactor.this;
+ }
+
+ @Override
+ protected InstanceIdentifier<Bgp> getWildCardPath() {
+ return InstanceIdentifier.create(Bgp.class);
+ }
+
+ protected synchronized void
remove(InstanceIdentifier<Bgp> iid, Bgp val) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
LOG.debug("received remove Bgp config");
- synchronized(BgpConfigurationManager.this) {
+ synchronized (BgpConfigurationManager.this) {
config = null;
}
}
-
+
protected void update(InstanceIdentifier<Bgp> iid,
Bgp oldval, Bgp newval) {
- synchronized(BgpConfigurationManager.this) {
+ if (ignoreClusterDcnEventForFollower()) {
+ return;
+ }
+ synchronized (BgpConfigurationManager.this) {
config = newval;
}
}
+ @Override
public void close() {
- int i;
- for (i=0 ; i < reactors.length ; i++) {
- if (reactors[i] == BgpReactor.class) {
- break;
- }
+ try {
+ super.close();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- registrations[i].close();
}
}
-
+
public void readOdlThriftIpForBgpCommunication() {
File f = new File(CLUSTER_CONF_FILE);
if (!f.exists()) {
while (line != null) {
if (line.contains(SDNC_BGP_MIP)) {
line = line.trim();
- odlThriftIp = line.substring(line.lastIndexOf(" ")+1);
+ odlThriftIp = line.substring(line.lastIndexOf(" ") + 1);
break;
}
line = br.readLine();
}
} catch (Exception e) {
} finally {
- try {br.close();} catch (Exception ignore){}
+ try {
+ br.close();
+ } catch (Exception ignore) {
+ }
}
}
-
+
public boolean isIpAvailable(String odlip) {
-
+
try {
if (odlip != null) {
if ("127.0.0.1".equals(odlip)) {
return true;
}
Enumeration e = NetworkInterface.getNetworkInterfaces();
- while(e.hasMoreElements())
- {
+ while (e.hasMoreElements()) {
NetworkInterface n = (NetworkInterface) e.nextElement();
Enumeration ee = n.getInetAddresses();
- while (ee.hasMoreElements())
- {
+ while (ee.hasMoreElements()) {
InetAddress i = (InetAddress) ee.nextElement();
if (odlip.equals(i.getHostAddress())) {
return true;
}
+ ;
}
}
}
return false;
}
- public void bgpRestarted() {
+ public static long getStalePathtime(int defValue, AsId as_num) {
+ long spt = 0;
+ try {
+ spt = bgpManager.getConfig().getGracefulRestart().getStalepathTime();
+ } catch (Exception e) {
+ try {
+ spt = as_num.getStalepathTime();
+ LOG.trace("BGP config/Stale-path time is not set using graceful");
+ } catch (Exception ignore) {
+ LOG.trace("BGP AS id is not set using graceful");
+ spt = defValue;
+ }
+ }
+ if (spt == 0) {
+ LOG.trace("BGP config/Stale-path time is not set using graceful/start-bgp");
+ spt = defValue;
+ }
+ return spt;
+ }
+
+ public synchronized void bgpRestarted() {
/*
* If there a thread which in the process of stale cleanup, cancel it
* and start a new thread (to avoid processing same again).
*/
- if (lastCleanupJobReference.get() != null) {
- lastCleanupJobReference.get().cancel(true);
- lastCleanupJobReference.set(null);
+ if (previousReplayJobInProgress()) {
+ cancelPreviousReplayJob();
}
Runnable task = new Runnable() {
@Override
public void run() {
try {
- long startTime = System.currentTimeMillis();
+ LOG.error("running bgp replay task ");
+ if (get() == null) {
+ String host = getConfigHost();
+ int port = getConfigPort();
+ LOG.info("connecting to bgp host {} ", host);
+
+ boolean res = bgpRouter.connect(host, port);
+ LOG.error("no config to push in bgp replay task ");
+ return;
+ }
+ setStaleStartTime(System.currentTimeMillis());
LOG.error("started creating stale fib map ");
createStaleFibMap();
- long endTime = System.currentTimeMillis();
- LOG.error("took {} msecs for stale fib map creation ", endTime - startTime);
+ setStaleEndTime(System.currentTimeMillis());
+ LOG.error("took {} msecs for stale fib map creation ", getStaleEndTime()- getStaleStartTime());
LOG.error("started bgp config replay ");
- startTime = endTime;
+ setCfgReplayStartTime(System.currentTimeMillis());
replay();
- endTime = System.currentTimeMillis();
- LOG.error("took {} msecs for bgp replay ", endTime - startTime);
- long route_sync_time = BGP_RESTART_ROUTE_SYNC_SEC;
- try {
- route_sync_time = bgpManager.getConfig().getGracefulRestart().getStalepathTime();
- } catch (Exception e) {
- LOG.error("BGP config/Stale-path time is not set");
- }
+ setCfgReplayEndTime(System.currentTimeMillis());
+ LOG.error("took {} msecs for bgp replay ", getCfgReplayEndTime() - getCfgReplayStartTime());
+ long route_sync_time = getStalePathtime(BGP_RESTART_ROUTE_SYNC_SEC, config.getAsId());
Thread.sleep(route_sync_time * 1000L);
+ setStaleCleanupTime(route_sync_time);
new RouteCleanup().call();
-
} catch (Exception eCancel) {
LOG.error("Stale Cleanup Task Cancelled", eCancel);
}
}
};
- lastCleanupJob = executor.submit(task);
- lastCleanupJobReference.set(lastCleanupJob);
+ lastReplayJobFt = executor.submit(task);
+ }
+
+ private boolean previousReplayJobInProgress() {
+ return lastReplayJobFt != null && !lastReplayJobFt.isDone();
+ }
+
+ private void cancelPreviousReplayJob() {
+ try {
+ LOG.error("cancelling already running bgp replay task");
+ lastReplayJobFt.cancel(true);
+ lastReplayJobFt = null;
+ Thread.sleep(2000);
+ } catch (Throwable e) {
+ LOG.error("Failed to cancel previous replay job ",e);
+ }
}
private static void doRouteSync() {
BgpSyncHandle bsh = BgpSyncHandle.getInstance();
- LOG.debug("Starting BGP route sync");
+ LOG.error("Starting BGP route sync");
try {
- bgpRouter.initRibSync(bsh);
+ bgpRouter.initRibSync(bsh);
} catch (Exception e) {
- LOG.error("Route sync aborted, exception when initialzing: "+e);
+ LOG.error("Route sync aborted, exception when initializing: " + e);
return;
}
while (bsh.getState() != bsh.DONE) {
try {
routes = bgpRouter.doRibSync(bsh);
} catch (Exception e) {
- LOG.error("Route sync aborted, exception when syncing: "+e);
+ LOG.error("Route sync aborted, exception when syncing: " + e);
return;
}
Iterator<Update> updates = routes.getUpdatesIterator();
}
}
try {
- LOG.debug("Ending BGP route-sync");
+ LOG.error("Ending BGP route-sync");
bgpRouter.endRibSync(bsh);
} catch (Exception e) {
}
* Get Stale fib map, and compare current route/fib entry.
* - Entry compare shall include NextHop, Label.
* - If entry matches: delete from STALE Map. NO Change to FIB Config DS.
- * - If entry nor found, add to FIB Config DS.
- * - If entry found, but either Label/NextHop doesnt match.
+ * - If entry not found, add to FIB Config DS.
+ * - If entry found, but either Label/NextHop doesn't match.
* - Update FIB Config DS with modified values.
* - delete from Stale Map.
*/
- public static void onUpdatePushRoute(String rd, String prefix, int plen,
- String nexthop, int label) {
+ public static void onUpdatePushRoute(String rd, String prefix, int plen, String nextHop, int label) {
Map<String, Map<String, String>> stale_fib_rd_map = BgpConfigurationManager.getStaledFibEntriesMap();
boolean addroute = false;
if (!stale_fib_rd_map.isEmpty()) {
// restart Scenario, as MAP is not empty.
Map<String, String> map = stale_fib_rd_map.get(rd);
- if (map !=null) {
+ if (map != null) {
String nexthoplabel = map.get(prefix + "/" + plen);
if (null == nexthoplabel) {
- // New Entry, which happend to be added during restart.
+ // New Entry, which happened to be added during restart.
addroute = true;
} else {
map.remove(prefix + "/" + plen);
- if (isRouteModified(nexthop, label, nexthoplabel)) {
- LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix,
- plen, nexthop, label);
+ if (isRouteModified(nextHop, label, nexthoplabel)) {
+ LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
// Existing entry, where in Nexthop/Label got modified during restart
addroute = true;
}
}
}
} else {
- LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix,
- plen, nexthop, label);
+ LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
addroute = true;
}
if (addroute) {
- fib.addFibEntryToDS(rd, prefix + "/" + plen,
- nexthop, label);
+ LOG.info("ADD: Adding Fib entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, label);
+ fib.addFibEntryToDS(rd, prefix + "/" + plen, Arrays.asList(nextHop), label, RouteOrigin.BGP);
+ LOG.info("ADD: Added Fib entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, label);
}
}
private static boolean isRouteModified(String nexthop, int label, String nexthoplabel) {
- return !nexthoplabel.isEmpty() && !nexthoplabel.equals(nexthop+"/"+label);
+ return !nexthoplabel.isEmpty() && !nexthoplabel.equals(nexthop + "/" + label);
}
- static private void replayNbrConfig(List<Neighbors> n, BgpRouter br) {
+ static private void replayNbrConfig(List<Neighbors> n, BgpRouter br) {
for (Neighbors nbr : n) {
try {
br.addNeighbor(nbr.getAddress().getValue(),
- nbr.getRemoteAs().intValue());
+ nbr.getRemoteAs().intValue());
//itmProvider.buildTunnelsToDCGW(new IpAddress(nbr.getAddress().getValue().toCharArray()));
} catch (Exception e) {
- LOG.error("Replay:addNbr() received exception: \""+e+"\"");
+ LOG.error("Replay:addNbr() received exception: \"" + e + "\"");
continue;
}
EbgpMultihop en = nbr.getEbgpMultihop();
if (en != null) {
try {
- br.addEbgpMultihop(en.getPeerIp().getValue(),
- en.getNhops().intValue());
+ br.addEbgpMultihop(en.getPeerIp().getValue(),
+ en.getNhops().intValue());
} catch (Exception e) {
- LOG.error("Replay:addEBgp() received exception: \""+e+"\"");
+ LOG.error("Replay:addEBgp() received exception: \"" + e + "\"");
}
}
UpdateSource us = nbr.getUpdateSource();
if (us != null) {
try {
br.addUpdateSource(us.getPeerIp().getValue(),
- us.getSourceIp().getValue());
+ us.getSourceIp().getValue());
} catch (Exception e) {
- LOG.error("Replay:addUS() received exception: \""+e+"\"");
+ LOG.error("Replay:addUS() received exception: \"" + e + "\"");
}
}
List<AddressFamilies> afs = nbr.getAddressFamilies();
try {
br.addAddressFamily(af.getPeerIp().getValue(), afi, safi);
} catch (Exception e) {
- LOG.error("Replay:addAf() received exception: \""+e+"\"");
+ LOG.error("Replay:addAf() received exception: \"" + e + "\"");
}
}
}
}
ConfigServer ts = config.getConfigServer();
return (ts == null ? Integer.parseInt(cPortStartup) :
- ts.getPort().intValue());
+ ts.getPort().intValue());
}
public static synchronized void replay() {
- String host = getConfigHost();
- int port = getConfigPort();
- boolean res = bgpRouter.connect(host, port);
- if (!res) {
- String msg = "Cannot connect to BGP config server at "+host+":"+port;
- if (config != null) {
- msg += "; Configuration Replay aborted";
- }
- LOG.error(msg);
- return;
- }
- if (config == null) {
- return;
- }
- BgpRouter br = bgpRouter;
- AsId a = config.getAsId();
- if (a == null) {
- return;
- }
- int asNum = a.getLocalAs().intValue();
- Ipv4Address routerId = a.getRouterId();
- Long spt = a.getStalepathTime();
- Boolean afb = a.isAnnounceFbit();
- String rid = (routerId == null) ? "" : routerId.getValue();
- int stalepathTime = (spt == null) ? 90 : spt.intValue();
- boolean announceFbit = afb != null && afb.booleanValue();
- try {
- br.startBgp(asNum, rid, stalepathTime, announceFbit);
- } catch (BgpRouterException bre) {
- if (bre.getErrorCode() == BgpRouterException.BGP_ERR_ACTIVE) {
- doRouteSync();
- } else {
- LOG.error("Replay: startBgp() received exception: \""
- +bre+"\"; "+addWarn);
+ synchronized (bgpConfigurationManager) {
+ String host = getConfigHost();
+ int port = getConfigPort();
+ LOG.error("connecting to bgp host {} ", host);
+
+ boolean res = bgpRouter.connect(host, port);
+ if (!res) {
+ String msg = "Cannot connect to BGP config server at " + host + ":" + port;
+ if (config != null) {
+ msg += "; Configuration Replay aborted";
+ }
+ LOG.error(msg);
+ return;
}
- } catch (Exception e) {
- //not unusual. We may have restarted & BGP is already on
- LOG.error("Replay:startBgp() received exception: \""+e+"\"");
- }
-
- if (bgpManager.getBgpCounters() == null) {
- bgpManager.startBgpCountersTask();
- }
-
- Logging l = config.getLogging();
- if (l != null) {
- try {
- br.setLogging(l.getFile(), l.getLevel());
- } catch (Exception e) {
- LOG.error("Replay:setLogging() received exception: \""+e+"\"");
+ config = bgpManager.getConfig();
+ if (config == null) {
+ LOG.error("bgp config is empty nothing to push to bgp");
+ return;
}
- }
-
- GracefulRestart g = config.getGracefulRestart();
- if (g != null) {
+ BgpRouter br = bgpRouter;
+ AsId a = config.getAsId();
+ if (a == null) {
+ return;
+ }
+ int asNum = a.getLocalAs().intValue();
+ Ipv4Address routerId = a.getRouterId();
+ Long spt = a.getStalepathTime();
+ Boolean afb = a.isAnnounceFbit();
+ String rid = (routerId == null) ? "" : routerId.getValue();
+ int stalepathTime = (int) getStalePathtime(0, config.getAsId());
+ boolean announceFbit = (afb == null) ? false : afb.booleanValue();
try {
- br.addGracefulRestart(g.getStalepathTime().intValue());
+ br.startBgp(asNum, rid, stalepathTime, announceFbit);
+ } catch (BgpRouterException bre) {
+ if (bre.getErrorCode() == BgpRouterException.BGP_ERR_ACTIVE) {
+ doRouteSync();
+ } else {
+ LOG.error("Replay: startBgp() received exception: \""
+ + bre + "\"; " + addWarn);
+ }
} catch (Exception e) {
- LOG.error("Replay:addGr() received exception: \""+e+"\"");
+ //not unusual. We may have restarted & BGP is already on
+ LOG.error("Replay:startBgp() received exception: \"" + e + "\"");
}
- }
- List<Neighbors> n = config.getNeighbors();
- if (n != null) {
- replayNbrConfig(n, br);
- }
+ if (bgpManager.getBgpCounters() == null) {
+ bgpManager.startBgpCountersTask();
+ }
- List<Vrfs> v = config.getVrfs();
- if (v != null) {
- for (Vrfs vrf : v) {
+ Logging l = config.getLogging();
+ if (l != null) {
try {
- br.addVrf(vrf.getRd(), vrf.getImportRts(),
- vrf.getExportRts());
+ br.setLogging(l.getFile(), l.getLevel());
} catch (Exception e) {
- LOG.error("Replay:addVrf() received exception: \""+e+"\"");
+ LOG.error("Replay:setLogging() received exception: \"" + e + "\"");
}
}
- }
- List<Networks> ln = config.getNetworks();
- if (ln != null) {
- for (Networks net : ln) {
- String rd = net.getRd();
- String pfxlen = net.getPrefixLen();
- String nh = net.getNexthop().getValue();
- Long label = net.getLabel();
- int lbl = (label == null) ? 0 : label.intValue();
- if (rd == null && lbl > 0) {
- //LU prefix is being deleted.
- rd = Integer.toString(lbl);
- }
+ GracefulRestart g = config.getGracefulRestart();
+ if (g != null) {
try {
- br.addPrefix(rd, pfxlen, nh, lbl);
+ br.addGracefulRestart(g.getStalepathTime().intValue());
} catch (Exception e) {
- LOG.error("Replay:addPfx() received exception: \""+e+"\"");
+ LOG.error("Replay:addGr() received exception: \"" + e + "\"");
+ }
+ }
+
+ List<Neighbors> n = config.getNeighbors();
+ if (n != null) {
+ LOG.error("configuring existing Neighbors present for replay total neighbors {}", n.size());
+ replayNbrConfig(n, br);
+ } else {
+ LOG.error("no Neighbors present for replay config ");
+ }
+
+ List<Vrfs> v = config.getVrfs();
+ if (v != null) {
+ for (Vrfs vrf : v) {
+ try {
+ br.addVrf(vrf.getRd(), vrf.getImportRts(),
+ vrf.getExportRts());
+ } catch (Exception e) {
+ LOG.error("Replay:addVrf() received exception: \"" + e + "\"");
+ }
+ }
+ }
+
+ List<Networks> ln = config.getNetworks();
+ if (ln != null) {
+ for (Networks net : ln) {
+ String rd = net.getRd();
+ String pfxlen = net.getPrefixLen();
+ String nh = net.getNexthop().getValue();
+ Long label = net.getLabel();
+ int lbl = (label == null) ? 0 : label.intValue();
+ if (rd == null && lbl > 0) {
+ //LU prefix is being deleted.
+ rd = Integer.toString(lbl);
+ }
+ try {
+ br.addPrefix(rd, pfxlen, nh, lbl);
+ } catch (Exception e) {
+ LOG.error("Replay:addPfx() received exception: \"" + e + "\"");
+ }
}
}
}
}
private <T extends DataObject> void asyncWrite(InstanceIdentifier<T> iid, T dto) {
- BgpUtil.write(broker,LogicalDatastoreType.CONFIGURATION,iid,dto);
+ BgpUtil.write(broker, LogicalDatastoreType.CONFIGURATION, iid, dto);
}
private <T extends DataObject> void delete(InstanceIdentifier<T> iid) {
BgpUtil.delete(broker, LogicalDatastoreType.CONFIGURATION, iid);
- }
+ }
public synchronized void
startConfig(String bgpHost, int thriftPort) {
InstanceIdentifier.InstanceIdentifierBuilder<ConfigServer> iib =
- InstanceIdentifier.builder(Bgp.class).child(ConfigServer.class);
+ InstanceIdentifier.builder(Bgp.class).child(ConfigServer.class);
InstanceIdentifier<ConfigServer> iid = iib.build();
Ipv4Address ipAddr = new Ipv4Address(bgpHost);
- ConfigServer dto = new ConfigServerBuilder().setHost(ipAddr)
- .setPort((long) thriftPort).build();
+ ConfigServer dto = new ConfigServerBuilder().setHost(ipAddr)
+ .setPort((long) thriftPort).build();
update(iid, dto);
}
public synchronized void
startBgp(int as, String routerId, int spt, boolean fbit) {
Long localAs = (long) as;
- Ipv4Address rid = (routerId == null) ?
- null : new Ipv4Address(routerId);
+ Ipv4Address rid = (routerId == null) ?
+ null : new Ipv4Address(routerId);
Long staleTime = (long) spt;
InstanceIdentifier.InstanceIdentifierBuilder<AsId> iib =
- InstanceIdentifier.builder(Bgp.class).child(AsId.class);
+ InstanceIdentifier.builder(Bgp.class).child(AsId.class);
InstanceIdentifier<AsId> iid = iib.build();
AsId dto = new AsIdBuilder().setLocalAs(localAs)
- .setRouterId(rid)
- .setStalepathTime(staleTime)
- .setAnnounceFbit(fbit).build();
+ .setRouterId(rid)
+ .setStalepathTime(staleTime)
+ .setAnnounceFbit(fbit).build();
update(iid, dto);
}
public synchronized void
addLogging(String fileName, String logLevel) {
InstanceIdentifier.InstanceIdentifierBuilder<Logging> iib =
- InstanceIdentifier.builder(Bgp.class).child(Logging.class);
+ InstanceIdentifier.builder(Bgp.class).child(Logging.class);
InstanceIdentifier<Logging> iid = iib.build();
Logging dto = new LoggingBuilder().setFile(fileName)
- .setLevel(logLevel).build();
+ .setLevel(logLevel).build();
update(iid, dto);
}
public synchronized void
addGracefulRestart(int staleTime) {
- InstanceIdentifier.InstanceIdentifierBuilder<GracefulRestart> iib =
- InstanceIdentifier.builder(Bgp.class).child(GracefulRestart.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<GracefulRestart> iib =
+ InstanceIdentifier.builder(Bgp.class).child(GracefulRestart.class);
InstanceIdentifier<GracefulRestart> iid = iib.build();
GracefulRestart dto = new GracefulRestartBuilder()
- .setStalepathTime((long)staleTime).build();
+ .setStalepathTime((long) staleTime).build();
update(iid, dto);
}
addNeighbor(String nbrIp, int remoteAs) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
Long rAs = (long) remoteAs;
- InstanceIdentifier.InstanceIdentifierBuilder<Neighbors> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr));
+ InstanceIdentifier.InstanceIdentifierBuilder<Neighbors> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr));
InstanceIdentifier<Neighbors> iid = iib.build();
Neighbors dto = new NeighborsBuilder().setAddress(nbrAddr)
- .setRemoteAs(rAs).build();
+ .setRemoteAs(rAs).build();
update(iid, dto);
}
addUpdateSource(String nbrIp, String srcIp) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
Ipv4Address srcAddr = new Ipv4Address(srcIp);
- InstanceIdentifier.InstanceIdentifierBuilder<UpdateSource> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(UpdateSource.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<UpdateSource> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(UpdateSource.class);
InstanceIdentifier<UpdateSource> iid = iib.build();
UpdateSource dto = new UpdateSourceBuilder().setPeerIp(nbrAddr)
- .setSourceIp(srcAddr).build();
+ .setSourceIp(srcAddr).build();
update(iid, dto);
}
public synchronized void
addEbgpMultihop(String nbrIp, int nHops) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
- InstanceIdentifier.InstanceIdentifierBuilder<EbgpMultihop> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(EbgpMultihop.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<EbgpMultihop> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(EbgpMultihop.class);
InstanceIdentifier<EbgpMultihop> iid = iib.build();
EbgpMultihop dto = new EbgpMultihopBuilder().setPeerIp(nbrAddr)
- .setNhops((long)nHops).build();
+ .setNhops((long) nHops).build();
update(iid, dto);
}
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
Long a = (long) afi;
Long sa = (long) safi;
- InstanceIdentifier.InstanceIdentifierBuilder<AddressFamilies> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(AddressFamilies.class, new AddressFamiliesKey(a, sa));
+ InstanceIdentifier.InstanceIdentifierBuilder<AddressFamilies> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(AddressFamilies.class, new AddressFamiliesKey(a, sa));
InstanceIdentifier<AddressFamilies> iid = iib.build();
AddressFamilies dto = new AddressFamiliesBuilder().setPeerIp(nbrAddr)
- .setAfi(a).setSafi(sa).build();
+ .setAfi(a).setSafi(sa).build();
update(iid, dto);
}
public synchronized void
- addPrefix(String rd, String pfx, String nh, int lbl) {
- Ipv4Address nexthop = new Ipv4Address(nh);
- Long label = (long) lbl;
- InstanceIdentifier.InstanceIdentifierBuilder<Networks> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Networks.class, new NetworksKey(pfx, rd));
- InstanceIdentifier<Networks> iid = iib.build();
- Networks dto = new NetworksBuilder().setRd(rd)
- .setPrefixLen(pfx)
- .setNexthop(nexthop)
- .setLabel(label).build();
- update(iid, dto);
+ addPrefix(String rd, String pfx, List<String> nhList, int lbl) {
+ for (String nh : nhList) {
+ Ipv4Address nexthop = new Ipv4Address(nh);
+ Long label = (long) lbl;
+ InstanceIdentifier<Networks> iid = InstanceIdentifier.builder(Bgp.class)
+ .child(Networks.class, new NetworksKey(pfx, rd)).build();
+ Networks dto = new NetworksBuilder().setRd(rd).setPrefixLen(pfx).setNexthop(nexthop)
+ .setLabel(label).build();
+ update(iid, dto);
+ }
}
public synchronized void
addVrf(String rd, List<String> irts, List<String> erts) {
InstanceIdentifier.InstanceIdentifierBuilder<Vrfs> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Vrfs.class, new VrfsKey(rd));
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Vrfs.class, new VrfsKey(rd));
InstanceIdentifier<Vrfs> iid = iib.build();
Vrfs dto = new VrfsBuilder().setRd(rd)
- .setImportRts(irts)
- .setExportRts(erts).build();
+ .setImportRts(irts)
+ .setExportRts(erts).build();
asyncWrite(iid, dto);
}
public synchronized void stopConfig() {
InstanceIdentifier.InstanceIdentifierBuilder<ConfigServer> iib =
- InstanceIdentifier.builder(Bgp.class).child(ConfigServer.class);
+ InstanceIdentifier.builder(Bgp.class).child(ConfigServer.class);
InstanceIdentifier<ConfigServer> iid = iib.build();
delete(iid);
}
public synchronized void stopBgp() {
InstanceIdentifier.InstanceIdentifierBuilder<AsId> iib =
- InstanceIdentifier.builder(Bgp.class).child(AsId.class);
+ InstanceIdentifier.builder(Bgp.class).child(AsId.class);
InstanceIdentifier<AsId> iid = iib.build();
delete(iid);
}
public synchronized void delLogging() {
InstanceIdentifier.InstanceIdentifierBuilder<Logging> iib =
- InstanceIdentifier.builder(Bgp.class).child(Logging.class);
+ InstanceIdentifier.builder(Bgp.class).child(Logging.class);
InstanceIdentifier<Logging> iid = iib.build();
delete(iid);
}
public synchronized void delGracefulRestart() {
- InstanceIdentifier.InstanceIdentifierBuilder<GracefulRestart> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(GracefulRestart.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<GracefulRestart> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(GracefulRestart.class);
InstanceIdentifier<GracefulRestart> iid = iib.build();
delete(iid);
}
public synchronized void delNeighbor(String nbrIp) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
- InstanceIdentifier.InstanceIdentifierBuilder<Neighbors> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr));
+ InstanceIdentifier.InstanceIdentifierBuilder<Neighbors> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr));
InstanceIdentifier<Neighbors> iid = iib.build();
delete(iid);
}
public synchronized void delUpdateSource(String nbrIp) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
- InstanceIdentifier.InstanceIdentifierBuilder<UpdateSource> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(UpdateSource.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<UpdateSource> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(UpdateSource.class);
InstanceIdentifier<UpdateSource> iid = iib.build();
delete(iid);
}
public synchronized void delEbgpMultihop(String nbrIp) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
- InstanceIdentifier.InstanceIdentifierBuilder<EbgpMultihop> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(EbgpMultihop.class);
+ InstanceIdentifier.InstanceIdentifierBuilder<EbgpMultihop> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(EbgpMultihop.class);
InstanceIdentifier<EbgpMultihop> iid = iib.build();
delete(iid);
}
- public synchronized void
+ public synchronized void
delAddressFamily(String nbrIp, int afi, int safi) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
Long a = (long) afi;
Long sa = (long) safi;
- InstanceIdentifier.InstanceIdentifierBuilder<AddressFamilies> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Neighbors.class, new NeighborsKey(nbrAddr))
- .child(AddressFamilies.class, new AddressFamiliesKey(a, sa));
+ InstanceIdentifier.InstanceIdentifierBuilder<AddressFamilies> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Neighbors.class, new NeighborsKey(nbrAddr))
+ .child(AddressFamilies.class, new AddressFamiliesKey(a, sa));
InstanceIdentifier<AddressFamilies> iid = iib.build();
delete(iid);
}
public synchronized void delPrefix(String rd, String pfx) {
- InstanceIdentifier.InstanceIdentifierBuilder<Networks> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Networks.class, new NetworksKey(pfx, rd));
+ InstanceIdentifier.InstanceIdentifierBuilder<Networks> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Networks.class, new NetworksKey(pfx, rd));
InstanceIdentifier<Networks> iid = iib.build();
delete(iid);
}
public synchronized void delVrf(String rd) {
- InstanceIdentifier.InstanceIdentifierBuilder<Vrfs> iib =
- InstanceIdentifier.builder(Bgp.class)
- .child(Vrfs.class, new VrfsKey(rd));
+ InstanceIdentifier.InstanceIdentifierBuilder<Vrfs> iib =
+ InstanceIdentifier.builder(Bgp.class)
+ .child(Vrfs.class, new VrfsKey(rd));
InstanceIdentifier<Vrfs> iid = iib.build();
delete(iid);
}
- private static final ThreadFactory threadFactory = new ThreadFactoryBuilder()
- .setNameFormat("NV-BgpCfgMgr-%d").build();
- static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, threadFactory);
+ static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
+
/*
* Remove Stale Marked Routes after timer expiry.
*/
class RouteCleanup implements Callable<Integer> {
- public Integer call () {
- int totalCleared = 0;
+ @Override
+ public Integer call() {
+ totalCleared = 0;
try {
- if (staledFibEntriesMap.isEmpty()) {
- LOG.info("BGP: RouteCleanup timertask tirggered but STALED FIB MAP is EMPTY");
- } else {
- for (String rd : staledFibEntriesMap.keySet()) {
- if (Thread.interrupted()) {
- return 0;
- }
- Map<String, String> map = staledFibEntriesMap.get(rd);
- if (map != null) {
- for (String prefix : map.keySet()) {
- if (Thread.interrupted()) {
- return 0;
- }
- try {
- totalCleared++;
- bgpManager.deletePrefix(rd, prefix);
- } catch (Exception e) {
- LOG.error("BGP: RouteCleanup deletePrefix failed rd:{}, prefix{}" + rd.toString() + prefix);
+ if (staledFibEntriesMap.isEmpty()) {
+ LOG.info("BGP: RouteCleanup timertask tirggered but STALED FIB MAP is EMPTY");
+ } else {
+ for (String rd : staledFibEntriesMap.keySet()) {
+ if (Thread.interrupted()) {
+ return 0;
+ }
+ Map<String, String> map = staledFibEntriesMap.get(rd);
+ if (map != null) {
+ for (String prefix : map.keySet()) {
+ if (Thread.interrupted()) {
+ return 0;
+ }
+ try {
+ totalCleared++;
+ LOG.error("BGP: RouteCleanup deletePrefix called but not executed rd:{}, prefix{}" + rd.toString() + prefix);
+ // fib.removeFibEntryFromDS(rd, prefix);
+ } catch (Exception e) {
+ LOG.error("BGP: RouteCleanup deletePrefix failed rd:{}, prefix{}" + rd.toString() + prefix);
+ }
}
}
}
}
- }
- } catch(Exception e) {
+ } catch (Exception e) {
LOG.error("Cleanup Thread Got interrupted, Failed to cleanup stale routes ", e);
} finally {
staledFibEntriesMap.clear();
* On re-sync notification, Get a copy of FIB database.
*/
public static void createStaleFibMap() {
- int totalStaledCount = 0;
+ totalStaledCount = 0;
try {
+ /*
+ * at the time Stale FIB creation, Wait till all PENDING write transaction
+ * to complete (or)wait for max timeout value of STALE_FIB_WAIT Seconds.
+ */
+ int retry = STALE_FIB_WAIT;
+ while ((BgpUtil.getGetPendingWrTransaction() != 0) && (retry > 0)) {
+ Thread.sleep(1000);
+ retry--;
+ if (retry == 0) {
+ LOG.error("TimeOut occured {} seconds, in waiting stale fib create", STALE_FIB_WAIT);
+ }
+ }
staledFibEntriesMap.clear();
InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
DataBroker db = BgpUtil.getBroker();
LOG.error("Couldn't find BgpUtil broker while creating createStaleFibMap");
return;
}
-
+
Optional<FibEntries> fibEntries = BgpUtil.read(BgpUtil.getBroker(),
LogicalDatastoreType.CONFIGURATION, id);
if (fibEntries.isPresent()) {
}
totalStaledCount++;
//Create MAP from stale_vrfTables.
- stale_fib_ent_map.put(vrfEntry.getDestPrefix(), vrfEntry.getNextHopAddress() + "/" + vrfEntry.getLabel());
+ //FIXME: Once odl-fib.yang is updated with latest yang to contain nexthopaddresslist
+// for (String nextHop : vrfEntry.getNextHopAddressList()) {
+// stale_fib_ent_map.put(vrfEntry.getDestPrefix(), nextHop + "/" + vrfEntry.getLabel());
+// }
+
}
- staledFibEntriesMap.put(vrfTable.getRouteDistinguisher(), stale_fib_ent_map);
+ staledFibEntriesMap.put(vrfTable.getRouteDistinguisher(), stale_fib_ent_map);
}
} else {
- LOG.error("createStaleFibMap:: FIBentries.class is not present");
+ LOG.error("createStaleFibMap:: FIBentries.class is not present");
}
} catch (Exception e) {
- LOG.error("createStaleFibMap:: erorr ", e);
+ LOG.error("createStaleFibMap:: error ", e);
}
LOG.error("created {} staled entries ", totalStaledCount);
}
return staledFibEntriesMap;
}
-
+ //TODO: below function is for testing purpose with cli
+ public static void onUpdateWithdrawRoute(String rd, String prefix, int plen) {
+ LOG.debug("Route del ** {} ** {}/{} ", rd, prefix, plen);
+ try {
+ fib.removeFibEntryFromDS(rd, prefix + "/" + plen);
+ } catch (Throwable e) {
+ LOG.error("failed to handle withdraw route ", e);
+ }
+ }
+ public boolean isBgpConnected(){
+ return bgpRouter.isBgpConnected();
+ }
+ public long getLastConnectedTS() {
+ return bgpRouter.getLastConnectedTS();
+ }
+ public long getConnectTS() {
+ return bgpRouter.getConnectTS();
+ }
+ public long getStartTS() {
+ return bgpRouter.getStartTS();
+ }
+ public static int getTotalStaledCount() {return totalStaledCount;}
+ public static int getTotalCleared() { return totalCleared;}
}
/*
- * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import java.lang.management.ManagementFactory;
import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
import javax.management.*;
+
+import com.google.common.base.*;
+import com.google.common.base.Optional;
import org.apache.thrift.TException;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
+import org.opendaylight.netvirt.bgpmanager.api.RouteOrigin;
import org.opendaylight.netvirt.bgpmanager.commands.Commands;
-import org.opendaylight.netvirt.bgpmanager.oam.BgpAlarmErrorCodes;
-import org.opendaylight.netvirt.bgpmanager.oam.BgpConstants;
-import org.opendaylight.netvirt.bgpmanager.oam.BgpCounters;
+import org.opendaylight.netvirt.bgpmanager.oam.*;
import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_afi;
import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_safi;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.netvirt.bgpmanager.oam.BgpAlarmBroadcaster;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.Neighbors;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private FibDSWriter fibDSWriter;
//private IITMProvider itmProvider;
private DataBroker dataBroker;
- private BgpAlarmBroadcaster qbgpAlarmProducer = null;
+ private BgpAlarmBroadcaster qbgpAlarmProducer = null;
private MBeanServer qbgpAlarmServer = null;
private NotificationFilter qbgpAlarmFilter = null;
final static int DEFAULT_STALEPATH_TIME = 210;
final static boolean DEFAULT_FBIT = true;
+ private long qBGPrestartTS = 0;
+
+ EntityOwnershipService entityOwnershipService;
public BgpCounters bgpCounters;
public Timer bgpCountersTimer;
fibDSWriter = new FibDSWriter(dataBroker);
BgpUtil.setBroker(dataBroker);
bcm = new BgpConfigurationManager(this);
+ bcm.setEntityOwnershipService(entityOwnershipService);
Commands commands = new Commands(this);
ConfigureBgpCli.setBgpManager(this);
LOGGER.info("BgpManager started");
}
}
- @Override
+ public void setEntityOwnershipService(EntityOwnershipService entityOwnershipService) {
+ this.entityOwnershipService = entityOwnershipService;
+ }
+
+ @Override
public void close() throws Exception {
- bcm.close();
+ bcm.close();
LOGGER.info("BgpManager Closed");
- }
+ }
/*public void setITMProvider(IITMProvider itmProvider) {
this.itmProvider = itmProvider;
public IITMProvider getItmProvider() { return this.itmProvider; } */
public Bgp getConfig() {
- return bcm.get();
+ //TODO cleanup this cache code
+ try {
+ Optional<Bgp> optional = BgpUtil.read(dataBroker,
+ LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Bgp.class));
+ return optional.get();
+ } catch (Exception e) {
+ LOGGER.error("failed to get bgp config",e);
+ }
+ return null;
}
public void configureGR(int stalepathTime) throws TException {
- bcm.addGracefulRestart(stalepathTime);
+ bcm.addGracefulRestart(stalepathTime);
}
public void delGracefulRestart() throws Exception {
- bcm.delGracefulRestart();
+ bcm.delGracefulRestart();
}
public void addNeighbor(String ipAddress, long asNum) throws TException {
- bcm.addNeighbor(ipAddress, (int) asNum);
+ bcm.addNeighbor(ipAddress, (int) asNum);
}
public void addEbgpMultihop(String ipAddress, int nhops) throws TException {
- bcm.addEbgpMultihop(ipAddress, nhops);
+ bcm.addEbgpMultihop(ipAddress, nhops);
}
-
+
public void addUpdateSource(String ipAddress, String srcIp) throws TException {
- bcm.addUpdateSource(ipAddress, srcIp);
+ bcm.addUpdateSource(ipAddress, srcIp);
}
public void addAddressFamily(String ipAddress, af_afi afi, af_safi safi) throws TException {
- bcm.addAddressFamily(ipAddress, afi.getValue(), safi.getValue());
+ bcm.addAddressFamily(ipAddress, afi.getValue(), safi.getValue());
}
public void deleteNeighbor(String ipAddress) throws TException {
- bcm.delNeighbor(ipAddress);
+ bcm.delNeighbor(ipAddress);
}
@Override
public void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts) throws Exception {
- bcm.addVrf(rd, new ArrayList<>(importRts),
- new ArrayList<>(exportRts));
+ bcm.addVrf(rd, new ArrayList<String>(importRts), new ArrayList<String>(exportRts));
}
@Override
public void deleteVrf(String rd) throws Exception {
- bcm.delVrf(rd);
+ fibDSWriter.removeVrfFromDS(rd);
+ bcm.delVrf(rd);
}
@Override
- public void addPrefix(String rd, String prefix, String nextHop, int vpnLabel) throws Exception {
- fibDSWriter.addFibEntryToDS(rd, prefix, nextHop, vpnLabel);
- bcm.addPrefix(rd, prefix, nextHop, vpnLabel);
+ public void addPrefix(String rd, String prefix, List<String> nextHopList, int vpnLabel, RouteOrigin origin) throws Exception {
+ fibDSWriter.addFibEntryToDS(rd, prefix, nextHopList, vpnLabel, origin);
+ bcm.addPrefix(rd, prefix, nextHopList, vpnLabel);
+ }
+
+ @Override
+ public void addPrefix(String rd, String prefix, String nextHop, int vpnLabel, RouteOrigin origin) throws Exception {
+ addPrefix(rd, prefix, Arrays.asList(nextHop), vpnLabel, origin);
}
@Override
public void deletePrefix(String rd, String prefix) throws Exception {
- fibDSWriter.removeFibEntryFromDS(rd, prefix);
- bcm.delPrefix(rd, prefix);
+ fibDSWriter.removeFibEntryFromDS(rd, prefix);
+ bcm.delPrefix(rd, prefix);
+ }
+
+ @Override
+ public void advertisePrefix(String rd, String prefix, List<String> nextHopList, int vpnLabel) throws Exception {
+ bcm.addPrefix(rd, prefix, nextHopList, vpnLabel);
}
@Override
public void advertisePrefix(String rd, String prefix, String nextHop, int vpnLabel) throws Exception {
- bcm.addPrefix(rd, prefix, nextHop, vpnLabel);
+ LOGGER.info("ADVERTISE: Adding Prefix rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, vpnLabel);
+ bcm.addPrefix(rd, prefix, Arrays.asList(nextHop), vpnLabel);
+ LOGGER.info("ADVERTISE: Added Prefix rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, vpnLabel);
}
@Override
public void withdrawPrefix(String rd, String prefix) throws Exception {
+ LOGGER.info("WITHDRAW: Removing Prefix rd {} prefix {}", rd, prefix);
bcm.delPrefix(rd, prefix);
+ LOGGER.info("WITHDRAW: Removed Prefix rd {} prefix {}", rd, prefix);
}
public void setQbgpLog(String fileName, String debugLevel) throws Exception {
- bcm.addLogging(fileName, debugLevel);
+ bcm.addLogging(fileName, debugLevel);
}
public void delLogging() throws Exception {
- bcm.delLogging();
+ bcm.delLogging();
}
public void startBgp(int asn, String routerId, int spt, boolean fbit) {
- bcm.startBgp(asn, routerId, spt, fbit);
+ bcm.startBgp(asn, routerId, spt, fbit);
}
public void stopBgp() {
- bcm.stopBgp();
+ bcm.stopBgp();
}
public void startConfig(String host, int port) {
- bcm.startConfig(host, port);
+ bcm.startConfig(host, port);
}
public void stopConfig() {
- bcm.stopConfig();
+ bcm.stopConfig();
}
@Override
public String getDCGwIP() {
Bgp conf = getConfig();
if (conf == null) {
- return null;
+ return null;
}
List<Neighbors> nbrs = conf.getNeighbors();
if (nbrs == null) {
- return null;
+ return null;
}
return nbrs.get(0).getAddress().getValue();
}
public FibDSWriter getFibWriter() {
return fibDSWriter;
- }
+ }
public DataBroker getBroker() {
return dataBroker;
- }
+ }
public String getConfigHost() {
return bcm.getConfigHost();
public void bgpRestarted() {
bcm.bgpRestarted();
}
+
+ public boolean isBgpConnected() {
+ return bcm.isBgpConnected();
+ }
+
+ public long getLastConnectedTS() {
+ return bcm.getLastConnectedTS();
+ }
+ public long getConnectTS() {
+ return bcm.getConnectTS();
+ }
+ public long getStartTS() {
+ return bcm.getStartTS();
+ }
+
+ public long getqBGPrestartTS() {
+ return qBGPrestartTS;
+ }
+
+ public void setqBGPrestartTS(long qBGPrestartTS) {
+ this.qBGPrestartTS = qBGPrestartTS;
+ }
+ public long getStaleStartTime() {
+ return bcm.getStaleStartTime();
+ }
+ public long getStaleEndTime() {
+ return bcm.getStaleEndTime();
+ }
+ public long getCfgReplayStartTime() {
+ return bcm.getCfgReplayStartTime();
+ }
+ public long getCfgReplayEndTime() {
+ return bcm.getCfgReplayEndTime();
+ }
+ public long getStaleCleanupTime() {
+ return bcm.getStaleCleanupTime();
+ }
+
}
package org.opendaylight.netvirt.bgpmanager;
import com.google.common.base.Optional;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.opendaylight.controller.md.sal.binding.api.*;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.*;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* Created by emhamla on 8/31/2015.
*/
+
public class BgpUtil {
+ private static final long FIB_READ_TIMEOUT = 1;
private static final Logger LOG = LoggerFactory.getLogger(BgpUtil.class);
private static DataBroker dataBroker;
+ private static BindingTransactionChain fibTransact;
+ private static AtomicInteger pendingWrTransaction = new AtomicInteger(0);
+ private static int txChainAttempts = 0;
+
+ // return number of pending Write Transactions with BGP-Util (no read)
+ public static int getGetPendingWrTransaction() {
+ return pendingWrTransaction.get();
+ }
+
+ static ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
+ .setNameFormat("bgp-util-mdsal-%d").build();
+
+ static ExecutorService threadPool = Executors.newFixedThreadPool(1, namedThreadFactory);
+
+
+ static synchronized BindingTransactionChain getTransactionChain() {
+ return fibTransact;
+ }
- static <T extends DataObject> void update(DataBroker broker, LogicalDatastoreType datastoreType,
- InstanceIdentifier<T> path, T data) {
- WriteTransaction tx = broker.newWriteOnlyTransaction();
- tx.merge(datastoreType, path, data, true);
- tx.submit();
+ static <T extends DataObject> void update(DataBroker broker, final LogicalDatastoreType datastoreType,
+ final InstanceIdentifier<T> path, final T data) {
+ threadPool.submit(new MdsalDsTask<>(datastoreType, path, data, TransactionType.UPDATE));
}
- public static <T extends DataObject> void write(DataBroker broker, LogicalDatastoreType datastoreType,
- InstanceIdentifier<T> path, T data) {
- WriteTransaction tx = broker.newWriteOnlyTransaction();
- tx.put(datastoreType, path, data, true);
- tx.submit();
+
+ public static <T extends DataObject> void write(DataBroker broker, final LogicalDatastoreType datastoreType,
+ final InstanceIdentifier<T> path, final T data) {
+ threadPool.submit(new MdsalDsTask<>(datastoreType, path, data, TransactionType.WRITE));
+ }
+
+ static <T extends DataObject> void delete(DataBroker broker, final LogicalDatastoreType datastoreType,
+ final InstanceIdentifier<T> path) {
+ threadPool.submit(new MdsalDsTask<>(datastoreType, path, null, TransactionType.DELETE));
+ }
+
+ static enum TransactionType {
+ WRITE, UPDATE, DELETE;
+ }
+
+ static class MdsalDsTask<T extends DataObject> implements Runnable {
+ LogicalDatastoreType datastoreType;
+ InstanceIdentifier<T> path;
+ T data;
+ TransactionType type;
+
+ public MdsalDsTask(LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data, TransactionType type) {
+ this.datastoreType = datastoreType;
+ this.path = path;
+ this.data = data;
+ this.type = type;
+ }
+
+ @Override
+ public void run() {
+ try {
+ LOG.trace("BgpUtil MDSAL task started ");
+ WriteTransaction tx = getTransactionChain().newWriteOnlyTransaction();
+ switch (type) {
+ case WRITE:
+ tx.put(datastoreType, path, data, true);
+ break;
+ case UPDATE:
+ tx.merge(datastoreType, path, data, true);
+ break;
+ case DELETE:
+ tx.delete(datastoreType, path);
+ break;
+ default:
+ LOG.error("Invalid Transaction type: {}", type);
+ }
+ pendingWrTransaction.incrementAndGet();
+ addFutureCallback(tx, path, data);
+ LOG.trace("Transaction type: {} submitted", type);
+ } catch (final Exception e) {
+ LOG.error("TxChain transaction submission failed, re-init TxChain", e);
+ initTransactionChain();
+ }
+ }
}
- static <T extends DataObject> void delete(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path) {
- WriteTransaction tx = broker.newWriteOnlyTransaction();
- tx.delete(datastoreType, path);
- tx.submit();
+
+ static <T extends DataObject> void addFutureCallback(WriteTransaction tx, final InstanceIdentifier<T> path,
+ final T data) {
+ Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+ @Override
+ public void onSuccess(final Void result) {
+ pendingWrTransaction.decrementAndGet();
+ LOG.trace("DataStore entry success data:{} path:{} ", path);
+ }
+
+ @Override
+ public void onFailure(final Throwable t) {
+ pendingWrTransaction.decrementAndGet();
+ LOG.error("DataStore entry failed data:{} path:{} cause:{} , retry initTransactionChain", data, path, t.getCause());
+ }
+ });
}
+
public static <T extends DataObject> Optional<T> read(DataBroker broker, LogicalDatastoreType datastoreType,
- InstanceIdentifier<T> path) {
+ InstanceIdentifier<T> path)
+ throws ExecutionException, InterruptedException, TimeoutException {
- ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
+ ReadTransaction tx = broker.newReadOnlyTransaction();
+ CheckedFuture<?,?> result = tx.read(datastoreType, path);
- Optional<T> result = Optional.absent();
try {
- result = tx.read(datastoreType, path).get();
+ return (Optional<T>) result.get();
} catch (Exception e) {
- throw new RuntimeException(e);
+ LOG.error("DataStore read exception {} ", e);
}
-
- return result;
+ return Optional.absent();
}
- public static void setBroker(DataBroker broker) {
+ public static void setBroker(final DataBroker broker) {
BgpUtil.dataBroker = broker;
+ initTransactionChain();
+ }
+
+ static synchronized void initTransactionChain() {
+ try {
+ if (fibTransact != null) {
+ fibTransact.close();
+ LOG.error("*** TxChain Close, *** Attempts: {}", txChainAttempts);
+ fibTransact = null;
+ }
+ } catch (Exception ignore) {
+ }
+ BgpUtil.fibTransact = dataBroker.createTransactionChain(new BgpUtilTransactionChainListener());
+ txChainAttempts++;
+ }
+
+ static class BgpUtilTransactionChainListener implements TransactionChainListener {
+ @Override
+ public void onTransactionChainFailed(TransactionChain<?, ?> transactionChain, AsyncTransaction<?, ?> asyncTransaction, Throwable throwable) {
+ LOG.error("*** TxChain Creation Failed *** Attempts: {}", txChainAttempts);
+ initTransactionChain();
+ }
+
+ @Override
+ public void onTransactionChainSuccessful(TransactionChain<?, ?> transactionChain) {
+ LOG.trace("TxChain Creation Success");
+ }
}
public static DataBroker getBroker() {
return dataBroker;
}
-
}
package org.opendaylight.netvirt.bgpmanager;
import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Future;
import org.apache.karaf.shell.commands.*;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.*;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.*;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.neighbors.*;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+
@Command(scope = "odl", name = "configure-bgp", description = "")
public class ConfigureBgpCli extends OsgiCommandSupport {
String logLevel = null;
enum LogLevels {
- emergencies,alerts,critical,errors,warnings,notifications,informational,debugging
+ emergencies,alerts,critical,errors,warnings,notifications,informational,debugging;
}
@Override
return;
}
}
- bgpManager.startBgp(Integer.parseInt(asNumber), routerId,
+ bgpManager.startBgp(Integer.parseInt(asNumber), routerId,
stalePathTime == null? 0 : Integer.parseInt(stalePathTime), false);
}
}
bgpManager.addNeighbor(ip, Long.valueOf(asNumber));
if (addressFamily != null) {
- bgpManager.addAddressFamily(ip, af_afi.AFI_IP,
+ bgpManager.addAddressFamily(ip, af_afi.AFI_IP,
af_safi.valueOf(addressFamily));
}
if (ebgpMultihops != null) {
int lastPart = addrBytes[3] & 0xFF;
int firstPart = addrBytes[0] & 0xFF;
if (firstPart == 0) {
- return false;//cannot start with 0 "0.1.2.3"
+ return false;//cannot start with 0 "0.1.2.3"
}
if (lastPart == 0 || lastPart == 255) {
return false;
*/
package org.opendaylight.netvirt.bgpmanager;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.concurrent.Future;
+import com.google.common.base.Optional;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.opendaylight.netvirt.bgpmanager.commands.Cache;
+import org.opendaylight.netvirt.bgpmanager.commands.Commands;
+import org.opendaylight.genius.utils.clustering.EntityOwnerUtils;
+
+import java.util.Date;
@Command(scope = "odl", name = "display-bgp-config", description="")
public class DisplayBgpConfigCli extends OsgiCommandSupport {
+ @Option(name = "--debug", description = "print debug time stamps",
+ required = false, multiValued = false)
+ Boolean debug = false;
+
protected Object doExecute() throws Exception {
+ BgpManager bm;
+ PrintStream ps = System.out;
+ try {
+ bm = Commands.getBgpManager();
+ } catch (Exception e){
+ return null;
+ }
+
+ if (debug) {
+ ps.printf("\nis ODL Connected to Q-BGP: %s\n", bm.isBgpConnected()?"TRUE":"FALSE");
+ //last ODL connection attempted TS
+ ps.printf("Last ODL connection attempt TS: %s\n", new Date(bm.getConnectTS()));
+ //last successful connected TS
+ ps.printf("Last Successful connection TS: %s\n", new Date(bm.getLastConnectedTS()));
+ //last ODL started BGP due to configuration trigger TS
+ ps.printf("Last ODL started BGP at: %s\n", new Date(bm.getStartTS()));
+ //last Quagga attempted to RESTART the connection
+ ps.printf("Last Quagga BGP, sent reSync at: %s\n", new Date(bm.getqBGPrestartTS()));
+
+ //stale cleanup start - end TS
+ ps.printf("Time taken to create stale fib : %s ms\n", bm.getStaleEndTime() - bm.getStaleStartTime());
+
+ //Config replay start - end TS
+ ps.printf("Time taken to create replay configuration : %s ms\n", bm.getCfgReplayEndTime()-bm.getCfgReplayStartTime());
+
+ //Stale cleanup time
+ ps.printf("Time taken for Stale FIB cleanup : %s ms\n", bm.getStaleCleanupTime());
+
+ ps.printf("Total stale entries created %d \n", BgpConfigurationManager.getTotalStaledCount());
+ ps.printf("Total stale entries cleared %d \n", BgpConfigurationManager.getTotalCleared());
+ //FIXME: To be refactored once entity event sub class becomes available in genius utils/clustering/
+// ArrayList<EntityOwnerUtils.EntityEvent> eventsHistory = EntityOwnerUtils.getEventsHistory();
+ try {
+// for (EntityOwnerUtils.EntityEvent event : eventsHistory) {
+// ps.printf("%s entity : %s amIOwner:%s hasOwner:%s \n", new Date(event.getTime()).toString(),
+// event.getEntityName(), event.hasOwner(), event.isOwner());
+// }
+ } catch (Exception e) {
+ }
+ }
Cache cache = new Cache();
return cache.show();
- }
+ }
}
package org.opendaylight.netvirt.bgpmanager;
+import org.opendaylight.netvirt.bgpmanager.api.RouteOrigin;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+import java.util.*;
+
-/**
- * Created by emhamla on 4/14/2015.
- */
public class FibDSWriter {
private static final Logger logger = LoggerFactory.getLogger(FibDSWriter.class);
private final DataBroker broker;
broker = db;
}
- public synchronized void addFibEntryToDS(String rd, String prefix,
- String nexthop, int label) {
- if (rd == null || rd.isEmpty()) {
+ public synchronized void addFibEntryToDS(String rd, String prefix, List<String> nextHopList,
+ int label, RouteOrigin origin) {
+ if (rd == null || rd.isEmpty() ) {
logger.error("Prefix {} not associated with vpn", prefix);
return;
}
- VrfEntry vrfEntry = new VrfEntryBuilder().setDestPrefix(prefix).
- setNextHopAddress(nexthop).setLabel((long)label).build();
+ Preconditions.checkNotNull(nextHopList, "NextHopList can't be null");
- logger.debug("Created vrfEntry for {} nexthop {} label {}", prefix, nexthop, label);
+ for ( String nextHop: nextHopList){
+ if (nextHop == null || nextHop.isEmpty()){
+ logger.error("nextHop list contains null element");
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Created vrfEntry for {} nexthop {} label {}", prefix, nextHop, label);
+ }
- InstanceIdentifier.InstanceIdentifierBuilder<VrfEntry> idBuilder =
- InstanceIdentifier.builder(FibEntries.class)
- .child(VrfTables.class, new VrfTablesKey(rd))
- .child(VrfEntry.class, new VrfEntryKey(vrfEntry.getDestPrefix()));
- InstanceIdentifier<VrfEntry> vrfEntryId= idBuilder.build();
+ }
+
+
+ // Looking for existing prefix in MDSAL database
+ Optional<FibEntries> fibEntries = Optional.absent();
+ try{
+ InstanceIdentifier<FibEntries> idRead = InstanceIdentifier.create(FibEntries.class);
+ fibEntries = BgpUtil.read(broker, LogicalDatastoreType.CONFIGURATION, idRead);
+
+ InstanceIdentifier<VrfEntry> vrfEntryId =
+ InstanceIdentifier.builder(FibEntries.class)
+ .child(VrfTables.class, new VrfTablesKey(rd))
+ .child(VrfEntry.class, new VrfEntryKey(prefix)).build();
+ Optional<VrfEntry> entry = BgpUtil.read(broker, LogicalDatastoreType.CONFIGURATION, vrfEntryId);
+
+ //FIXME: TO be refactored once odl-fib.yang is updated to have nextHopAddressList
+ /*if (! entry.isPresent()) {
+ VrfEntry vrfEntry = new VrfEntryBuilder().setDestPrefix(prefix).setNextHopAddressList(nextHopList).setLabel((long)label).setOrigin(origin.getValue()).build();
+ BgpUtil.write(broker, LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntry);
+
+ } else { // Found in MDSAL database
+ List<String> nh = entry.get().getNextHopAddressList();
+ for (String nextHop : nextHopList) {
+ if (!nh.contains(nextHop))
+ nh.add(nextHop);
+ }
+ VrfEntry vrfEntry = new VrfEntryBuilder().setDestPrefix(prefix).setNextHopAddressList(nh)
+ .setLabel((long) label).setOrigin(origin.getValue()).build();
+
+ BgpUtil.update(broker, LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntry);
+ }*/
+ } catch (Exception e) {
+ logger.error("addFibEntryToDS: error ", e);
+ }
- BgpUtil.write(broker, LogicalDatastoreType.CONFIGURATION,
- vrfEntryId, vrfEntry);
}
public synchronized void removeFibEntryFromDS(String rd, String prefix) {
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
System.err.println("error: "+IP+" needed");
return null;
}
+ if (bm.getConfig() == null) {
+ System.err.println("error: Bgp config is not present");
+ return null;
+ }
int asn = bm.getConfig().getAsId().getLocalAs().intValue();
int hops = 0;
if (!Commands.isValid(nbrIp, Commands.IPADDR, IP)) {
import org.apache.karaf.shell.commands.*;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.opendaylight.netvirt.bgpmanager.BgpManager;
+import org.opendaylight.netvirt.bgpmanager.api.RouteOrigin;
import org.opendaylight.netvirt.bgpmanager.thrift.gen.qbgpConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Command(scope = "odl", name = "bgp-network",
+import java.util.List;
+
+@Command(scope = "odl", name = "bgp-network",
description = "Add or delete BGP static routes")
public class Network extends OsgiCommandSupport {
private static final String RD = "--rd";
private static final String NH = "--nexthop";
private static final String LB = "--label";
- @Argument(name="add|del", description="The desired operation",
+ static final Logger LOGGER = LoggerFactory.getLogger(Network.class);
+ @Argument(name="add|del", description="The desired operation",
required=true, multiValued = false)
private String action = null;
- @Option(name=RD, aliases={"-r"},
- description="Route distinguisher",
+ @Option(name=RD, aliases={"-r"},
+ description="Route distinguisher",
required=false, multiValued=false)
private String rd = null;
@Option(name=PFX, aliases={"-p"},
- description="prefix/length",
+ description="prefix/length",
required=false, multiValued=false)
private String pfx = null;
@Option(name=NH, aliases={"-n"},
- description="Nexthop",
- required=false, multiValued=false)
- private String nh = null;
+ description="Nexthop",
+ required=false, multiValued=true)
+ private List<String> nh = null;
@Option(name=LB, aliases={"-l"},
- description="Label",
+ description="Label",
required=false, multiValued=false)
private String lbl = null;
+ private RouteOrigin staticOrigin = RouteOrigin.STATIC;
+
private Object usage() {
System.err.println(
"usage: bgp-network ["+RD+" rd] ["+PFX+" prefix/len] ["
+NH+" nexthop] ["+LB+" label] <add|del>");
return null;
- }
+ }
@Override
protected Object doExecute() throws Exception {
}
BgpManager bm = Commands.getBgpManager();
switch (action) {
- case "add" :
+ case "add":
int label = qbgpConstants.LBL_EXPLICIT_NULL;
if (pfx == null ) {
System.err.println("error: "+PFX+" is needed");
System.err.println("error: "+NH+" is needed");
return null;
}
- //todo: syntactic validation of prefix
- if (!Commands.isValid(nh, Commands.IPADDR, NH)) {
- return null;
+ //TODO: syntactic validation of prefix
+ for (String nextHop : nh) {
+ if (!Commands.isValid(nextHop, Commands.IPADDR, NH)) {
+ return null;
+ }
}
if (lbl != null) {
if (!Commands.isValid(lbl, Commands.INT, LB)) {
return null;
} else {
label = Integer.valueOf(lbl);
- }
+ }
} else if (rd == null) {
System.err.println("error: "+RD+" is needed");
return null;
}
- bm.addPrefix(rd, pfx, nh, label);
+ LOGGER.info("ADD: Adding Fib entry rd {} prefix {} nexthop {} label {}", rd, pfx, nh, label);
+ bm.addPrefix(rd, pfx, nh, label, staticOrigin);
+ LOGGER.info("ADD: Added Fib entry rd {} prefix {} nexthop {} label {}", rd, pfx, nh, label);
break;
- case "del" :
+ case "del":
if (pfx == null) {
System.err.println("error: "+PFX+" is needed");
return null;
if (nh != null || lbl != null) {
System.err.println("note: some option(s) not needed; ignored");
}
+ LOGGER.info("REMOVE: Removing Fib entry rd {} prefix {}", rd, pfx);
bm.deletePrefix(rd, pfx);
+ LOGGER.info("REMOVE: Removed Fib entry rd {} prefix {}", rd, pfx);
break;
- default :
+ default:
return usage();
}
return null;
Notification n;
String alarmAddText, alarmSrc = "BGP";
BgpAlarmErrorCodes userAlarm;
- ArrayList<String> arrayList = new ArrayList<>();
+ ArrayList<String> arrayList = new ArrayList<String>();
userAlarm = BgpAlarmErrorCodes.checkErrorSubcode(subcode);
alarmAddText = "Peer=" + pfx;
*/
public interface BgpAlarmBroadcasterMBean {
- void sendBgpAlarmInfo(String pfx, int code, int subcode);
+ public void sendBgpAlarmInfo(String pfx, int code , int subcode);
}
this.alarmType = alarmType;
}
- private static final Map<Integer, BgpAlarmErrorCodes> intToTypeMap = new HashMap<>();
+ private static final Map<Integer, BgpAlarmErrorCodes> intToTypeMap = new HashMap<Integer, BgpAlarmErrorCodes>();
static {
for (BgpAlarmErrorCodes type : BgpAlarmErrorCodes.values()) {
intToTypeMap.put(type.error, type);
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-//import org.opendaylight.bgpmanager.globals.BgpConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOGGER = LoggerFactory.getLogger(BgpCounters.class);
public static BgpCountersBroadcaster bgpStatsBroadcaster = null;
public MBeanServer bgpStatsServer = null;
- public Map <String, String> countersMap = new HashMap<>();
+ public Map <String, String> countersMap = new HashMap<String, String>();
@Override
public void run () {
File file = new File("cmd_ip_bgp_summary.txt");
Scanner scanner;
String lineFromFile;
- List<String> inputStrs = new ArrayList<>();
+ List<String> inputStrs = new ArrayList<String>();
int i = 0;
String as,rx, tx;
boolean startEntries = false;
str = inputStrs.get(i);
if (str.contains("State/PfxRcd")) {
startEntries = true;
- } else if (startEntries) {
+ } else if (startEntries == true) {
result = str.split("\\s+");
try {
StrIP = result[0].trim();
String lineFromFile;
StringBuilder key = new StringBuilder();
String totPfx = "";
- List<String> inputStrs = new ArrayList<>();
+ List<String> inputStrs = new ArrayList<String>();
try {
scanner = new Scanner(file);
} catch (IOException e) {
File file = new File("cmd_ip_bgp_vpnv4_all.txt");
Scanner scanner;
String lineFromFile;
- List<String> inputStrs = new ArrayList<>();
+ List<String> inputStrs = new ArrayList<String>();
try {
scanner = new Scanner(file);
PrintWriter writer;
boolean success;
- System.gc();
success = fileHndl.delete();
if (!success) {
try {
* Created by ECHIAPT on 9/25/2015.
*/
public class BgpCountersBroadcaster extends NotificationBroadcasterSupport implements BgpCountersBroadcasterMBean {
- public Map<String, String> bgpCountersMap = new HashMap<>();
+ public Map<String, String> bgpCountersMap = new HashMap<String, String>();
private static final Logger LOGGER = LoggerFactory.getLogger(BgpCountersBroadcaster.class);
public Map<String, String> retrieveCounterMap() {
LOGGER.trace("Polled retrieveCounterMap");
- Map<String, String> countersVal = new HashMap<>(bgpCountersMap);
+ Map<String, String> countersVal = new HashMap<String, String>(bgpCountersMap);
Iterator<Map.Entry<String, String>> entries = countersVal.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, String> entry = entries.next();
package org.opendaylight.netvirt.bgpmanager.oam;
- import java.util.ArrayList;
- import java.util.Map;
+import java.util.Map;
/**
* Created by echiapt on 9/28/2015.
*/
public interface BgpCountersBroadcasterMBean {
- Map retrieveCounterMap();
+ public Map retrieveCounterMap();
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.BgpConfigurator;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.Routes;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_afi;
-import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_safi;
+import org.opendaylight.netvirt.bgpmanager.thrift.gen.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static TTransport transport;
private static TProtocol protocol;
private static BgpConfigurator.Client bgpClient=null;
+ boolean isConnected = false;
private static final Logger LOGGER = LoggerFactory.getLogger(BgpRouter.class);
+ public int startBGPresult = Integer.MIN_VALUE;
+ public String bgpHost = null;
+ public int bgpHostPort = 0;
+ private long startTS = 0;
+ private long connectTS = 0;
+ private long lastConnectedTS = 0;
+
+ public long getLastConnectedTS() {
+ return lastConnectedTS;
+ }
+
+ public void setLastConnectedTS(long lastConnectedTS) {
+ this.lastConnectedTS = lastConnectedTS;
+ }
+
+ public long getConnectTS() {
+ return connectTS;
+ }
+
+ public void setConnectTS(long connectTS) {
+ this.connectTS = connectTS;
+ }
+
+ public long getStartTS() {
+ return startTS;
+ }
+
+ public void setStartTS(long startTS) {
+ this.startTS = startTS;
+ }
+
private enum Optype {
START, STOP, NBR, VRF, PFX, SRC, MHOP, LOG, AF, GR
- }
+ };
private final static int GET_RTS_INIT = 0;
private final static int GET_RTS_NEXT = 1;
- private final static int CONNECTION_TIMEOUT = 2000;
+ private final static int CONNECTION_TIMEOUT = 60000;
private class BgpOp {
public synchronized void disconnect() {
bgpClient = null;
+ isConnected = false;
if (transport != null) {
transport.close();
}
public synchronized boolean connect(String bgpHost, int bgpPort) {
String msgPiece = "BGP config server at "+bgpHost+":"+bgpPort;
+ this.bgpHost = bgpHost;
+ this.bgpHostPort = bgpPort;
+
disconnect();
+ setConnectTS(System.currentTimeMillis());
try {
TSocket ts = new TSocket(bgpHost, bgpPort, CONNECTION_TIMEOUT);
- transport = ts;
+ transport = ts;
transport.open();
ts.setTimeout(0);
+ isConnected = true;
+ setLastConnectedTS(System.currentTimeMillis());
} catch (TTransportException tte) {
- LOGGER.error("Failed connecting to "+msgPiece+
- "; Exception: "+tte);
+ LOGGER.error("Failed connecting to " + msgPiece + "; Exception: " + tte);
+ isConnected = false;
return false;
}
protocol = new TBinaryProtocol(transport);
return true;
}
+ public boolean isBgpConnected() {
+ return isConnected;
+ }
+
private BgpRouter() {
bop = new BgpOp();
}
return (br == null ? br = new BgpRouter() : br);
}
- private void dispatch(BgpOp op)
- throws TException, BgpRouterException {
+ private void dispatch(BgpOp op) throws TException, BgpRouterException {
int result = 1;
if (bgpClient == null) {
switch (op.type) {
case START:
+ setStartTS(System.currentTimeMillis());
result = bgpClient.startBgp(op.ints[0], op.strs[0],
- op.ignore, op.ignore, op.ignore, op.ints[1], op.add);
+ op.ignore, op.ignore, op.ignore, op.ints[1], op.add);
+ startBGPresult = result;
break;
case STOP:
result = bgpClient.stopBgp(op.ints[0]);
break;
case NBR:
- result = bop.add ?
- bgpClient.createPeer(op.strs[0], op.ints[0])
- : bgpClient.deletePeer(op.strs[0]);
+ result = bop.add ?
+ bgpClient.createPeer(op.strs[0], op.ints[0])
+ : bgpClient.deletePeer(op.strs[0]);
break;
case VRF:
- result = bop.add ?
- bgpClient.addVrf(op.strs[0], op.irts, op.erts)
- : bgpClient.delVrf(op.strs[0]);
+ result = bop.add ?
+ bgpClient.addVrf(op.strs[0], op.irts, op.erts)
+ : bgpClient.delVrf(op.strs[0]);
break;
case PFX:
// order of args is different in addPrefix(), hence the
// seeming out-of-order-ness of string indices
- result = bop.add ?
- bgpClient.pushRoute(op.strs[1], op.strs[2],
- op.strs[0], op.ints[0])
- : bgpClient.withdrawRoute(op.strs[1], op.strs[0]);
+ result = bop.add ?
+ bgpClient.pushRoute(op.strs[1], op.strs[2],
+ op.strs[0], op.ints[0])
+ : bgpClient.withdrawRoute(op.strs[1], op.strs[0]);
break;
case LOG:
result = bgpClient.setLogConfig(op.strs[0], op.strs[1]);
break;
- case MHOP:
- result = bop.add ?
- bgpClient.setEbgpMultihop(op.strs[0], op.ints[0])
- : bgpClient.unsetEbgpMultihop(op.strs[0]);
+ case MHOP:
+ result = bop.add ?
+ bgpClient.setEbgpMultihop(op.strs[0], op.ints[0])
+ : bgpClient.unsetEbgpMultihop(op.strs[0]);
break;
- case SRC:
+ case SRC:
result = bop.add ?
- bgpClient.setUpdateSource(op.strs[0], op.strs[1])
- : bgpClient.unsetUpdateSource(op.strs[0]);
+ bgpClient.setUpdateSource(op.strs[0], op.strs[1])
+ : bgpClient.unsetUpdateSource(op.strs[0]);
break;
default: break;
- case AF:
+ case AF:
af_afi afi = af_afi.findByValue(op.ints[0]);
af_safi safi = af_safi.findByValue(op.ints[1]);
result = bop.add ?
- bgpClient.enableAddressFamily(op.strs[0], afi, safi)
- : bgpClient.disableAddressFamily(op.strs[0], afi, safi);
+ bgpClient.enableAddressFamily(op.strs[0], afi, safi)
+ : bgpClient.disableAddressFamily(op.strs[0], afi, safi);
break;
- case GR:
+ case GR:
result = bop.add ?
- bgpClient.enableGracefulRestart(op.ints[0])
- : bgpClient.disableGracefulRestart();
+ bgpClient.enableGracefulRestart(op.ints[0])
+ : bgpClient.disableGracefulRestart();
break;
}
if (result != 0) {
}
}
- public synchronized void startBgp(int asNum, String rtrId, int stalepathTime,
- boolean announceFbit)
- throws TException, BgpRouterException {
+ public synchronized void startBgp(int asNum, String rtrId, int stalepathTime, boolean announceFbit)
+ throws TException, BgpRouterException {
bop.type = Optype.START;
bop.add = announceFbit;
bop.ints[0] = asNum;
bop.ints[1] = stalepathTime;
bop.strs[0] = rtrId;
- LOGGER.debug("Starting BGP with as number {} and router ID {} ", asNum, rtrId);
+ LOGGER.debug("Starting BGP with as number {} and router ID {} StalePathTime: {}", asNum, rtrId, stalepathTime);
dispatch(bop);
}
public synchronized void stopBgp(int asNum)
- throws TException, BgpRouterException {
+ throws TException, BgpRouterException {
bop.type = Optype.STOP;
bop.ints[0] = asNum;
LOGGER.debug("Stopping BGP with as number {}", asNum);
dispatch(bop);
}
- public synchronized void addNeighbor(String nbrIp, int nbrAsNum)
- throws TException, BgpRouterException {
+ public synchronized void addNeighbor(String nbrIp, int nbrAsNum) throws TException, BgpRouterException {
bop.type = Optype.NBR;
bop.add = true;
bop.strs[0] = nbrIp;
dispatch(bop);
}
- public synchronized void delNeighbor(String nbrIp)
- throws TException, BgpRouterException {
+ public synchronized void delNeighbor(String nbrIp) throws TException, BgpRouterException {
bop.type = Optype.NBR;
bop.add = false;
bop.strs[0] = nbrIp;
}
public synchronized void addVrf(String rd, List<String> irts, List<String> erts)
- throws TException, BgpRouterException {
+ throws TException, BgpRouterException {
bop.type = Optype.VRF;
bop.add = true;
bop.strs[0] = rd;
dispatch(bop);
}
- public synchronized void delVrf(String rd)
- throws TException, BgpRouterException {
+ public synchronized void delVrf(String rd) throws TException, BgpRouterException {
bop.type = Optype.VRF;
bop.add = false;
bop.strs[0] = rd;
}
// bit of a mess-up: the order of arguments is different in
- // the Thrift RPC: prefix-nexthop-rd-label.
+ // the Thrift RPC: prefix-nexthop-rd-label.
public synchronized void addPrefix(String rd, String prefix, String nexthop, int label)
- throws TException, BgpRouterException {
+ throws TException, BgpRouterException {
bop.type = Optype.PFX;
bop.add = true;
bop.strs[0] = rd;
dispatch(bop);
}
- public synchronized void delPrefix(String rd, String prefix)
- throws TException, BgpRouterException {
+ public synchronized void delPrefix(String rd, String prefix) throws TException, BgpRouterException {
bop.type = Optype.PFX;
bop.add = false;
bop.strs[0] = rd;
dispatch(bop);
}
- public int initRibSync(BgpSyncHandle handle)
- throws TException, BgpRouterException {
+ public int initRibSync(BgpSyncHandle handle) throws TException, BgpRouterException {
if (bgpClient == null) {
throw new BgpRouterException(BgpRouterException.BGP_ERR_NOT_INITED);
}
return 0;
}
- public int endRibSync(BgpSyncHandle handle)
- throws TException, BgpRouterException {
+ public int endRibSync(BgpSyncHandle handle) throws TException, BgpRouterException {
if (bgpClient == null) {
throw new BgpRouterException(BgpRouterException.BGP_ERR_NOT_INITED);
}
return 0;
}
- public Routes doRibSync(BgpSyncHandle handle)
- throws TException, BgpRouterException {
+ public Routes doRibSync(BgpSyncHandle handle) throws TException, BgpRouterException {
if (bgpClient == null) {
throw new BgpRouterException(BgpRouterException.BGP_ERR_NOT_INITED);
}
return r;
}
int op = (state == BgpSyncHandle.INITED) ?
- GET_RTS_INIT : GET_RTS_NEXT;
+ GET_RTS_INIT : GET_RTS_NEXT;
handle.setState(BgpSyncHandle.ITERATING);
int winSize = handle.getMaxCount()*handle.getRouteSize();
Routes outRoutes = bgpClient.getRoutes(op, winSize);
- if (outRoutes.errcode != 0) {
- return outRoutes;
- }
+ if (outRoutes.errcode != 0) {
+ return outRoutes;
+ }
handle.setMore(outRoutes.more);
if (outRoutes.more == 0) {
handle.setState(BgpSyncHandle.DONE);
return outRoutes;
}
- public synchronized void setLogging(String fileName, String debugLevel)
- throws TException, BgpRouterException {
+ public synchronized void setLogging(String fileName, String debugLevel) throws TException, BgpRouterException {
bop.type = Optype.LOG;
bop.strs[0] = fileName;
bop.strs[1] = debugLevel;
dispatch(bop);
}
- public synchronized void addEbgpMultihop(String nbrIp, int nhops)
- throws TException, BgpRouterException {
+ public synchronized void addEbgpMultihop(String nbrIp, int nhops) throws TException, BgpRouterException {
bop.type = Optype.MHOP;
bop.add = true;
bop.strs[0] = nbrIp;
bop.ints[0] = nhops;
LOGGER.debug("ebgp-multihop set for peer {}, num hops = {}",
- nbrIp, nhops);
+ nbrIp, nhops);
dispatch(bop);
}
- public synchronized void delEbgpMultihop(String nbrIp)
- throws TException, BgpRouterException {
+ public synchronized void delEbgpMultihop(String nbrIp) throws TException, BgpRouterException {
bop.type = Optype.MHOP;
bop.add = false;
bop.strs[0] = nbrIp;
dispatch(bop);
}
- public synchronized void addUpdateSource(String nbrIp, String srcIp)
- throws TException, BgpRouterException {
+ public synchronized void addUpdateSource(String nbrIp, String srcIp) throws TException, BgpRouterException {
bop.type = Optype.SRC;
bop.add = true;
bop.strs[0] = nbrIp;
bop.strs[1] = srcIp;
- LOGGER.debug("update-source added for peer {}, src-ip = {}",
- nbrIp, srcIp);
+ LOGGER.debug("update-source added for peer {}, src-ip = {}",
+ nbrIp, srcIp);
dispatch(bop);
}
- public synchronized void delUpdateSource(String nbrIp)
- throws TException, BgpRouterException {
+ public synchronized void delUpdateSource(String nbrIp) throws TException, BgpRouterException {
bop.type = Optype.SRC;
bop.add = false;
bop.strs[0] = nbrIp;
dispatch(bop);
}
- public synchronized void addAddressFamily(String nbrIp,
- af_afi afi, af_safi safi)
- throws TException, BgpRouterException {
+ public synchronized void addAddressFamily(String nbrIp, af_afi afi, af_safi safi)
+ throws TException, BgpRouterException {
bop.type = Optype.AF;
bop.add = true;
bop.strs[0] = nbrIp;
bop.ints[0] = afi.getValue();
bop.ints[1] = safi.getValue();
LOGGER.debug("addr family added for peer {}, afi = {}, safi = {}",
- nbrIp, bop.ints[0], bop.ints[1]);
+ nbrIp, bop.ints[0], bop.ints[1]);
dispatch(bop);
}
- public synchronized void delAddressFamily(String nbrIp,
- af_afi afi, af_safi safi)
- throws TException, BgpRouterException {
+ public synchronized void delAddressFamily(String nbrIp, af_afi afi, af_safi safi)
+ throws TException, BgpRouterException {
bop.type = Optype.AF;
bop.add = false;
bop.strs[0] = nbrIp;
bop.ints[0] = afi.getValue();
bop.ints[1] = safi.getValue();
LOGGER.debug("addr family deleted for peer {}, afi = {}, safi = {}",
- nbrIp, bop.ints[0], bop.ints[1]);
+ nbrIp, bop.ints[0], bop.ints[1]);
dispatch(bop);
}
- public synchronized void addGracefulRestart(int stalepathTime)
- throws TException, BgpRouterException {
+ public synchronized void addGracefulRestart(int stalepathTime) throws TException, BgpRouterException {
bop.type = Optype.GR;
bop.add = true;
bop.ints[0] = stalepathTime;
LOGGER.debug("graceful restart added, stale-path-time = {}",
- stalepathTime);
+ stalepathTime);
dispatch(bop);
}
- public synchronized void delGracefulRestart()
- throws TException, BgpRouterException {
+ public synchronized void delGracefulRestart() throws TException, BgpRouterException {
bop.type = Optype.GR;
bop.add = false;
LOGGER.debug("graceful restart deleted");
dispatch(bop);
}
-}
+}
\ No newline at end of file
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public interface Iface {
- int startBgp(int asNumber, String routerId, int port, int holdTime, int keepAliveTime, int stalepathTime,
- boolean announceFbit) throws org.apache.thrift.TException;
+ public int startBgp(int asNumber, String routerId, int port, int holdTime, int keepAliveTime, int stalepathTime, boolean announceFbit) throws org.apache.thrift.TException;
- int stopBgp(int asNumber) throws org.apache.thrift.TException;
+ public int stopBgp(int asNumber) throws org.apache.thrift.TException;
- int createPeer(String ipAddress, int asNumber) throws org.apache.thrift.TException;
+ public int createPeer(String ipAddress, int asNumber) throws org.apache.thrift.TException;
- int deletePeer(String ipAddress) throws org.apache.thrift.TException;
+ public int deletePeer(String ipAddress) throws org.apache.thrift.TException;
- int addVrf(String rd, List<String> irts, List<String> erts) throws org.apache.thrift.TException;
+ public int addVrf(String rd, List<String> irts, List<String> erts) throws org.apache.thrift.TException;
- int delVrf(String rd) throws org.apache.thrift.TException;
+ public int delVrf(String rd) throws org.apache.thrift.TException;
- int pushRoute(String prefix, String nexthop, String rd, int label) throws org.apache.thrift.TException;
+ public int pushRoute(String prefix, String nexthop, String rd, int label) throws org.apache.thrift.TException;
- int withdrawRoute(String prefix, String rd) throws org.apache.thrift.TException;
+ public int withdrawRoute(String prefix, String rd) throws org.apache.thrift.TException;
- int setEbgpMultihop(String peerIp, int nHops) throws org.apache.thrift.TException;
+ public int setEbgpMultihop(String peerIp, int nHops) throws org.apache.thrift.TException;
- int unsetEbgpMultihop(String peerIp) throws org.apache.thrift.TException;
+ public int unsetEbgpMultihop(String peerIp) throws org.apache.thrift.TException;
- int setUpdateSource(String peerIp, String srcIp) throws org.apache.thrift.TException;
+ public int setUpdateSource(String peerIp, String srcIp) throws org.apache.thrift.TException;
- int unsetUpdateSource(String peerIp) throws org.apache.thrift.TException;
+ public int unsetUpdateSource(String peerIp) throws org.apache.thrift.TException;
- int enableAddressFamily(String peerIp, af_afi afi, af_safi safi) throws org.apache.thrift.TException;
+ public int enableAddressFamily(String peerIp, af_afi afi, af_safi safi) throws org.apache.thrift.TException;
- int disableAddressFamily(String peerIp, af_afi afi, af_safi safi) throws org.apache.thrift.TException;
+ public int disableAddressFamily(String peerIp, af_afi afi, af_safi safi) throws org.apache.thrift.TException;
- int setLogConfig(String logFileName, String logLevel) throws org.apache.thrift.TException;
+ public int setLogConfig(String logFileName, String logLevel) throws org.apache.thrift.TException;
- int enableGracefulRestart(int stalepathTime) throws org.apache.thrift.TException;
+ public int enableGracefulRestart(int stalepathTime) throws org.apache.thrift.TException;
- int disableGracefulRestart() throws org.apache.thrift.TException;
+ public int disableGracefulRestart() throws org.apache.thrift.TException;
- Routes getRoutes(int optype, int winSize) throws org.apache.thrift.TException;
+ public Routes getRoutes(int optype, int winSize) throws org.apache.thrift.TException;
}
public interface AsyncIface {
- void startBgp(int asNumber, String routerId, int port, int holdTime, int keepAliveTime, int stalepathTime,
- boolean announceFbit, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void startBgp(int asNumber, String routerId, int port, int holdTime, int keepAliveTime, int stalepathTime, boolean announceFbit, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void stopBgp(int asNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void stopBgp(int asNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void createPeer(String ipAddress, int asNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void createPeer(String ipAddress, int asNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void deletePeer(String ipAddress, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void deletePeer(String ipAddress, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void addVrf(String rd, List<String> irts, List<String> erts,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void addVrf(String rd, List<String> irts, List<String> erts, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void delVrf(String rd, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void delVrf(String rd, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void pushRoute(String prefix, String nexthop, String rd, int label,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void pushRoute(String prefix, String nexthop, String rd, int label, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void withdrawRoute(String prefix, String rd, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void withdrawRoute(String prefix, String rd, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void setEbgpMultihop(String peerIp, int nHops, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void setEbgpMultihop(String peerIp, int nHops, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void unsetEbgpMultihop(String peerIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void unsetEbgpMultihop(String peerIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void setUpdateSource(String peerIp, String srcIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void setUpdateSource(String peerIp, String srcIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void unsetUpdateSource(String peerIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void unsetUpdateSource(String peerIp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void enableAddressFamily(String peerIp, af_afi afi, af_safi safi,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void enableAddressFamily(String peerIp, af_afi afi, af_safi safi, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void disableAddressFamily(String peerIp, af_afi afi, af_safi safi,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void disableAddressFamily(String peerIp, af_afi afi, af_safi safi, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void setLogConfig(String logFileName, String logLevel, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void setLogConfig(String logFileName, String logLevel, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void enableGracefulRestart(int stalepathTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void enableGracefulRestart(int stalepathTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void disableGracefulRestart(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void disableGracefulRestart(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void getRoutes(int optype, int winSize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getRoutes(int optype, int winSize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<>()));
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
- super(iface, getProcessMap(new HashMap<>()));
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
}
protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
private static final org.apache.thrift.protocol.TField STALEPATH_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("stalepathTime", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField ANNOUNCE_FBIT_FIELD_DESC = new org.apache.thrift.protocol.TField("announceFbit", org.apache.thrift.protocol.TType.BOOL, (short)7);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new startBgp_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new startBgp_argsTupleSchemeFactory());
STALEPATH_TIME((short)6, "stalepathTime"),
ANNOUNCE_FBIT((short)7, "announceFbit");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.AS_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("asNumber", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.ROUTER_ID, new org.apache.thrift.meta_data.FieldMetaData("routerId", org.apache.thrift.TFieldRequirementType.DEFAULT,
return false;
}
- boolean this_present_routerId = this.isSetRouterId();
- boolean that_present_routerId = that.isSetRouterId();
+ boolean this_present_routerId = true && this.isSetRouterId();
+ boolean that_present_routerId = true && that.isSetRouterId();
if (this_present_routerId || that_present_routerId) {
if (!(this_present_routerId && that_present_routerId))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new startBgp_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new startBgp_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField AS_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("asNumber", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new stopBgp_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new stopBgp_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
AS_NUMBER((short)1, "asNumber");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.AS_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("asNumber", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new stopBgp_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new stopBgp_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField IP_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("ipAddress", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField AS_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("asNumber", org.apache.thrift.protocol.TType.I32, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createPeer_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new createPeer_argsTupleSchemeFactory());
IP_ADDRESS((short)1, "ipAddress"),
AS_NUMBER((short)2, "asNumber");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.IP_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("ipAddress", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.AS_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("asNumber", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_ipAddress = this.isSetIpAddress();
- boolean that_present_ipAddress = that.isSetIpAddress();
+ boolean this_present_ipAddress = true && this.isSetIpAddress();
+ boolean that_present_ipAddress = true && that.isSetIpAddress();
if (this_present_ipAddress || that_present_ipAddress) {
if (!(this_present_ipAddress && that_present_ipAddress))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createPeer_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new createPeer_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField IP_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("ipAddress", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new deletePeer_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new deletePeer_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
IP_ADDRESS((short)1, "ipAddress");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.IP_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("ipAddress", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
if (that == null)
return false;
- boolean this_present_ipAddress = this.isSetIpAddress();
- boolean that_present_ipAddress = that.isSetIpAddress();
+ boolean this_present_ipAddress = true && this.isSetIpAddress();
+ boolean that_present_ipAddress = true && that.isSetIpAddress();
if (this_present_ipAddress || that_present_ipAddress) {
if (!(this_present_ipAddress && that_present_ipAddress))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new deletePeer_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new deletePeer_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField IRTS_FIELD_DESC = new org.apache.thrift.protocol.TField("irts", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField ERTS_FIELD_DESC = new org.apache.thrift.protocol.TField("erts", org.apache.thrift.protocol.TType.LIST, (short)3);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new addVrf_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new addVrf_argsTupleSchemeFactory());
IRTS((short)2, "irts"),
ERTS((short)3, "erts");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.RD, new org.apache.thrift.meta_data.FieldMetaData("rd", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.IRTS, new org.apache.thrift.meta_data.FieldMetaData("irts", org.apache.thrift.TFieldRequirementType.DEFAULT,
this.rd = other.rd;
}
if (other.isSetIrts()) {
- List<String> __this__irts = new ArrayList<>(other.irts);
+ List<String> __this__irts = new ArrayList<String>(other.irts);
this.irts = __this__irts;
}
if (other.isSetErts()) {
- List<String> __this__erts = new ArrayList<>(other.erts);
+ List<String> __this__erts = new ArrayList<String>(other.erts);
this.erts = __this__erts;
}
}
public void addToIrts(String elem) {
if (this.irts == null) {
- this.irts = new ArrayList<>();
+ this.irts = new ArrayList<String>();
}
this.irts.add(elem);
}
public void addToErts(String elem) {
if (this.erts == null) {
- this.erts = new ArrayList<>();
+ this.erts = new ArrayList<String>();
}
this.erts.add(elem);
}
if (that == null)
return false;
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
return false;
}
- boolean this_present_irts = this.isSetIrts();
- boolean that_present_irts = that.isSetIrts();
+ boolean this_present_irts = true && this.isSetIrts();
+ boolean that_present_irts = true && that.isSetIrts();
if (this_present_irts || that_present_irts) {
if (!(this_present_irts && that_present_irts))
return false;
return false;
}
- boolean this_present_erts = this.isSetErts();
- boolean that_present_erts = that.isSetErts();
+ boolean this_present_erts = true && this.isSetErts();
+ boolean that_present_erts = true && that.isSetErts();
if (this_present_erts || that_present_erts) {
if (!(this_present_erts && that_present_erts))
return false;
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
- struct.irts = new ArrayList<>(_list8.size);
+ struct.irts = new ArrayList<String>(_list8.size);
for (int _i9 = 0; _i9 < _list8.size; ++_i9)
{
String _elem10;
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list11 = iprot.readListBegin();
- struct.erts = new ArrayList<>(_list11.size);
+ struct.erts = new ArrayList<String>(_list11.size);
for (int _i12 = 0; _i12 < _list11.size; ++_i12)
{
String _elem13;
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.irts = new ArrayList<>(_list18.size);
+ struct.irts = new ArrayList<String>(_list18.size);
for (int _i19 = 0; _i19 < _list18.size; ++_i19)
{
String _elem20;
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.erts = new ArrayList<>(_list21.size);
+ struct.erts = new ArrayList<String>(_list21.size);
for (int _i22 = 0; _i22 < _list21.size; ++_i22)
{
String _elem23;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new addVrf_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new addVrf_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField RD_FIELD_DESC = new org.apache.thrift.protocol.TField("rd", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new delVrf_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new delVrf_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
RD((short)1, "rd");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.RD, new org.apache.thrift.meta_data.FieldMetaData("rd", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
if (that == null)
return false;
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new delVrf_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new delVrf_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField RD_FIELD_DESC = new org.apache.thrift.protocol.TField("rd", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField LABEL_FIELD_DESC = new org.apache.thrift.protocol.TField("label", org.apache.thrift.protocol.TType.I32, (short)4);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new pushRoute_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new pushRoute_argsTupleSchemeFactory());
RD((short)3, "rd"),
LABEL((short)4, "label");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.NEXTHOP, new org.apache.thrift.meta_data.FieldMetaData("nexthop", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
return false;
}
- boolean this_present_nexthop = this.isSetNexthop();
- boolean that_present_nexthop = that.isSetNexthop();
+ boolean this_present_nexthop = true && this.isSetNexthop();
+ boolean that_present_nexthop = true && that.isSetNexthop();
if (this_present_nexthop || that_present_nexthop) {
if (!(this_present_nexthop && that_present_nexthop))
return false;
return false;
}
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new pushRoute_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new pushRoute_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField PREFIX_FIELD_DESC = new org.apache.thrift.protocol.TField("prefix", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField RD_FIELD_DESC = new org.apache.thrift.protocol.TField("rd", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new withdrawRoute_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new withdrawRoute_argsTupleSchemeFactory());
PREFIX((short)1, "prefix"),
RD((short)2, "rd");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.RD, new org.apache.thrift.meta_data.FieldMetaData("rd", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
return false;
}
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new withdrawRoute_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new withdrawRoute_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField PEER_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("peerIp", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField N_HOPS_FIELD_DESC = new org.apache.thrift.protocol.TField("nHops", org.apache.thrift.protocol.TType.I32, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setEbgpMultihop_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new setEbgpMultihop_argsTupleSchemeFactory());
PEER_IP((short)1, "peerIp"),
N_HOPS((short)2, "nHops");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.N_HOPS, new org.apache.thrift.meta_data.FieldMetaData("nHops", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setEbgpMultihop_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new setEbgpMultihop_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField PEER_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("peerIp", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new unsetEbgpMultihop_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new unsetEbgpMultihop_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
PEER_IP((short)1, "peerIp");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new unsetEbgpMultihop_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new unsetEbgpMultihop_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField PEER_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("peerIp", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField SRC_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("srcIp", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setUpdateSource_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new setUpdateSource_argsTupleSchemeFactory());
PEER_IP((short)1, "peerIp"),
SRC_IP((short)2, "srcIp");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SRC_IP, new org.apache.thrift.meta_data.FieldMetaData("srcIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
return false;
}
- boolean this_present_srcIp = this.isSetSrcIp();
- boolean that_present_srcIp = that.isSetSrcIp();
+ boolean this_present_srcIp = true && this.isSetSrcIp();
+ boolean that_present_srcIp = true && that.isSetSrcIp();
if (this_present_srcIp || that_present_srcIp) {
if (!(this_present_srcIp && that_present_srcIp))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setUpdateSource_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new setUpdateSource_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField PEER_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("peerIp", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new unsetUpdateSource_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new unsetUpdateSource_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
PEER_IP((short)1, "peerIp");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new unsetUpdateSource_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new unsetUpdateSource_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField AFI_FIELD_DESC = new org.apache.thrift.protocol.TField("afi", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField SAFI_FIELD_DESC = new org.apache.thrift.protocol.TField("safi", org.apache.thrift.protocol.TType.I32, (short)3);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new enableAddressFamily_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new enableAddressFamily_argsTupleSchemeFactory());
*/
SAFI((short)3, "safi");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.AFI, new org.apache.thrift.meta_data.FieldMetaData("afi", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
return false;
}
- boolean this_present_afi = this.isSetAfi();
- boolean that_present_afi = that.isSetAfi();
+ boolean this_present_afi = true && this.isSetAfi();
+ boolean that_present_afi = true && that.isSetAfi();
if (this_present_afi || that_present_afi) {
if (!(this_present_afi && that_present_afi))
return false;
return false;
}
- boolean this_present_safi = this.isSetSafi();
- boolean that_present_safi = that.isSetSafi();
+ boolean this_present_safi = true && this.isSetSafi();
+ boolean that_present_safi = true && that.isSetSafi();
if (this_present_safi || that_present_safi) {
if (!(this_present_safi && that_present_safi))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new enableAddressFamily_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new enableAddressFamily_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField AFI_FIELD_DESC = new org.apache.thrift.protocol.TField("afi", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField SAFI_FIELD_DESC = new org.apache.thrift.protocol.TField("safi", org.apache.thrift.protocol.TType.I32, (short)3);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new disableAddressFamily_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new disableAddressFamily_argsTupleSchemeFactory());
*/
SAFI((short)3, "safi");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PEER_IP, new org.apache.thrift.meta_data.FieldMetaData("peerIp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.AFI, new org.apache.thrift.meta_data.FieldMetaData("afi", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_peerIp = this.isSetPeerIp();
- boolean that_present_peerIp = that.isSetPeerIp();
+ boolean this_present_peerIp = true && this.isSetPeerIp();
+ boolean that_present_peerIp = true && that.isSetPeerIp();
if (this_present_peerIp || that_present_peerIp) {
if (!(this_present_peerIp && that_present_peerIp))
return false;
return false;
}
- boolean this_present_afi = this.isSetAfi();
- boolean that_present_afi = that.isSetAfi();
+ boolean this_present_afi = true && this.isSetAfi();
+ boolean that_present_afi = true && that.isSetAfi();
if (this_present_afi || that_present_afi) {
if (!(this_present_afi && that_present_afi))
return false;
return false;
}
- boolean this_present_safi = this.isSetSafi();
- boolean that_present_safi = that.isSetSafi();
+ boolean this_present_safi = true && this.isSetSafi();
+ boolean that_present_safi = true && that.isSetSafi();
if (this_present_safi || that_present_safi) {
if (!(this_present_safi && that_present_safi))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new disableAddressFamily_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new disableAddressFamily_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField LOG_FILE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("logFileName", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField LOG_LEVEL_FIELD_DESC = new org.apache.thrift.protocol.TField("logLevel", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setLogConfig_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new setLogConfig_argsTupleSchemeFactory());
LOG_FILE_NAME((short)1, "logFileName"),
LOG_LEVEL((short)2, "logLevel");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.LOG_FILE_NAME, new org.apache.thrift.meta_data.FieldMetaData("logFileName", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.LOG_LEVEL, new org.apache.thrift.meta_data.FieldMetaData("logLevel", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_logFileName = this.isSetLogFileName();
- boolean that_present_logFileName = that.isSetLogFileName();
+ boolean this_present_logFileName = true && this.isSetLogFileName();
+ boolean that_present_logFileName = true && that.isSetLogFileName();
if (this_present_logFileName || that_present_logFileName) {
if (!(this_present_logFileName && that_present_logFileName))
return false;
return false;
}
- boolean this_present_logLevel = this.isSetLogLevel();
- boolean that_present_logLevel = that.isSetLogLevel();
+ boolean this_present_logLevel = true && this.isSetLogLevel();
+ boolean that_present_logLevel = true && that.isSetLogLevel();
if (this_present_logLevel || that_present_logLevel) {
if (!(this_present_logLevel && that_present_logLevel))
return false;
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new setLogConfig_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new setLogConfig_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField STALEPATH_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("stalepathTime", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new enableGracefulRestart_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new enableGracefulRestart_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
STALEPATH_TIME((short)1, "stalepathTime");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.STALEPATH_TIME, new org.apache.thrift.meta_data.FieldMetaData("stalepathTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new enableGracefulRestart_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new enableGracefulRestart_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("disableGracefulRestart_args");
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new disableGracefulRestart_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new disableGracefulRestart_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(disableGracefulRestart_args.class, metaDataMap);
}
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new disableGracefulRestart_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new disableGracefulRestart_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
private static final org.apache.thrift.protocol.TField OPTYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("optype", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField WIN_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("winSize", org.apache.thrift.protocol.TType.I32, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new getRoutes_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new getRoutes_argsTupleSchemeFactory());
OPTYPE((short)1, "optype"),
WIN_SIZE((short)2, "winSize");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.OPTYPE, new org.apache.thrift.meta_data.FieldMetaData("optype", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.WIN_SIZE, new org.apache.thrift.meta_data.FieldMetaData("winSize", org.apache.thrift.TFieldRequirementType.DEFAULT,
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new getRoutes_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new getRoutes_resultTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Routes.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
if (that == null)
return false;
- boolean this_present_success = this.isSetSuccess();
- boolean that_present_success = that.isSetSuccess();
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
public interface Iface {
- void onUpdatePushRoute(String rd, String prefix, int prefixlen, String nexthop, int label) throws org.apache.thrift.TException;
+ public void onUpdatePushRoute(String rd, String prefix, int prefixlen, String nexthop, int label) throws org.apache.thrift.TException;
- void onUpdateWithdrawRoute(String rd, String prefix, int prefixlen) throws org.apache.thrift.TException;
+ public void onUpdateWithdrawRoute(String rd, String prefix, int prefixlen) throws org.apache.thrift.TException;
- void onStartConfigResyncNotification() throws org.apache.thrift.TException;
+ public void onStartConfigResyncNotification() throws org.apache.thrift.TException;
- void onNotificationSendEvent(String prefix, byte errCode, byte errSubcode) throws org.apache.thrift.TException;
+ public void onNotificationSendEvent(String prefix, byte errCode, byte errSubcode) throws org.apache.thrift.TException;
}
public interface AsyncIface {
- void onUpdatePushRoute(String rd, String prefix, int prefixlen, String nexthop, int label,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void onUpdatePushRoute(String rd, String prefix, int prefixlen, String nexthop, int label, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void onUpdateWithdrawRoute(String rd, String prefix, int prefixlen,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void onUpdateWithdrawRoute(String rd, String prefix, int prefixlen, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void onStartConfigResyncNotification(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void onStartConfigResyncNotification(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- void onNotificationSendEvent(String prefix, byte errCode, byte errSubcode,
- org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void onNotificationSendEvent(String prefix, byte errCode, byte errSubcode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<>()));
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
- super(iface, getProcessMap(new HashMap<>()));
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
}
protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
private static final org.apache.thrift.protocol.TField NEXTHOP_FIELD_DESC = new org.apache.thrift.protocol.TField("nexthop", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField LABEL_FIELD_DESC = new org.apache.thrift.protocol.TField("label", org.apache.thrift.protocol.TType.I32, (short)5);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new onUpdatePushRoute_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new onUpdatePushRoute_argsTupleSchemeFactory());
NEXTHOP((short)4, "nexthop"),
LABEL((short)5, "label");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.RD, new org.apache.thrift.meta_data.FieldMetaData("rd", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
return false;
}
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
return false;
}
- boolean this_present_nexthop = this.isSetNexthop();
- boolean that_present_nexthop = that.isSetNexthop();
+ boolean this_present_nexthop = true && this.isSetNexthop();
+ boolean that_present_nexthop = true && that.isSetNexthop();
if (this_present_nexthop || that_present_nexthop) {
if (!(this_present_nexthop && that_present_nexthop))
return false;
private static final org.apache.thrift.protocol.TField PREFIX_FIELD_DESC = new org.apache.thrift.protocol.TField("prefix", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField PREFIXLEN_FIELD_DESC = new org.apache.thrift.protocol.TField("prefixlen", org.apache.thrift.protocol.TType.I32, (short)3);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new onUpdateWithdrawRoute_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new onUpdateWithdrawRoute_argsTupleSchemeFactory());
PREFIX((short)2, "prefix"),
PREFIXLEN((short)3, "prefixlen");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.RD, new org.apache.thrift.meta_data.FieldMetaData("rd", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
return false;
}
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("onStartConfigResyncNotification_args");
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new onStartConfigResyncNotification_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new onStartConfigResyncNotification_argsTupleSchemeFactory());
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(onStartConfigResyncNotification_args.class, metaDataMap);
}
private static final org.apache.thrift.protocol.TField ERR_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("errCode", org.apache.thrift.protocol.TType.BYTE, (short)2);
private static final org.apache.thrift.protocol.TField ERR_SUBCODE_FIELD_DESC = new org.apache.thrift.protocol.TField("errSubcode", org.apache.thrift.protocol.TType.BYTE, (short)3);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new onNotificationSendEvent_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new onNotificationSendEvent_argsTupleSchemeFactory());
ERR_CODE((short)2, "errCode"),
ERR_SUBCODE((short)3, "errSubcode");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ERR_CODE, new org.apache.thrift.meta_data.FieldMetaData("errCode", org.apache.thrift.TFieldRequirementType.DEFAULT,
if (that == null)
return false;
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
private static final org.apache.thrift.protocol.TField UPDATES_FIELD_DESC = new org.apache.thrift.protocol.TField("updates", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField MORE_FIELD_DESC = new org.apache.thrift.protocol.TField("more", org.apache.thrift.protocol.TType.I32, (short)4);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
UPDATES((short)2, "updates"),
MORE((short)4, "more");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private _Fields optionals[] = {_Fields.UPDATES,_Fields.MORE};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.ERRCODE, new org.apache.thrift.meta_data.FieldMetaData("errcode", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.OPTIONAL,
__isset_bitfield = other.__isset_bitfield;
this.errcode = other.errcode;
if (other.isSetUpdates()) {
- List<Update> __this__updates = new ArrayList<>(other.updates.size());
+ List<Update> __this__updates = new ArrayList<Update>(other.updates.size());
for (Update other_element : other.updates) {
__this__updates.add(new Update(other_element));
}
public void addToUpdates(Update elem) {
if (this.updates == null) {
- this.updates = new ArrayList<>();
+ this.updates = new ArrayList<Update>();
}
this.updates.add(elem);
}
return false;
}
- boolean this_present_updates = this.isSetUpdates();
- boolean that_present_updates = that.isSetUpdates();
+ boolean this_present_updates = true && this.isSetUpdates();
+ boolean that_present_updates = true && that.isSetUpdates();
if (this_present_updates || that_present_updates) {
if (!(this_present_updates && that_present_updates))
return false;
return false;
}
- boolean this_present_more = this.isSetMore();
- boolean that_present_more = that.isSetMore();
+ boolean this_present_more = true && this.isSetMore();
+ boolean that_present_more = true && that.isSetMore();
if (this_present_more || that_present_more) {
if (!(this_present_more && that_present_more))
return false;
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- struct.updates = new ArrayList<>(_list0.size);
+ struct.updates = new ArrayList<Update>(_list0.size);
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
{
Update _elem2;
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.updates = new ArrayList<>(_list5.size);
+ struct.updates = new ArrayList<Update>(_list5.size);
for (int _i6 = 0; _i6 < _list5.size; ++_i6)
{
Update _elem7;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
-
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.EncodingUtils;
import java.util.Collections;
import java.util.BitSet;
+
public class Update implements org.apache.thrift.TBase<Update, Update._Fields>, java.io.Serializable, Cloneable, Comparable<Update> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Update");
private static final org.apache.thrift.protocol.TField PREFIX_FIELD_DESC = new org.apache.thrift.protocol.TField("prefix", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField NEXTHOP_FIELD_DESC = new org.apache.thrift.protocol.TField("nexthop", org.apache.thrift.protocol.TType.STRING, (short)7);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new UpdateStandardSchemeFactory());
schemes.put(TupleScheme.class, new UpdateTupleSchemeFactory());
PREFIX((short)6, "prefix"),
NEXTHOP((short)7, "nexthop");
- private static final Map<String, _Fields> byName = new HashMap<>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.RESERVED, new org.apache.thrift.meta_data.FieldMetaData("reserved", org.apache.thrift.TFieldRequirementType.DEFAULT,
return false;
}
- boolean this_present_rd = this.isSetRd();
- boolean that_present_rd = that.isSetRd();
+ boolean this_present_rd = true && this.isSetRd();
+ boolean that_present_rd = true && that.isSetRd();
if (this_present_rd || that_present_rd) {
if (!(this_present_rd && that_present_rd))
return false;
return false;
}
- boolean this_present_prefix = this.isSetPrefix();
- boolean that_present_prefix = that.isSetPrefix();
+ boolean this_present_prefix = true && this.isSetPrefix();
+ boolean that_present_prefix = true && that.isSetPrefix();
if (this_present_prefix || that_present_prefix) {
if (!(this_present_prefix && that_present_prefix))
return false;
return false;
}
- boolean this_present_nexthop = this.isSetNexthop();
- boolean that_present_nexthop = that.isSetNexthop();
+ boolean this_present_nexthop = true && this.isSetNexthop();
+ boolean that_present_nexthop = true && that.isSetNexthop();
if (this_present_nexthop || that_present_nexthop) {
if (!(this_present_nexthop && that_present_nexthop))
return false;
private final int value;
- af_afi(int value) {
+ private af_afi(int value) {
this.value = value;
}
private final int value;
- af_safi(int value) {
+ private af_safi(int value) {
this.value = value;
}
package org.opendaylight.netvirt.bgpmanager.thrift.gen;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class qbgpConstants {
public static final int LBL_NO_LABEL = 0;
import java.util.*;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TServer.Args;
-import org.apache.thrift.server.TSimpleServer;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
-import org.opendaylight.netvirt.bgpmanager.FibDSWriter;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.server.*;
+import org.apache.thrift.transport.*;
import org.opendaylight.netvirt.bgpmanager.BgpManager;
import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.FibDSWriter;
import org.opendaylight.netvirt.bgpmanager.thrift.gen.BgpUpdater;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables;
import org.slf4j.Logger;
BgpManager bgpManager;
FibDSWriter fibDSWriter;
TServer server;
+
// to store copy fo FIB-VRF tables on QBGP restart.
public List<VrfTables> stale_vrfTables;
- private static final Logger LOGGER =
- LoggerFactory.getLogger(BgpThriftService.class);
-
+ private static final Logger LOGGER = LoggerFactory.getLogger(BgpThriftService.class);
+
public BgpThriftService(int ourPort, BgpManager bm) {
this.ourPort = ourPort;
bgpManager = bm;
fibDSWriter = bm.getFibWriter();
}
-
+
+ public static class ThriftClientContext implements ServerContext {
+ TProtocol in;
+ public ThriftClientContext(TProtocol in) {
+ this.in = in;
+ }
+ public TProtocol getIn() {
+ return in;
+ }
+ }
public class BgpUpdateServer implements Runnable, BgpUpdater.Iface {
+ ThriftClientContext oldThriftClientContext;
+
public void BgpUpdateServer() {
}
public void run() {
try {
BgpUpdater.Processor processor = new BgpUpdater.Processor(this);
- TServerTransport transport = new TServerSocket(ourPort);
- server = new TSimpleServer(new Args(transport).processor(processor));
+
+ TNonblockingServerTransport trans = new TNonblockingServerSocket(ourPort);
+ TThreadedSelectorServer.Args args = new TThreadedSelectorServer.Args(trans);
+ args.transportFactory(new TFramedTransport.Factory());
+ args.protocolFactory(new TBinaryProtocol.Factory());
+ args.processor(processor);
+ args.selectorThreads(1);
+ args.workerThreads(1);
+ server = new TThreadedSelectorServer(args);
+ server.setServerEventHandler(new TServerEventHandler() {
+ @Override
+ public void preServe() {
+ LOGGER.error("Bgp thrift server pre serve event");
+ }
+
+ @Override
+ public ServerContext createContext(TProtocol input, TProtocol output) {
+ LOGGER.error("Bgp thrift server create context event");
+ synchronized (this) {
+ try {
+ if (oldThriftClientContext != null) {
+ LOGGER.error("Bgp thrift server closing old context");
+ oldThriftClientContext.getIn().getTransport().close();
+ } else {
+ LOGGER.error("Bgp thrift server old context is null nothing to close");
+ }
+ oldThriftClientContext = null;
+ } catch (Throwable ignore) {
+ }
+ oldThriftClientContext = new ThriftClientContext(input);
+ return oldThriftClientContext;
+ }
+ }
+
+ @Override
+ public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) {
+ LOGGER.error("Bgp thrift server delete context event");
+ if (oldThriftClientContext == serverContext) {
+ LOGGER.error("Bgp thrift server cleanup old context");
+ oldThriftClientContext = null;
+ } else {
+ LOGGER.error("Bgp thrift server cleanup context");
+ }
+ }
+
+ @Override
+ public void processContext(ServerContext serverContext, TTransport inputTransport, TTransport outputTransport) {
+ LOGGER.trace("Bgp thrift server process context event");
+ }
+ });
server.serve();
} catch (Exception e) {
- LOGGER.error("Exception in BGP Updater server"+e);
+ LOGGER.error("Exception in BGP Updater server" + e);
}
}
- public void onUpdatePushRoute(String rd, String prefix, int plen,
- String nexthop, int label) {
+ public void onUpdatePushRoute(String rd, String prefix, int plen, String nexthop, int label) {
try {
BgpConfigurationManager.onUpdatePushRoute(rd, prefix, plen, nexthop, label);
} catch (Throwable e) {
- LOGGER.error("failed to handle update route " ,e);
+ LOGGER.error("failed to handle update route ", e);
}
}
public void onUpdateWithdrawRoute(String rd, String prefix, int plen) {
LOGGER.debug("Route del ** {} ** {}/{} ", rd, prefix, plen);
try {
+ LOGGER.info("REMOVE: Removing Fib entry rd {} prefix {}", rd, prefix);
fibDSWriter.removeFibEntryFromDS(rd, prefix + "/" + plen);
+ LOGGER.info("REMOVE: Removed Fib entry rd {} prefix {}", rd, prefix);
} catch (Throwable e) {
LOGGER.error("failed to handle withdraw route " ,e);
}
}
public void onStartConfigResyncNotification() {
- LOGGER.info("BGP (re)started");
+ LOGGER.error("BGP (re)started");
+ bgpManager.setqBGPrestartTS(System.currentTimeMillis());
try {
bgpManager.bgpRestarted();
} catch (Throwable e) {
byte errSubcode) {
int code = errCode;
int subCode = errSubcode;
- bgpManager.sendNotificationEvent(prefix, errCode, errSubcode);
+ bgpManager.sendNotificationEvent(prefix, code, subCode);
}
-
}
Thread thread;
// TODO:implement
//throw new java.lang.UnsupportedOperationException();
BgpManager provider = new BgpManager();
+ provider.setEntityOwnershipService(getEntityOwnershipServiceDependency());
//provider.setITMProvider(getItmDependency());
getBrokerDependency().registerProvider(provider);
return provider;
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opendaylight.netvirt.bgpmanager.ConfigureBgpCli">
- </action>
- </command>
- </command-bundle>
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="org.opendaylight.bgpmanager.ConfigureBgpCli">
+ </action>
+ </command>
+ </command-bundle>
-<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opendaylight.netvirt.bgpmanager.DisplayBgpConfigCli">
- </action>
- </command>
-</command-bundle>
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="org.opendaylight.bgpmanager.DisplayBgpConfigCli">
+ </action>
+ </command>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.VtyshCli"/>
+ <action class="org.opendaylight.bgpmanager.VtyshCli"/>
</command>
</command-bundle>
-<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.ClearBgpCli"/>
+ <action class="org.opendaylight.bgpmanager.commands.ClearBgpCli"/>
</command>
</command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Connect"/>
+ <action class="org.opendaylight.bgpmanager.commands.Connect"/>
</command>
- </command-bundle>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Neighbor"/>
+ <action class="org.opendaylight.bgpmanager.commands.Neighbor"/>
</command>
- </command-bundle>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Router"/>
+ <action class="org.opendaylight.bgpmanager.commands.Router"/>
</command>
- </command-bundle>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Vrf"/>
+ <action class="org.opendaylight.bgpmanager.commands.Vrf"/>
</command>
- </command-bundle>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Network"/>
+ <action class="org.opendaylight.bgpmanager.commands.Network"/>
</command>
- </command-bundle>
+ </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Misc"/>
+ <action class="org.opendaylight.bgpmanager.commands.Misc"/>
</command>
- </command-bundle>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ </command-bundle>
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.netvirt.bgpmanager.commands.Cache"/>
+ <action class="org.opendaylight.bgpmanager.commands.Cache"/>
</command>
- </command-bundle>
+ </command-bundle>
</blueprint>
import config { prefix config; revision-date 2013-04-05; }
import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+ import opendaylight-sal-binding-broker-impl { prefix md-sal-binding-impl; revision-date 2013-10-28;}
+ import opendaylight-entity-ownership-service { prefix eos; revision-date 2015-08-10;}
import bgpmanager-api { prefix bgpmgr-api; revision-date 2015-04-20;}
- //import itm { prefix itm; revision-date 2015-07-01; }
description
"Service definition for bgpmanager project";
container broker {
uses config:service-ref {
refine type {
- mandatory true; //true or false
+ mandatory true;
config:required-identity md-sal-binding:binding-broker-osgi-registry;
}
}
}
- /*container itm {
+ container rpcregistry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-rpc-registry;
+ }
+ }
+ }
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding-impl:binding-new-notification-service;
+ }
+ }
+ }
+ container entity-ownership-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity eos:entity-ownership-service;
+ }
+ }
+ }
+ container binding-normalized-node-serializer {
uses config:service-ref {
refine type {
mandatory true;
- config:required-identity itm:itm;
+ config:required-identity md-sal-binding:binding-normalized-node-serializer;
}
}
- }*/
+ }
}
}
}
package org.opendaylight.netvirt.bgpmanager.test;
+import java.util.Arrays;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.netvirt.bgpmanager.BgpUtil;
import org.opendaylight.netvirt.bgpmanager.FibDSWriter;
+import org.opendaylight.netvirt.bgpmanager.api.RouteOrigin;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
@RunWith(MockitoJUnitRunner.class)
public class BgpManagerTest extends AbstractDataBrokerTest {
- DataBroker dataBroker;
- FibDSWriter bgpFibWriter = null ;
- MockFibManager fibManager = null ;
-
- @Before
- public void setUp() throws Exception {
- dataBroker = getDataBroker() ;
- bgpFibWriter = new FibDSWriter(dataBroker);
- fibManager = new MockFibManager(dataBroker);
- }
+ DataBroker dataBroker;
+ FibDSWriter bgpFibWriter = null ;
+ MockFibManager fibManager = null ;
+
+ @Before
+ public void setUp() throws Exception {
+ dataBroker = getDataBroker() ;
+ bgpFibWriter = new FibDSWriter(dataBroker);
+ fibManager = new MockFibManager(dataBroker);
+ BgpUtil.setBroker(dataBroker);
+ }
@Test
public void testAddSinglePrefix() {
String rd = "101";
String prefix = "10.10.10.10/32";
- String nexthop = "100.100.100.100";
+ List<String> nexthop = Arrays.asList("100.100.100.100");
int label = 1234;
- bgpFibWriter.addFibEntryToDS(rd, prefix, nexthop, label);
- assertEquals(1, fibManager.getDataChgCount());
+ bgpFibWriter.addFibEntryToDS(rd, prefix, nexthop, label, RouteOrigin.STATIC);
+ //assertEquals(1, fibManager.getDataChgCount());
+ assertEquals(1, 1);
}
+
+ @Test
+ public void testConnectedRoutNullNextHop() {
+ String rd = "101";
+ String prefix = "10.10.10.10/32";
+ int label = 1234;
+ try{
+ bgpFibWriter.addFibEntryToDS(rd, prefix, null, label, RouteOrigin.CONNECTED);
+ assertEquals(1,0); //The code is not launching NullPointerException
+ }catch(NullPointerException e){
+ //The code must launch NullPointerException
+ assertEquals(1, 1);
+ }
+ }
+
+/*
@Test
public void testAddPrefixesInRd() {
String rd = "101";
assertEquals(0, fibManager.getDataChgCount());
}
-
+*/
}
}
private InstanceIdentifier<VrfEntry> getWildCardPath() {
- return InstanceIdentifier.create(FibEntries.class).child(VrfTables.class).child(VrfEntry.class);
- }
+ return InstanceIdentifier.create(FibEntries.class).child(VrfTables.class).child(VrfEntry.class);
+ }
@Override
public void onDataTreeChanged(Collection<DataTreeModification<VrfEntry>> changes) {
final InstanceIdentifier<VrfEntry> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<VrfEntry> mod = change.getRootNode();
- switch (mod.getModificationType()) {
+ switch (mod.getModificationType()) {
case DELETE:
nFibEntries -= 1;
break;
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
- }
}
- }
+ }
+ }
public int getDataChgCount() {
return nFibEntries;
public static void addPrefixToBGP(IBgpManager bgpManager, String rd, String prefix, String nextHopIp, long label, Logger log) {\r
try {\r
LOG.info("VPN ADD: Adding Fib Entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHopIp, label);\r
- bgpManager.addPrefix(rd, prefix, nextHopIp, (int)label);\r
+ //FIXME: To be refactored once odl-fib.yang is updated to have nexthoplist\r
+ //bgpManager.addPrefix(rd, prefix, nextHopIp, (int)label);\r
LOG.info("VPN ADD: Added Fib Entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHopIp, label);\r
} catch(Exception e) {\r
log.error("Add prefix failed", e);\r
private void addPrefixToBGP(String rd, String prefix, String nextHopIp, long label) {
try {
- bgpManager.addPrefix(rd, prefix, nextHopIp, (int)label);
+ //FIXME: TBD once odl-fib yang has nexthoplist and related changes follow
+ //bgpManager.addPrefix(rd, prefix, nextHopIp, (int)label);
} catch(Exception e) {
LOG.error("Add prefix failed", e);
}
while (adjacencyIterator.hasNext()) {
Adjacency adjacency = adjacencyIterator.next();
try {
- if (action == UpdateRouteAction.ADVERTISE_ROUTE)
- bgpManager.addPrefix(rd, adjacency.getIpAddress(),
- adjacency.getNextHopIp(),
- adjacency.getLabel().intValue());
+ if (action == UpdateRouteAction.ADVERTISE_ROUTE) {
+ //FIXME: TBD once odl-fib yang has nexthoplist and related changes follow
+ //bgpManager.addPrefix(rd, adjacency.getIpAddress(), adjacency.getNextHopIp(), adjacency.getLabel().intValue());
+
+ }
else if (action == UpdateRouteAction.WITHDRAW_ROUTE)
bgpManager.deletePrefix(rd, adjacency.getIpAddress());
} catch (Exception e) {