SMQ-2533 - Rename Magistrala to SuperMQ (#2560)

Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
This commit is contained in:
Dušan Borovčanin
2024-12-04 11:17:09 +01:00
committed by GitHub
parent 10bc218dee
commit 178aa46ad4
748 changed files with 7502 additions and 7507 deletions
+5 -5
View File
@@ -24,13 +24,13 @@ linters-settings:
alias:
- pkg: github.com/absmach/callhome/pkg/client
alias: chclient
- pkg: github.com/absmach/magistrala/logger
alias: mglog
- pkg: github.com/absmach/magistrala/pkg/errors/service
- pkg: github.com/absmach/supermq/logger
alias: smqlog
- pkg: github.com/absmach/supermq/pkg/errors/service
alias: svcerr
- pkg: github.com/absmach/magistrala/pkg/errors/repository
- pkg: github.com/absmach/supermq/pkg/errors/repository
alias: repoerr
- pkg: github.com/absmach/magistrala/pkg/sdk/mocks
- pkg: github.com/absmach/supermq/pkg/sdk/mocks
alias: sdkmocks
gocritic:
+6 -6
View File
@@ -6,35 +6,35 @@ filename: "{{.InterfaceName}}.go"
outpkg: "mocks"
boilerplate-file: "./tools/config/boilerplate.txt"
packages:
github.com/absmach/magistrala/internal/grpc/clients/v1:
github.com/absmach/supermq/internal/grpc/clients/v1:
interfaces:
ClientsServiceClient:
config:
dir: "./clients/mocks"
mockname: "ClientsServiceClient"
filename: "clients_client.go"
github.com/absmach/magistrala/internal/grpc/domains/v1:
github.com/absmach/supermq/internal/grpc/domains/v1:
interfaces:
DomainsServiceClient:
config:
dir: "./domains/mocks"
mockname: "DomainsServiceClient"
filename: "domains_client.go"
github.com/absmach/magistrala/internal/grpc/token/v1:
github.com/absmach/supermq/internal/grpc/token/v1:
interfaces:
TokenServiceClient:
config:
dir: "./auth/mocks"
mockname: "TokenServiceClient"
filename: "token_client.go"
github.com/absmach/magistrala/internal/grpc/channels/v1:
github.com/absmach/supermq/internal/grpc/channels/v1:
interfaces:
ChannelsServiceClient:
config:
dir: "./channels/mocks"
mockname: "ChannelsServiceClient"
filename: "channels_client.go"
github.com/absmach/magistrala/internal/grpc/groups/v1:
github.com/absmach/supermq/internal/grpc/groups/v1:
interfaces:
GroupsServiceClient:
config:
@@ -42,7 +42,7 @@ packages:
mockname: "GroupsServiceClient"
filename: "groups_client.go"
github.com/absmach/magistrala/certs/pki/amcerts:
github.com/absmach/supermq/certs/pki/amcerts:
interfaces:
Agent:
config:
+1 -1
View File
@@ -1,5 +1,5 @@
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
// Package tools contains tools for Magistrala.
// Package tools contains tools for SuperMQ.
package tools
+7 -7
View File
@@ -1,4 +1,4 @@
# Magistrala Users Groups Clients and Channels E2E Testing Tool
# SuperMQ Users Groups Clients and Channels E2E Testing Tool
A simple utility to create a list of groups and users connected to these groups and channels and clients connected to these channels.
@@ -13,11 +13,11 @@ make
```bash
./e2e --help
Tool for testing end-to-end flow of Magistrala by doing a couple of operations namely:
Tool for testing end-to-end flow of SuperMQ by doing a couple of operations namely:
1. Creating, viewing, updating and changing status of users, groups, clients and channels.
2. Connecting users and groups to each other and clients and channels to each other.
3. Sending messages from clients to channels on all 4 protocol adapters (HTTP, WS, CoAP and MQTT).
Complete documentation is available at https://docs.magistrala.abstractmachines.fr
Complete documentation is available at https://docs.supermq.abstractmachines.fr
Usage:
@@ -28,7 +28,7 @@ Usage:
Examples:
Here is a simple example of using e2e tool.
Use the following commands from the root Magistrala directory:
Use the following commands from the root SuperMQ directory:
go run tools/e2e/cmd/main.go
go run tools/e2e/cmd/main.go --host 142.93.118.47
@@ -38,19 +38,19 @@ go run tools/e2e/cmd/main.go --host localhost --num 10 --num_of_messages 100 --p
Flags:
-h, --help help for e2e
-H, --host string address for a running Magistrala instance (default "localhost")
-H, --host string address for a running SuperMQ instance (default "localhost")
-n, --num uint number of users, groups, channels and clients to create and connect (default 10)
-N, --num_of_messages uint number of messages to send (default 10)
-p, --prefix string name prefix for users, groups, clients and channels
```
To use `-H` option, you can specify the address for the Magistrala instance as an argument when running the program. For example, if the Magistrala instance is running on another computer with the IP address 192.168.0.1, you could use the following command:
To use `-H` option, you can specify the address for the SuperMQ instance as an argument when running the program. For example, if the SuperMQ instance is running on another computer with the IP address 192.168.0.1, you could use the following command:
```bash
go run tools/e2e/cmd/main.go --host 142.93.118.47
```
This will tell the program to connect to the Magistrala instance running on the specified IP address.
This will tell the program to connect to the SuperMQ instance running on the specified IP address.
If you want to create a list of channels with certificates:
+7 -7
View File
@@ -1,13 +1,13 @@
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
// Package main contains e2e tool for testing Magistrala.
// Package main contains e2e tool for testing SuperMQ.
package main
import (
"log"
"github.com/absmach/magistrala/tools/e2e"
"github.com/absmach/supermq/tools/e2e"
cc "github.com/ivanpirog/coloredcobra"
"github.com/spf13/cobra"
)
@@ -19,14 +19,14 @@ func main() {
rootCmd := &cobra.Command{
Use: "e2e",
Short: "e2e is end-to-end testing tool for Magistrala",
Long: "Tool for testing end-to-end flow of magistrala by doing a couple of operations namely:\n" +
Short: "e2e is end-to-end testing tool for SuperMQ",
Long: "Tool for testing end-to-end flow of supermq by doing a couple of operations namely:\n" +
"1. Creating, viewing, updating and changing status of users, groups, clients and channels.\n" +
"2. Connecting users and groups to each other and clients and channels to each other.\n" +
"3. Sending messages from clients to channels on all 4 protocol adapters (HTTP, WS, CoAP and MQTT).\n" +
"Complete documentation is available at https://docs.magistrala.abstractmachines.fr",
"Complete documentation is available at https://docs.supermq.abstractmachines.fr",
Example: "Here is a simple example of using e2e tool.\n" +
"Use the following commands from the root magistrala directory:\n\n" +
"Use the following commands from the root supermq directory:\n\n" +
"go run tools/e2e/cmd/main.go\n" +
"go run tools/e2e/cmd/main.go --host 142.93.118.47\n" +
"go run tools/e2e/cmd/main.go --host localhost --num 10 --num_of_messages 100 --prefix e2e",
@@ -47,7 +47,7 @@ func main() {
})
// Root Flags
rootCmd.PersistentFlags().StringVarP(&econf.Host, "host", "H", "localhost", "address for a running magistrala instance")
rootCmd.PersistentFlags().StringVarP(&econf.Host, "host", "H", "localhost", "address for a running supermq instance")
rootCmd.PersistentFlags().StringVarP(&econf.Prefix, "prefix", "p", "", "name prefix for users, groups, clients and channels")
rootCmd.PersistentFlags().Uint64VarP(&econf.Num, "num", "n", defNum, "number of users, groups, channels and clients to create and connect")
rootCmd.PersistentFlags().Uint64VarP(&econf.NumOfMsg, "num_of_messages", "N", defNum, "number of messages to send")
+2 -2
View File
@@ -14,7 +14,7 @@ import (
"time"
"github.com/0x6flab/namegenerator"
sdk "github.com/absmach/magistrala/pkg/sdk/go"
sdk "github.com/absmach/supermq/pkg/sdk/go"
"github.com/gookit/color"
"github.com/gorilla/websocket"
"golang.org/x/sync/errgroup"
@@ -600,7 +600,7 @@ func sendCoAPMessage(msg string, client sdk.Client, chanID string) error {
}
func sendMQTTMessage(msg string, client sdk.Client, chanID string) error {
cmd := exec.Command("mosquitto_pub", "--id-prefix", "magistrala", "-u", client.ID, "-P", client.Credentials.Secret, "-t", fmt.Sprintf("channels/%s/messages", chanID), "-h", "localhost", "-m", msg)
cmd := exec.Command("mosquitto_pub", "--id-prefix", "supermq", "-u", client.ID, "-P", client.Credentials.Secret, "-t", fmt.Sprintf("channels/%s/messages", chanID), "-h", "localhost", "-m", msg)
if _, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("MQTT failed to send message from client %s to channel %s: %w", client.ID, chanID, err)
}
+13 -13
View File
@@ -1,11 +1,11 @@
# MQTT Benchmarking Tool
A simple MQTT benchmarking tool for Magistrala platform.
A simple MQTT benchmarking tool for SuperMQ platform.
It connects Magistrala clients as subscribers over a number of channels and
uses other Magistrala clients to publish messages and create MQTT load.
It connects SuperMQ clients as subscribers over a number of channels and
uses other SuperMQ clients to publish messages and create MQTT load.
Magistrala clients used must be pre-provisioned first, and Magistrala `provision` tool can be used for this purpose.
SuperMQ clients used must be pre-provisioned first, and SuperMQ `provision` tool can be used for this purpose.
## Installation
@@ -20,8 +20,8 @@ The tool supports multiple concurrent clients, publishers and subscribers config
```
./mqtt-bench --help
Tool for extensive load and benchmarking of MQTT brokers used within Magistrala platform.
Complete documentation is available at https://docs.magistrala.abstractmachines.fr
Tool for extensive load and benchmarking of MQTT brokers used within SuperMQ platform.
Complete documentation is available at https://docs.supermq.abstractmachines.fr
Usage:
mqtt-bench [flags]
@@ -33,7 +33,7 @@ Flags:
-n, --count int Number of messages sent per publisher (default 100)
-f, --format string Output format: text|json (default "text")
-h, --help help for mqtt-bench
-m, --magistrala string config file for Magistrala connections (default "connections.toml")
-m, --supermq string config file for SuperMQ connections (default "connections.toml")
--mtls Use mtls for connection
-p, --pubs int Number of publishers (default 10)
-q, --qos int QoS for published messages, values 0 1 2
@@ -46,11 +46,11 @@ Flags:
Two output formats supported: human-readable plain text and JSON.
Before use you need a `mgconn.toml` - a TOML file that describes Magistrala connection data (channels, clientIDs, clientKeys, certs).
Before use you need a `mgconn.toml` - a TOML file that describes SuperMQ connection data (channels, clientIDs, clientKeys, certs).
You can use `provision` tool (in tools/provision) to create this TOML config file.
```bash
go run tools/mqtt-bench/cmd/main.go -u test@magistrala.com -p test1234 --host http://127.0.0.1 --num 100 > tools/mqtt-bench/mgconn.toml
go run tools/mqtt-bench/cmd/main.go -u test@supermq.com -p test1234 --host http://127.0.0.1 --num 100 > tools/mqtt-bench/mgconn.toml
```
Example use and output
@@ -58,11 +58,11 @@ Example use and output
Without mtls:
```
go run tools/mqtt-bench/cmd/main.go --broker tcp://localhost:1883 --count 100 --size 100 --qos 0 --format text --pubs 10 --magistrala tools/mqtt-bench/mgconn.toml
go run tools/mqtt-bench/cmd/main.go --broker tcp://localhost:1883 --count 100 --size 100 --qos 0 --format text --pubs 10 --supermq tools/mqtt-bench/mgconn.toml
```
With mtls
go run tools/mqtt-bench/cmd/main.go --broker tcps://localhost:8883 --count 100 --size 100 --qos 0 --format text --pubs 10 --magistrala tools/mqtt-bench/mgconn.toml --mtls -ca docker/ssl/certs/ca.crt
go run tools/mqtt-bench/cmd/main.go --broker tcps://localhost:8883 --count 100 --size 100 --qos 0 --format text --pubs 10 --supermq tools/mqtt-bench/mgconn.toml --mtls -ca docker/ssl/certs/ca.crt
```
@@ -100,8 +100,8 @@ count = 100
[log]
quiet = false
[magistrala]
connections_file = "mgconn.toml"
[supermq]
connections_file = "smqconn.toml"
```
+6 -6
View File
@@ -14,7 +14,7 @@ import (
"sync"
"time"
mglog "github.com/absmach/magistrala/logger"
smqlog "github.com/absmach/supermq/logger"
"github.com/pelletier/go-toml"
)
@@ -23,7 +23,7 @@ func Benchmark(cfg Config) error {
if err := checkConnection(cfg.MQTT.Broker.URL, 1); err != nil {
return err
}
logger, err := mglog.New(os.Stdout, "debug")
logger, err := smqlog.New(os.Stdout, "debug")
if err != nil {
return err
}
@@ -44,14 +44,14 @@ func Benchmark(cfg Config) error {
caByte, _ = io.ReadAll(caFile)
}
data, err := os.ReadFile(cfg.Mg.ConnFile)
data, err := os.ReadFile(cfg.Smq.ConnFile)
if err != nil {
return fmt.Errorf("error loading connections file: %s", err)
}
mg := magistrala{}
mg := superMQ{}
if err := toml.Unmarshal(data, &mg); err != nil {
return fmt.Errorf("cannot load Magistrala connections config %s \nUse tools/provision to create file", cfg.Mg.ConnFile)
return fmt.Errorf("cannot load SuperMQ connections config %s \nUse tools/provision to create file", cfg.Smq.ConnFile)
}
resCh := make(chan *runResults)
@@ -171,7 +171,7 @@ func getBytePayload(size int, m message) (handler, error) {
return ret, nil
}
func makeClient(i int, cfg Config, mgChan mgChannel, cli mgClient, start time.Time, caCert []byte, clientCert tls.Certificate) (*Client, error) {
func makeClient(i int, cfg Config, mgChan channel, cli client, start time.Time, caCert []byte, clientCert tls.Certificate) (*Client, error) {
c := &Client{
ID: strconv.Itoa(i),
BrokerURL: cfg.MQTT.Broker.URL,
+5 -5
View File
@@ -7,7 +7,7 @@ package main
import (
"log"
bench "github.com/absmach/magistrala/tools/mqtt-bench"
bench "github.com/absmach/supermq/tools/mqtt-bench"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@@ -19,9 +19,9 @@ func main() {
// Command
rootCmd := &cobra.Command{
Use: "mqtt-bench",
Short: "mqtt-bench is MQTT benchmark tool for Magistrala",
Long: `Tool for exctensive load and benchmarking of MQTT brokers used within the Magistrala platform.
Complete documentation is available at https://docs.magistrala.abstractmachines.fr`,
Short: "mqtt-bench is MQTT benchmark tool for SuperMQ",
Long: `Tool for exctensive load and benchmarking of MQTT brokers used within the SuperMQ platform.
Complete documentation is available at https://docs.supermq.abstractmachines.fr`,
Run: func(cmd *cobra.Command, args []string) {
if confFile != "" {
viper.SetConfigFile(confFile)
@@ -69,7 +69,7 @@ Complete documentation is available at https://docs.magistrala.abstractmachines.
// Config file
rootCmd.PersistentFlags().StringVarP(&confFile, "config", "c", "config.toml", "config file for mqtt-bench")
rootCmd.PersistentFlags().StringVarP(&bconf.Mg.ConnFile, "magistrala", "m", "connections.toml", "config file for Magistrala connections")
rootCmd.PersistentFlags().StringVarP(&bconf.Smq.ConnFile, "supermq", "m", "connections.toml", "config file for SuperMQ connections")
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
+10 -10
View File
@@ -39,30 +39,30 @@ type logConfig struct {
Quiet bool `toml:"quiet" mapstructure:"quiet"`
}
type magistralaFile struct {
type smqFile struct {
ConnFile string `toml:"connections_file" mapstructure:"connections_file"`
}
type mgClient struct {
type client struct {
ClientID string `toml:"client_id" mapstructure:"client_id"`
ClientSecret string `toml:"client_secret" mapstructure:"client_secret"`
MTLSCert string `toml:"mtls_cert" mapstructure:"mtls_cert"`
MTLSKey string `toml:"mtls_key" mapstructure:"mtls_key"`
}
type mgChannel struct {
type channel struct {
ChannelID string `toml:"channel_id" mapstructure:"channel_id"`
}
type magistrala struct {
Clients []mgClient `toml:"clients" mapstructure:"clients"`
Channels []mgChannel `toml:"channels" mapstructure:"channels"`
type superMQ struct {
Clients []client `toml:"clients" mapstructure:"clients"`
Channels []channel `toml:"channels" mapstructure:"channels"`
}
// Config struct holds benchmark configuration.
type Config struct {
MQTT mqttConfig `toml:"mqtt" mapstructure:"mqtt"`
Test testConfig `toml:"test" mapstructure:"test"`
Log logConfig `toml:"log" mapstructure:"log"`
Mg magistralaFile `toml:"magistrala" mapstructure:"magistrala"`
MQTT mqttConfig `toml:"mqtt" mapstructure:"mqtt"`
Test testConfig `toml:"test" mapstructure:"test"`
Log logConfig `toml:"log" mapstructure:"log"`
Smq smqFile `toml:"supermq" mapstructure:"supermq"`
}
+1 -1
View File
@@ -25,5 +25,5 @@ count = 70
[log]
quiet = true
[magistrala]
[supermq]
connections_file = "../provision/mgconn.toml"
+9 -9
View File
@@ -1,9 +1,9 @@
# Magistrala Clients and Channels Provisioning Tool
# SuperMQ Clients and Channels Provisioning Tool
A simple utility to create a list of channels and clients connected to these channels with possibility to create certificates for mTLS use case.
This tool is useful for testing, and it creates a TOML format output (on stdout, can be redirected into the file as needed)
that can be used by Magistrala MQTT benchmarking tool (`mqtt-bench`).
that can be used by SuperMQ MQTT benchmarking tool (`mqtt-bench`).
## Installation
@@ -16,8 +16,8 @@ make
```bash
./provision --help
Tool for provisioning series of Magistrala channels and clients and connecting them together.
Complete documentation is available at https://docs.magistrala.abstractmachines.fr
Tool for provisioning series of SuperMQ channels and clients and connecting them together.
Complete documentation is available at https://docs.supermq.abstractmachines.fr
Usage:
provision [flags]
@@ -26,24 +26,24 @@ Flags:
--ca string CA for creating and signing clients certificate (default "ca.crt")
--cakey string ca.key for creating and signing clients certificate (default "ca.key")
-h, --help help for provision
--host string address for magistrala instance (default "https://localhost")
--host string address for supermq instance (default "https://localhost")
--num int number of channels and clients to create and connect (default 10)
-p, --password string magistrala users password
-p, --password string supermq users password
--ssl create certificates for mTLS access
-u, --username string magistrala user
-u, --username string supermq user
--prefix string name prefix for clients and channels
```
Example:
```bash
go run tools/provision/cmd/main.go -u test@magistrala.com -p test1234 --host https://142.93.118.47
go run tools/provision/cmd/main.go -u test@supermq.com -p test1234 --host https://142.93.118.47
```
If you want to create a list of channels with certificates:
```bash
go run tools/provision/cmd/main.go --host http://localhost --num 10 -u test@magistrala.com -p test1234 --ssl true --ca docker/ssl/certs/ca.crt --cakey docker/ssl/certs/ca.key
go run tools/provision/cmd/main.go --host http://localhost --num 10 -u test@supermq.com -p test1234 --ssl true --ca docker/ssl/certs/ca.crt --cakey docker/ssl/certs/ca.key
```
+7 -7
View File
@@ -7,7 +7,7 @@ package main
import (
"log"
"github.com/absmach/magistrala/tools/provision"
"github.com/absmach/supermq/tools/provision"
"github.com/spf13/cobra"
)
@@ -16,9 +16,9 @@ func main() {
rootCmd := &cobra.Command{
Use: "provision",
Short: "provision is provisioning tool for Magistrala",
Long: `Tool for provisioning series of Magistrala channels and clients and connecting them together.
Complete documentation is available at https://docs.magistrala.abstractmachines.fr`,
Short: "provision is provisioning tool for SuperMQ",
Long: `Tool for provisioning series of SuperMQ channels and clients and connecting them together.
Complete documentation is available at https://docs.supermq.abstractmachines.fr`,
Run: func(_ *cobra.Command, _ []string) {
if err := provision.Provision(pconf); err != nil {
log.Fatal(err)
@@ -27,10 +27,10 @@ Complete documentation is available at https://docs.magistrala.abstractmachines.
}
// Root Flags
rootCmd.PersistentFlags().StringVarP(&pconf.Host, "host", "", "https://localhost", "address for magistrala instance")
rootCmd.PersistentFlags().StringVarP(&pconf.Host, "host", "", "https://localhost", "address for supermq instance")
rootCmd.PersistentFlags().StringVarP(&pconf.Prefix, "prefix", "", "", "name prefix for clients and channels")
rootCmd.PersistentFlags().StringVarP(&pconf.Username, "username", "u", "", "magistrala user")
rootCmd.PersistentFlags().StringVarP(&pconf.Password, "password", "p", "", "magistrala users password")
rootCmd.PersistentFlags().StringVarP(&pconf.Username, "username", "u", "", "supermq user")
rootCmd.PersistentFlags().StringVarP(&pconf.Password, "password", "p", "", "supermq users password")
rootCmd.PersistentFlags().IntVarP(&pconf.Num, "num", "", 10, "number of channels and clients to create and connect")
rootCmd.PersistentFlags().BoolVarP(&pconf.SSL, "ssl", "", false, "create certificates for mTLS access")
rootCmd.PersistentFlags().StringVarP(&pconf.CAKey, "cakey", "", "ca.key", "ca.key for creating and signing clients certificate")
+4 -4
View File
@@ -21,7 +21,7 @@ import (
"time"
"github.com/0x6flab/namegenerator"
sdk "github.com/absmach/magistrala/pkg/sdk/go"
sdk "github.com/absmach/supermq/pkg/sdk/go"
)
const (
@@ -31,7 +31,7 @@ const (
var namesgenerator = namegenerator.NewGenerator()
// MgConn - structure describing Magistrala connection set.
// MgConn - structure describing SuperMQ connection set.
type MgConn struct {
ClientID string
ClinetSecret string
@@ -206,9 +206,9 @@ func Provision(conf Config) error {
tmpl := x509.Certificate{
SerialNumber: serialNumber,
Subject: pkix.Name{
Organization: []string{"Magistrala"},
Organization: []string{"SuperMQ"},
CommonName: clients[i].Credentials.Secret,
OrganizationalUnit: []string{"magistrala"},
OrganizationalUnit: []string{"supermq"},
},
NotBefore: notBefore,
NotAfter: notAfter,