Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Configuring BGPaaS using VNC API

 

To configure BGPaaS using VNC APIs:

  1. Access the default project.

    default_project = self._vnc_lib.project_read(fq_name=[u'default-domain', ‘bgpaas-tenant’])

  2. Create a BGPaaS object.

    bgpaas_obj = BgpAsAService(name=‘bgpaas_1’, parent_obj=default_project)

  3. Attach the BGP object to a precreated virtual machine interface.

    bgpaas_obj.add_virtual_machine_interface(vmi)

  4. Set the ASN. It must be an eBGP session.

    bgpaas_obj.set_autonomous_system('65000')

    If the ASN is not set, the primary instance IP will be chosen.

    bgpaas_obj.set_bgpaas_ip_address(u’10.1.1.5’)

  5. Set session attributes.

    bgp_addr_fams = AddressFamilies(['inet’, ‘inet6’])

    bgp_sess_attrs = BgpSessionAttributes(address_families=bgp_addr_fams,hold_time=60)

    bgpaas_obj.set_bgpaas_session_attributes(bgp_sess_attrs)

    self._vnc_lib.bgp_as_a_service_create(bgpaas_obj)

To delete a BGPaaS object, follow the given code:

fq_name=[u'default-domain', ‘bgpaas-tenant’, ‘bgpaas_1’]

bgpaas_obj = self._vnc_lib.bgp_as_a_service_read(fq_name=fq_name)

bgpaas_obj.del_virtual_machine_interface(vmi)

self._vnc_lib.bgp_as_a_service_update(bgpaas_obj)

self._vnc_lib.bgp_as_a_service_delete(id=bgpaas_obj.get_uuid())