# Staticroute

Module for working with EOS static routes

The staticroute resource provides configuration management of static route resources on an EOS node. It provides the following class implementations:

> - StaticRoute - Configure static routes in EOS

StaticRoute Attributes:
  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 (int): Administrative distance for this route tag (int): Route tag route_name (string): Route name

Notes

The ‘default’ prefix function of the ‘ip route’ command, ‘default ip route …’, currently equivalent to the ‘no ip route …’ command.

class `pyeapi.api.staticroute.``StaticRoute`(node)

  Bases: `pyeapi.api.abstract.EntityCollection`

  The StaticRoute class provides a configuration instance for working with static routes

  `create`(ip_dest, next_hop, **kwargs)

    Create a static route

    Parameters:

    - 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
    - **kwargs['next_hop_ip'] (string) – The next hop address on destination interface
    - **kwargs['distance'] (string) – Administrative distance for this route
    - **kwargs['tag'] (string) – Route tag
    - **kwargs['route_name'] (string) – Route name

    Returns: | True if the operation succeeds, otherwise False.

  `default`(ip_dest, next_hop, **kwargs)

    Set a static route to default (i.e. delete the matching route)

    Parameters:

    - 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
    - **kwargs['next_hop_ip'] (string) – The next hop address on destination interface
    - **kwargs['distance'] (string) – Administrative distance for this route
    - **kwargs['tag'] (string) – Route tag
    - **kwargs['route_name'] (string) – Route name

    Returns: | True if the operation succeeds, otherwise False.

  `delete`(ip_dest, next_hop, **kwargs)

    Delete a static route

    Parameters:

    - 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
    - **kwargs['next_hop_ip'] (string) – The next hop address on destination interface
    - **kwargs['distance'] (string) – Administrative distance for this route
    - **kwargs['tag'] (string) – Route tag
    - **kwargs['route_name'] (string) – Route name

    Returns: | True if the operation succeeds, otherwise False.

  `get`(name)

    Retrieves the ip route information for the destination ip address specified.

    Parameters: | name (string) – The ip address of the destination in the form of A.B.C.D/E

    Returns:

    An dict object of static route entries in the form:

        { ip_dest:
            { next_hop:
                { next_hop_ip:
                    { distance:
                        { 'tag': tag,
                          'route_name': route_name
                        }
                    }
                }
            }
        }

    If the ip address specified does not have any associated static routes, then None is returned.

    Return type: | dict

    Notes

    The keys ip_dest, next_hop, next_hop_ip, and distance in the returned dictionary are the values of those components of the ip route specification. If a route does not contain a next_hop_ip, then that key value will be set as ‘None’.

  `getall`()

    Return all ip routes configured on the switch as a resource dict

    Returns:

    An dict object of static route entries in the form:

        { ip_dest:
            { next_hop:
                { next_hop_ip:
                    { distance:
                        { 'tag': tag,
                          'route_name': route_name
                        }
                    }
                }
            }
        }

    If the ip address specified does not have any associated static routes, then None is returned.

    Return type: | dict

    Notes

    The keys ip_dest, next_hop, next_hop_ip, and distance in the returned dictionary are the values of those components of the ip route specification. If a route does not contain a next_hop_ip, then that key value will be set as ‘None’.

  `set_route_name`(ip_dest, next_hop, **kwargs)

    Set the route_name value for the specified route

    Parameters:

    - 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
    - **kwargs['next_hop_ip'] (string) – The next hop address on destination interface
    - **kwargs['distance'] (string) – Administrative distance for this route
    - **kwargs['tag'] (string) – Route tag
    - **kwargs['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.
  `set_tag`(ip_dest, next_hop, **kwargs)

    Set the tag value for the specified route

    Parameters:

    - 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
    - **kwargs['next_hop_ip'] (string) – The next hop address on destination interface
    - **kwargs['distance'] (string) – Administrative distance for this route
    - **kwargs['tag'] (string) – Route tag
    - **kwargs['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.

`pyeapi.api.staticroute.``instance`(node)

  Returns an instance of StaticRoute

  This method will create and return an instance of the StaticRoute object passing the value of API to the object. The instance method is required for the resource to be autoloaded by the Node object

  Parameters: | node (Node) – The node argument passes an instance of Node to the resource