Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.6.0.3
|
This document provides a brief description of the BGP OpEN APIs. The BGP OpEN APIs allow processes outside of the ICOS main process (switchdrvr) access to BGP and its routing management services.
In addition to providing the ability to create and delete a BGP entry with its local Autonomous System Number (ASN), the global OpEN_API's available are;
In addition to providing the ability to create and delete internal or external BGP peers with its associated ASN, the following OpEN API's for managing BGP peers are available;
All 'Set' operations would affect the Switch behavior and configuration.
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
bgp_example.c is a sample application that demonstrates the use of the BGP OpEN API. bgp_example is started from the command line. The example first establishes a BGP entry with an ASN of 1 using an IPv4 address (1.1.1.1) as its identifier. The example continues to test the ability to set and get the available global attributes. The following is a list and sequence of these tests;
The second part of the bgp_example creates two (2) local peers, the first is a IPv4 peer (2.2.2.2) and the second, a IPv6 peer (2222::). The bgp_example continues to exercise the remaining BGP OpEN APIs one by one for each peer with appropriate arguments to demonstrate its capabilities using the ICOS main process (switchdrvr). The following is a list and sequence of these peer tests;
And lastly, this sample application retrieves the first available routing interface and demonstrates the following OpEN_API tests.
Please note that a display containing Feature not supported is shown in the output if appropriate.
# ./bgp_example
Begin Sanity tests...
Establish BGP and global parameters...
Sanity Success - testLocalAS
Sanity Success - testLocalId
Sanity Success - testLocalPref
Sanity Success - testDistance
Sanity Success - testDistance
Sanity Success - testDistance
Sanity Success - testGlobalHoldTime
Sanity Success - testGlobalKeepAlive
Sanity Success - testLogNeighbor
Sanity Success - testMaxPaths
Sanity Success - testMaxPaths
Sanity Success - testNetwork
Sanity Success - testRedistribution
Create a ipv4 test peer...
Sanity Success - testPeerRemoteAS
Sanity Success - testPeerAdminStatus
Sanity Success - testPeerKeepAlive
Sanity Success - testPeerHoldTime
Sanity Success - testPeerActivate
Sanity Success - testPeerAdvertisement
Sanity Success - testPeerNextHopSelf
Sanity Success - testPeerPfxLimit
Create a ipv6 test peer...
Sanity Success - testPeerRemoteAS
Sanity Success - testPeerAdminStatus
Sanity Success - testPeerKeepAlive
Sanity Success - testPeerHoldTime
Sanity Success - testPeerActivate
Sanity Success - testPeerAdvertisement
Sanity Success - testPeerNextHopSelf
Sanity Success - testPeerPfxLimit
Sanity Success - testPeerRemoteAS
Sanity Success - testPeerUpdateSource
Complete.
In addition to bgp_example.c, a python implementation has also been provided for demonstration purposes. This python bgp_example.py script essentially duplicates the bgp_example.c implementation.
In addition to bgp_example.c, a ruby implementation has also been provided for demonstration purposes. This ruby bgp_example.rb application essentially duplicates the bgp_example.c implementation.
The below ruby implementations have also been provided to monitor BGP status and statistics for demonstration purposes.
bgp_flapCount.rb is a sample application that demonstrates the use of the BGP OpEN API to view the flap count of a neighbor.
# ./bgp_flapCount.rb –ipv4
ICOS Version 3.9.23.21
OpEN version = 1.0.0.0
Remote Address ........................ 1.1.1.1
Remote AS ............................. 100
Flap Count ............................ 1
Remote Address ........................ 2.2.2.2
Remote AS ............................. 100
Flap Count ............................ 0
bgp_flapCountClearOnRead.rb is a sample application that demonstrates the use of the BGP OpEN API to clear the flap count of a neighbor.
# ./bgp_flapCountClearOnRead.rb –ipv4
ICOS Version 3.9.23.21
OpEN version = 1.0.0.0
Remote Address ........................ 1.1.1.1
Remote AS ............................. 100
Flap Count ............................ 1
Remote Address ........................ 2.2.2.2
Remote AS ............................. 100
Flap Count ............................ 0
bgp_neighbors.rb is a sample application that demonstrates the use of the BGP OpEN API to display neighbors.
# ./bgp_neighbors.rb –ipv4
ICOS Version 3.9.23.21
OpEN version = 1.0.0.0
Remote Address .................................... 1.1.1.1
Remote AS ......................................... 100
Peer ID ........................................... 1.1.1.1
Peer Admin Status ................................. START
Peer State ........................................ ACTIVE
Local Interface Address ........................... 1.1.1.2
Local Port ........................................ 53145
Remote Port ....................................... 179
Connection Retry Interval ......................... 2 sec
Neighbor Capabilities ............................. MP RF
IPv4 Unicast Support .............................. Both
IPv6 Unicast Support .............................. None
Template Name ..................................... None
Update Source ..................................... None
Configured Hold Time .............................. None
Configured Keep Alive Time ........................ None
MD5 Password ...................................... None
Last Error ........................................ Cease (Received)
Last SubError ..................................... None
Time Since Last Error ............................. 0 days 00 hrs 08 mins 51 secs
Established Transitions ........................... 1
Flap Count ........................................ 1
Established Time .................................. 0 days 00 hrs 08 mins 51 secs
Time Since Last Update ............................ 0 days 06 hrs 01 mins 54 secs
IPv4 Outbound Update Group ........................ None
IPv6 Outbound Update Group ........................ None<br>
Open Update Keepalive Notification Refresh Total<br>
Msgs Sent 1 2 816 1 0 820
Msgs Rcvd 1 2 819 0 0 822
Received UPDATE Queue Size: 0 bytes. High: 34 Limit: 392192 Drops: 0
IPv4 Prefix Statistics:
Inbound Outbound
Prefixes Advertised 3 6
Prefixes Withdrawn 0 0
Prefixes Current 0 0
Prefixes Accepted 0 N/A
Prefixes Rejected 0 N/A
Max NLRI per Update 3 3
Min NLRI per Update 0 3
bgp_statistics.rb is a sample application that demonstrates the use of the BGP OpEN API to display BGP process statistics.
# ./bgp_statistics.rb –ipv4<br>
ICOS Version 3.9.23.21
OpEN version = 1.0.0.0
Delta T Phase Upd Grp GenId Reason Peer Duration Adds Mods Dels
06:06:03 3 0 0 New update grp 0 0 0 0
06:06:02 1 0 Adj-RIB-In+ 1 6 0 0
06:06:02 2 1 Phase 1 done 1 3 0 0
06:06:02 3 0 1 Phase 2 done 0 3 0 0
06:05:58 2 2 Local route add 0 1 2 0
06:05:31 3 0 2 Phase 2 done 0 1 2 0
00:12:28 2 3 Accept-RIB-In- 0 0 1 0
00:12:28 3 0 3 Phase 2 done 0 0 1 0
00:12:27 2 4 Local route del 0 0 0 1
00:11:58 3 0 4 Phase 2 done 0 0 0 1
bgp_summary.rb is a sample application that demonstrates the use of the BGP OpEN API to display BGP summary.
# ./bgp_summary.rb –ipv4<br>
ICOS Version 3.9.23.21
OpEN version = 1.0.0.0
IPv4 Routing .................................. Enabled
BGP Admin Mode ................................ Enabled
BGP Router ID ................................. 1.1.1.2
Local AS Number ............................... 200
Number of Network Entries ..................... 3
Number of AS Paths ............................ 1
Neighbor ASN MsgRcvd MsgSent State Up/Down Time Pfx Rcvd
-------------— --— -----— -----— ----------— -----------— ------—
1.1.1.1 100 822 820 ACTIVE 0:00:14:36 0
2.2.2.2 100 857 852 ESTABLISHED 0:06:08:11 2