Added JSON and XML payloads tabs with RFC 8040 URL 51/90551/11
authorAman <170030039@iitdh.ac.in>
Mon, 22 Jun 2020 09:42:19 +0000 (15:12 +0530)
committerRobert Varga <nite@hq.sk>
Mon, 7 Sep 2020 13:08:48 +0000 (13:08 +0000)
Modified docs/bgp/bgp-user-guide-linkstate-family.rst by adding JSON,XML examples with corresponding sphinx tab

Change-Id: I277e40fb90b1140d9c59ff492024db0361845468
Signed-off-by: Aman <170030039@iitdh.ac.in>
docs/bgp/bgp-user-guide-linkstate-family.rst

index 607b58c8de8f8bc6f279de599b449b6a052c03ee..83a2e633879274c7a86fa9eced3bbb688712c69b 100644 (file)
@@ -22,31 +22,69 @@ To enable BGP-LS support in BGP plugin, first configure BGP speaker instance:
 
 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
 
+**RFC8040 URL:** ``/rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/protocols``
+
 **Method:** ``POST``
 
-**Content-Type:** ``application/xml``
-
-**Request Body:**
-
-.. code-block:: xml
-
-   <protocol xmlns="http://openconfig.net/yang/network-instance">
-       <name>bgp-example</name>
-       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
-       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
-           <global>
-               <config>
-                   <router-id>192.0.2.2</router-id>
-                   <as>65000</as>
-               </config>
-               <afi-safis>
-                   <afi-safi>
-                       <afi-safi-name>LINKSTATE</afi-safi-name>
-                   </afi-safi>
-               </afi-safis>
-           </global>
-       </bgp>
-   </protocol>
+.. tabs::
+
+   .. tab:: XML
+
+      **Content-Type:** ``application/xml``
+
+      **Request Body:**
+
+      .. code-block:: xml
+
+         <protocol xmlns="http://openconfig.net/yang/network-instance">
+             <name>bgp-example</name>
+             <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+             <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+                 <global>
+                     <config>
+                         <router-id>192.0.2.2</router-id>
+                         <as>65000</as>
+                     </config>
+                     <afi-safis>
+                         <afi-safi>
+                             <afi-safi-name>LINKSTATE</afi-safi-name>
+                         </afi-safi>
+                     </afi-safis>
+                 </global>
+             </bgp>
+         </protocol>
+
+   .. tab:: JSON
+
+      **Content-Type:** ``application/json``
+
+      **Request Body:**
+
+      .. code-block:: json
+
+         {
+             "protocol": [
+                 {
+                     "identifier": "openconfig-policy-types:BGP",
+                     "name": "bgp-example",
+                     "bgp-openconfig-extensions:bgp": {
+                         "global": {
+                             "config": {
+                                 "router-id": "192.0.2.2",
+                                 "as": 65000
+                             },
+                             "afi-safis": {
+                                 "afi-safi": [
+                                     {
+                                         "afi-safi-name": "LINKSTATE"
+                                     }
+                                 ]
+                             }
+                         }
+                     }
+                 }
+             ]
+         }
 
 Linkstate path attribute
 ''''''''''''''''''''''''
@@ -56,17 +94,37 @@ To use TYPE = 99, you need to set value bellow to false.
 
 **URL:** ``/restconf/config/bgp-linkstate-app-config:bgp-linkstate-app-config``
 
+**RFC8040 URL:** ``/rests/data/bgp-linkstate-app-config:bgp-linkstate-app-config``
+
 **Method:** ``PUT``
 
-**Content-Type:** ``application/xml``
+.. tabs::
+
+   .. tab:: XML
+
+      **Content-Type:** ``application/xml``
+
+      **Request Body:**
+
+      .. code-block:: xml
 
-**Request Body:**
+         <bgp-linkstate-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate-app-config">
+             <iana-linkstate-attribute-type>false</iana-linkstate-attribute-type>
+         </bgp-linkstate-app-config>
 
-.. code-block:: xml
+   .. tab:: JSON
 
-   <bgp-linkstate-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate-app-config">
-       <iana-linkstate-attribute-type>false</iana-linkstate-attribute-type>
-   </bgp-linkstate-app-config>
+      **Content-Type:** ``application/json``
+
+      **Request Body:**
+
+      .. code-block:: json
+
+         {
+             "bgp-linkstate-app-config": {
+                 "iana-linkstate-attribute-type": false
+             }
+         }
 
 BGP Peer
 ''''''''
@@ -76,20 +134,47 @@ Here is an example for BGP peer configuration with enabled BGP-LS family.
 
 **Method:** ``POST``
 
-**Content-Type:** ``application/xml``
+.. tabs::
+
+   .. tab:: XML
+
+      **Content-Type:** ``application/xml``
 
-**Request Body:**
+      **Request Body:**
 
-.. code-block:: xml
+      .. code-block:: xml
 
-   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
-       <neighbor-address>192.0.2.1</neighbor-address>
-       <afi-safis>
-           <afi-safi>
-               <afi-safi-name>LINKSTATE</afi-safi-name>
-           </afi-safi>
-       </afi-safis>
-   </neighbor>
+         <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+             <neighbor-address>192.0.2.1</neighbor-address>
+             <afi-safis>
+                 <afi-safi>
+                     <afi-safi-name>LINKSTATE</afi-safi-name>
+                 </afi-safi>
+             </afi-safis>
+         </neighbor>
+
+   .. tab:: JSON
+
+      **Content-Type:** ``application/json``
+
+      **Request Body:**
+
+      .. code-block:: json
+
+         {
+             "neighbor": [
+                 {
+                     "neighbor-address": "192.0.2.1",
+                     "afi-safis": {
+                         "afi-safi": [
+                             {
+                                 "afi-safi-name": "LINKSTATE"
+                             }
+                         ]
+                     }
+                 }
+             ]
+         }
 
 Link-State Route API
 ^^^^^^^^^^^^^^^^^^^^
@@ -526,13 +611,27 @@ The Link-State table in a instance of the speaker's Loc-RIB can be verified via
 
 **Method:** ``GET``
 
-**Response Body:**
+.. tabs::
+
+   .. tab:: XML
+
+      **Response Body:**
+
+      .. code-block:: xml
+
+         <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
+            ...
+         </linkstate-routes>
+
+   .. tab:: JSON
+
+      **Response Body:**
 
-.. code-block:: xml
+      .. code-block:: json
 
-   <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
-      ...
-   </linkstate-routes>
+         {
+             "bgp-linkstate:linkstate-routes": "..."
+         }
 
 .. note:: Link-State routes mapping to topology links/nodes/prefixes is supported by BGP Topology Provider.