blob: 85425caff0b132e5e7f6a3b3f8b6eea8daf61675 [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
18vpp = require "vpp-lapi"
19
20root_dir = "/home/ubuntu/vpp"
Damjan Marion374e2c52017-03-09 20:38:15 +010021pneum_path = root_dir .. "/build-root/install-vpp_debug-native/vpp-api/lib64/libpneum.so"
Andrew Yourtchenkofa1456a2016-11-11 16:32:52 +000022
23vpp:init({ pneum_path = pneum_path })
24
Damjan Marion374e2c52017-03-09 20:38:15 +010025vpp:json_api(root_dir .. "/build-root/install-vpp_debug-native/vpp/vpp-api/vpe.api.json")
Andrew Yourtchenkofa1456a2016-11-11 16:32:52 +000026
27vpp:connect("aytest")
28
29-- api calls
30reply = vpp:api_call("show_version")
31print("Version: ", reply[1].version)
32print(vpp.hex_dump(reply[1].version))
33print(vpp.dump(reply))
34print("---")
35
36
37reply = vpp:api_call("cli_inband", { cmd = "show vers" })
38print(vpp.dump(reply))
39print("---")
40
41
42vpp:disconnect()
43
44