1 package org.opendaylight.bgpmanager.thrift.server.implementation;
3 import org.opendaylight.bgpmanager.BgpManager;
4 import org.opendaylight.bgpmanager.FibDSWriter;
5 import org.opendaylight.bgpmanager.thrift.gen.BgpUpdater;
6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory;
9 class BgpUpdateHandler implements BgpUpdater.Iface {
11 private static final Logger LOGGER = LoggerFactory.getLogger(BgpUpdateHandler.class);
12 private BgpManager bgpManager;
13 private FibDSWriter fibDSWriter;
15 public BgpUpdateHandler(BgpManager bgpMgr, FibDSWriter dsWriter) {
17 fibDSWriter = dsWriter;
20 public void onUpdatePushRoute(String rd, String prefix, int plen,
21 String nexthop, int label) {
23 LOGGER.info("Route add ** " + rd + " ** " + prefix + "/" + plen
24 + " ** " + nexthop + " ** " + label);
25 //Write to FIB in Data Store
26 fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nexthop, label);
30 public void onUpdateWithdrawRoute(String rd, String prefix, int plen) {
31 LOGGER.info("Route del ** " + rd + " ** " + prefix + "/" + plen);
32 fibDSWriter.removeFibEntryFromDS(rd, prefix + "/" + plen);
36 public void onStartConfigResyncNotification() {
37 LOGGER.info("BGP (re)started");
38 bgpManager.reInitConn();