cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
799
Views
0
Helpful
1
Replies

For kickers we have action right, how to differentiate operations like create, modify, delete in actions

kiran kotari
Cisco Employee
Cisco Employee

Is there any documentation about action.

In subscriber we can differentiate operations like on create, on modify, on delete, e.t.c. can we differentiate the operations in actions as well. 

1 Accepted Solution

Accepted Solutions

spudukko
Cisco Employee
Cisco Employee

Hi Kiran,

You can check this under ncs examples  and developer guide ( path : ncs-4.5.3/examples.ncs/web-server-farm/web-site-service) .  You can use maapi.diffIterate. You can read about the api from api reference under (ncs-4.5.3/doc/api/java/index.html) search for maapi and



The example uses kicker:action-input-params and is part of ncs examples


YANG:

    container actions {

      tailf:action diffcheck {

        tailf:actionpoint diffcheck;

        input {

          uses kicker:action-input-params;

        }

        output {

        }

      }

    }

  }

JAVA call back :

    @ActionCallback(callPoint="diffcheck", callType=ActionCBType.ACTION)

    public ConfXMLParam[] diffcheck(DpActionTrans trans, ConfTag name,

                                   ConfObject[] kp, ConfXMLParam[] params)

    throws DpCallbackException {

        try {

            System.out.println("-------------------");

            System.out.println(params[0]);

            System.out.println(params[1]);

            System.out.println(params[2]);

            ConfUInt32 val = (ConfUInt32) params[2].getValue();

            int tid = (int)val.longValue();

            Socket s3 = new Socket("127.0.0.1", Conf.NCS_PORT);

            Maapi maapi3 = new Maapi(s3);

            maapi3.attach(tid, -1);

            maapi3.diffIterate(tid, new MaapiDiffIterate() {

                // Override the Default iterate function in the TestCase class

                public DiffIterateResultFlag iterate(ConfObject[] kp,

                                                     DiffIterateOperFlag op,

                                                     ConfObject oldValue,

                                                     ConfObject newValue,

                                                     Object initstate) {

                    System.out.println("path = " + new ConfPath(kp));

                    System.out.println("op = " + op);

                    System.out.println("newValue = " + newValue);

                    return DiffIterateResultFlag.ITER_RECURSE;

                }

            });

            maapi3.detach(tid);

            s3.close();

}

View solution in original post

1 Reply 1

spudukko
Cisco Employee
Cisco Employee

Hi Kiran,

You can check this under ncs examples  and developer guide ( path : ncs-4.5.3/examples.ncs/web-server-farm/web-site-service) .  You can use maapi.diffIterate. You can read about the api from api reference under (ncs-4.5.3/doc/api/java/index.html) search for maapi and



The example uses kicker:action-input-params and is part of ncs examples


YANG:

    container actions {

      tailf:action diffcheck {

        tailf:actionpoint diffcheck;

        input {

          uses kicker:action-input-params;

        }

        output {

        }

      }

    }

  }

JAVA call back :

    @ActionCallback(callPoint="diffcheck", callType=ActionCBType.ACTION)

    public ConfXMLParam[] diffcheck(DpActionTrans trans, ConfTag name,

                                   ConfObject[] kp, ConfXMLParam[] params)

    throws DpCallbackException {

        try {

            System.out.println("-------------------");

            System.out.println(params[0]);

            System.out.println(params[1]);

            System.out.println(params[2]);

            ConfUInt32 val = (ConfUInt32) params[2].getValue();

            int tid = (int)val.longValue();

            Socket s3 = new Socket("127.0.0.1", Conf.NCS_PORT);

            Maapi maapi3 = new Maapi(s3);

            maapi3.attach(tid, -1);

            maapi3.diffIterate(tid, new MaapiDiffIterate() {

                // Override the Default iterate function in the TestCase class

                public DiffIterateResultFlag iterate(ConfObject[] kp,

                                                     DiffIterateOperFlag op,

                                                     ConfObject oldValue,

                                                     ConfObject newValue,

                                                     Object initstate) {

                    System.out.println("path = " + new ConfPath(kp));

                    System.out.println("op = " + op);

                    System.out.println("newValue = " + newValue);

                    return DiffIterateResultFlag.ITER_RECURSE;

                }

            });

            maapi3.detach(tid);

            s3.close();

}