blob: 7511fdb5417af624b9b26494dc1af4af16f6f39d [file] [log] [blame]
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -05001/**
2 * Copyright (C) 2014 Regents of the University of Memphis.
3 * See COPYING for copyright and distribution information.
4 */
5
6#include "lsdb.hpp"
7#include "nlsr.hpp"
8#include "lsa.hpp"
9#include "name-prefix-list.hpp"
10#include <boost/test/unit_test.hpp>
11
12namespace nlsr {
13
14namespace test {
15
16BOOST_AUTO_TEST_SUITE(TestLsdb)
17
18BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists)
19{
20 Nlsr nlsr1;
21
22 NamePrefixList npl1;
23
akmhoquefdbddb12014-05-02 18:35:19 -050024 std::string s1 = "name1";
25 std::string s2 = "name2";
26 std::string router1 = "router1/1";
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050027
28 npl1.insert(s1);
29 npl1.insert(s2);
30
31//For NameLsa lsType is 1.
32//12 is seqNo, randomly generated.
33//1800 is the default life time.
34 NameLsa nlsa1("router1", 1, 12, 1800, npl1);
35
36 Lsdb lsdb1;
37
38 lsdb1.installNameLsa(nlsr1, nlsa1);
39
40 BOOST_CHECK(lsdb1.doesLsaExist("router1/1", 1));
41
42 lsdb1.removeNameLsa(nlsr1, router1);
43
44 BOOST_CHECK_EQUAL(lsdb1.doesLsaExist("router1/1", 1), false);
45}
46
47BOOST_AUTO_TEST_SUITE_END()
48
49} //namespace test
50} //namespace nlsr