REST Resources

/api/space/device-management/devices/{device-id}/configurations/expanded

The following operations are supported on this resource:

  • GET - Expanded configuration
  • GET - CLI Expanded Configuration
  • GET - Get expanded configuration of device
  • POST - Expanded configuration
  • POST - CLI Expanded Configuration
  • POST - Filter the expanded device configuration
GET /devices/{device-id}/configurations/expandedVersion 5

This API is used to access configuration data with configuration groups expanded and results will be displayed in xml format
sample configuration:

         <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm" xmlns:junos="http://xml.juniper.net/junos/12.3R3/junos" junos:commit-localtime="2013-06-17 04:32:17 UTC" junos:commit-seconds="1371443537" junos:commit-user="root">
          <version>12.3R3.4</version>
          <system>
              <root-authentication>
                  <encrypted-password>$1$nTfQePCG$paMKOkFTfjGLjK9K7DGkJ0</encrypted-password>
              </root-authentication>
              <scripts>
                  <op>
                      <file>
                          <name>MyscriptlogicalinterfaceScript.slax</name>
                      </file>
                  </op>
              </scripts>
              <login>
                  <user>
                      <name>String</name>
                      <uid>2077</uid>
                      <class>super-user</class>
                      <authentication>
                          <encrypted-password>$1$dbopsnyN$PVDcL2aAuh2uaP.j.q7U0.</encrypted-password>
                      </authentication>
                  </user>
              </login>
          </system>
          <interfaces>
              <interface>
                  <name>ge-0/0/0</name>
                  <unit>
                      <name>0</name>
                      <family>
                          <ethernet-switching>
                          </ethernet-switching>
                      </family>
                  </unit>
              </interface>
          ...
          ... 
      </configuration>
      
.

Sample Usage

GET /devices/{device-id}/configurations/expanded


  • Parameters:
    NameTypeURI TypeDescriptionRequired
    device-idIntegerPathDevice ID Y
  • Sample Output XML:
    <expanded-xml-configuration uri="/api/space/device-management/devices/2228251/configurations/raw">
         <id>2228251</id>
         <configuration>
         <![CDATA[
              <configuration
                  xmlns="http://xml.juniper.net/xnm/1.1/xnm" junos:commit-seconds="1263864466" junos:commit-localtime="2010-01-19 01:27:46 UTC" junos:commit-user="root"
                  xmlns:junos="http://xml.juniper.net/junos/14.1X53/junos">
                  <version>14.1X53-D40.8</version>
                  <system>
                      <host-name>EX</host-name>
                      <root-authentication>
                          <encrypted-password>$1$kXs/XDp0$fALhYuFTOIsNgSxtHpiJO.</encrypted-password>
                      </root-authentication>
                  </system>
              </configuration> 
         
         ]]>
       </configuration>
    </expanded-xml-configuration>

  • Sample Output JSON:
    {
       "expanded-xml-configuration" : {
         "@uri" :
         "/api/space/device-management/devices/2228251/configurations/raw" ,
         "id" : 2228251 ,
         "configuration" : "<![CDATA[
            <configuration\n xmlns=\"http://xml.juniper.net/xnm/1.1/xnm\" junos:commit-seconds=\"1263864466\"
            junos:commit-localtime=\"2010-01-19 01:27:46 UTC\" junos:commit-user=\"root\"\n xmlns:junos=
            \"http://xml.juniper.net/junos/14.1X53/junos\">\n   <version>14.1X53-D40.8</version>\n    
            <system>\n     <host-name>EX</host-name>\n   <root-authentication>\n          <encrypted
            -password>$1$kXs/XDp0$fALhYuFTOIsNgSxtHpiJO.</encrypted-password>\n    </root-authentication>\n  
            </system>\n</configuration>  
     
         ]]>"
       }
    }

  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration

    GET /devices/{device-id}/configurations/expandedVersion 5

    This API is used to access configuration data with configuration groups expanded and results will be displayed in CLI format
    Sample configuration :

             version 12.3R3.4;
          system {
                  root-authentication {
                          encrypted-password $1$nTfQePCG$paMKOkFTfjGLjK9K7DGkJ0;
                  }
                  scripts {
                          op {
                                  file MyscriptPhysicalinterfaceScript.slax ;
                          }
                  }
                  login {
                          user String {
                                  uid 2077;
                                  class super-user;
                                  authentication {
                                          encrypted-password $1$dbopsnyN$PVDcL2aAuh2uaP.j.q7U0.;
                                  }
                          }
                  }
                  services {
                          ssh {
                                  protocol-version v2;
                                  max-sessions-per-connection 32;
                          }
                          netconf {
                                  ssh ;
                          }
                          outbound-ssh {
                                  client 192.168.27.171 {
                                          device-id C233F9;
                                          secret $9$cklrKWNdsJGiLxGik.zFcyl;
                                          services netconf;
                                          192.168.27.171 {
                                                  port 7804;
                                          }
                                  }
                          }
                          web-management {
                                  http ;
                          }
                  }
                  syslog {
                          user * {
                                  any {
                                          emergency ;
                                  }
                          }
                          file messages {
                                  any {
                                          notice ;
                                  }
                                  authorization {
                                          info ;
                                  }
                          }
                          file interactive-commands {
                                  interactive-commands {
                                          any ;
                                  }
                          }
                  }
          }
          interfaces {
                  ge-0/0/0 {
                          unit 0 {
                                  family  ethernet-switching ;
                          }
                  }
                  ge-0/0/1 {
                          description mydescription;
                          mtu 554;
                          unit 0 {
                                  family  ethernet-switching ;
                          }
                  }
          }
          protocols {
                  igmp-snooping {
                          vlan all ;
                  }
                  rstp ;
                  lldp {
                          interface all ;
                  }
                  lldp-med {
                          interface all ;
                  }
          }
          poe {
                  interface all ;
          }
       
    .

    Sample Usage

    GET /devices/{device-id}/configurations/expanded


    • Parameters:
      NameTypeURI TypeDescriptionRequired
      device-idIntegerPathDevice ID Y
  • Sample Output XML:
    <expanded-cli-configuration uri="/api/space/device-management/devices/2228251/configurations/raw">
         <id>2228251</id>
         <configuration><![CDATA[
                version 14.1X53-D40.8;
                system {
                host-name EX;
                        root-authentication {
                            encrypted-password $1$kXs/XDp0$fALhYuFTOIsNgSxtHpiJO.;
                        }
                }
         ]]>
       </configuration>
    </expanded-cli-configuration>

  • Sample Output JSON:
    {
       "expanded-cli-configuration" : {
         "@uri" :
         "/api/space/device-management/devices/2228251/configurations/expanded" ,
         "id" : 2228251 ,
         "configuration" :
               "version 14.1X53-D40.8;\n            system {\n            host-name EX;\n                   
               root-authentication {\n                        encrypted-password $1$kXs/XDp0$f
               ALhYuFTOIsNgSxtHpiJO.;\n   *                                 }\n            }"
     
       }
    }

  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration

    GET /devices/{device-id}/configurations/expandedVersion 3

    This API is used to access configuration data with configuration groups expanded (using the inherit="inherit" option on the Junos OS "get-configuration" RPC).

    Fields Selection

    A particular section of a configuration can be fetched using the 'fields' criteria. For example:

        fields=(version,system:(login:(user)))

    These fields should be nested properly to get the required configuration content. For example, a 'fields' selection passed as fields=(version) will fetch only version information. (See the sample output below.)

    .

    Sample Usage

    GET /devices/{device-id}/configurations/expanded


    • Parameters:
      NameTypeURI TypeDescriptionRequired
      device-idIntegerPathThe ID of the device whose configuration data will be accessed. Y
  • Sample Output XML:

    <expanded-configuration>
      <configuration>String</configuration>
      <method href= "/api/space/device-management/devices/229377/configurations/raw/match-content" rel="match device configuration"/>
    </expanded-configuration>

  • Sample Output JSON:


      "expanded-configuration":{
        "configuration":"String",
        "method":{
          "@href": "/api/space/device-management/devices/229377/configurations/expanded/match-content",
          "@rel":"match device configuration"
        } 
      }
    }

  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration

    POST /devices/{device-id}/configurations/expandedVersion 5

    This API is used to filter expanded configuration content of a device using an XPath expression. Configuration groups are expanded and results will be displayed in xml format
    sample xpath : "/configuration" sample configuration:

             <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm" xmlns:junos="http://xml.juniper.net/junos/12.3R3/junos" junos:commit-localtime="2013-06-17 04:32:17 UTC" junos:commit-seconds="1371443537" junos:commit-user="root">
              <version>12.3R3.4</version>
              <system>
                  <root-authentication>
                      <encrypted-password>$1$nTfQePCG$paMKOkFTfjGLjK9K7DGkJ0</encrypted-password>
                  </root-authentication>
                  <scripts>
                      <op>
                          <file>
                              <name>MyscriptlogicalinterfaceScript.slax</name>
                          </file>
                      </op>
                  </scripts>
                  <login>
                      <user>
                          <name>String</name>
                          <uid>2077</uid>
                          <class>super-user</class>
                          <authentication>
                              <encrypted-password>$1$dbopsnyN$PVDcL2aAuh2uaP.j.q7U0.</encrypted-password>
                          </authentication>
                      </user>
                  </login>
              </system>
              <interfaces>
                  <interface>
                      <name>ge-0/0/0</name>
                      <unit>
                          <name>0</name>
                          <family>
                              <ethernet-switching>
                              </ethernet-switching>
                          </family>
                      </unit>
                  </interface>
              ...
              ... 
          </configuration>
          
    .

    Sample Usage

    POST /devices/{device-id}/configurations/expanded


    • Parameters:
      NameTypeURI TypeDescriptionRequired
      device-idIntegerPathDevice ID Y
  • Sample Input XML:
    <expanded-xml-configuration-request>
         <xpath-list>
               <xpath>/configuration/interfaces/interface[name='me0']</xpath>
         </xpath-list>
    </expanded-xml-configuration-request>

  • Sample Output XML:
    <expanded-xml-configuration uri="/api/space/device-management/devices/2228241/configurations/raw">
         <id>2228241</id>
         <configuration><![CDATA[
              <interface>
                  <name>me0</name>
                  <unit>
                      <name>me0-unit-0</name>
                      <family>
                          <inet>
                              <address>
                                  <name>192.168.27.72/23</name>
                              </address>
                          </inet>
                      </family>
                  </unit>
              </interface>
     
           ]]>    </configuration>
    </expanded-xml-configuration>

  • Sample Input JSON:
    {
       "expanded-xml-configuration-request" : {
         "xpath-list" : {
           "xpath" : "/configuration/interfaces/interface[name='me0']"
         }
       }
    }

  • Sample Output JSON:
    {
       "expanded-xml-configuration" : {
         "@uri" : "/api/space/device-management/devices/2228241/configurations/raw" ,
         "id" : "2228241" ,
         "configuration" : "<![CDATA[
          <interface>\n            <name>me0</name>\n            
          <unit>\n                <name>0</name>\n    
          <family>\n                    <inet>\n 
          <address>\n                       
          <name>192.168.27.72/23</name>\n              
          </address>\n                    </inet>\n
           </family>\n            </unit>\n   
          </interface>
         
        ]]>"
       }
    }

  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration

    POST /devices/{device-id}/configurations/expandedVersion 5

    This API is used to filter expanded configuration content of a device using an XPath expression. Configuration groups are expanded. Results will be displayed in CLI format
    Sample xpath : /configuration
    Sample configuration :

             version 12.3R3.4;
          system {
                  root-authentication {
                          encrypted-password $1$nTfQePCG$paMKOkFTfjGLjK9K7DGkJ0;
                  }
                  scripts {
                          op {
                                  file MyscriptPhysicalinterfaceScript.slax ;
                          }
                  }
                  login {
                          user String {
                                  uid 2077;
                                  class super-user;
                                  authentication {
                                          encrypted-password $1$dbopsnyN$PVDcL2aAuh2uaP.j.q7U0.;
                                  }
                          }
                  }
                  services {
                          ssh {
                                  protocol-version v2;
                                  max-sessions-per-connection 32;
                          }
                          netconf {
                                  ssh ;
                          }
                          outbound-ssh {
                                  client 192.168.27.171 {
                                          device-id C233F9;
                                          secret $9$cklrKWNdsJGiLxGik.zFcyl;
                                          services netconf;
                                          192.168.27.171 {
                                                  port 7804;
                                          }
                                  }
                          }
                          web-management {
                                  http ;
                          }
                  }
                  syslog {
                          user * {
                                  any {
                                          emergency ;
                                  }
                          }
                          file messages {
                                  any {
                                          notice ;
                                  }
                                  authorization {
                                          info ;
                                  }
                          }
                          file interactive-commands {
                                  interactive-commands {
                                          any ;
                                  }
                          }
                  }
          }
          interfaces {
                  ge-0/0/0 {
                          unit 0 {
                                  family  ethernet-switching ;
                          }
                  }
                  ge-0/0/1 {
                          description mydescription;
                          mtu 554;
                          unit 0 {
                                  family  ethernet-switching ;
                          }
                  }
          }
          protocols {
                  igmp-snooping {
                          vlan all ;
                  }
                  rstp ;
                  lldp {
                          interface all ;
                  }
                  lldp-med {
                          interface all ;
                  }
          }
          poe {
                  interface all ;
          }
       
    .

    Sample Usage

    POST /devices/{device-id}/configurations/expanded


    • Parameters:
      NameTypeURI TypeDescriptionRequired
      device-idIntegerPathDevice ID Y
  • Sample Input XML:
    <expanded-cli-configuration-request>
         <xpath-list>
               <xpath>/configuration/interfaces/interface[name='me0']</xpath>
         </xpath-list>
    </expanded-cli-configuration-request>

  • Sample Output XML:
    <expanded-cli-configuration uri="/api/space/device-management/devices/2228241/configurations/raw">
         <id>2228241</id>
         <configuration>
           <![CDATA[
       interfaces {
            me0 {
                    unit {
                            name 0;
                            family {
                                    inet {
                                            address {
                                                    name 192.168.27.72/23;
                                            }
                                    }
                            }
                    }
            }
       }
     
           ]]>
         </configuration>
    </expanded-cli-configuration>

  • Sample Input JSON:
    {
       "expanded-cli-configuration-request" : {
         "xpath-list" : {
           "xpath" : "/configuration/interfaces/interface[name='me0']"
         }
       }
    }

  • Sample Output JSON:
    {
       "expanded-cli-configuration" : {
         "@uri" :
         "/api/space/device-management/devices/2228241/configurations/raw" ,
         "id" : "2228241" ,
         "configuration" :
              "\ninterfaces {\n        me0 {\n        unit {\n                
                  name 0;\n           family {\n                     
                  inet {\n        address {\n   name 192.168.27.72/23;\n      
                   }\n                                }\n  
                }\n                }\n        }\n}\n" 
     
       }
    }

  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration

    POST /devices/{device-id}/configurations/expandedVersion 1

    This API is used to filter expanded configuration content of a device using an XPath expression. Configuration groups are expanded (using the inherit="inherit" option on the Junos "get-configuration" RPC). Also, an XPath filter expression is passed in the HTPP body to filter the XML datafurther.

    Fields Selection

    A particular section of the configuration can be fetched using the 'fields' criteria. For example:

        fields=(version,system:(login:(user)))

    These fields should be nested properly to get the required configuration content. For example, the 'fields' selection passed as fields=(version) will fetch only version information. (See the sample output below.)

    An additional XPath filter expression can be supplied in the HTTP body.

    Sample Usage

    POST /devices/{device-id}/configurations/expanded


    • Parameters:
      NameTypeURI TypeDescriptionRequired
      device-idIntegerPathThe ID of the device whose expanded configuration content will be filtered. Y
  • Sample Input XML:

     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <xpaths>
       <xpath>/configuration/version</xpath>
       <xpath>/configuration/interfaces/interface[name= 'ge-0/0/0']</xpath>
         </xpaths>

  • Sample Output XML:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <expanded-configuration>
       <configuration><configuration><version>10.0R2.10 </version></configuration>
       <method href= "/api/space/device-management/devices/229377/configurations/raw/match-content" rel="match device configuration"/>
    </expanded-configuration>

  • Sample Input JSON:

    {
     "xpaths":{
      "xpath":[
       "/configuration/version",
       "/configuration/interfaces/interface[name=\"ge-0/0/0\"]"
      ]
     }
    }

  • Sample Output JSON:

    {
    "expanded-configuration":
    {
       "configuration": "10.0R2.10",
       "method":
       {
          "@href":"/api/space/device-management/devices/229377/configurations/expanded/match-content",
          "@rel":"match device configuration"
       }



  • Access Control

    The following capabilities are required to access this API: DeviceConfiguration