nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 1 | // Copyright 2018 Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | At the root of the device-management source tree |
| 16 | 1. cd demotest |
| 17 | make demotest |
| 18 | ./demotest |
| 19 | 2. Create another ssh session |
| 20 | cd ./demotest/cmd_cleint |
| 21 | make cmd_cl |
| 22 | ./cmd_cl |
| 23 | |
| 24 | then it will have "CMD to send:" prompt |
| 25 | You can use the following "client cmd" to test. |
| 26 | |
| 27 | Example: |
| 28 | |
| 29 | For the first time, you need to use "attach:ipaddress:port:vendorname:freq" to set the device's IP related info. |
| 30 | If successful, you will get "[ipaddress:port]CMD to send:" prompt to indicate what device you attached now. |
| 31 | This attach will subscribe default 3 types events into the server. |
| 32 | You can use the following wget to check if any events subscriptions on the device. |
| 33 | |
| 34 | wget --no-check-certificate \ |
| 35 | -qO- https://RFSERVERIP:8888/redfish/v1/EventService/Subscriptions/ \ |
| 36 | | python -m json.tool |
| 37 | |
| 38 | You can also use "unsub:add:rm:alert" to unsubscribe all 3 types of event subscriptions on the device. |
| 39 | |
| 40 | And use "QUIT" to leave test. |
| 41 | |
| 42 | -------------------------------------------------------------------------------------- |
| 43 | Test items client cmd |
| 44 | -------------------------------------------------------------------------------------- |
| 45 | set device info Example: |
| 46 | |
| 47 | Set IP 192.168.4.27 port 8888 vendor "edgecore" freq 180 |
| 48 | attach:192.168.4.27:8888:edgecore:180 |
| 49 | -------------------------------------------------------------------------------------- |
dileepbk | 86ef010 | 2019-11-13 00:08:33 +0000 | [diff] [blame] | 50 | set multi-device info Example: |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 51 | |
| 52 | attach:192.168.4.27:8888:edgecore:180 |
| 53 | attach:192.168.3.34:8888:edgecore:180 |
| 54 | -------------------------------------------------------------------------------------- |
dileepbk | 86ef010 | 2019-11-13 00:08:33 +0000 | [diff] [blame] | 55 | Get Current List of Devices monitored showdevices |
| 56 | Return from server: 192.168.4.26:8888,192.168.4.27:8888 |
| 57 | -------------------------------------------------------------------------------------- |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 58 | UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert) unsub:192.168.4.27:8888:add:rm:alert |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 59 | -------------------------------------------------------------------------------------- |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 60 | Subscribe all events(ResourceAdded/ResourceRemoved/Alert) sub:192.168.4.27:8888:add:rm:alert |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 61 | -------------------------------------------------------------------------------------- |
| 62 | Subscribe and unsubscribe an event Example: |
| 63 | |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 64 | Subscribe ResourceAdded event sub:192.168.4.27:8888:add |
| 65 | Subscribe ResourceRemoved event sub:192.168.4.27:8888:rm |
| 66 | Subscribe Alert event sub:192.168.4.27:8888:alert |
| 67 | Unsubscribe ResourceAdded event unsub:192.168.4.27:8888:add |
| 68 | Unsubscribe ResourceRemoved event unsub:192.168.4.27:8888:rm |
| 69 | Unsubscribe Alert event unsub:192.168.4.27:8888:alert |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 70 | -------------------------------------------------------------------------------------- |
| 71 | Subscribe and unsubscribe multiple events, out of order Use the above commands to do test. |
| 72 | -------------------------------------------------------------------------------------- |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 73 | Subscribe an unsupported event sub:192.168.4.27:8888:update |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 74 | -------------------------------------------------------------------------------------- |
| 75 | Subscribe to an already subscribed event Example: |
| 76 | |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 77 | sub:192.168.4.27:8888:add |
| 78 | sub:192.168.4.27:8888:add |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 79 | -------------------------------------------------------------------------------------- |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 80 | Unsubscribe an unsupported event unsub:192.168.4.27:8888:update |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 81 | -------------------------------------------------------------------------------------- |
| 82 | Unsubscribe a supported but not-subscribed event Example: |
| 83 | |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 84 | unsub:192.168.4.27:8888:add:rm:alert |
| 85 | unsub:192.168.4.27:8888:add |
| 86 | unsub:192.168.4.27:8888:rm |
| 87 | unsub:192.168.4.27:8888:alert |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 88 | -------------------------------------------------------------------------------------- |
| 89 | Change polling interval Example: |
| 90 | |
| 91 | Set frequecny to 30 seconds |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 92 | period:192.168.4.27:8888:30 |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 93 | -------------------------------------------------------------------------------------- |
Dinesh Belwalkar | b5db83f | 2019-10-24 17:27:58 +0000 | [diff] [blame] | 94 | Show support event list vendor showeventlist:edgecore |
| 95 | ----------------------------------------------------------------------------------------------- |
| 96 | Show current events subscribed by device showdeviceeventlist:192.168.4.27:8888 |
| 97 | ------------------------------------------------------------------------------------------------------------ |
| 98 | Clear all current events subscribed by device cleardeviceeventlist:192.168.4.27:8888 |
| 99 | ------------------------------------------------------------------------------------------------------------- |
nickhuang | 6b31f8f | 2019-09-26 02:02:14 +0000 | [diff] [blame] | 100 | * During and after each test, verify the list of events subscribed wget --no-check-certificate \ |
| 101 | -qO- https://192.168.4.27:8888/redfish/v1/EventService/Subscriptions/ \ |
| 102 | | python -m json.tool |
| 103 | -------------------------------------------------------------------------------------- |