+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.api;
import java.util.Collection;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager;
import com.google.common.util.concurrent.Futures;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.globals;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.client.globals;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.client.implementation;
import org.apache.thrift.TException;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.bgpmanager.thrift.client.implementation;
public static final int DEFAULT_TCP_SOCK_SZ = 87380; //default receive buffer size on linux > 2.4
private BgpSyncHandle() {
- more = 1;
+ more = 1;
state = NEVER_DONE;
}
//size of one update structure on the wire. ideally
//this should be computed; or thrift sure has a nice
//way to tell this to the applciation, but for the
- //moment, we just use 8 bytes more than the size of
- //the C struct.
+ //moment, we just use 8 bytes more than the size of
+ //the C struct.
return 96;
}
}
}
-
-
+
+
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.common;
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.exceptions;
public class BgpRouterException extends Exception {
public int getErrorCode() {
return errcode;
}
-
+
private int errcode;
}
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.server.implementation;
import org.apache.thrift.server.THsHaServer;
import org.slf4j.LoggerFactory;
public class BgpThriftService {
-
+
private static final Logger LOGGER = LoggerFactory.getLogger(BgpThriftService.class);
-
+
private int port;
private int maxWorkerThreads;
private int minWorkerThreads;
private TServer server;
private BgpUpdateHandler notificationHandler;
private BgpManager bgpManager;
-
+
public BgpThriftService(BgpManager bgpMgr, FibDSWriter dsWriter) {
bgpManager = bgpMgr;
notificationHandler = new BgpUpdateHandler(bgpManager, dsWriter);
LOGGER.debug("BGP Thrift Server starting...");
startBgpThriftServer();
}
-
+
public void stop() {
LOGGER.debug("BGP Thrift Server stopping...");
stopBgpThriftServer();
/**
* Loading the parameters required for a connection
- *
+ *
*/
private void loadParameters() {
port = Integer.getInteger(Constants.PROP_BGP_THRIFT_PORT, Constants.BGP_SERVICE_PORT);
if (serverTransport != null) {
serverTransport.close();
}
-
+
server.stop();
LOGGER.info("BGP Thrift Server stopped");
} catch (Exception e) {
LOGGER.error("Error while stopping the server - {} {}", getClass().getName(), e.getMessage());
}
}
-
+
private class ThriftRunnable implements Runnable {
@Override
public void run() {
.maxWorkerThreads(maxWorkerThreads).minWorkerThreads(minWorkerThreads)
.processor(new BgpUpdater.Processor<BgpUpdateHandler>(notificationHandler)));
server.serve();
- }
+ }
}
}
+/*
+ * 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.bgpmanager.thrift.server.implementation;
import org.opendaylight.bgpmanager.BgpManager;