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
Konstantin Yarovoy committed Nov 1, 2024
1 parent e432397 commit df5f452
Show file tree
Hide file tree
Showing 43 changed files with 271 additions and 979 deletions.
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
4 changes: 2 additions & 2 deletions SOURCE_INSTALL.md
Original file line number Diff line number Diff line change
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
```
4 changes: 2 additions & 2 deletions example-cnfs/ip-forwarder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ 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
Expand Down
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
```
6 changes: 3 additions & 3 deletions example-cnfs/vpp-3c2n-csp-use-case/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ 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
Expand Down
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
4 changes: 2 additions & 2 deletions spec/5g/ran_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe "5g" do
ensure
result = Helm.delete("open5gs -n oran")
result[:status].success?.should be_true
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample-oran-ric/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
Expand All @@ -59,7 +59,7 @@ describe "5g" do
ensure
result = Helm.delete("open5gs -n oran")
result[:status].success?.should be_true
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample-oran-noric/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
end
end
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.cnf_cleanup()
end

it "a task should fail with an exit code of 2 when there is an exception", tags: ["security"] do
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.cnf_cleanup()
result = ShellCmd.run_testsuite("setup")
result[:status].success?.should be_true
end
Expand Down
3 changes: 1 addition & 2 deletions spec/platform/platform_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.cnf_cleanup()
result = ShellCmd.run_testsuite("setup")
result[:status].success?.should be_true
end
Expand Down
15 changes: 7 additions & 8 deletions spec/setup_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe "Setup" do
result = ShellCmd.cnf_setup("cnf-path=example-cnfs/coredns/cnf-testsuite.yml")
(/Successfully setup coredns/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=example-cnfs/coredns/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
end
Expand All @@ -35,7 +35,7 @@ describe "Setup" do
result = ShellCmd.cnf_setup("cnf-config=example-cnfs/coredns/cnf-testsuite.yml")
(/Successfully setup coredns/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=example-cnfs/coredns/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
end
Expand All @@ -48,7 +48,7 @@ describe "Setup" do
(/Successfully setup coredns/ =~ result[:output]).should_not be_nil
ensure

result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=spec/fixtures/cnf-testsuite.yml verbose")
result = ShellCmd.cnf_cleanup("verbose")
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
end
Expand All @@ -59,19 +59,19 @@ describe "Setup" do
result = ShellCmd.cnf_setup("cnf-path=sample-cnfs/multi_helm_directories/cnf-testsuite.yml")
(/Successfully setup coredns/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=sample-cnfs/multi_helm_directories/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
end
end

it "'cnf_setup/cnf_cleanup' should properly install/uninstall old versions of cnf configs", tags: ["setup"] do
it "'cnf_setup/cnf_cleanup' should properly install/cleanup old versions of cnf configs", tags: ["setup"] do
begin
result = ShellCmd.cnf_setup("cnf-path=spec/fixtures/cnf-testsuite-v1-example.yml")
result[:status].success?.should be_true
(/Successfully setup coredns/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=spec/fixtures/cnf-testsuite-v1-example.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
end
Expand All @@ -84,10 +84,9 @@ describe "Setup" do
result = ShellCmd.cnf_setup("cnf-path=sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml")
(/A CNF is already set up. Setting up multiple CNFs is not allowed./ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=sample-cnfs/sample_coredns/cnf-testsuite.yml")
result = ShellCmd.cnf_cleanup()
result[:status].success?.should be_true
(/Successfully cleaned up/ =~ result[:output]).should_not be_nil
result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml")
end
end
end
14 changes: 13 additions & 1 deletion spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ module ShellCmd
end

def self.cnf_setup(setup_params, cmd_prefix="", expect_failure=false)
result = run_testsuite("cnf_setup #{setup_params} wait_count=300", cmd_prefix)
timeout_parameter = setup_params.contains?("timeout") ? "" : "timeout=300"
result = run_testsuite("cnf_setup #{setup_params} #{timeout_parameter}", cmd_prefix)
if !expect_failure
result[:status].success?.should be_true
else
result[:status].success?.should be_false
end
result
end

def self.cnf_cleanup(cleanup_params="", cmd_prefix="", expect_failure=false)
timeout_parameter = cleanup_params.contains?("timeout") ? "" : "timeout=300"
result = run_testsuite("cnf_cleanup #{cleanup_params} #{timeout_parameter}", cmd_prefix)
if !expect_failure
result[:status].success?.should be_true
else
Expand Down
Loading

0 comments on commit df5f452

Please sign in to comment.