Skip to content

Commit

Permalink
Merge "static route introspect crash" into R2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 18, 2015
2 parents 6bfed93 + eaf4003 commit b4e01e8
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bgp/routing-instance/static_route.cc
Expand Up @@ -203,7 +203,7 @@ StaticRoute::StaticRoute(RoutingInstance *rtinst,
const Ip4Prefix &static_route, const vector<string> &rtargets,
IpAddress nexthop)
: routing_instance_(rtinst), static_route_prefix_(static_route),
nexthop_(nexthop), unregistered_(false) {
nexthop_(nexthop), nexthop_route_(NULL), unregistered_(false) {
for (vector<string>::const_iterator it = rtargets.begin();
it != rtargets.end(); it++) {
error_code ec;
Expand Down
74 changes: 74 additions & 0 deletions src/bgp/test/static_route_test.cc
Expand Up @@ -1338,6 +1338,80 @@ TEST_F(StaticRouteTest, EntryAfterStop) {
"Wait for Static route in blue..");
}

// Sandesh introspect test
// Verify http introspect output
// 1. After creating the config and before nexthop route is published
// 2. After creating the config and after nexthop route is published
// 3. After updating the config(nexthop) and before new nexthop route is published
// 4. After updating the config(nexthop) and after new nexthop route is published
TEST_F(StaticRouteTest, SandeshTest) {
vector<string> instance_names = list_of("blue")("nat")("red")("green");
multimap<string, string> connections;
NetworkConfig(instance_names, connections);
task_util::WaitForIdle();

std::auto_ptr<autogen::StaticRouteEntriesType> params =
GetStaticRouteConfig("controller/src/bgp/testdata/static_route_1.xml");

ifmap_test_util::IFMapMsgPropertyAdd(&config_db_, "routing-instance",
"nat", "static-route-entries", params.release(), 0);
task_util::WaitForIdle();

// Check for Static route
TASK_UTIL_WAIT_EQ_NO_MSG(InetRouteLookup("blue", "192.168.1.0/24"),
NULL, 1000, 10000,
"Wait for Static route in blue..");

VerifyStaticRouteSandesh("nat");

// Add Nexthop Route
AddInetRoute(NULL, "nat", "192.168.1.254/32", 100, "2.3.4.5");
task_util::WaitForIdle();

// Check for Static route
TASK_UTIL_WAIT_NE_NO_MSG(InetRouteLookup("nat", "192.168.1.0/24"),
NULL, 1000, 10000,
"Wait for Static route in nat instance..");

// Check for Static route
TASK_UTIL_WAIT_NE_NO_MSG(InetRouteLookup("blue", "192.168.1.0/24"),
NULL, 1000, 10000,
"Wait for Static route in blue..");

VerifyStaticRouteSandesh("nat");
// Delete nexthop route
DeleteInetRoute(NULL, "nat", "192.168.1.254/32");
task_util::WaitForIdle();


params = GetStaticRouteConfig("controller/src/bgp/testdata/static_route_4.xml");

ifmap_test_util::IFMapMsgPropertyAdd(&config_db_, "routing-instance",
"nat", "static-route-entries", params.release(), 0);
task_util::WaitForIdle();

// Check for Static route
TASK_UTIL_WAIT_EQ_NO_MSG(InetRouteLookup("blue", "192.168.1.0/24"),
NULL, 1000, 10000,
"Wait for Static route in blue..");

VerifyStaticRouteSandesh("nat");

// Add Nexthop Route
AddInetRoute(NULL, "nat", "192.168.1.1/32", 100, "5.4.3.2");
task_util::WaitForIdle();

// Check for Static route
TASK_UTIL_WAIT_NE_NO_MSG(InetRouteLookup("blue", "192.168.1.0/24"),
NULL, 1000, 10000,
"Wait for Static route in blue..");

VerifyStaticRouteSandesh("nat");
// Delete nexthop route
DeleteInetRoute(NULL, "nat", "192.168.1.1/32");
task_util::WaitForIdle();
}

class TestEnvironment : public ::testing::Environment {
virtual ~TestEnvironment() { }
};
Expand Down

0 comments on commit b4e01e8

Please sign in to comment.