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 onUpdatePushRoute("5", "10.1.1.2", 32, "1.2.3.4", 200);
21 onUpdatePushRoute("5", "10.1.1.3", 32, "1.2.3.5", 400);
22 onUpdatePushRoute("10", "10.10.0.10", 32, "5.4.3.2", 600);
23 onUpdateWithdrawRoute("5", "10.1.1.3", 32);
28 public void onUpdatePushRoute(String rd, String prefix, int plen,
29 String nexthop, int label) {
31 logger.info("Route add ** " + rd + " ** " + prefix + "/" + plen
32 + " ** " + nexthop + " ** " + label);
33 //Write to FIB in Data Store
34 fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nexthop, label);
38 public void onUpdateWithdrawRoute(String rd, String prefix, int plen) {
39 logger.info("Route del ** " + rd + " ** " + prefix + "/" + plen);
40 fibDSWriter.removeFibEntryFromDS(rd, prefix + "/" + plen);
44 public void onStartConfigResyncNotification() {
45 logger.info("BGP (re)started");
46 bgpManager.reInitConn();