blob: efc6f4ad72f545caba0699baceeb4deae2dab90c [file] [log] [blame]
/**
* Copyright (C) 2014 Regents of the University of Memphis.
* See COPYING for copyright and distribution information.
*/
#include "lsdb.hpp"
#include "nlsr.hpp"
#include "lsa.hpp"
#include "name-prefix-list.hpp"
#include <boost/test/unit_test.hpp>
namespace nlsr {
namespace test {
BOOST_AUTO_TEST_SUITE(TestLsdb)
BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists)
{
Nlsr nlsr1;
NamePrefixList npl1;
string s1 = "name1";
string s2 = "name2";
string router1 = "router1/1";
npl1.insert(s1);
npl1.insert(s2);
//For NameLsa lsType is 1.
//12 is seqNo, randomly generated.
//1800 is the default life time.
NameLsa nlsa1("router1", 1, 12, 1800, npl1);
Lsdb lsdb1;
lsdb1.installNameLsa(nlsr1, nlsa1);
BOOST_CHECK(lsdb1.doesLsaExist("router1/1", 1));
lsdb1.removeNameLsa(nlsr1, router1);
BOOST_CHECK_EQUAL(lsdb1.doesLsaExist("router1/1", 1), false);
}
BOOST_AUTO_TEST_SUITE_END()
} //namespace test
} //namespace nlsr