cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

114
Views
2
Helpful
3
Replies
khgrant
Cisco Employee

About how to get device interface configuration

As my config interface interface is ony one . I set the deivce name is constant value. But build failed.
list interface {
                 key name;
                 leaf name {
                 type leafref {
                     path "/ncs:devices/ncs:device[ncs:name='FB1']/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
                    }
                  }
           }
[root@ucs-sdn-7 src]# make
/nobackup/haofan/./nso/4.1.1/bin/ncsc  `ls vrf-ann.yang  > /dev/null 2>&1 && echo "-a vrf-ann.yang"` \
             --yangpath yang --yangpath ../../cisco-iosxr-icon/src/ncsc-out/modules/yang -c -o ../load-dir/vrf.fxs yang/vrf.yang
yang/vrf.yang:37: error: bad argument value "/ncs:devices/ncs:device[ncs:name='FB1']/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id", should be of type path-arg
make: *** [../load-dir/vrf.fxs] Error 1
         And I try another methods tailf:link , but when run package reload failed.   
         list interface {
                 key name;
                 leaf name {
                     type string;
                     tailf:link "/ncs:devices/ncs:device[ncs:name='FB1']/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
                  }
           }

admin@ncs# packages reload

>>> System upgrade is starting.
>>> Sessions in configure mode must exit to operational mode.
>>> No configuration changes can be performed until upgrade has completed.
>>> System upgrade has been cancelled.
Error: Failed to load ./state/packages-in-use/1/vrf/load-dir/vrf.fxs: /services/vrf/interface/name: Missing keys in symlink: /ncs:devices/ncs:device[ncs:name='FB1']/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id


 

3 REPLIES 3
khgrant
Cisco Employee

 

Hi,

 

 

To access an element within a list you just need to supply the key:

 

URL-For-The-List/key

 

 

Just like you have:

 

/devices/device/FB1

 

 

Thanks,

  Bilal.

 

khgrant
Cisco Employee

Ok. Got it

 

 

---------

 

Thanks

 

Hao Fan   

 

khgrant
Cisco Employee

 

Try normal URL encoding

 

 

http://www.w3schools.com/tags/ref_urlencode.asp

 

 

/ = %2F

 

 

curl -s -u admin:admin http://localhost:8080/api/running/devices/device/xr0/config/cisco-ios-xr:interface/GigabitEthernet/0%2F0%2F0%2F0

 

 

On 30 Aug 2016 at 13:23:21 , Hao Fan (haofan) (haofan@cisco.com) wrote:

 

Hi,

 

curl -s -u admin:admin http://localhost:8080/api/running/devices/device/FB1/config/cisco-ios-xr:interface/GigabitEthernet can show all interface information. How can I only get one interface configurations , such as only get GigabitEthernet 0/0/0/0 configuration ?

 

<collection xmlns:y="http://tail-f.com/ns/rest">

 

  <GigabitEthernet xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

    <id>0/0/0/0</id>

 

<description>connect to FB1</description>

 

    <frequency xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<synchronization xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<quality xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<transmit xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<highest xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

</highest>

 

</transmit>

 

</quality>

 

</synchronization>

 

    </frequency>

 

    <ipv4 xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

      <address xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<ip>11.1.1.2</ip>

 

<mask>255.255.255.0</mask>

 

      </address>

 

      <pim xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

      </pim>

 

      <verify xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<unicast xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

</unicast>

 

      </verify>

 

    </ipv4>

 

    <ipv6 xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

      <nd xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

<prefix xmlns="http://tail-f.com/ned/cisco-ios-xr">

 

</prefix>

 

      </nd>

 

      <verify xmlns="http://tail-f.com/ned/cisco-ios-xr"

 

 

---------

 

Thanks

 

Hao Fan   

 

Create
Recognize Your Peers
Content for Community-Ad