Repair Doxygen build infrastructure
[vpp.git] / vpp-api / lua / examples / example-cli.lua
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 vpp = require "vpp-lapi"
19
20 root_dir = "/home/ubuntu/vpp"
21 pneum_path = root_dir .. "/build-root/install-vpp_lite_debug-native/vpp-api/lib64/libpneum.so"
22
23 vpp:init({ pneum_path = pneum_path })
24
25 vpp:json_api(root_dir .. "/build-root/install-vpp_lite_debug-native/vpp/vpp-api/vpe.api.json")
26
27 vpp:connect("aytest")
28
29 -- api calls
30 reply = vpp:api_call("show_version")
31 print("Version: ", reply[1].version)
32 print(vpp.hex_dump(reply[1].version))
33 print(vpp.dump(reply))
34 print("---")
35
36
37 reply = vpp:api_call("cli_inband", { cmd = "show vers" }) 
38 print(vpp.dump(reply))
39 print("---")
40
41
42 vpp:disconnect()
43
44