2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.bgpmanager.thrift.server.implementation;
11 import org.opendaylight.bgpmanager.BgpManager;
12 import org.opendaylight.bgpmanager.FibDSWriter;
13 import org.opendaylight.bgpmanager.thrift.gen.BgpUpdater;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 class BgpUpdateHandler implements BgpUpdater.Iface {
19 private static final Logger LOGGER = LoggerFactory.getLogger(BgpUpdateHandler.class);
20 private BgpManager bgpManager;
21 private FibDSWriter fibDSWriter;
23 public BgpUpdateHandler(BgpManager bgpMgr, FibDSWriter dsWriter) {
25 fibDSWriter = dsWriter;
28 public void onUpdatePushRoute(String rd, String prefix, int plen,
29 String nexthop, int label) {
31 LOGGER.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nexthop, label);
32 //Write to FIB in Data Store
33 fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nexthop, label);
37 public void onUpdateWithdrawRoute(String rd, String prefix, int plen) {
38 LOGGER.debug("Route del ** {} ** {}/{} ", rd, prefix, plen);
39 fibDSWriter.removeFibEntryFromDS(rd, prefix + "/" + plen);
43 public void onStartConfigResyncNotification() {
44 LOGGER.debug("BGP (re)started");
45 bgpManager.reInitConn();