Revert "Revert "Clean up commented or unused code"" This reverts commit c1cf1b9a33dd1929fb834424626661f9c9dce64d. Code Clean up approved by TSC on Feb 2nd Change-Id: I069215c71aaebf3cf7009a3538e4e5112e66103d
Revert "Clean up commented or unused code" This reverts commit b4e7f5c425df48f7e946d792184d1d1b44879fe9. Change-Id: I31a65516e65c3eb6528f241e36c1e45f3753f4c0 Signed-off-by: David Garcia <david.garcia@canonical.com>
Clean up commented or unused code Change-Id: Ib116128c15d727b9124e51d2475556045b79ac0d Signed-off-by: David Garcia <david.garcia@canonical.com>
Update to use safe_load The use of a bare yaml.load with no Loader is deprecated. Use the sugar shortcut safe_load per https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation Change-Id: I856d4263fcf20453157f9d3835289e665d1664bf Signed-off-by: Adam Israel <adam.israel@canonical.com>
Revert change 8b1bcf0 Change-Id: I85fd9a038aa123eaf9b216e9d15f709cef7a808a Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
minor fix in yaml load with Loader Change-Id: I1bc0e7197f6057c942490b710fbaf25013202ecb Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
Remove dependency on vendored libjuju This patch removes the dependency on the embedded version of libjuju, instead relying on the upstream library. Change-Id: I88bd762006e5a182eaea74b5eba636ad03d524b0 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Fix bug 760 This commit fixes bug 670 by introducing a new PrimitiveDoesNotExist exception that will be raised if ExecutePrimitive is called but the primitive does not exist in the charm. This also bumps the required version of websocket to match libjuju, along with other minor tweaks to the test framework Change-Id: I028c3c9c19fbfa87c8feb788446a290d66112043 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Align machine_spec with pydoc Align the name of the machine_spec keys as defined in the pydoc Change-Id: I3e9c3609ea81b53b77cefcda63bbb4a8b0c6510c Signed-off-by: Adam Israel <adam.israel@canonical.com>
Add Juju Public Key This commit adds the requirement to provide the Juju public key to N2VC - Updates integration testing to use public key - Updates N2VC to accept juju_public_key and ca-cert - Updated docstring of N2VC constructor Change-Id: I4cad1f8c39024137a23060000d7502aad56ac644 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Bug 666: Fix window_size overflow with Paramiko This commit fixes integration testing around bug fixes in the sshproxy layer that were causing a window_size overflow. This also improves reliability around testing machine charms, by verifying the sshd service is running inside the target machine (lxd) before running tests. Change-Id: I465d51521bf87b8e4b3dc5cac07c163fac836393 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Merge "Fix bug 564"
Fix bug 564 This fixes bug 684, which noted that the workload message was not being passed to the callback when removing charms. This also fixes some lint errors and adds tear-down of the per-ns model in integration tests Change-Id: I83be9e3d951cf10a7479ea2e55074526403cf674 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Fix bug 601 This fixes bug 601, where a charm in a broken state would fail to be removed. This builds of of the new DestroyNetworkService method, which will remove a model containing a network service. There is no way, currently, to resolve errors on an individual charm through the Juju API (client), but removing the model will force the removal of a broken charm. Change-Id: I47f41991ed444395061b5a20e5a51059950e5200 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Fix bug 628 - Better handling of model management In order to address the issue raised in bug 628, we've improved the handling of how N2VC creates and destroys models. Previously this was done transparently, but now they are explicit operations that will need to be performed by the LCM. The LCM will be required to call `CreateNetworkService()` prior to calling `DeployCharms`. This will return True if successful, or raise an exception if the model can't be created. After LCM has called `RemoveCharms()`, it will need to call `DestroyNetworkService()` to remove the model from the Juju controller. - Fix lint errors - Implement the `DestroyNetworkService` method, which will destroy the model per Network Service, and any applications deployed to it. - Adds a new test for creating and deleting models - Add `CreateNetworkService` to explicitly create a new model for a Network Service. - Add proper return values from `logout()` so we can assert against it during tests - Add dependency on pytest-assume so we can test multiple failures per test. This allows us to properly assert and still tear down the juju client. - Use pytest.assume. If a method asserts, we can continue with the teardown of the client. Change-Id: I3031b008f4ed79f978ecd84ade72e125153729a7 Signed-off-by: Adam Israel <adam.israel@canonical.com>
Add per-network service models In part to address, Bug 585, this patch drops the use of the "default" Juju model and instead creates a model per network service (which is required to be passed to N2VC methods). Change-Id: I31cfd56d71697066ff9c11df9c7607c791470cfa Signed-off-by: Adam Israel <adam.israel@canonical.com>
Secure Key Management This patchset implements the Secure Key Management feature as described in Gerrit 1429, enabling support for native charms deployed to machines provisioned by the Resource Orchestrator. - Implement GetPublicKey, which will provide the public key to be injected into new machines - Support machine placement, to provision an existing machine for use with juju - Automatically create a SSH keypair to be used for provisioning - Add method to check if a charm is deployed (CI) - Update integration tests to use new ssh key workflow Signed-off-by: Adam Israel <adam.israel@canonical.com> Change-Id: Iacd2f02800484fd90945f9b9c1ac2d8951115a76
Improved integration tests This merge includes a refactored integration test framework, to better take advantage of asyncio, and clarifies the test logic so it's easier to extend in the future. It also supports testing of more complex VNFs, such as multi-vdu, multi-charm VNFs. n2vc/vnf.py: - Remove duplicate status filtering, as it was a poor solution and lead to situations where some callbacks were not sent. - Added an internal refcount to track libjuju instantiation (helpful in debugging) tests/charms/layers/proxy-ci/reactive/proxy_ci.py: - Fix name of install function (remove confusion while reading logs) tests/base.py: - Add debug() for more consistent and useful logging - Refactor: remove parse_metrics - Improved error handling - Better LXD network connectivity verification - Refactor test framework: - Better use of async coded - Make handling of test phase more robust - Support more complex test cases, such as multi-vdu, multi-charm tests/integration/* - Update to use refactored test framework Other: - `make clean` now removes charm artifacts in tests/charms/builds/ - `make lint` now ignores charm artifacts Signed-off-by: Adam Israel <adam.israel@canonical.com> Change-Id: I43a6d573a7bafdfe3ccb0bb0f0f7d75dcc9c42b1
[WIP] Multi-vdu, multi-charm support This work-in-progress adds support + integration testing for multi-vdu, multi-charm VNFs TODO: - Resolve race condition causing some tests to hang or not clean up properly Signed-off-by: Adam Israel <adam.israel@canonical.com> Change-Id: Ibb6c93bb622c5807ed136cabc0c3b1cfcc50bdbf
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