Put address in top bytes for the nexthop in vl_api_fib_path_t (VPP-532)
[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_debug-native/vpp-api/lib64/libpneum.so"
22
23 vpp:init({ pneum_path = pneum_path })
24
25 vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vlib-api/vlibmemory/memclnt.api")
26 vpp:consume_api(root_dir .. "/build-root/install-vpp_debug-native/vpp/vpp-api/vpe.api")
27
28 vpp:connect("aytest")
29
30 -- api calls
31 reply = vpp:api_call("show_version")
32 print("Version: ", reply[1].version)
33 print(vpp.hex_dump(reply[1].version))
34 print(vpp.dump(reply))
35 print("---")
36
37
38 reply = vpp:api_call("cli_inband", { cmd = "show vers" }) 
39 print(vpp.dump(reply))
40 print("---")
41
42
43 vpp:disconnect()
44
45