mc | cd7e950 | 2019-12-16 22:04:13 +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 | |
| 16 | 'dm' is a command line wrapper of the test application 'demotest' serving the purpose of device-management API functional testing. |
| 17 | |
| 18 | It runs on top of the device-management container and 'demotest' requiring the accessibility of at least 2 separate devices running RedFish servers and can be utilized in either automated or manual testing. Either way, the device-mangement container needs to have been deployed (Please refer to Device Management Deployment Guide). |
| 19 | |
| 20 | 1. Test Automation |
| 21 | Test cases utilizing 'dm' are provided in the tests/ sub-directory. They can be executed through either the Makefile or the Robot Framework test suite that are provided. |
| 22 | |
| 23 | a) Makefile |
| 24 | At command line, type |
| 25 | make test IP1=<ip of 1st device> PORT1=<RF port # of 1st device> IP2=<ip of 2nd device> PORT2=<RF port # of 2nd device> |
| 26 | |
| 27 | b) Robot Framework |
| 28 | i) Make and launch 'demotest', which ls located one level up, first. |
| 29 | ii) Modify the test suite with the appropriate ip's and port #'s of the RF servers |
| 30 | iii) At command line, type |
| 31 | robot importer.robot |
| 32 | |
Scott Baker | 5d03e17 | 2020-04-10 14:56:20 -0700 | [diff] [blame^] | 33 | Note: If ../../voltha-system-tests does not exist, and the tests are run without |
| 34 | the use_mock_redfish variable set, then two harmless warnings will be emitted |
| 35 | due to the missing robot voltha imports. These imports are only required |
| 36 | when use_mock_redfish==True. |
| 37 | |
mc | cd7e950 | 2019-12-16 22:04:13 +0000 | [diff] [blame] | 38 | 2. Manual testing at command line |
| 39 | To build 'dm', at command line, type |
| 40 | make |
| 41 | To run 'dm', please make and launch 'demotest' first then follow the syntax and examples below. |
| 42 | |
| 43 | ------------------------------------------------------------------------------- |
| 44 | register one device |
| 45 | Example: Set IP 192.168.4.27 port 8888 freq 180 |
| 46 | ./dm attach 192.168.4.27:8888:180 |
| 47 | |
| 48 | ------------------------------------------------------------------------------- |
| 49 | register multiple devices |
| 50 | Example: Set "IP 192.168.4.27 port 8888 freq 180" and "IP 192.168.4.26 port 8888 freq 120" |
| 51 | ./dm attach 192.168.4.27:8888:180 192.168.4.26:8888:120 |
| 52 | |
| 53 | ------------------------------------------------------------------------------- |
| 54 | delete devices |
| 55 | Example: Delete "IP 192.168.4.27" and "IP 192.168.3.34" |
| 56 | ./dm delete 192.168.4.27:8888 192.168.4.26:8888 |
| 57 | |
| 58 | ------------------------------------------------------------------------------- |
| 59 | Get Current List of Devices monitored |
| 60 | ./dm showdevices |
| 61 | Sample output: 192.168.4.26:8888 192.168.4.27:8888 |
| 62 | |
| 63 | ------------------------------------------------------------------------------- |
| 64 | UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert) |
| 65 | ./dm cleardeviceeventlist 192.168.4.27:8888 |
| 66 | |
| 67 | ------------------------------------------------------------------------------- |
| 68 | Subscribe all events(ResourceAdded/ResourceRemoved/Alert) |
| 69 | ./dm sub 192.168.4.27:8888:add:rm:alert |
| 70 | |
| 71 | ------------------------------------------------------------------------------- |
| 72 | Subscribe and unsubscribe an event |
| 73 | Example: |
| 74 | Subscribe ResourceAdded event |
| 75 | ./dm sub 192.168.4.27:8888:add |
| 76 | Subscribe ResourceRemoved event |
| 77 | ./dm sub 192.168.4.27:8888:rm |
| 78 | Subscribe Alert event |
| 79 | ./dm sub 192.168.4.27:8888:alert |
| 80 | Unsubscribe ResourceAdded event |
| 81 | ./dm unsub 192.168.4.27:8888:add |
| 82 | Unsubscribe ResourceRemoved event |
| 83 | ./dm unsub 192.168.4.27:8888:rm |
| 84 | Unsubscribe Alert event |
| 85 | ./dm unsub 192.168.4.27:8888:alert |
| 86 | |
| 87 | ------------------------------------------------------------------------------- |
| 88 | Subscribe an unsupported event |
| 89 | ./dm sub 192.168.4.27:8888:update |
| 90 | |
| 91 | ------------------------------------------------------------------------------- |
| 92 | Subscribe to an already subscribed event |
| 93 | Example: |
| 94 | ./dm sub 192.168.4.27:8888:add |
| 95 | ./dm sub 192.168.4.27:8888:add |
| 96 | |
| 97 | ------------------------------------------------------------------------------- |
| 98 | Unsubscribe an unsupported event |
| 99 | ./dm unsub 192.168.4.27:8888:update |
| 100 | |
| 101 | ------------------------------------------------------------------------------- |
| 102 | Unsubscribe a supported but not-subscribed event |
| 103 | Example: |
| 104 | ./dm unsub 192.168.4.27:8888:add:rm:alert |
| 105 | ./dm unsub 192.168.4.27:8888:add |
| 106 | ./dm unsub 192.168.4.27:8888:rm |
| 107 | ./dm unsub 192.168.4.27:8888:alert |
| 108 | |
| 109 | ------------------------------------------------------------------------------- |
| 110 | Change polling interval |
| 111 | Example: |
| 112 | Set frequecny to 30 seconds |
| 113 | ./dm period 192.168.4.27:8888:30 |
| 114 | |
| 115 | ------------------------------------------------------------------------------- |
| 116 | Show list of supported event |
| 117 | ./dm showeventlist 192.168.4.27:8888 |
| 118 | |
| 119 | ------------------------------------------------------------------------------- |
| 120 | Show current events subscribed by device |
| 121 | showdeviceeventlist 192.168.4.27:8888 |
| 122 | |
| 123 | ------------------------------------------------------------------------------- |
| 124 | Note: following command can be used to verify the list of events subscribed |
| 125 | wget --no-check-certificate -qO- https://192.168.4.27:8888/redfish/v1/EventService/Subscriptions | python -m json.tool |