Routes Class
class Routes(object)
Example:
>>> from cisco.routes import *
>>> rt = Routes()
add_route
add_route(self, srcIp="", prefix="", mask="", intf="", nexthop="",nhMask="", nhPrefix="", tag="", routePref="", vrf="default")
Examples:
>>> rt.add_route(srcIp="1.1.1.0", prefix="24", intf="eth3", nexthop="1.0.0.1"), vrf="default")
>>> rt.add_route(srcIp="1.1.2.0", mask="255.255.255.0", intf="eth4", nexthop="1.0.0.1"), vrf="default")
Arguments:
- srcIp: Source IP address.
- prefix: IP route prefix for the destination.
- mask: Prefix mask for the destination.
- intf: Network interface type and interface number.
- nexthop: IP address of the next hop that can be used to reach the destination network.
- nhMask: IP address mask of the next hop.
- nhPrefix: IP route prefix for the next hop.
- tag: Tag value that can be used as a match value for controlling redistribution via route maps.
- routePref: Route preference.
- vrf: Name of the VRF.
delete_route
delete_route(self, srcIp="", prefix="", mask="", intf="", nexthop="",nhMask="", nhPrefix="", tag="", routePref="",vrf="default")
Examples:
>>> rt.delete_route(srcIp="1.1.1.0", prefix="24", intf="eth3", nexthop="1.0.0.1"), vrf="default")
>>> rt.delete_route(srcIp="1.1.2.0", mask="255.255.255.0", intf="eth4", nexthop="1.0.0.1"), vrf="default")
- srcIp: Source IP address.
- prefix: IP route prefix for the destination.
- mask: Prefix mask for the destination.
- intf: Network interface type and interface number.
- nexthop: IP address of the next hop that can be used to reach the destination network.
- nhMask: IP address mask of the next hop.
- nhPrefix: IP route prefix for the next hop.
- tag: Tag value that can be used as a match value for controlling redistribution via route maps.
- routePref: Route preference.
- vrf: Name of the VRF.
show_arp_table
Returns the ARP table entries on the switch.
show_arp_table(self)
Example:
>>> rt.show_arp_table()
'\nFlags: * - Adjacencies learnt on non-active FHRP router\n + - Adjacencies synced via CFSoE\n # - Adjacencies Throttled for Glean\n D - Static Adjacencies attached to down interface\n\nIP ARP Table for context default\nTotal number of entries: 0\nAddress Age MAC Address Interface\n'
Arguments: None
Returns: ARP table
show_hw_routes
Computes the hardware routes and returns the output.
show_hw_routes(self)
Example:
>>> rt.show_hw_routes()
------------------+------------------+---------------------
Prefix | Next-hop | Interface
------------------+------------------+---------------------
0.0.0.0/0 0 0
0.0.0.0/0 0 0
0.0.0.0/0 0 0
0.0.0.0/0 0 0
4
Arguments: None
Returns: Hardware route entries.
show_vsh_routes
Returns the software route entries.
show_vsh_routes(self)
Example:
>>> rt.show_vsh_routes()
'\nslot 1\n=======\n\n\n\nslot 1\n=======\n...
Arguments: None
Returns: Software route entries.
verify_arp_table
Verifies the software and hardware ARP table entries.
verify_arp_table(self)
Example:
>>> rt.verify_arp_table()
Flags: * - Adjacencies learnt on non-active FHRP router
+ - Adjacencies synced via CFSoE
# - Adjacencies Throttled for Glean
D - Static Adjacencies attached to down interface
IP ARP Table for context default
Total number of entries: 0
Address Age MAC Address Interface
Arguments: None
Returns: The number of ARP table entries matched and unmatched between hardware and software, and detail table.
verify_route
verify_route(self,route="")
Example:
>>> rt.verify_route()
slot 1
=======
...
Arguments:
- route:
verify_routes
Verifies the software and hardware routes.
verify_routes(self)
Example:
>>> rt.verify_routes()
slot 1
=======
...
Arguments: None
Returns: The number of routes matched and unmatched between hardware and software.