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 | vpp = require "vpp-lapi" |
| 19 | |
| 20 | root_dir = "/home/ubuntu/vpp" |
Damjan Marion | 374e2c5 | 2017-03-09 20:38:15 +0100 | [diff] [blame] | 21 | pneum_path = root_dir .. "/build-root/install-vpp_debug-native/vpp-api/lib64/libpneum.so" |
Andrew Yourtchenko | fa1456a | 2016-11-11 16:32:52 +0000 | [diff] [blame] | 22 | |
| 23 | vpp:init({ pneum_path = pneum_path }) |
| 24 | |
Damjan Marion | 374e2c5 | 2017-03-09 20:38:15 +0100 | [diff] [blame] | 25 | vpp:json_api(root_dir .. "/build-root/install-vpp_debug-native/vpp/vpp-api/vpe.api.json") |
Andrew Yourtchenko | fa1456a | 2016-11-11 16:32:52 +0000 | [diff] [blame] | 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 | |