Skip to content

Commit

Permalink
add set_tag and set_route_name methods
Browse files Browse the repository at this point in the history
  • Loading branch information
grybak-arista committed Oct 16, 2015
1 parent 6e5c24d commit bd914a1
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions pyeapi/api/staticroute.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def create(self, ip_dest, next_hop, next_hop_ip=None,
True if the operation succeeds, otherwise False.
"""

# Call _set_route with the delete flag set to True
# Call _set_route with delete and default set to False
return self._set_route(ip_dest, next_hop, next_hop_ip=next_hop_ip,
distance=distance, tag=tag,
route_name=route_name)
Expand Down Expand Up @@ -217,11 +217,67 @@ def default(self, ip_dest, next_hop, next_hop_ip=None,
True if the operation succeeds, otherwise False.
"""

# Call _set_route with the delete flag set to True
# Call _set_route with the default flag set to True
return self._set_route(ip_dest, next_hop, next_hop_ip=next_hop_ip,
distance=distance, tag=tag,
route_name=route_name, default=True)

def set_tag(self, ip_dest, next_hop, next_hop_ip=None,
distance=None, tag=None, route_name=None):
"""Set the tag value for the specified route
Args:
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Notes:
Any existing route_name value must be included in call to
set_tag, otherwise the tag will be reset
by the call to EOS.
"""

# Call _set_route with the delete flag set to True
return self._set_route(ip_dest, next_hop, next_hop_ip=next_hop_ip,
distance=distance, tag=tag,
route_name=route_name)

def set_route_name(self, ip_dest, next_hop, next_hop_ip=None,
distance=None, tag=None, route_name=None):
"""Set the route_name value for the specified route
Args:
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Notes:
Any existing tag value must be included in call to
set_route_name, otherwise the tag will be reset
by the call to EOS.
"""

# Call _set_route with the delete flag set to True
return self._set_route(ip_dest, next_hop, next_hop_ip=next_hop_ip,
distance=distance, tag=tag,
route_name=route_name)

def _build_commands(self, ip_dest, next_hop, next_hop_ip=None,
distance=None, tag=None, route_name=None):
"""Build the EOS command string for ip route interactions.
Expand Down

0 comments on commit bd914a1

Please sign in to comment.