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

109
Views
1
Helpful
3
Replies
khgrant
Cisco Employee

How pick up router interface number in Java Code ?

 

Hi Expert,

 

 

I want to pick up loopback interface number in Java code.

 

 

My test code search loopback interface, but I can not pick up interface number of integer value.

 

I want pick up only “0”,”1”,”2”. How is coding in Java code ?

 

 

<My code>

 

 

           NavuList test1 = managedDevices.elem(customerDevice.valueAsString()).container("config").container("ios","interface").list("Loopback”);

 

 

           for (NavuContainer loopInterface: test1.elements()){

 

             System.out.println(loopInterface);

 

 

//             NavuLeaf loopnum = test1.leaf("name”);        <— here is error

 

//             System.out.println(loopnum.valueAsString());

 

 

           }

 

<Java debug>

 

<INFO> 23-3-2016::17:05:44.606 NcsMain JVM-Launcher: - READ SOCKET =>

NavuListEntry[NavuNodeInfo[Loopback,7,2],/ncs:devices/device{vCPE0}/config/ios:interface/Loopback{0}]

NavuListEntry[NavuNodeInfo[Loopback,7,2],/ncs:devices/device{vCPE0}/config/ios:interface/Loopback{1}]

NavuListEntry[NavuNodeInfo[Loopback,7,2],/ncs:devices/device{vCPE0}/config/ios:interface/Loopback{2}]

 

 

Please advice for me.

 

 

Thanks,

 

Hideomi

 

1 ACCEPTED SOLUTION

Accepted Solutions
khgrant
Cisco Employee

 

Hideomi,

 

 

I want to pick up loopback interface number in Java code.

 

 

My test code search loopback interface, but I can not pick up interface number of integer value.

 

I want pick up only “0”,”1”,”2”. How is coding in Java code ?

 

 

<My code>

 

 

           NavuList test1 = managedDevices.elem(customerDevice.valueAsString()).container("config").container("ios","interface").list("Loopback”);

 

 

           for (NavuContainer loopInterface: test1.elements()){

 

             System.out.println(loopInterface);

 

 

//             NavuLeaf loopnum = test1.leaf("name”);        <— here is error

 

//             System.out.println(loopnum.valueAsString());

 

 

Try NavuLeaf loopnum = loopInterface.leaf("name");

 

 

/jan

 

View solution in original post

3 REPLIES 3
khgrant
Cisco Employee

 

Hideomi,

 

 

I want to pick up loopback interface number in Java code.

 

 

My test code search loopback interface, but I can not pick up interface number of integer value.

 

I want pick up only “0”,”1”,”2”. How is coding in Java code ?

 

 

<My code>

 

 

           NavuList test1 = managedDevices.elem(customerDevice.valueAsString()).container("config").container("ios","interface").list("Loopback”);

 

 

           for (NavuContainer loopInterface: test1.elements()){

 

             System.out.println(loopInterface);

 

 

//             NavuLeaf loopnum = test1.leaf("name”);        <— here is error

 

//             System.out.println(loopnum.valueAsString());

 

 

Try NavuLeaf loopnum = loopInterface.leaf("name");

 

 

/jan

 

khgrant
Cisco Employee

 

You are looping over list elements, but then using list instead of an element. I believe you should do

 

 

loopInterface.leaf("name”)

 

 

Instead of

 

NavuLeaf loopnum = test1.leaf("name”); 

 

 

BR,

 

Bostjan

 

khgrant
Cisco Employee

 

Thanks Jan, Bastjan,

 

 

My debug result will be change.

 

 

0

 

1

 

2

 

 

Thanks very much.

 

 

/Hideomi

 

Create
Recognize Your Peers
Content for Community-Ad