| commit | 5e08a0e8fa4fd9d0156d28f8f4e53e5b176c704a | [log] [tgz] |
|---|---|---|
| author | Adam Israel <adam.israel@canonical.com> | Thu Sep 06 19:22:47 2018 -0400 |
| committer | Adam Israel <adam.israel@canonical.com> | Thu Sep 13 13:01:10 2018 -0400 |
| tree | 9c54be88e745853203f046e6d2a4eb542e6563b1 | |
| parent | 427f57893cb4bf8aebc0b6f56d0cb3f178d23cf1 [diff] |
Tox + Integration testing This commit implements a VNF Descriptor-driven integration test framework, which will lead to integration tests being able to run via jenkins, and more robust testing in general. N2VC: - Allow the use of an event loop passed when instantiating N2VC - Refactor the execution of the initial-config-primitive so that it can be easily re-run, such as the case of when a proxy charm is deployed before the VNF's VM is created. - Refactor GetPrimitiveStatus, to return the status (queued, running, complete, failed) of a primitive. - Add GetPrimitiveOutput, to return the output of a completed primitive - Fix model disconnection when executing a primitive (it was happening in the wrong scope) - Fix wait_for_application, which was previously unused and broken - Add support for parameter's 'data-type' field - Add support for better SSH key management, allowing for a proxy charm to be deployed before the VNF, so that it's public SSH key can be injected when the VNF's VM is created. Integration Tests: The integration tests are intended to exercise the expected functionality of a VNF/charm: deploy the charm, configure it as required (i.e., ssh credentials), and execute the VNF's initial-config-primitives. - test_native_charm: deploy a native charm to a juju-managed machine and verify primitive execution works - test_proxy_charm: deploy a proxy charm, configured to talk to a remote machine, and verify primitive execution works - test_metrics_native: deploy a native charm and collect a metric - test_metrics_proxy: deploy a proxy charm and collect a metric from the vnf - test_no_initial-config-primitive: deploy a vnf without an initial-config-primitive - test_non-string_parameter: deploy a vnf with a non-string parameter in initial-config-primitive - test_no_parameter: deploy a vnf with a primitive with no parameters General: - Add a build target to tox.ini so that a .deb is built via Jenkins TODO (in a follow-up commit): - test multi-vdu, multi-charm - test deploying a native charm to a manually-provisioned machine - Update inline pydoc - Add more integration tests - Add global per-test timeout to catch stalled tests Signed-off-by: Adam Israel <adam.israel@canonical.com> Change-Id: Id322b45d65c44714e8051fc5764f8c20b76d846c
The N2VC library provides an OSM-centric interface to the VCA. This enables any OSM module (SO, LCM, osmclient) to use a standard pattern for communicating with Juju and the charms responsible for configuring a VNF.
N2VC relies on the IM module, enforcing compliance with the OSM Information Model.
This library is in active development for OSM Release FOUR. The interface is subject to change prior to release.
Because this is still in heavy development, there are a few manual steps required to use this library.
# This list is incomplete apt install python3-nose
In order to run the test(s) included in N2VC, you'll need to install Juju locally.
Note: It's not necessary to install the juju library via pip3; N2VC uses a version bundled within the modules/ directory.
snap install lxd snap install juju --classic
There are currently a few limitations with regard to metrics in Juju.
GetMetrics method more often, and discard duplicate values.A basic test has been written to exercise the functionality of the library, and to serve as a demonstration of how to use it.
Export a few environment variables so the test knows where to find the VCA, and the compiled pingpong charm from the devops repository.
# You can find the ip of the VCA by running `juju status -m controller` and looking for the DNS for Machine 0 export VCA_HOST= export VCA_PORT=17070 # You can find these variables in ~/.local/share/juju/accounts.yaml export VCA_USER=admin export VCA_SECRET=PASSWORD
Note: There is a bug in the cleanup of the N2VC/Juju that will throw an exception after the test has finished. This is on the list of things to fix for R4 and should not impact your tests or integration.
nosetests3 --nocapture tests/test_python.py
Many. This is still in active development for Release FOUR.
Exception ignored in: <generator object WebSocketCommonProtocol.close_connection at 0x7f29a3b3f780>
Traceback (most recent call last):
File "/home/stone/.local/lib/python3.6/site-packages/websockets/protocol.py", line 743, in close_connection
if (yield from self.wait_for_connection_lost()):
File "/home/stone/.local/lib/python3.6/site-packages/websockets/protocol.py", line 768, in wait_for_connection_lost
self.timeout, loop=self.loop)
File "/usr/lib/python3.6/asyncio/tasks.py", line 342, in wait_for
timeout_handle = loop.call_later(timeout, _release_waiter, waiter)
File "/usr/lib/python3.6/asyncio/base_events.py", line 543, in call_later
timer = self.call_at(self.time() + delay, callback, *args)
File "/usr/lib/python3.6/asyncio/base_events.py", line 553, in call_at
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 357, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <generator object Queue.get at 0x7f29a2ac6938>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/queues.py", line 169, in get
getter.cancel() # Just in case getter is not done yet.
File "/usr/lib/python3.6/asyncio/base_events.py", line 574, in call_soon
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 357, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <coroutine object AllWatcherFacade.Next at 0x7f29a3bd9990>
Traceback (most recent call last):
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/client/facade.py", line 412, in wrapper
reply = await f(*args, **kwargs)
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/client/_client1.py", line 59, in Next
reply = await self.rpc(msg)
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/client/overrides.py", line 104, in rpc
result = await self.connection.rpc(msg, encoder=TypeEncoder)
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/client/connection.py", line 306, in rpc
result = await self._recv(msg['request-id'])
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/client/connection.py", line 208, in _recv
return await self.messages.get(request_id)
File "/home/stone/src/osm/N2VC/modules/libjuju/juju/utils.py", line 61, in get
value = await self._queues[id].get()
File "/usr/lib/python3.6/asyncio/queues.py", line 169, in get
getter.cancel() # Just in case getter is not done yet.
File "/usr/lib/python3.6/asyncio/base_events.py", line 574, in call_soon
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 357, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
To update the libjuju module:
Needs to be fully tested:
git checkout master git subtree pull --prefix=modules/libjuju/ --squash libjuju master <resolve any merge conflicts> git merge --continue