Skip to content

Commit

Permalink
@9755714 Add breath tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimu Yang authored and aparna-arista committed Jan 16, 2019
1 parent 28f5253 commit a80c01d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
19 changes: 19 additions & 0 deletions eos/ip_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,19 @@ class EOS_SDK_PUBLIC ip_route_mgr {
* is set, only return vias on routes that match the current tag.
*/
virtual ip_route_via_iter_t ip_route_via_iter(ip_route_key_t const &) const = 0;
virtual ip_route_via_iter_t ip_route_via_iter(ip_route_key_t const &,
std::string vrfName) const = 0;

/**
* Tests for existence of any routes matching the route key in the config.
* If a tag is set and the route belongs to a different tag, this
* function returns false.
*/
virtual bool exists(ip_route_key_t const &) const = 0;
virtual bool exists(ip_route_key_t const &, std::string vrfName) const = 0;
/// Tests if the given via exists.
virtual bool exists(ip_route_via_t const &) const = 0;
virtual bool exists(ip_route_via_t const &, std::string vrfName) const = 0;

// Route management functions

Expand All @@ -102,6 +106,7 @@ class EOS_SDK_PUBLIC ip_route_mgr {
* an empty ip_route_t() if no matching route is found.
*/
virtual ip_route_t ip_route(ip_route_key_t const &) = 0;
virtual ip_route_t ip_route(ip_route_key_t const &, std::string vrfName) = 0;
/**
* Inserts or updates a static route into the switch configuration.
*/
Expand All @@ -117,6 +122,18 @@ class EOS_SDK_PUBLIC ip_route_mgr {
*/
virtual void ip_route_set(ip_route_t const &,
ip_route_action_t expected_type) = 0;
/**
* Inserts or updates a static route for a given vrf into the
* switch configuration.
*/
virtual void ip_route_set(ip_route_t const &,
std::string vrfName) = 0;
/**
* Delete an existing static route for a given vrf from the
* switch configuration.
*/
virtual void ip_route_del(ip_route_key_t const &,
std::string vrfName) = 0;
/// Removes all ECMP vias matching the route key, and the route itself.
virtual void ip_route_del(ip_route_key_t const &) = 0;

Expand All @@ -138,12 +155,14 @@ class EOS_SDK_PUBLIC ip_route_mgr {
* address, interface or nexthop group set.
*/
virtual void ip_route_via_set(ip_route_via_t const &) = 0;
virtual void ip_route_via_set(ip_route_via_t const &, std::string vrfName) = 0;
/**
* Removes a via from an ip_route_t.
* When all vias are removed, the route still exists with no
* nexthop information.
*/
virtual void ip_route_via_del(ip_route_via_t const &) = 0;
virtual void ip_route_via_del(ip_route_via_t const &, std::string vrfName) = 0;

protected:
ip_route_mgr() EOS_SDK_PRIVATE;
Expand Down
41 changes: 41 additions & 0 deletions ip_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ class ip_route_mgr_impl : public ip_route_mgr {
return *nop; // TODO: No op impl.
}

ip_route_via_iter_t ip_route_via_iter(ip_route_key_t const &,
std::string vrfName) const {
ip_route_via_iter_t * nop = 0;
return *nop; // TODO: No op impl.
}

bool exists(ip_route_key_t const &, std::string vrfName) const {
return false; // TODO: No op impl.
}

bool exists(const ip_route_key_t & route_key) const {
return false; // TODO: No op impl.
}
Expand All @@ -45,10 +55,20 @@ class ip_route_mgr_impl : public ip_route_mgr {
return false; // TODO: No op impl.
}

bool exists(const ip_route_via_t & route_via,
std::string vrfName) const {
return false; // TODO: No op impl.
}

ip_route_t ip_route(ip_route_key_t const & route_key) {
// TODO: No op impl.
return ip_route_t();
}
virtual ip_route_t ip_route(ip_route_key_t const &,
std::string vrfName) {
// TODO: No op impl.
return ip_route_t();
}

void ip_route_set(const ip_route_t & route) {
// TODO: No op impl.
Expand All @@ -59,6 +79,16 @@ class ip_route_mgr_impl : public ip_route_mgr {
// TODO: No op impl.
}

void ip_route_set(ip_route_t const &,
std::string vrfName) {
// TODO: No op impl.
}

void ip_route_del(ip_route_key_t const &,
std::string vrfName) {
// TODO: No op impl.
}

void ip_route_del(const ip_route_key_t & route_key) {
// TODO: No op impl.
}
Expand All @@ -70,6 +100,17 @@ class ip_route_mgr_impl : public ip_route_mgr {
void ip_route_via_del(const ip_route_via_t & route_via) {
// TODO: No op impl.
}

void ip_route_via_set(const ip_route_via_t & route_via,
std::string vrfName) {
// TODO: No op impl.
}

void ip_route_via_del(const ip_route_via_t & route_via,
std::string vrfName) {
// TODO: No op impl.
}

};

DEFINE_STUB_MGR_CTOR(ip_route_mgr)
Expand Down

0 comments on commit a80c01d

Please sign in to comment.