Skip to content

Commit

Permalink
Merge "Minor tweak to test::NextHop constructor"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 21, 2017
2 parents a13926e + 14ff4b9 commit eaefadb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/bgp/test/graceful_restart_test.cc
Expand Up @@ -896,7 +896,7 @@ test::NextHops GracefulRestartTest::GetNextHops (test::NetworkAgentMock *agent,
test::NextHops nexthops;
nexthops.push_back(test::NextHop("100.100.100." +
boost::lexical_cast<string>(agent->id()),
10000 + instance_id));
10000 + instance_id, "gre"));
return nexthops;
}

Expand Down
14 changes: 7 additions & 7 deletions src/control-node/test/network_agent_mock.cc
Expand Up @@ -1023,7 +1023,7 @@ void NetworkAgentMock::AddRoute(const string &network_name,
int local_pref, int med) {
NextHops nexthops;
if (!nexthop.empty()) {
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));
}
RouteAttributes attributes(
local_pref, med, RouteAttributes::GetDefaultSequence());
Expand Down Expand Up @@ -1066,7 +1066,7 @@ void NetworkAgentMock::AddRoute(const string &network_name,
const RouteAttributes &attributes) {
NextHops nexthops;
if (!nexthop.empty())
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));
AddRoute(network_name, prefix, nexthops, attributes);
}

Expand Down Expand Up @@ -1094,7 +1094,7 @@ void NetworkAgentMock::AddInet6Route(const string &network,
const RouteAttributes &attributes) {
NextHops nexthops;
if (!nexthop.empty())
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));
AddInet6Route(network, prefix, nexthops, attributes);
}

Expand All @@ -1113,7 +1113,7 @@ void NetworkAgentMock::AddInet6Route(const string &network,
int med) {
NextHops nexthops;
if (!nexthop_str.empty()) {
nexthops.push_back(NextHop(nexthop_str, 0));
nexthops.push_back(NextHop(nexthop_str));
}
RouteAttributes attributes(
local_pref, med, RouteAttributes::GetDefaultSequence());
Expand All @@ -1140,7 +1140,7 @@ void NetworkAgentMock::DeleteInet6Route(const string &network,
void NetworkAgentMock::AddBogusInet6Route(const string &network,
const string &prefix, const string &nexthop, TestErrorType error_type) {
NextHops nexthops;
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));

AgentPeer *peer = GetAgent();
xml_document *xdoc = impl_->Inet6RouteAddBogusXmlDoc(network, prefix,
Expand All @@ -1154,7 +1154,7 @@ void NetworkAgentMock::AddEnetRoute(const string &network_name,
NextHops nexthops;

if (!nexthop.empty()) {
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));
}
AddEnetRoute(network_name, prefix, nexthops, params);
}
Expand Down Expand Up @@ -1186,7 +1186,7 @@ void NetworkAgentMock::AddEnetRoute(const string &network_name,
NextHops nexthops;

if (!nexthop.empty())
nexthops.push_back(NextHop(nexthop, 0));
nexthops.push_back(NextHop(nexthop));
AddEnetRoute(network_name, prefix, nexthops, attributes);
}

Expand Down
10 changes: 6 additions & 4 deletions src/control-node/test/network_agent_mock.h
Expand Up @@ -191,18 +191,20 @@ struct NextHop {
NextHop(bool no_label, std::string address) :
address_(address), no_label_(no_label), label_(0) {
}
NextHop(std::string address, uint32_t label, std::string tun1 = "gre",
NextHop(std::string address, uint32_t label, std::string tunnel,
const std::string virtual_network = "") :
address_(address), no_label_(false), label_(label),
virtual_network_(virtual_network) {
if (tun1 == "all") {
if (tunnel.empty()) {
tunnel_encapsulations_.push_back("gre");
} else if (tunnel == "all") {
tunnel_encapsulations_.push_back("gre");
tunnel_encapsulations_.push_back("udp");
} else if (tun1 == "all_ipv6") {
} else if (tunnel == "all_ipv6") {
tunnel_encapsulations_.push_back("gre");
tunnel_encapsulations_.push_back("udp");
} else {
tunnel_encapsulations_.push_back(tun1);
tunnel_encapsulations_.push_back(tunnel);
}
}

Expand Down

0 comments on commit eaefadb

Please sign in to comment.