Creating a BGP Interface Neighbor

This article describes how to create a (non-VRF) BGP interface neighbor. The figure below illustrates the BGP Neighbor relationship scenario followed in this article.

The first part of this article explains how to configure a BGP Interface Neighbor using the FlexSwitch CLI and the second part explains the process using the REST interface with examples in cURL.

BGP Neighbor Diagram

Using the CLI to Create a BGP Neighbor

The following steps explain how to create a BGP Neighbor using the FlexSwitch CLI. See Accessing the Command Line Reference for more information about logging into the CLI facility.

This is a four step process:

  • Assign an IP Address to an existing interface.
  • Create a BGPGlobal object.
  • Create a BGPNeighbor object.
  • Set the peer AS number.

These steps are performed on both switches in the pair.

Assign an Network Address to a Port

Assign the network address 10.1.10.1/30 to eth 25. Enter the following commands at the config prompt.

localhost(config)#interface fpPort 1
localhost(config-if-eth-1)#

This brings you into the fpPort1 object so you can configure its IP address.

Use the ip address command at the config-if-eth-1 prompt

localhost(config-if-eth-1)#ip address 10.1.0.1/30
localhost(config-if-eth-1-ip-10.1.0.1/30)#

Verify your configuration with the showunapplied command.

localhost(config-if-eth-1-ip-10.1.0.1/30)#showunapplied 
Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.


id: 14  object: IPv4Intf   status: PENDING CONFIG  valid: True delete: False num user cmds: 2
 command                   attr       value          model attr    iskey    required    userprov    time provisioned         
-----------------------------------------------------------------------------------------------------------------------------
 interface fpPort 1        fpPort     1              IntfRef       True     X           X           Wed Aug 16 08:59:00 2017 
 ip address 10.1.0.1/30    address    10.1.0.1/30    IpAddr        True     X           X           Wed Aug 16 08:59:00 2017 

Apply the configuration.

localhost(config-if-eth-1-ip-10.1.0.1/30)#apply
Applying Config:

id: 14  object: IPv4Intf   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command                   attr       value          model attr    iskey    required    userprov    time provisioned         
-----------------------------------------------------------------------------------------------------------------------------
 interface fpPort 1        fpPort     1              IntfRef       True     X           X           Wed Aug 16 08:59:00 2017 
 ip address 10.1.0.1/30    address    10.1.0.1/30    IpAddr        True     X           X           Wed Aug 16 08:59:00 2017 

sdk:createIPv4Intf(fpPort1,10.1.0.1/30,AdminState=UP) result: SUCCESS: http status code: 201

Create a BGPGlobal Object

Enter the following command at the config prompt, then verify that the object was successfully created.

localhost(config)#router bgp 500
localhost(config-router-bgp-500)#

Verify the creation using the showunapplied command.

localhost(config-router-bgp-500)#showunapplied 
Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.

id: 26  object: BGPGlobal   status: PENDING CONFIG  valid: True delete: False num user cmds: 1
 command           attr    value    model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------
 router bgp 500    bgp     500      ASNum         True     X           X           Wed Aug 16 08:59:50 2017 

Apply the configuration using the apply command.

localhost(config-router-bgp-500)#apply
Applying Config:
id: 26  object: BGPGlobal   status: APPLIED CONFIG  valid: True delete: False num user cmds: 1
 command           attr    value    model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------
 router bgp 500    bgp     500      ASNum         True     X           X           Wed Aug 16 08:59:50 2017 

sdk:updateBGPGlobal(default,DefaultMED=0,Defaultv4Route=False,UseMultiplePaths=False,Defaultv6Route=False,ASNum=500,Disabled=False,EBGPMaxPaths=0,EBGPAllowMultipleAS=False,RouterId=0.0.0.0,IBGPMaxPaths=0,Redistribution=[]) result: SUCCESS: http status code: 200

Assign BGP Neighbor Attributes

The final step in the process is assigning attributes to the BGPv4Neighbor object. In this example we will assign an interface reference (intfRef) and a peer AS number (PeerAS). Optionally, you can assign a neighbor IP address instead of the interface reference.

Assign an Interface to the BGP Neighbor

Assigning the interface is accomplished through the router command structure. Enter the following command at the config prompt.

localhost(config)#router bgp 500 
localhost(config-router-bgp-500)#

Enter the following command at the config-router-bgp-500 prompt.

localhost(config-router-bgp-500)#neighbor v4_interface fpPort 1
localhost(config-router-bgp-500-neighbor-if-1)#

Assign the PeerAS to the BGP Neighbor

Enter the following command at the config-router-bgp-500-neighbor-if-25 prompt.

localhost(config-router-bgp-500-neighbor-if-1)#peer_as 600
localhost(config-router-bgp-500-neighbor-if-1)#

Verify the configuration settings.

localhost(config-router-bgp-500-neighbor-if-1)#showunapplied 
Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.

id: 25  object: BGPv4Neighbor   status: PENDING CONFIG  valid: True delete: False num user cmds: 3
 command                           attr       value    model attr    iskey    required    userprov    time provisioned         
-------------------------------------------------------------------------------------------------------------------------------
 router bgp 500                    bgp        500      LocalAS       False                X           Wed Aug 16 09:01:09 2017 
 neighbor v4_interface fpPort 1    fpPort     1        IntfRef       True     X           X           Wed Aug 16 09:01:09 2017 
 peer_as 600                       peer_as    600      PeerAS        False                X           Wed Aug 16 09:01:27 2017 

id: 1   object: BGPGlobal   status: PENDING CONFIG  valid: True delete: False num user cmds: 1
 command           attr    value    model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------
 router bgp 500    bgp     500      ASNum         True     X           X           Wed Aug 16 09:00:54 2017 

Apply the settings.

localhost(config-router-bgp-500-neighbor-if-1)#apply
Applying Config:
id: 1   object: BGPGlobal   status: APPLIED CONFIG  valid: True delete: False num user cmds: 1
 command           attr    value    model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------
 router bgp 500    bgp     500      ASNum         True     X           X           Wed Aug 16 09:00:54 2017 

sdk:updateBGPGlobal(default,DefaultMED=0,Defaultv4Route=False,UseMultiplePaths=False,Defaultv6Route=False,ASNum=500,Disabled=False,EBGPMaxPaths=0,EBGPAllowMultipleAS=False,RouterId=0.0.0.0,IBGPMaxPaths=0,Redistribution=[]) result: SUCCESS: http status code: 200


id: 25  object: BGPv4Neighbor   status: APPLIED CONFIG  valid: True delete: False num user cmds: 3
 command                           attr       value    model attr    iskey    required    userprov    time provisioned         
-------------------------------------------------------------------------------------------------------------------------------
 router bgp 500                    bgp        500      LocalAS       False                X           Wed Aug 16 09:01:09 2017 
 neighbor v4_interface fpPort 1    fpPort     1        IntfRef       True     X           X           Wed Aug 16 09:01:09 2017 
 peer_as 600                       peer_as    600      PeerAS        False                X           Wed Aug 16 09:01:27 2017 

sdk:createBGPv4Neighbor(fpPort1,,BfdEnable=False,RouteReflectorClusterId=0,RouteReflectorClient=False,MultiHopTTL=0,MaxPrefixesDisconnect=False,LocalAS=500,KeepaliveTime=0,AddPathsMaxTx=0,AdjRIBInFilter=,AddPathsRx=False,UpdateSource=,PeerGroup=,MaxPrefixes=0,MaxPrefixesThresholdPct=80,MaxPrefixesRestartTimer=0,Description=,BfdSessionParam=default,AdjRIBOutFilter=,AuthPassword=,Disabled=False,MultiHopEnable=False,NextHopSelf=False,HoldTime=0,PeerAS=600,ConnectRetryTime=0) result: SUCCESS: http status code: 201



localhost(config)#

Using REST and cURL to Create BGP Interface Neighbors

The following instructions explain how to use the REST interface to create a BGP Interface Neighbor.

Assign an Network Address to a Port

Execute the following cURL command.

curl -k -u <user>:<password> -k -u <user>:<password> -H "Content-Type: application/json" -d '{ "IpAddr": "10.1.0.1/30", "IntfRef": "fpPort1"}' <flexSwitch_IP_Address>:443/public/v1/config/IPv4Intf

Create the BGP Global Object

Execute the following curl -k -u : command.

curl -k -u <user>:<password> -k -u <user>:<password> -X PATCH -H "Content-Type: application/json" -d '{"ASNum": "500"}' <flexSwitch_IP_Address>:443/public/v1/config/BGPGlobal

Create the BGP Neighbor

Execute the following cURL command.

curl -k -u <user>:<password> -H "Content-Type: application/json" -d '{ "PeerAS": "600", "IntfRef:fpPort1"}' <flexSwitch_IP_Address>:443/public/v1/config/BGPv4Neighbor