| // Copyright 2018 Open Networking Foundation |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| |
| 'dm' is a command line wrapper of the test application 'demotest' serving the purpose of device-management API functional testing. |
| |
| 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). |
| |
| 1. Test Automation |
| 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. |
| |
| a) Makefile |
| At command line, type |
| make test IP1=<ip of 1st device> PORT1=<RF port # of 1st device> IP2=<ip of 2nd device> PORT2=<RF port # of 2nd device> |
| |
| b) Robot Framework |
| i) Make and launch 'demotest', which ls located one level up, first. |
| ii) Modify the test suite with the appropriate ip's and port #'s of the RF servers |
| iii) At command line, type |
| robot importer.robot |
| |
| Note: If ../../voltha-system-tests does not exist, and the tests are run without |
| the use_mock_redfish variable set, then two harmless warnings will be emitted |
| due to the missing robot voltha imports. These imports are only required |
| when use_mock_redfish==True. |
| |
| 2. Manual testing at command line |
| To build 'dm', at command line, type |
| make |
| To run 'dm', please make and launch 'demotest' first then follow the syntax and examples below. |
| |
| ------------------------------------------------------------------------------- |
| register one device |
| Example: Set IP 192.168.4.27 port 8888 freq 180 |
| ./dm attach 192.168.4.27:8888:180 |
| |
| ------------------------------------------------------------------------------- |
| register multiple devices |
| Example: Set "IP 192.168.4.27 port 8888 freq 180" and "IP 192.168.4.26 port 8888 freq 120" |
| ./dm attach 192.168.4.27:8888:180 192.168.4.26:8888:120 |
| |
| ------------------------------------------------------------------------------- |
| delete devices |
| Example: Delete "IP 192.168.4.27" and "IP 192.168.3.34" |
| ./dm delete 192.168.4.27:8888 192.168.4.26:8888 |
| |
| ------------------------------------------------------------------------------- |
| Get Current List of Devices monitored |
| ./dm showdevices |
| Sample output: 192.168.4.26:8888 192.168.4.27:8888 |
| |
| ------------------------------------------------------------------------------- |
| UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert) |
| ./dm cleardeviceeventlist 192.168.4.27:8888 |
| |
| ------------------------------------------------------------------------------- |
| Subscribe all events(ResourceAdded/ResourceRemoved/Alert) |
| ./dm sub 192.168.4.27:8888:add:rm:alert |
| |
| ------------------------------------------------------------------------------- |
| Subscribe and unsubscribe an event |
| Example: |
| Subscribe ResourceAdded event |
| ./dm sub 192.168.4.27:8888:add |
| Subscribe ResourceRemoved event |
| ./dm sub 192.168.4.27:8888:rm |
| Subscribe Alert event |
| ./dm sub 192.168.4.27:8888:alert |
| Unsubscribe ResourceAdded event |
| ./dm unsub 192.168.4.27:8888:add |
| Unsubscribe ResourceRemoved event |
| ./dm unsub 192.168.4.27:8888:rm |
| Unsubscribe Alert event |
| ./dm unsub 192.168.4.27:8888:alert |
| |
| ------------------------------------------------------------------------------- |
| Subscribe an unsupported event |
| ./dm sub 192.168.4.27:8888:update |
| |
| ------------------------------------------------------------------------------- |
| Subscribe to an already subscribed event |
| Example: |
| ./dm sub 192.168.4.27:8888:add |
| ./dm sub 192.168.4.27:8888:add |
| |
| ------------------------------------------------------------------------------- |
| Unsubscribe an unsupported event |
| ./dm unsub 192.168.4.27:8888:update |
| |
| ------------------------------------------------------------------------------- |
| Unsubscribe a supported but not-subscribed event |
| Example: |
| ./dm unsub 192.168.4.27:8888:add:rm:alert |
| ./dm unsub 192.168.4.27:8888:add |
| ./dm unsub 192.168.4.27:8888:rm |
| ./dm unsub 192.168.4.27:8888:alert |
| |
| ------------------------------------------------------------------------------- |
| Change polling interval |
| Example: |
| Set frequecny to 30 seconds |
| ./dm period 192.168.4.27:8888:30 |
| |
| ------------------------------------------------------------------------------- |
| Show list of supported event |
| ./dm showeventlist 192.168.4.27:8888 |
| |
| ------------------------------------------------------------------------------- |
| Show current events subscribed by device |
| showdeviceeventlist 192.168.4.27:8888 |
| |
| ------------------------------------------------------------------------------- |
| Note: following command can be used to verify the list of events subscribed |
| wget --no-check-certificate -qO- https://192.168.4.27:8888/redfish/v1/EventService/Subscriptions | python -m json.tool |