Harald Welte | 830026a | 2020-03-04 15:48:49 +0100 | [diff] [blame] | 1 | [[remsim-apitool]] |
| 2 | == remsim-apitool.py |
| 3 | |
| 4 | `remsim-apitool.py` is a small python script whic can be used to manually |
| 5 | control `osmo-remsim-server` via its RESTful interface in setups where |
| 6 | no external back-end application is controlling this interface. |
| 7 | |
| 8 | For more information about The RESTful inteface, see <<RSRES>>. |
| 9 | |
| 10 | === Usage |
| 11 | |
| 12 | Common command line arguments that can be used with any of the commands below: |
| 13 | |
| 14 | *-H, --host HOST*:: |
| 15 | Specify the hostname / IP of the `osmo-remsim-server` to connect to. Default: localhost |
| 16 | *-P, --port PORT*:: |
| 17 | Specify the remote TCP port of the RSRES interface of `osmo-remsim-server`. Default: 9997 |
| 18 | *-v, --verbose* |
| 19 | Increase verbosity of output: Show the GET request generated, not just the response. |
| 20 | |
| 21 | ==== Listing connected clients |
| 22 | |
| 23 | The command `remsim-apitool.py -c` can be used to list all currently connected clients. |
| 24 | |
| 25 | ---- |
| 26 | $ remsim-apitool.py -c |
| 27 | /clients: {'clients': [{'peer': 'C23:0', 'state': 'CONNECTED_CLIENT', 'component_id': {'type_': 'remsimClient', 'name': 'nataraja', 'software': 'remsim-client', 'swVersion': '0.2.2.63-844b'}}]} |
| 28 | ---- |
| 29 | |
| 30 | ==== Listing connected bankds |
| 31 | |
| 32 | The command `remsim-apitool.py -b` can be used to list all currently connected bankds. |
| 33 | |
| 34 | ---- |
| 35 | $ remsim-apitool.py -b |
| 36 | /banks: {'banks': [{'peer': 'B1', 'state': 'CONNECTED_BANKD', 'component_id': {'type_': 'remsimBankd', 'name': 'fixme-name', 'software': 'remsim-bankd', 'swVersion': '0.2.2.46-3598'}, 'bankId': 1, 'numberOfSlots': 5}]} |
| 37 | ---- |
| 38 | |
| 39 | ==== Listing installed slotmaps |
| 40 | |
| 41 | The command `remsim-apitool.py -s` can be used to list all currently installed slotmaps. |
| 42 | |
| 43 | ---- |
| 44 | $ remsim-apitool.py -s |
| 45 | /slotmaps: {'slotmaps': [{'bank': {'bankId': 1, 'slotNr': 1}, 'client': {'clientId': 23, 'slotNr': 0}, 'state': 'ACTIVE'}]} |
| 46 | ---- |
| 47 | |
| 48 | ==== Listing all information |
| 49 | |
| 50 | The command `remsim-apitool.py -a` can be used to list all information (clients, bankds, slotmaps). |
| 51 | |
| 52 | ---- |
| 53 | $ remsim-apitool.py -a |
| 54 | /clients: {'clients': [{'peer': 'C23:0', 'state': 'CONNECTED_CLIENT', 'component_id': {'type_': 'remsimClient', 'name': 'nataraja', 'software': 'remsim-client', 'swVersion': '0.2.2.63-844b'}}]} |
| 55 | /banks: {'banks': [{'peer': 'B1', 'state': 'CONNECTED_BANKD', 'component_id': {'type_': 'remsimBankd', 'name': 'fixme-name', 'software': 'remsim-bankd', 'swVersion': '0.2.2.46-3598'}, 'bankId': 1, 'numberOfSlots': 5}]} |
| 56 | /slotmaps: {'slotmaps': [{'bank': {'bankId': 1, 'slotNr': 1}, 'client': {'clientId': 23, 'slotNr': 0}, 'state': 'ACTIVE'}]} |
| 57 | ---- |
| 58 | |
| 59 | ==== Creating a slotmap |
| 60 | |
| 61 | The command `remsim-apitool.py -m bank_id bankd_slot client_id client_slot` can be used to create a new slotmap. |
| 62 | |
| 63 | .Create a slotmap between Bankd 1 Slot a (B1:1) and Client 23 Slot 0 (C23:0) |
| 64 | ---- |
| 65 | $ remsim-apitool.py -m 1 1 23 0 |
| 66 | ---- |
| 67 | |
| 68 | ==== Deleting a slotmap |
| 69 | |
| 70 | The command `remsim-apitool.py -d bank_id bank_slot` can be used to create a new slotmap. |
| 71 | |
| 72 | .Remove a slotmap for Bankd 1 Slot a (B1:1) |
| 73 | ---- |
| 74 | $ remsim-apitool.py -m 1 1 |
| 75 | ---- |
| 76 | |
| 77 | ==== Reset all state |
| 78 | |
| 79 | The command `remsim-apitool.py -r` can be used to reset all state in bankd, including all slotmaps. |
| 80 | |
| 81 | ---- |
| 82 | $ remsim-apitool.py -r |
| 83 | ---- |
| 84 | |
| 85 | WARNING: Use with extreme caution, particularly in production environments. |