blob: a3fa45f271910ab831def10d6ceaeba7891f0e35 [file] [log] [blame]
Andrew Yourtchenkofa1456a2016-11-11 16:32:52 +00001--[[
2/*
3 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16]]
17
18
19local vpp = require "vpp-lapi"
20local bit = require("bit")
21
22root_dir = "/home/ubuntu/vpp"
23pneum_path = root_dir .. "/build-root/install-vpp_debug-native/vpp-api/lib64/libpneum.so"
24
25vpp:init({ pneum_path = pneum_path })
26
27vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vlib-api/vlibmemory/memclnt.api")
28vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vpp/vpp-api/vpe.api")
29
30vpp:connect("aytest")
31
32-- api calls
33
34print("Calling API to add a new classifier table")
35reply = vpp:api_call("classify_add_del_table", {
36 context = 43,
37 memory_size = bit.lshift(2, 20),
38 client_index = 42,
39 is_add = 1,
40 nbuckets = 32,
41 skip_n_vectors = 0,
42 match_n_vectors = 1,
43 mask = "\255\255\255\255\255\255\255\255" .. "\255\255\255\255\255\255\255\255"
44})
45print(vpp.dump(reply))
46print("---")
47
48
49vpp:disconnect()
50
51