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