Andrew Yourtchenko | fa1456a | 2016-11-11 16:32:52 +0000 | [diff] [blame^] | 1 | --[[ |
| 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 | |
| 19 | local vpp = require "vpp-lapi" |
| 20 | local bit = require("bit") |
| 21 | |
| 22 | root_dir = "/home/ubuntu/vpp" |
| 23 | pneum_path = root_dir .. "/build-root/install-vpp_debug-native/vpp-api/lib64/libpneum.so" |
| 24 | |
| 25 | vpp:init({ pneum_path = pneum_path }) |
| 26 | |
| 27 | vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vlib-api/vlibmemory/memclnt.api") |
| 28 | vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vpp/vpp-api/vpe.api") |
| 29 | |
| 30 | vpp:connect("aytest") |
| 31 | |
| 32 | -- api calls |
| 33 | |
| 34 | print("Calling API to add a new classifier table") |
| 35 | reply = 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 | }) |
| 45 | print(vpp.dump(reply)) |
| 46 | print("---") |
| 47 | |
| 48 | |
| 49 | vpp:disconnect() |
| 50 | |
| 51 | |