aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin
AgeCommit message (Collapse)AuthorFilesLines
2019-03-22Use httptest instead of http in unit testsKiran Kamineni6-152/+105
Use httptest instead of http in unit tests similar to: https://golang.org/pkg/net/http/httptest/#example_ResponseRecorder Update empty body checking to account for change Issue-ID: MULTICLOUD-545 Change-Id: Ib9775078c2c9ae2878b714363b569d8d79bd7698 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-22Merge "NewRouter supports custom backend clients"Victor Morales3-16/+23
2019-03-21Merge "Remove -a build flag"Victor Morales1-2/+2
2019-03-20Remove -a build flagRitu Sood1-2/+2
-a forces rebuilding of packages that are already up-to-date. This is slowing down builds to several minutes Change-Id: Iac082538b91e60b23dc1a2f3b1f1597e078d7a4a Signed-off-by: Ritu Sood <ritu.sood@intel.com> Issue-ID: MULTICLOUD-301
2019-03-20NewRouter supports custom backend clientsKiran Kamineni3-16/+23
NewRouter needs to support custom clients This is needed where the backend clients are mocked and we need url path parameters to be available in our unit tests. Using the same router code allows us to do this. Issue-ID: MULTICLOUD-547 Change-Id: Id51b6f0a9afe4965efaf2611fc642bccb9ac1d39 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-19Bring in all the other helper codeKiran Kamineni9-38/+377
Bring in all the helper functions added for end to end integration. This allows the api level upload of helm charts, profiles and also instantiation of said helm charts. P3: Plugin index is based on lowercase kind name whereas the map contains the correct case for kind. Convert to lower case before loading the plugin. Changes after rebasing on the new folder structure. Rebasing over the new folder structure P8: Add unit tests for Resolve function Fix the integration tests for createvnf I had to add a huge blob of base64 encoded data based on the profile and sample helm chart to test the flow. P12: Update the integration test with the rb_profile_id parameter Issue-ID: MULTICLOUD-291 Change-Id: If04c41cb185074989ab6c96557958140c43e456d Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-14Upgrade mongo driver to 1.0Kiran Kamineni4-53/+58
Mongo driver 1.0 was released recently Upgrading from 0.2.0 which we were on right now. Issue-ID: MULTICLOUD-530 Change-Id: I6d968e99b129d4307414ec31410505200b7bd47d Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-12Add support for helm templatesKiran Kamineni4-13/+665
Add support for evaluating helm templates The interface provides a way to get a map which contains a mapping from kubernetes kind to the corresponding yaml file that defines a resource of that kind. This map is then provided to the instantiation code at instantiation time to create in the kubernetes cluster. P5: Use filepath.join instead of strings.join P9: rebase with new folder structure P10: moved the helm code into its own package. P12: Add unit tests update the go.mod to use latest docker version Issue-ID: MULTICLOUD-291 Change-Id: Ie75f5c616cc0cdc3e0ace49ff2c2f6c356a4c0d1 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-12Merge "Add support for parsing profile yaml files"Victor Morales20-4/+486
2019-03-11Add support for parsing profile yaml filesKiran Kamineni20-4/+486
Add code to parse profile configuration yaml The parsing function is global and returns a client which can then be used to get or apply specific parts of the configuration on top of an extracted helm chart. P14: Add unit test that covers both ProcessProfileYaml and CopyConfigurationOverrides P15: Adding mock_charts and mock_profiles We expect to reuse these files for other unit tests Issue-ID: ONAPARC-348 Change-Id: I4504d0b158fdfef476b8c2a461d33306926545d7 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-03-11Detect chart nameKiran Kamineni4-20/+128
ChartName should not be mandatory field If not provided it will be detected by inspection of the tar.gz archive. Issue-ID: MULTICLOUD-525 Change-Id: Idaf9672f2cbbb882d78b1987467472ce73c651da Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-30Add net tag to MakefileVictor Morales1-1/+1
The change that removes duplicate plugins make actions I0efecdcb70052b4c0d66102c56e0c715481cb34a didn't consider the flag for net module which it's needed during the runtime. Change-Id: I534c38d017fcc08294e8ca52cc936dea117914e3 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2019-01-28Add support for downloading contentKiran Kamineni6-2/+400
Add support for downloading content for creating the merged helm charts. This api will be used mainly by the profile api to create a converged chart which will then be created by the instantiation code P2: Add unit tests for archive.go Add download method for profile.go Update comments for download method P3: Add unit test for empty files P4: Add unit tests for Download functions P5: Rebase against new folder structure Issue-ID: MULTICLOUD-291 Change-Id: I9779eaf95366f527f0360eaddea663722c13b196 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-28Merge "Remove duplicate plugins make action"Victor Morales1-3/+2
2019-01-25Move api.go functionsVictor Morales3-78/+74
CheckEnvVariables, CheckDatabaseConnection, LoadPlugins and CheckInitialSettings functions are utility functions which are not related with the API. These functions need to be moved to utils.go file. Change-Id: Ie6dfbafe8909962fba31534916a7e0f07ded116b Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2019-01-25Use a standard Go project layoutVictor Morales35-95/+97
This project wasn't following some Standard Go Project Layout guidelines(https://github.com/golang-standards/project-layout). This change pretends to organize the source code and following those guidelines. Change-Id: I61085ac20f28069cede013f83034bed06892d87c Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2019-01-25Add another parameter to the definitionKiran Kamineni4-2/+33
Add a ChartName parameter to definition This is need to explicitly specify the chart name to be used within the tar file. Issue-ID: MULTICLOUD-291 Change-Id: I3d6e20607b74e54801622a6c27d5674777548ee1 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-25Remove duplicate plugins make actionVictor Morales1-3/+2
The action which compiles all the plugins is duplicated in the Makefile. This change remove that duplication to define a consistent build process. Change-Id: I0efecdcb70052b4c0d66102c56e0c715481cb34a Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2019-01-23Add support for tags in the mockdbKiran Kamineni4-103/+151
Add support for tags in mockdb. Needed for supporting unit tests where a method does multiple db calls using same uuid but different tags. Eg: Download methods Issue-ID: MULTICLOUD-455 Change-Id: I4eff8eeb00eac630205e4e186981a53a573b61fa Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-22Merge "Fix sorting with right index value"Victor Morales4-8/+8
2019-01-22Merge "Delete content when a definition is deleted"Victor Morales1-0/+6
2019-01-18Fix sorting with right index valueKiran Kamineni4-8/+8
Fix the less function used in sort.Slice with the right index. I am using the same index which obviously will not work. Issue-ID: MULTICLOUD-439 Change-Id: Ibb78c03d67cf59e3941acc786796d0cc69b4f0aa Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-18Delete content when a definition is deletedKiran Kamineni1-0/+6
When a definition is deleted, delete the content too. Not deleting the content would leave blobs of data that is not connected to any metadata in the mongo database. Issue-ID: MULTICLOUD-393 Change-Id: Ifae55bab0affc22b06b1069a27cd90af6f7d5d98 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-18Account for strings when reading from dbKiran Kamineni1-1/+7
Strings are not returned unmodified by the mongo driver and seem to have a size value prepended to them. Using the built in string reader resolves this issue. Issue-ID: MULTICLOUD-441 Change-Id: I5c5e35b0749a61b741c9b63cfad55bf2720d91bb Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-18Merge "Add resource bundle profile api"Victor Morales11-12/+1212
2019-01-17Add resource bundle profile apiKiran Kamineni11-12/+1212
Add CRUD api for uploading profiles for specific definition resource bundles. - Adding unit tests Issue-ID: ONAPARC-348 Change-Id: Ic43724b4e2c035e7989c827612f1b2800fc49a69 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-17Minor refactoring of definition unit testsKiran Kamineni2-11/+35
The definition unit tests needed some small changes to ensure consistency between the source and the tests. P3: Sort both the slices before running DeepEqual Issue-ID: MULTICLOUD-440 Change-Id: If797322e44321a580cb1441bd5c60b812799f844 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-16Fix order of db create callKiran Kamineni1-1/+1
definition upload code call db create in wrong order This patch fixes that. Issue-ID: MULTICLOUD-438 Change-Id: I7c60308c89b35583bb739cf98e8106f1c738a143 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-16Merge "Check if no document is returned before error"Victor Morales1-0/+5
2019-01-16Bump mongodriver to 0.2.0Kiran Kamineni2-3/+3
Bumping mongodriver version to 0.2.0 This is a driver that has frequent updates and we need to keep on top of those changes Issue-ID: MULTICLOUD-426 Change-Id: Ibfc7bdbfd8c3443886d14560bc22a10483ada76a Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-16Check if no document is returned before errorKiran Kamineni1-0/+5
Check if no document is returned in SingleResult before throwing any error. Issue-ID: MULTICLOUD-435 Change-Id: I9d92ff325701c04af278ba7c9e2bf5a55fd4d9bd Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2019-01-03Bump kubernetes client to 1.12.3Kiran Kamineni2-4/+35
Bumping up the kubernetes client library used to kubernetes 1.12.3 We will move it to v10.0.0 once our k8s deployment moves to 1.13.0 Bumping kubectl version to 1.12.2 as andrewrothstein/ansible-kubectl does not have 1.12.3 in its main.yml Issue-ID: MULTICLOUD-301 Change-Id: Ifb2eaecb794bfdec19d631fdc9ece051d5ebfc60 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2018-12-19Merge "Add Network and OVN4NFV Plugins"Victor Morales15-8/+706
2018-12-14Migrating from consul to mongodb for backendKiran Kamineni13-275/+1126
Migrating to mongodb from consul. The main reason being the value size limitation of 512kb in consul. See https://jira.onap.org/browse/MULTICLOUD-426 for details. This requires a little bit of hierarchy management and data management. We are no longer converting structs to json encoded strings. The underlying db supports structs without any modifications. Also, since Mongo has the concept of collections, each submodule can use its own collection for storage as needed. Definition uses a collection called rbdef right now. P10: Enabling unit tests for mongo.go. This requires the usage of aliased functions. P11: Expanded unit tests for all functions in mongo.go P12: Refactored parameter validation. Removed TestHealthCheck as we are not mocking any of the db commands right now Checking return value of read with an expected value P13: Adding back consul support. Fixing functional test Full consul implementation check and modifications is being tracked by MULTICLOUD-427 P15: Fix ReadAll unit test and corresponding code ReadAll now returns error when no objects are found Issue-ID: MULTICLOUD-426 Change-Id: I42d239b324025fc4ef4e561790aceeff794001ef Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2018-12-05Add Network and OVN4NFV PluginsRitu Sood15-8/+706
This patch includes support for Network Objects through a new plugin. It also add the first sub-module plugin for OVN4NFVK8s support. Change-Id: Ia23c42d50f75a5206e1b6a04052c34e940518428 Signed-off-by: Ritu Sood <ritu.sood@intel.com> Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-303
2018-11-21Add upload backend implementationKiran Kamineni7-5/+396
Upload is a seperate API where it takes a binary stream and stores it. The api supports tar.gz file format only. P2: Check if ID is valid before trying upload Add test with an invalid ID Issue-ID: MULTICLOUD-393 Change-Id: Id636a95823a046e1795d3be72d0214e953a8c5fc Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2018-11-19Reconcile names in code and Jira itemsKiran Kamineni6-278/+279
k8splugin manages deployment of resource bundles and these are not restricted to vnfs. This names' change is to reflect that functionality. P2: using rb instead of resource bundle Issue-ID: MULTICLOUD-410 Change-Id: I09e0b92a8fc13562e1c6bb17dc8bc13de97264d7 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2018-11-13Create UTs to cover DB callsVictor Morales11-456/+980
This change pretends to increase the code coverage creating Unit Tests for the interactions with the Databases. Change-Id: I3b78ebe8ddb131e3c06bcee0065ad5eabeed5677 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2018-11-08Add vnf definition APIs3.0.0-ONAPcasablancaKiran Kamineni13-5/+1008
Adding APIs for POST, GET, LIST (implemented via GET) and DELETE commands on /v1/vnfd base for creating, getting, listing and deleting VNF Definitions. P2: Added unit tests for vnfdhandler.go P3: Add unit tests for serialize and deserialize P4: Integrating review comments P5: Added customizable mocking for vnfdhandler_test P6: Added customizablt mocking for vnfd_test Note that this will soon need to be updated once the db changes go through in patch 71090 Issue-ID: MULTICLOUD-393 Change-Id: Id509bed370ab3bdc572c6ead22324c1ee3dbf82d Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com> Signed-off-by: Victor Morales <victor.morales@intel.com>
2018-10-31Migrate from dep to go modKiran Kamineni5-516/+102
Migrate from dep to go mod which is native package management functionality in golang 1.11 Issue-ID: MULTICLOUD-392 Change-Id: I9a94cb38bd230738d7d0e586e6956b7a46472dd7 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
2018-10-02Merge "Fix build.sh deployment script"Bin Hu1-2/+1
2018-10-01Fix build.sh deployment scriptVictor Morales1-2/+1
The build.sh file didn't include the GOPATH variable which in some cases was causing some building failures. This change includes a source instruction at beginining of the file. Change-Id: I718411fd90ede74decbaac7efc5c065aa5a853fc Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2018-09-29Merge "Improve Services UTs"Victor Morales1-33/+104
2018-09-29Merge "Improve Namespaces UTs"Victor Morales2-31/+67
2018-09-29Merge "Improve Deployments UTs"Victor Morales1-34/+105
2018-09-29Merge "Add UTs for plugins module"Victor Morales2-5/+104
2018-09-26Improve Services UTsVictor Morales1-33/+104
The current implementation of Unit Tests for Services wasn't validating sucessful cases properly. This change fix that gap and increase the coverage number. Change-Id: Ib5daa607f38e490ced471a129a5fa71b2d4eb133 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2018-09-26Improve Deployments UTsVictor Morales1-34/+105
The current implementation of Unit Tests for Deployments wasn't validating sucessful cases properly. This change fix that gap and increase the coverage number. Change-Id: I9b891d700c152c9b57d6b5858867a7439ac83f3f Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2018-09-25Create code coverage reportVictor Morales1-1/+6
The cover action target allows the creation of code coverage report during the Jenkins Job execution, giving an idea of the impact of the change submitted. Change-Id: Ia2b8d57a0f9235ace021baaa6f74370b6656e58f Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
2018-09-25Improve Namespaces UTsVictor Morales2-31/+67
The current implementation of Unit Tests for Namespaces wasn't validating sucessful cases properly. This change fix that gap and increase the coverage number. Change-Id: Iddc0aca3b52ea8ffebca7dccfc94d4d99e052b06 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301