Skip to content

Commit

Permalink
new-cnf-installation: Fully transition to new CNF installation method
Browse files Browse the repository at this point in the history
Remove old installation method, use the new one instead.
Change specs accordingly.
Remove unnecessary config parameters.
Fully enable multiple deployments installation.

Refs: #2169
Signed-off-by: Konstantin Yarovoy <[email protected]>
  • Loading branch information
kosstennbl committed Nov 18, 2024
1 parent 7621efb commit 2a2d6d1
Show file tree
Hide file tree
Showing 62 changed files with 376 additions and 1,361 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.swp
*.swo
/cnfs
/installed_cnf_files
/results
/tools/chaos_mesh
/tools/helm
Expand Down
22 changes: 3 additions & 19 deletions CNF_TESTSUITE_YML_USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Missing config version is presumed to be config version `"v1"`, which is not sup

#### Common Parameters

Common parameters are required for proper functioning of some tests. If these parameters are not set up, corresponding tests will be failed/skipped or would not function properly (in example - whitelist_container_names).
Common parameters are required for proper functioning of some tests. If these parameters are not set up, corresponding tests will be failed/skipped or would not function properly (in example - white_list_container_names).
`common: ...`

##### container_names
Expand All @@ -78,7 +78,7 @@ Array of container parameters for rolling version change tests, example:
rollback_from_tag: 1.8.0


##### whitelist_container_names
##### white_list_container_names

The values of this key are the names of the 'containers' defined in the Kubernetes pod spec of pods that are allowed to be running in privileged mode. (Optional)
This value is used to allow 'particular' pods to run in privileged mode on the K8s cluster where the CNF is installed.
Expand Down Expand Up @@ -118,25 +118,9 @@ image_registry_fqdns:

Described below: [link](#5G-parameters)

#### Dynamic parameters

Dynamic parameters are not meant to be set up manually. They exist due to limitations of testsuite design.

##### source_cnf_dir

Directory where config is located.

##### destintaion_cnf_dir

Internal directory where CNF installation files are copied, currently in `cnfs` folder

##### installation_method

Installation method of the CNF and additional info according to it.

#### Deployments

Deployments are defined as three arrays, each for different installation method. Each array element represents one deployment, and they are meant to represent a single CNF together (Not implemented yet).
Deployments are defined as three arrays, each for different installation method. Each array element represents one deployment, and they are meant to represent a single CNF together.
At least one deployment should exist in CNF config for it to be a proper config.
All info for deployments is used in cnf_setup and cnf_cleanup tasks.

Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ For more details on points, see our [POINTS.md](./POINTS.md) documentation.

#### Cleaning Up

Run the following to cleanup the specific cnf-testsuite test (this is assuming you installed the cnf-testsuite.yml in your present working directory):
Run the following to uninstall the CNF (this is assuming you installed the cnf-testsuite.yml in your present working directory):
```
cnf-testsuite cnf_cleanup cnf-config=./cnf-testsuite.yml
cnf-testsuite cnf_cleanup
```
You can also run `cleanall` and cnf-testsuite will attempt to cleanup everything.

Expand Down
6 changes: 3 additions & 3 deletions SOURCE_INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ crystal spec

### Setup

Now that we have a `cnf-testsuite` binary, we can run `setup` to ensure it has all the pre-requisites needed in order to successfully run tests and setup required cnfs/ directory and other files required for cnf-testsuite.
Now that we have a `cnf-testsuite` binary, we can run `setup` to ensure it has all the pre-requisites needed in order to successfully run tests and setup required installed_cnf_files/ directory and other files required for cnf-testsuite.

- Run the following to setup cnf-testsuite:
```
Expand Down Expand Up @@ -255,10 +255,10 @@ For more details on points, see our [POINTS.md](./POINTS.md) documentation.

#### Cleaning Up

Run the following to cleanup the specific cnf-testsuite test:
Run the following to uninstall the CNF:

```
./cnf-testsuite cnf_cleanup cnf-config=./cnf-testsuite.yml
./cnf-testsuite cnf_cleanup
```

You can also run `cleanall` and cnf-testsuite will attempt to cleanup everything.
Expand Down
4 changes: 2 additions & 2 deletions example-cnfs/coredns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Run the all the tests

Check the results file

Cleanup the cnf test setup (including undeployment of CoreDNS)
Uninstall the CNF (including undeployment of CoreDNS)

```
./cnf-testsuite cnf_cleanup cnf-path=example-cnfs/coredns
./cnf-testsuite cnf_cleanup
```
4 changes: 2 additions & 2 deletions example-cnfs/envoy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Run the test suite:
./cnf-testsuite all
```

Envoy cleanup
Envoy uninstallation

```
./cnf-testsuite cnf_cleanup cnf-path=example-cnfs/envoy
./cnf-testsuite cnf_cleanup
```
13 changes: 2 additions & 11 deletions example-cnfs/ip-forwarder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,10 @@ export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite cnf_setup cnf-path=example
### Testing
Run the test suite: `export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite all`

### Automated cleanup
### Automated uninstallation
```
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite cnf_cleanup cnf-path=example-cnfs/ip-forwarder/cnf-testsuite.yml
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite cnf_cleanup
```

### Manual installation
1. Install helm version 3
1. Make the cnfs/ip-forwarder diretory
1. If you are testing the cnf source, clone the source into the cnfs/ip-forwarder directory
1. Copy the cnf-testsuite.yml into the cnfs/ip-forwarder directory
1. Deploy the CNF using helm: `helm install cnfs/ip-forwarder/vpp`
1. Wait for the installation to finish (all pods are ready)
1. Run the test suite: `export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite all`



4 changes: 2 additions & 2 deletions example-cnfs/linkerd2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Run the test suite:
./cnf-testsuite all
```

linkerd cleanup
linkerd uninstallation

```
./cnf-testsuite cnf_cleanup cnf-path=example-cnfs/linkerd2/cnf-testsuite.yml
./cnf-testsuite cnf_cleanup
```
4 changes: 2 additions & 2 deletions example-cnfs/nsm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Run the all the tests

Check the results file

Cleanup the cnf test setup (including undeployment of NSM)
Uninstall the CNF (including undeployment of NSM)

```
./cnf-testsuite cnf_cleanup cnf-config=./example-cnfs/nsm/cnf-testsuite.yml
./cnf-testsuite cnf_cleanup
```
5 changes: 2 additions & 3 deletions example-cnfs/pantheon-nsm-nat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ Run the all the tests

Check the results file

Cleanup the cnf test setup (including undeployment of nsm-nat)
Uninstall the CNF (including undeployment of nsm-nat)

```
./cnf-testsuite cnf_cleanup cnf-config=./example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml
./cnf-testsuite cnf_cleanup cnf-config=./example-cnfs/nsm/cnf-testsuite.yml
./cnf-testsuite cnf_cleanup
```
4 changes: 2 additions & 2 deletions example-cnfs/pantheon-nsm-nat/nat-cnf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ crystal src/cnf-testsuite.cr all

Check the results file

Cleanup the cnf test setup (including undeployment of nsm-nat)
Uninstall the CNF (including undeployment of nsm-nat)

```
crystal src/cnf-testsuite.cr cnf_cleanup cnf-config=./example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml
crystal src/cnf-testsuite.cr cnf_cleanup
```
15 changes: 3 additions & 12 deletions example-cnfs/vpp-3c2n-csp-use-case/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,14 @@ export KUBECONFIG=$(pwd)/<YourKubeConf> ; ./cnf-testsuite setup

Setup and deploy service chain
```
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite example_cnf_setup example-cnf-path=example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite cnf_setup example-cnf-path=example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml
```

### Testing
Run the test suite: `export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite all`

### Automated cleanup
### Automated uninstallation
```
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite example_cnf_cleanup example-cnf-path=example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml
export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite cnf_cleanup
```

### Manual installation
1. Install helm version 3
1. Make the cnfs/vpp-3c2n-csp-use-case diretory
1. If you are testing the cnf source, clone the source into the cnfs/vpp-3c2n-csp-use-case directory
1. Copy the cnf-testsuite.yml into the cnfs/vpp-3c2n-csp-use-case directory
1. Deploy the service chain using helm: `helm install vpp-3c2n-csp-use-case cnfs/csp`
1. Wait for the installation to finish (all pods are ready)
1. Run the test suite: `export KUBECONFIG=$(pwd)/admin.conf ; ./cnf-testsuite all`

8 changes: 4 additions & 4 deletions spec/5g/core_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe "Core" do
result = ShellCmd.run_testsuite("smf_upf_heartbeat verbose")
(/(PASSED).*(Chaos service degradation is less than 50%)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
Expand All @@ -29,7 +29,7 @@ describe "Core" do
result = ShellCmd.run_testsuite("smf_upf_heartbeat verbose baseline_count=300")
(/(FAILED).*(Chaos service degradation is more than 50%)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
Expand All @@ -40,7 +40,7 @@ describe "Core" do
result = ShellCmd.run_testsuite("suci_enabled verbose")
(/(PASSED).*(Core uses SUCI 5g authentication)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
Expand All @@ -51,7 +51,7 @@ describe "Core" do
result = ShellCmd.run_testsuite("suci_enabled verbose")
(/(FAILED).*(Core does not use SUCI 5g authentication)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/cluster_setup_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ require "cluster_tools"

describe "Cluster Setup" do
before_each do
result = ShellCmd.run_testsuite("cleanup")
result[:status].success?.should be_true
result = ShellCmd.environment_cleanup()
end

it "'install_cluster_tools' should give a message if namespace does not exist", tags: ["cluster_setup"] do
Expand Down
3 changes: 1 addition & 2 deletions spec/cnf_testsuite_all/cnf_testsuite_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ describe CnfTestSuite do
end

after_all do
result = ShellCmd.run_testsuite("samples_cleanup")
result[:status].success?.should be_true
result = ShellCmd.environment_cleanup()
end

it "a task should fail with an exit code of 2 when there is an exception", tags: ["security"] do
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/cnf-testsuite-unmapped-keys-and-subkeys.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
helm_directory: cnfs/coredns/helm_chart/coredns
helm_directory: installed_cnf_files/coredns/helm_chart/coredns
release_name: coredns
helm_repository:
name: stable
Expand Down
3 changes: 1 addition & 2 deletions spec/platform/hardware_and_scheduler_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ require "./../../src/tasks/utils/utils.cr"

describe "Platform" do
before_all do
result = ShellCmd.run_testsuite("samples_cleanup")
result[:status].success?.should be_true
result = ShellCmd.environment_cleanup()
result = ShellCmd.run_testsuite("setup")
result[:status].success?.should be_true
end
Expand Down
7 changes: 3 additions & 4 deletions spec/platform/platform_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ require "../../src/tasks/utils/utils.cr"

describe "Platform" do
before_all do
result = ShellCmd.run_testsuite("samples_cleanup")
result[:status].success?.should be_true
result = ShellCmd.environment_cleanup()
result = ShellCmd.run_testsuite("setup")
result[:status].success?.should be_true
end
it "'platform:*' should not error out when no cnf is installed", tags: ["platform"] do
result = ShellCmd.run_testsuite("cleanup")
result = ShellCmd.environment_cleanup()
result = ShellCmd.run_testsuite("platform:oci_compliant")
puts result[:output]
(/No cnf_testsuite.yml found/ =~ result[:output]).should be_nil
end
it "'platform' should not run prerequisites that are prefixed with a ~", tags: ["platform"] do
result = ShellCmd.run_testsuite("cleanup")
result = ShellCmd.environment_cleanup()
result = ShellCmd.run_testsuite("platform ~k8s_conformance")
(/kind=namespace namespace=sonobuoy/ =~ (result[:output] + result[:error])).should be_nil
end
Expand Down
Loading

0 comments on commit 2a2d6d1

Please sign in to comment.