Junos OS

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Junos OS.
  • 1.  Utilising REST API

     
    Posted 01-25-2018 07:45

    Hi,

     

    I have just been thrown a curve ball in the middle of SNMP Testing 🙂

     

    I have been asked to enable the REST API on the MX240 routers we have. Okay, no problem. Juniper has great resources for this and a great example....

    Problem I have is the following:

     

    Set system servies rest http addresses xxx.xxx.xxx.xxx

     

    It does not matter what address I put in there I get the following error:

    [edit]
    Clive@THW-CORE-01# set system services rest http addresses [10.1.100.10]

    [edit]
    Clive@THW-CORE-01# commit
    error: rest-api: Address 10.1.100.10:3000 unavailable
    error: commit failed: daemon file propagation failed

     

    I have tried searching for why this occurs as it should be available on the MX240s but cannot find why.

     

    Any help appreciated please

     

     



  • 2.  RE: Utilising REST API

    Posted 01-25-2018 07:58
    Are you using fxp0 address?

    Non-working

    [edit]
    labroot@JTAC-mx240-r2014# set system services rest http addresses 10.1.100.10

    [edit]
    labroot@JTAC-mx240-r2014# commit
    error: rest-api: Address 10.1.100.10:3000 unavailable
    error: commit failed: daemon file propagation failed

    [edit]
    labroot@JTAC-mx240-r2014#

    Working

    [edit]
    labroot@JTAC-mx240-r2014# show interfaces fxp0
    unit 0 {
    family inet {
    address 10.0.0.1/26;
    }
    }

    [edit]
    labroot@JTAC-mx240-r2014# rollback
    load complete

    [edit]
    labroot@JTAC-mx240-r2014# set system services rest http addresses 10.0.0.1

    [edit]
    labroot@JTAC-mx240-r2014# commit
    commit complete

    [edit]
    labroot@JTAC-mx240-r2014#


    HTH


  • 3.  RE: Utilising REST API
    Best Answer

     
    Posted 01-25-2018 08:02


    lab@TEST# run show version
    Junos: 14.2R6.5

    lab@TEST# run show configuration chassis | display set
    set chassis aggregated-devices ethernet device-count 1

    lab@TEST# run show configuration interfaces | display set | match ae1
    set interfaces ge-1/0/0 gigether-options 802.3ad ae1
    set interfaces ae1 aggregated-ether-options minimum-links 1
    set interfaces ae1 aggregated-ether-options link-speed 1g
    set interfaces ae1 unit 0 family inet address 10.1.1.100/32

    lab@TEST# run show interfaces terse ae1
    Interface               Admin                 Link        Proto    Local                 Remote
    ae1                           up                            up
    ae1.0                       up                            up          inet     10.1.1.100          --> 0/0
    multis ervice

    lab@TEST# run show route 10.1.1.100

    inet.0: 6 destinations, 9 routes (6 active, 0 holddown, 0 hidden)
    + = Active Route, - = Last Active, * = Both

    10.1.1.100/32      *[Direct/0] 00:12:29
    > via ae1.0
    [Local/0] 00:12:31
    Local via ae1.0


    lab@TEST# set system services rest http port 3000

    [edit]
    lab@TEST# set system services rest http addresses 10.1.1.100

    [edit]
    lab@TEST# commit check
    configuration check succeeds

    [edit]
    lab@TEST# commit
    commit complete

    lab@TEST# run show configuration | match rest | display set
    set system services rest http port 3000
    set system services rest http addresses 10.1.1.100

    Point to be remember:

    1.       set chassis aggregated-devices ethernet device-count-----------should be configured
    2.       AE should be up up
    3.       The IP address defined as the addresses in rest http configuration should be present in the " show route x.x.x.x" as direct /local router via the same interface.

    Please try this and let us know the rsult.



  • 4.  RE: Utilising REST API

    Posted 01-25-2018 08:14
    To add more, You can use any interface IP but it should be unique on that box.

    Regards
    Harpreet


  • 5.  RE: Utilising REST API

     
    Posted 01-26-2018 00:54

    Thanks Rahul and Kingsman ---- Worked perfectly