diff --git a/api-ref/source/v2/bgp_peer.inc b/api-ref/source/v2/bgp_peer.inc new file mode 100644 index 000000000..5a9ac374c --- /dev/null +++ b/api-ref/source/v2/bgp_peer.inc @@ -0,0 +1,169 @@ +.. -*- rst -*- + +======== +BGP Peer +======== + +BGP peer defined in Neutron represents real BGP infrastructure such as +routers, route reflectors and route servers. + +When a BGP peer is defined and associated with a BGP Speaker, Neutron will +attempt to open a BGP peering session with the mentioned remote peer. It is +this session, using which Neutron announces it's routes. + +List BGP Peers +================= + +.. rest_method:: GET /v2.0/bgp-peers + +Issue a ``GET`` request to ``/v2.0/bgp-peers`` to retrieve the list of available +BGP peers. + +Use the ``fields`` query parameter to control which fields are +returned in the response body. Additionally, you can filter results +by using query string parameters. For information, see `Filtering +and Column Selection `__. + +Normal response codes: 200 + +Error response codes: 400, 401, 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - fields: fields + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_peers: bgp_peers + - remote_as: bgp_peer_remote_as_body + - name: bgp_peer_name_body + - peer_ip: bgp_peer_ip_body + - id: bgp_peer_id_body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_peer-list-response.json + :language: javascript + +Show BGP Peer details +===================== + +.. rest_method:: GET /v2.0/bgp-peers/{bgp-peer-id} + +Normal response codes: 200 + +Error response codes: 401, 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speaker-id: bgp_speaker_id-path + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_peers: bgp_peers + - remote_as: bgp_peer_remote_as_body + - name: bgp_peer_name_body + - peer_ip: bgp_peer_ip_body + - id: bgp_peer_id_body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_peer-show-response.json + :language: javascript + +Create a BGP Peer +================= + +.. rest_method:: POST /v2.0/bgp-peers + +Create a BGP Peer. + +Normal response codes: 201 + +Error response codes: 401, 403, 404, 409 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - auth_type: bgp_peer_auth_type_body + - remote_as: bgp_peer_remote_as_body + - name: bgp_peer_name_body + - peer_ip: bgp_peer_ip_body + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_peer-create-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_peer: bgp_peer_body + - auth_type: bgp_peer_auth_type_body + - password: bgp_peer_password_body + - remote_as: bgp_peer_remote_as_body + - name: bgp_peer_name_body + - peer_ip: bgp_peer_ip_body + - id: bgp_peer_id_body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_peer-create-response.json + :language: javascript + +Update a BGP Peer +================= + +.. rest_method:: PUT /v2.0/bgp-peers/{bgp-peer-id} + +Update a specific BGP Peer. + +Normal response codes: 202 + +Error response codes: 400, 401, 404, 41 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - name: bgp_peer_name_body + - password: bgp_peer_password_body + +Delete a BGP Peer +================= + +.. rest_method:: DELETE /v2.0/bgp-peers/{bgp-peer-id} + +Delete a specific BGP Peer. + +Normal response codes: 204 + +Error response codes: 400, 401, 404, 412 diff --git a/api-ref/source/v2/bgp_speaker.inc b/api-ref/source/v2/bgp_speaker.inc new file mode 100644 index 000000000..cff005d60 --- /dev/null +++ b/api-ref/source/v2/bgp_speaker.inc @@ -0,0 +1,375 @@ +.. -*- rst -*- + +=========== +BGP Speaker +=========== + +BGP Speaker acts as a route server using BGP routing protocol. It advertises +routes to the BGP peers which are added to the BGP Speaker. +Currently, BGP Speaker only advertises routes for a network to which it is associated. + +A BGP Speaker requires association with a "gateway" network to determine eligible routes. +In Neutron, a "gateway" network connects Neutron routers to the upstream routers. An +external network is best for being used as a gateway network. + +The association builds a list of all virtual routers with gateways on provider +and self-service networks within the same address scope. + +List BGP Speakers +================= + +.. rest_method:: GET /v2.0/bgp-speakers + +Issue a ``GET`` request to ``/v2.0/bgp-speakers`` to retrieve this list of available +BGP Speakers. + +Use the ``fields`` query parameter to control which fields are +returned in the response body. Additionally, you can filter results +by using query string parameters. For information, see `Filtering +and Column Selection `__. + +Normal response codes: 200 + +Error response codes: 400, 401, 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - fields: fields + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_speakers: bgp_speakers + - id: bgp_speaker-id-body + - name: bgp_speaker-name-body + - ip_version: bgp_speaker_ip_version-body + - advertise_floating_ip_host_routes: bgp_speaker_advertise_fip_host_routes-body + - advertise_tenant_networks: bgp_speaker_advertise_tenant_net-body + - local_as: bgp_speaker_local_as_body + - networks: bgp_speaker-networks-body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker-list-response.json + :language: javascript + +Show BGP Speaker details +======================== + +.. rest_method:: GET /v2.0/bgp-speakers/{bgp-speaker-id} + +Issue a ``GET`` request to ``/v2.0/bgp-speakers/`` to retrieve the +detail about a specific BGP Speaker. + +Normal response codes: 200 + +Error response codes: 401, 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speaker-id: bgp_speaker_id-path + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: bgp_speaker-id-body + - name: bgp_speaker-name-body + - ip_version: bgp_speaker_ip_version-body + - advertise_floating_ip_host_routes: bgp_speaker_advertise_fip_host_routes-body + - advertise_tenant_networks: bgp_speaker_advertise_tenant_net-body + - local_as: bgp_speaker_local_as_body + - networks: bgp_speaker-networks-body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker-show-response.json + :language: javascript + +Create BGP Speaker +================== + +.. rest_method:: POST /v2.0/bgp-speakers + +Issue a ``POST`` request to ``/v2.0/bgp-speakers`` with following JSON-encoded +data to create a BGP Speaker. + +Normal response codes: 201 + +Error response codes: 401, 403, 404, 409 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - name: bgp_speaker-name-body + - ip_version: bgp_speaker_ip_version-body + - advertise_floating_ip_host_routes: bgp_speaker_advertise_fip_host_routes-body + - advertise_tenant_networks: bgp_speaker_advertise_tenant_net-body + - local_as: bgp_speaker_local_as_body + - networks: bgp_speaker-networks-body + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_speaker-create-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: bgp_speaker-id-body + - name: bgp_speaker-name-body + - ip_version: bgp_speaker_ip_version-body + - advertise_floating_ip_host_routes: bgp_speaker_advertise_fip_host_routes-body + - advertise_tenant_networks: bgp_speaker_advertise_tenant_net-body + - local_as: bgp_speaker_local_as_body + - networks: bgp_speaker-networks-body + - tenant_id: project_id + - project_id: project_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker-create-response.json + :language: javascript + +Update a BGP Speaker +==================== + +.. rest_method:: PUT /v2.0/bgp-speakers/{bgp-speaker-id} + +Issue ``PUT`` request to ``/v2.0/bgp-speakers/`` to update a +specific BGP Speaker. Following attributes can be updated. + +Normal response codes: 202 + +Error response codes: 400, 401, 404, 41 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speakeriid: bgp_speaker_id-path + - name: bgp_speaker-name-body + - advertise_floating_ip_host_routes: bgp_speaker_advertise_fip_host_routes-body + - advertise_tenant_networks: bgp_speaker_advertise_tenant_net-body + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_speaker-update-request.json + :language: javascript + +Delete a BGP Speaker +==================== + +.. rest_method:: DELETE /v2.0/bgp-speakers/{bgp-speaker-id} + +Delete a specific BGP Speaker. + +Normal response codes: 204 + +Error response codes: 400, 401, 404, 412 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speakeri-id: bgp_speaker_id-path + +Response +-------- + +There is no body content for the response of a successful DELETE request. + +Add BGP Peer to a BGP Speaker +============================= + +.. rest_method:: PUT /v2.0/bgp-speakers//add-bgp-peer + +Bind the BGP peer to the specified BGP Speaker. + +Normal response codes: 200 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speaker-id: bgp_speaker_id-path + - bgp_peer_id: bgp_speaker_peer_id-body + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_speaker_add_peer-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_peer_id: bgp_speaker_peer_id-body + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker_add_peer-response.json + :language: javascript + +Remove BGP Peer from a BGP Speaker +================================== + +.. rest_method:: PUT /v2.0/bgp-speakers//remove-bgp-peer + +Unbind the BGP peer from a BGP Speaker. + +Normal response codes: 200 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speaker-id: bgp_speaker_id-path + - bgp_peer_id: bgp_speaker_peer_id-body + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_speaker_remove_peer-request.json + :language: javascript + +Response +-------- + +There is no body content for the response of a successful DELETE request. + +Add Network to a BGP Speaker +============================ + +.. rest_method:: PUT /v2.0/bgp-speakers//add_gateway_network + +Add a network to the specified BGP speaker. + +Normal response codes: 200 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bgp-speaker-id: bgp_speaker_id-path + - network_id: network_id + +Request Example +--------------- + +.. literalinclude:: samples/bgp/bgp_speaker_add_network-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bgp_peer_id: bgp_speaker_peer_id-body + - network_id: network_id + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker_add_network-response.json + :language: javascript + +Delete Network from a BGP Speaker +================================= + +.. rest_method:: PUT /v2.0/bgp-speakers//remove_gateway_network + +Remove a network from the specified BGP speaker. + +Normal response codes: 200 + +List routes advertised by a BGP Speaker +======================================= + +.. rest_method:: GET /v2.0/bgp-speakers//get_advertised_routes + +List all routes advertised by the specified BGP Speaker. + +Normal response codes: 200 + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - advertised_routes: bgp_speaker_advertised_routes-body + - cidr: bgp_speaker_cidr-body + - nexthop: bgp_speaker_nexthop-body + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker_list_routes-response.json + :language: javascript + +List Dynamic Routing Agents hosting a specific BGP Speaker +========================================================== + +.. rest_method:: GET /v2.0/bgp-speakers//bgp-dragents + +List all BGP dynamic agents which are hosting the specified BGP Speaker. + +Normal response codes: 200 + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - admin_state_up: admin_state_up + - agents: agents + - agent_type: agent_type + - alive: alive + - availability_zone: availability_zone + - binary: binary + - configurations: configurations + - created_at: created_at_resource + - description: description + - heartbeat_timestamp: heartbeat_timestamp + - host: host + - id: id + - resources_synced: agent_resources_synced + - started_at: started_at + - topic: topic + +Response Example +---------------- + +.. literalinclude:: samples/bgp/bgp_speaker_list_dragent_host-response.json + :language: javascript diff --git a/api-ref/source/v2/index.rst b/api-ref/source/v2/index.rst index 7373ac64c..6a621996d 100644 --- a/api-ref/source/v2/index.rst +++ b/api-ref/source/v2/index.rst @@ -90,6 +90,11 @@ BGP/MPLS VPN Interconnection .. include:: bgpvpn-network_associations.inc .. include:: bgpvpn-router_associations.inc .. include:: bgpvpn-port_associations.inc +################### +BGP Dynamic Routing +################### +.. include:: bgp_speaker.inc +.. include:: bgp_peer.inc ####### Logging ####### diff --git a/api-ref/source/v2/parameters.yaml b/api-ref/source/v2/parameters.yaml index b020c2f52..d77f31d8a 100644 --- a/api-ref/source/v2/parameters.yaml +++ b/api-ref/source/v2/parameters.yaml @@ -13,6 +13,12 @@ agent_id-path: in: path required: true type: string +bgp_speaker_id-path: + description: | + The ID of the BGP Speaker. + in: path + required: true + type: string bgpvpn-id-path: description: | The ID of the BGP VPN. @@ -1679,6 +1685,132 @@ bandwidth_limit_rules: in: body required: true type: array +bgp_peer_auth_type_body: + description: | + The authentication type for the BGP Peer, can be ``none`` or ``md5``. + ``none`` by default. + in: body + required: true + type: object +bgp_peer_body: + description: | + A BGP Peer object. + in: body + required: true + type: object +bgp_peer_id_body: + description: | + The ID of the BGP Peer. + in: body + required: true + type: string +bgp_peer_ip_body: + description: | + The ip address of the Peer. + in: body + required: true + type: string +bgp_peer_name_body: + description: | + The user meaningful name of the BGP Peer. + in: body + required: true + type: string +bgp_peer_password_body: + description: | + The authentication password for the specified authentication type. + in: body + required: true + type: string +bgp_peer_remote_as_body: + description: | + The remote Autonomous System number of the BGP Peer. + in: body + required: true + type: string +bgp_peers: + description: | + A list of ``bgp_peer`` objects. Each ``bgp_peer`` object represents + real BGP infrastructure such as routers, route reflectors and route + servers. + in: body + required: true + type: array +bgp_speaker-id-body: + description: | + The ID of the BGP Speaker. + in: body + required: true + type: string +bgp_speaker-name-body: + description: | + The user meaningful name of the BGP Speaker. + in: body + required: true + type: string +bgp_speaker-networks-body: + description: | + The ID of the network to which the BGP Speaker is associated. + in: body + required: true + type: string +bgp_speaker_advertise_fip_host_routes-body: + description: | + Whether to enable or disable the advertisement of floating ip host + routes by the BGP Speaker. True by default. + in: body + required: true + type: string +bgp_speaker_advertise_tenant_net-body: + description: | + Whether to enable or disable the advertisement of tenant network + routes by the BGP Speaker. True by default. + in: body + required: true + type: string +bgp_speaker_advertised_routes-body: + description: | + A list of routes (cidr-nexthop pairs) advertised by the BGP Speaker. + in: body + required: true + type: array +bgp_speaker_cidr-body: + description: | + The cidr of the route advertised by the BGP Speaker. + in: body + required: true + type: string +bgp_speaker_ip_version-body: + description: | + The IP version (4 or 6) of the BGP Speaker. + in: body + required: true + type: string +bgp_speaker_local_as_body: + description: | + The local Autonomous System number of the BGP Speaker. + in: body + required: true + type: string +bgp_speaker_nexthop-body: + description: | + The nexthop of the route advertised by the BGP Speaker. + in: body + required: true + type: string +bgp_speaker_peer_id-body: + description: | + The id of the peer. + in: body + required: true + type: string +bgp_speakers: + description: | + A list of ``bgp_speaker`` objects. Each ``bgp_speaker`` object acts as a + route server using BGP routing protocol. + in: body + required: true + type: array bgpvpn: description: | A ``bgpvpn`` object represents an MPLS network with which Neutron routers diff --git a/api-ref/source/v2/samples/bgp/bgp_peer-create-request.json b/api-ref/source/v2/samples/bgp/bgp_peer-create-request.json new file mode 100644 index 000000000..f7e2a6868 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_peer-create-request.json @@ -0,0 +1,8 @@ +{ + "bgp_peer":{ + "auth_type":"none", + "remote_as":"1001", + "name":"bgp-peer", + "peer_ip":"10.0.0.3" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_peer-create-response.json b/api-ref/source/v2/samples/bgp/bgp_peer-create-response.json new file mode 100644 index 000000000..6c54312a4 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_peer-create-response.json @@ -0,0 +1,10 @@ +{ + "bgp_peer":{ + "auth_type":"none", + "remote_as":"1001", + "name":"bgp-peer", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "peer_ip":"10.0.0.3", + "id":"a7193581-a31c-4ea5-8218-b3052758461f" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_peer-list-response.json b/api-ref/source/v2/samples/bgp/bgp_peer-list-response.json new file mode 100644 index 000000000..47f638d0c --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_peer-list-response.json @@ -0,0 +1,12 @@ +{ + "bgp_peers":[ + { + "auth_type":"none", + "remote_as":1001, + "name":"bgp-peer", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "peer_ip":"10.0.0.3", + "id":"a7193581-a31c-4ea5-8218-b3052758461f" + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_peer-show-response.json b/api-ref/source/v2/samples/bgp/bgp_peer-show-response.json new file mode 100644 index 000000000..ebe64727c --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_peer-show-response.json @@ -0,0 +1,10 @@ +{ + "bgp_peer":{ + "auth_type":"none", + "remote_as":1001, + "name":"bgp-peer", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "peer_ip":"10.0.0.3", + "id":"a7193581-a31c-4ea5-8218-b3052758461f" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker-create-request.json b/api-ref/source/v2/samples/bgp/bgp_speaker-create-request.json new file mode 100644 index 000000000..bdeda21f5 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker-create-request.json @@ -0,0 +1,7 @@ +{ + "bgp_speaker":{ + "ip_version":4, + "local_as":"1000", + "name":"bgp-speaker" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker-create-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker-create-response.json new file mode 100644 index 000000000..7eca04fd3 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker-create-response.json @@ -0,0 +1,15 @@ +{ + "bgp_speaker":{ + "peers":[ + ], + "name":"bgp-speaker", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "local_as":1000, + "advertise_tenant_networks":true, + "networks":[ + ], + "ip_version":4, + "advertise_floating_ip_host_routes":true, + "id":"5e08db80-db77-4b5c-a56d-dbca0b284f2c" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker-list-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker-list-response.json new file mode 100644 index 000000000..0d573a916 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker-list-response.json @@ -0,0 +1,30 @@ +{ + "bgp_speakers":[ + { + "peers":[ + ], + "name":"bgp-speaker-1", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "local_as":1001, + "advertise_tenant_networks":true, + "networks":[ + ], + "ip_version":4, + "advertise_floating_ip_host_routes":true, + "id":"5e08db80-db77-4b5c-a56d-dbca0b284f2c" + }, + { + "peers":[ + ], + "name":"bgp-speaker", + "tenant_id":"34a6e17a48cf414ebc890367bf42266b", + "local_as":1000, + "advertise_tenant_networks":true, + "networks":[ + ], + "ip_version":4, + "advertise_floating_ip_host_routes":true, + "id":"b759b2a1-27f4-4a6b-bb61-f2c9a22c9902" + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker-show-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker-show-response.json new file mode 100644 index 000000000..90469281a --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker-show-response.json @@ -0,0 +1,15 @@ +{ + "bgp_speaker": { + "peers": [ + ], + "name": "bgp-speaker-1", + "tenant_id": "34a6e17a48cf414ebc890367bf42266b", + "local_as": 1001, + "advertise_tenant_networks": true, + "networks": [ + ], + "ip_version": 4, + "advertise_floating_ip_host_routes": true, + "id": "5e08db80-db77-4b5c-a56d-dbca0b284f2c" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker-update-request.json b/api-ref/source/v2/samples/bgp/bgp_speaker-update-request.json new file mode 100644 index 000000000..c7374b2fe --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker-update-request.json @@ -0,0 +1,7 @@ +{ + "bgp_speaker":{ + "advertise_floating_ip_host_routes": "true", + "advertise_tenant_networks": "false", + "name":"bgp-speaker_2" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-request.json b/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-request.json new file mode 100644 index 000000000..c6488b58d --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-request.json @@ -0,0 +1,3 @@ +{ + "network_id":"f2269b61-6755-4174-8f64-5e318617b204" +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-response.json new file mode 100644 index 000000000..c6488b58d --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_add_network-response.json @@ -0,0 +1,3 @@ +{ + "network_id":"f2269b61-6755-4174-8f64-5e318617b204" +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-request.json b/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-request.json new file mode 100644 index 000000000..9d85dc5e0 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-request.json @@ -0,0 +1,3 @@ +{ + "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f" +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-response.json new file mode 100644 index 000000000..9d85dc5e0 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_add_peer-response.json @@ -0,0 +1,3 @@ +{ + "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f" +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_list_dragent_host-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker_list_dragent_host-response.json new file mode 100644 index 000000000..19784901f --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_list_dragent_host-response.json @@ -0,0 +1,25 @@ +{ + "agents":[ + { + "binary":"neutron-bgp-dragent", + "description":null, + "admin_state_up":true, + "heartbeat_timestamp":"2016-05-17 03:05:12", + "availability_zone":null, + "alive":true, + "topic":"bgp_dragent", + "host":"yangyubj-virtual-machine", + "agent_type":"BGP dynamic routing agent", + "resource_versions":{ + }, + "created_at":"2016-05-09 07:38:00", + "started_at":"2016-05-11 09:06:13", + "id":"af216618-29d3-4ee7-acab-725bdc90e614", + "configurations":{ + "advertise_routes":0, + "bgp_peers":0, + "bgp_speakers":1 + } + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_list_routes-response.json b/api-ref/source/v2/samples/bgp/bgp_speaker_list_routes-response.json new file mode 100644 index 000000000..02d01aff7 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_list_routes-response.json @@ -0,0 +1,8 @@ +{ + "advertised_routes":[ + { + "cidr":"192.168.10.0/24", + "nexthop":"10.0.0.1" + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bgp/bgp_speaker_remove_peer-request.json b/api-ref/source/v2/samples/bgp/bgp_speaker_remove_peer-request.json new file mode 100644 index 000000000..9d85dc5e0 --- /dev/null +++ b/api-ref/source/v2/samples/bgp/bgp_speaker_remove_peer-request.json @@ -0,0 +1,3 @@ +{ + "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f" +} \ No newline at end of file diff --git a/neutron_lib/api/definitions/__init__.py b/neutron_lib/api/definitions/__init__.py index 4218f3d06..83791264a 100644 --- a/neutron_lib/api/definitions/__init__.py +++ b/neutron_lib/api/definitions/__init__.py @@ -19,6 +19,9 @@ from neutron_lib.api.definitions import allowedaddresspairs from neutron_lib.api.definitions import auto_allocated_topology from neutron_lib.api.definitions import availability_zone from neutron_lib.api.definitions import availability_zone_filter +from neutron_lib.api.definitions import bgp +from neutron_lib.api.definitions import bgp_4byte_asn +from neutron_lib.api.definitions import bgp_dragentscheduler from neutron_lib.api.definitions import bgpvpn from neutron_lib.api.definitions import bgpvpn_routes_control from neutron_lib.api.definitions import bgpvpn_stdattrs @@ -140,6 +143,9 @@ _ALL_API_DEFINITIONS = { auto_allocated_topology, availability_zone, availability_zone_filter, + bgp, + bgp_4byte_asn, + bgp_dragentscheduler, bgpvpn, bgpvpn_routes_control, bgpvpn_stdattrs, diff --git a/neutron_lib/api/definitions/base.py b/neutron_lib/api/definitions/base.py index baa8c209d..bd74d73a7 100644 --- a/neutron_lib/api/definitions/base.py +++ b/neutron_lib/api/definitions/base.py @@ -157,7 +157,7 @@ KNOWN_EXTENSIONS = ( 'trunk', 'trunk-details', # Add here list of extensions with pointers to the project repo, e.g. - # 'bgp', # https://opendev.org/openstack/neutron-dynamic-routing + 'bgp', # https://opendev.org/openstack/neutron-dynamic-routing # https://opendev.org/openstack/neutron-fwaas 'fwaas', diff --git a/neutron_lib/api/definitions/bgp.py b/neutron_lib/api/definitions/bgp.py new file mode 100644 index 000000000..8307ca06b --- /dev/null +++ b/neutron_lib/api/definitions/bgp.py @@ -0,0 +1,132 @@ +# Copyright 2016 Hewlett Packard Development Coompany LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from neutron_lib.api import converters as n_conv +from neutron_lib import constants +from neutron_lib.db import constants as db_const + + +ALIAS = 'bgp' +IS_SHIM_EXTENSION = False +IS_STANDARD_ATTR_EXTENSION = False +NAME = "Neutron BGP Dynamic Routing Extension" +DESCRIPTION = ("Discover and advertise routes for Neutron prefixes " + "dynamically via BGP") +UPDATED_TIMESTAMP = '2016-05-10T15:37:00-00:00' +BGP_SPEAKER_RESOURCE_NAME = 'bgp-speaker' +BGP_SPEAKER_BODY_KEY_NAME = 'bgp_speaker' +BGP_SPEAKERS = '%ss' % BGP_SPEAKER_BODY_KEY_NAME +BGP_PEER_BODY_KEY_NAME = 'bgp_peer' + + +RESOURCE_ATTRIBUTE_MAP = { + BGP_SPEAKER_RESOURCE_NAME + 's': { + 'id': {'allow_post': False, 'allow_put': False, + 'validate': {'type:uuid': None}, + 'is_visible': True, 'primary_key': True}, + 'name': {'allow_post': True, 'allow_put': True, + 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, + 'is_visible': True, 'default': ''}, + 'local_as': {'allow_post': True, 'allow_put': False, + 'validate': {'type:range': (constants.MIN_ASNUM, + constants.MAX_ASNUM)}, + 'is_visible': True, 'default': None, + 'required_by_policy': False, + 'enforce_policy': False}, + 'ip_version': {'allow_post': True, 'allow_put': False, + 'validate': {'type:values': [4, 6]}, + 'is_visible': True, 'default': None, + 'required_by_policy': False, + 'enforce_policy': False}, + 'tenant_id': {'allow_post': True, 'allow_put': False, + 'required_by_policy': False, + 'validate': { + 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, + 'is_visible': True}, + 'peers': {'allow_post': False, 'allow_put': False, + 'validate': {'type:uuid_list': None}, + 'is_visible': True, 'default': [], + 'required_by_policy': False, + 'enforce_policy': True}, + 'networks': {'allow_post': False, 'allow_put': False, + 'validate': {'type:uuid_list': None}, + 'is_visible': True, 'default': [], + 'required_by_policy': False, + 'enforce_policy': True}, + 'advertise_floating_ip_host_routes': { + 'allow_post': True, + 'allow_put': True, + 'convert_to': n_conv.convert_to_boolean, + 'validate': {'type:boolean': None}, + 'is_visible': True, 'default': True, + 'required_by_policy': False, + 'enforce_policy': True}, + 'advertise_tenant_networks': { + 'allow_post': True, + 'allow_put': True, + 'convert_to': n_conv.convert_to_boolean, + 'validate': {'type:boolean': None}, + 'is_visible': True, 'default': True, + 'required_by_policy': False, + 'enforce_policy': True}, + }, + 'bgp-peers': { + 'id': {'allow_post': False, 'allow_put': False, + 'validate': {'type:uuid': None}, + 'is_visible': True, 'primary_key': True}, + 'name': {'allow_post': True, 'allow_put': True, + 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, + 'is_visible': True, 'default': ''}, + 'peer_ip': {'allow_post': True, 'allow_put': False, + 'required_by_policy': True, + 'validate': {'type:ip_address': None}, + 'is_visible': True}, + 'remote_as': {'allow_post': True, 'allow_put': False, + 'validate': {'type:range': (constants.MIN_ASNUM, + constants.MAX_ASNUM)}, + 'is_visible': True, 'default': None, + 'required_by_policy': False, + 'enforce_policy': False}, + 'auth_type': {'allow_post': True, 'allow_put': False, + 'required_by_policy': True, + 'validate': {'type:values': + constants.SUPPORTED_AUTH_TYPES}, + 'is_visible': True}, + 'password': {'allow_post': True, 'allow_put': True, + 'required_by_policy': True, + 'validate': {'type:string_or_none': None}, + 'is_visible': False, + 'default': None}, + 'tenant_id': {'allow_post': True, 'allow_put': False, + 'required_by_policy': False, + 'validate': { + 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, + 'is_visible': True} + } +} +SUB_RESOURCE_ATTRIBUTE_MAP = None +ACTION_MAP = { + BGP_SPEAKER_RESOURCE_NAME: { + 'add_bgp_peer': 'PUT', + 'remove_bgp_peer': 'PUT', + 'add_gateway_network': 'PUT', + 'remove_gateway_network': 'PUT', + 'get_advertised_routes': 'GET' + } +} +ACTION_STATUS = {} +REQUIRED_EXTENSIONS = [] +OPTIONAL_EXTENSIONS = [] diff --git a/neutron_lib/api/definitions/bgp_4byte_asn.py b/neutron_lib/api/definitions/bgp_4byte_asn.py new file mode 100644 index 000000000..f7de3d7a1 --- /dev/null +++ b/neutron_lib/api/definitions/bgp_4byte_asn.py @@ -0,0 +1,47 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron_lib.api.definitions import bgp +from neutron_lib import constants + + +ALIAS = 'bgp_4byte_asn' +IS_SHIM_EXTENSION = False +IS_STANDARD_ATTR_EXTENSION = False +NAME = "BGP 4-byte AS numbers" +DESCRIPTION = "Support bgp 4-byte AS number" +UPDATED_TIMESTAMP = '2017-09-07T00:00:00-00:00' + + +RESOURCE_ATTRIBUTE_MAP = { + 'bgp-speakers': { + 'local_as': {'allow_post': True, 'allow_put': False, + 'validate': {'type:range': (constants.MIN_ASNUM, + constants.MAX_4BYTE_ASNUM)}, + 'is_visible': True, 'default': None, + 'required_by_policy': False, + 'enforce_policy': False} + }, + 'bgp-peers': { + 'remote_as': {'allow_post': True, 'allow_put': False, + 'validate': {'type:range': (constants.MIN_ASNUM, + constants.MAX_4BYTE_ASNUM)}, + 'is_visible': True, 'default': None, + 'required_by_policy': False, + 'enforce_policy': False} + } +} +SUB_RESOURCE_ATTRIBUTE_MAP = None +ACTION_MAP = {} +ACTION_STATUS = {} +REQUIRED_EXTENSIONS = [bgp.ALIAS] +OPTIONAL_EXTENSIONS = [] diff --git a/neutron_lib/api/definitions/bgp_dragentscheduler.py b/neutron_lib/api/definitions/bgp_dragentscheduler.py new file mode 100644 index 000000000..7d5ae2e93 --- /dev/null +++ b/neutron_lib/api/definitions/bgp_dragentscheduler.py @@ -0,0 +1,32 @@ +# Copyright 2016 Huawei Technologies India Pvt. Ltd. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +ALIAS = 'bgp_dragent_scheduler' +IS_SHIM_EXTENSION = True +IS_STANDARD_ATTR_EXTENSION = False +NAME = "BGP Dynamic Routing Agent Scheduler" +DESCRIPTION = "Schedules BgpSpeakers on BgpDrAgent" +UPDATED_TIMESTAMP = '2015-07-30T10:00:00-00:00' +BGP_DRINSTANCE = 'bgp-drinstance' +BGP_DRINSTANCES = BGP_DRINSTANCE + 's' +BGP_DRAGENT = 'bgp-dragent' +BGP_DRAGENTS = BGP_DRAGENT + 's' +RESOURCE_ATTRIBUTE_MAP = {} +SUB_RESOURCE_ATTRIBUTE_MAP = None +ACTION_MAP = {} +ACTION_STATUS = {} +REQUIRED_EXTENSIONS = [] +OPTIONAL_EXTENSIONS = [] diff --git a/neutron_lib/constants.py b/neutron_lib/constants.py index 493ac7feb..7388e78ce 100644 --- a/neutron_lib/constants.py +++ b/neutron_lib/constants.py @@ -874,3 +874,10 @@ OVSDB_RESOURCE = 'ovsdb' # Used in ovs port 'external_ids' in order mark it for no cleanup when # ovs_cleanup script is used. SKIP_CLEANUP = 'skip_cleanup' + +# neutron-dynamic-routing constants +MIN_ASNUM = 1 +MAX_ASNUM = 65535 +MAX_4BYTE_ASNUM = 4294967295 + +SUPPORTED_AUTH_TYPES = ['none', 'md5'] diff --git a/neutron_lib/tests/unit/api/definitions/test_bgp.py b/neutron_lib/tests/unit/api/definitions/test_bgp.py new file mode 100644 index 000000000..6e2864a0d --- /dev/null +++ b/neutron_lib/tests/unit/api/definitions/test_bgp.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from neutron_lib.api.definitions import bgp +from neutron_lib.tests.unit.api.definitions import base + + +class BgpDefinitionTestCase(base.DefinitionBaseTestCase): + extension_module = bgp + extension_resources = ('bgp-speakers', 'bgp-peers') + extension_attributes = ('local_as', 'peers', 'networks', + 'advertise_floating_ip_host_routes', + 'advertise_tenant_networks', 'peer_ip', + 'remote_as', 'auth_type', 'password',) diff --git a/neutron_lib/tests/unit/api/definitions/test_bgp_4byte_asn.py b/neutron_lib/tests/unit/api/definitions/test_bgp_4byte_asn.py new file mode 100644 index 000000000..a84c42132 --- /dev/null +++ b/neutron_lib/tests/unit/api/definitions/test_bgp_4byte_asn.py @@ -0,0 +1,21 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from neutron_lib.api.definitions import bgp_4byte_asn +from neutron_lib.tests.unit.api.definitions import base + + +class Bgp4ByteAsnDefinitionTestCase(base.DefinitionBaseTestCase): + extension_module = bgp_4byte_asn + extension_resources = ('bgp-speakers', 'bgp-peers') + extension_attributes = ('local_as', 'remote_as', ) diff --git a/neutron_lib/tests/unit/api/definitions/test_bgp_dragentscheduler.py b/neutron_lib/tests/unit/api/definitions/test_bgp_dragentscheduler.py new file mode 100644 index 000000000..df6eba94a --- /dev/null +++ b/neutron_lib/tests/unit/api/definitions/test_bgp_dragentscheduler.py @@ -0,0 +1,19 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from neutron_lib.api.definitions import bgp_dragentscheduler +from neutron_lib.tests.unit.api.definitions import base + + +class BgpDragentSchedulerDefinitionTestCase(base.DefinitionBaseTestCase): + extension_module = bgp_dragentscheduler diff --git a/releasenotes/notes/rehome-dynamic-routing-apidef-3d78ae209ec59858.yaml b/releasenotes/notes/rehome-dynamic-routing-apidef-3d78ae209ec59858.yaml new file mode 100644 index 000000000..cd7428c0a --- /dev/null +++ b/releasenotes/notes/rehome-dynamic-routing-apidef-3d78ae209ec59858.yaml @@ -0,0 +1,5 @@ +--- +features: + - The API definitions of ``neutron-dynamic-routing``, ``bgp``, + ``bgp_4byte_asn`` and ``bgp_dragent_scheduler``, are now available + in ``neutron_lib.api.definitions``.