diff --git a/integration/c2e-setup/go.sum b/integration/c2e-setup/go.sum index 25bdaa0b..04806fe4 100644 --- a/integration/c2e-setup/go.sum +++ b/integration/c2e-setup/go.sum @@ -1,6 +1,5 @@ github.com/caarlos0/env/v6 v6.10.1 h1:t1mPSxNpei6M5yAeu1qtRdPAK29Nbcf/n3G7x+b3/II= github.com/caarlos0/env/v6 v6.10.1/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/eclipse-kanto/kanto/integration/util v0.0.0-20240201094116-d9d28a339764 h1:ldkxNs+Hz1i8zb0UWRwDOi/oRvhaD5H8lhop4tSWRCk= @@ -8,57 +7,32 @@ github.com/eclipse-kanto/kanto/integration/util v0.0.0-20240201094116-d9d28a3397 github.com/eclipse/ditto-clients-golang v0.0.0-20220225085802-cf3b306280d3 h1:bfFGs26yNSfhSi6xmnmykB0jZn1Vu5e1/7JA5Wu5aGc= github.com/eclipse/ditto-clients-golang v0.0.0-20220225085802-cf3b306280d3/go.mod h1:ey7YwfHSQJsinGkGbgeEgqZA7qJnoB0YiFVTFEY50Jg= github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= -github.com/eclipse/paho.mqtt.golang v1.4.1/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA= github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik= github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -67,42 +41,16 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/integration/c2e-setup/main.go b/integration/c2e-setup/main.go index 9d830ec0..d4f0c604 100644 --- a/integration/c2e-setup/main.go +++ b/integration/c2e-setup/main.go @@ -34,9 +34,8 @@ const ( restart = "restart" stop = "stop" - suiteConnectorService = "suite-connector.service" - suiteBootstrappingService = "suite-bootstrapping.service" - ldtService = "local-digital-twins.service" + suiteConnectorService = "suite-connector.service" + ldtService = "local-digital-twins.service" deleteResourcesTemplate = "%s unable to delete resources, error: %v\n" ) @@ -58,21 +57,13 @@ var ( authID string - bootstrapCaCert string - logBootstrapFile string - postBootstrapFile string - postBootstrapScript string - configBootstrapFile string - configBootstrapFileBackup string - ldtCaCert string logLdtFile string thingsDb string configLdtFile string configLdtFileBackup string - bootstrap bool - ldt bool + ldt bool ) type c2eConfiguration struct { @@ -103,22 +94,6 @@ func main() { "Path to Suite Connector configuration file backup. "+ "If set to the empty string, backing up the Suite Connector configuration file will be skipped") - flag.StringVar(&bootstrapCaCert, "bootstrapCaCert", "/etc/suite-bootstrapping/iothub.crt", "Path to Suite Bootstrapping CA certificates file") - flag.StringVar(&logBootstrapFile, "logBootstrapFile", "/var/log/suite-bootstrapping/suite-bootstrapping.log", - "Path to Suite Bootstrapping log file") - flag.StringVar(&postBootstrapFile, "postBootstrapFile", "/etc/suite-connector/config.json", - "Path to the file used for a bootstrapping response data") - flag.StringVar(&postBootstrapScript, "postBootstrapScript", "/var/tmp/suite-bootstrapping/post_script.sh", - "Path to the script that is executed after a bootstrapping response") - - flag.StringVar(&configBootstrapFile, "configBootstrapFile", "/etc/suite-bootstrapping/config.json", - "Path to Suite Bootstrapping configuration file. "+ - "If set to the empty string, configuring Suite Bootstrapping and restarting it will be skipped") - - flag.StringVar(&configBootstrapFileBackup, "configBootstrapFileBackup", "/etc/suite-bootstrapping/configBackup.json", - "Path to Suite Bootstrapping configuration file backup. "+ - "If set to the empty string, backing up the Suite Bootstrapping configuration file will be skipped") - flag.StringVar(&ldtCaCert, "ldtCaCert", "/etc/local-digital-twins/iothub.crt", "Path to Local Digital Twins CA certificates file") flag.StringVar(&logLdtFile, "logLdtFile", "/var/log/local-digital-twins/local-digital-twins.log", "Path to Local Digital Twins log file") @@ -134,7 +109,6 @@ func main() { "If set to the empty string, backing up the Local Digital Twins configuration file will be skipped") clean := flag.Bool("clean", false, "Clean up test resources") - flag.BoolVar(&bootstrap, "bootstrap", false, "Create bootstrapping resources") flag.BoolVar(&ldt, "ldt", false, "Create local-digital-twins resources") flag.Parse() @@ -239,9 +213,7 @@ func isDeviceIDPresentInRegistry(deviceResource *util.Resource) bool { } func getServiceNameConfigAndBackupFile() (string, string, string) { - if bootstrap { - return suiteBootstrappingService, configBootstrapFile, configBootstrapFileBackup - } else if ldt { + if ldt { return ldtService, configLdtFile, configLdtFileBackup } return suiteConnectorService, configConnectorFile, configConnectorFileBackup @@ -291,9 +263,7 @@ func performSetUp(resources []*util.Resource) bool { ok := true if configFile != "" { var err error - if serviceName == suiteBootstrappingService { - err = writeConfigBootstrapFile(configFile) - } else if serviceName == ldtService { + if serviceName == ldtService { err = writeConfigLdtFile(configFile) } else { err = writeConfigFile(configFile) @@ -395,21 +365,6 @@ func writeConfigFile(path string) error { return util.WriteConfigFile(path, cfg) } -func writeConfigBootstrapFile(path string) error { - postScriptArr := []string{postBootstrapScript} - cfg := &util.BootstrapConfiguration{ - LogFile: logBootstrapFile, - PostBootstrapFile: postBootstrapFile, - PostBootstrapScript: postScriptArr, - Address: c2eCfg.MQTTAdapterAddress, - TenantID: tenantID, - DeviceID: deviceID, - AuthID: authID, - Password: password, - } - return util.WriteConfigFile(path, cfg) -} - func writeConfigLdtFile(path string) error { type ldtConnectorConfig struct { CaCert string `json:"caCert"` diff --git a/integration/util/go.sum b/integration/util/go.sum index 1d6cd437..546bf83f 100644 --- a/integration/util/go.sum +++ b/integration/util/go.sum @@ -25,30 +25,17 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -57,31 +44,12 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integration/util/registry.go b/integration/util/registry.go index 5a4f2432..937dc6ff 100644 --- a/integration/util/registry.go +++ b/integration/util/registry.go @@ -32,20 +32,6 @@ type Resource struct { Delete bool } -// BootstrapConfiguration holds the required configuration to suite bootstrapping to connect and -// where to receive post bootstrapping files and script. -type BootstrapConfiguration struct { - LogFile string `json:"logFile"` - PostBootstrapFile string `json:"postBootstrapFile"` - PostBootstrapScript []string `json:"postBootstrapScript"` - CaCert string `json:"caCert"` - Address string `json:"address"` - TenantID string `json:"tenantId"` - DeviceID string `json:"deviceId"` - AuthID string `json:"authId"` - Password string `json:"password"` -} - // ConnectorConfiguration holds the minimum required configuration to suite connector to connect. type ConnectorConfiguration struct { CaCert string `json:"caCert"` diff --git a/quickstart/hono_commands_sb.py b/quickstart/hono_commands_sb.py deleted file mode 100644 index 0d2e81f0..00000000 --- a/quickstart/hono_commands_sb.py +++ /dev/null @@ -1,286 +0,0 @@ -# Copyright (c) 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License 2.0 which is available at -# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -# which is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - -import base64 -import getopt -import json -import os -import signal -import sys -import threading -import time -import uuid -import requests -import hashlib - -from string import Template -from proton import Message -from proton._reactor import AtLeastOnce -from proton.handlers import MessagingHandler -from proton.reactor import Container - -ditto_live_inbox_msg_template = Template(""" -{ - "topic": "$namespace/$name/things/live/messages/response", - "headers": { - "Content-Type": "application/json", - "correlation-id": "$correlation_id", - "response-required": true - }, - "path": "/features/Bootstrapping/inbox/messages/response", - "value": - { - "requestId": "$request_id", - "hash": "$hash", - "chunk": "$chunk" - } -} -""") - -config_json_template = Template("""{ - "logFile": "/var/log/suite-connector/suite-connector.log", - "address": "mqtts://hono.eclipseprojects.io:8883", - "caCert": "/etc/suite-connector/iothub.crt", - "tenantId": "$tenant_id", - "deviceId": "$device_id", - "authId": "$auth_id", - "password": "$password" -}""") - -update_credentials_template = Template(""" -[{ - "type": "hashed-password", - "auth-id": "$auth_id", - "secrets": [{ - "pwd-plain": "$pwd" - }] -}] -""") - - -class CommandResponsesHandler(MessagingHandler): - def __init__(self, server, address): - super(CommandResponsesHandler, self).__init__() - self.server = server - self.address = address - - def on_start(self, event): - conn = event.container.connect(self.server, user="consumer@HONO", password="verysecret") - event.container.create_receiver(conn, self.address) - print('[command handler connected]') - - def on_message(self, event): - print('[got response]') - response = json.loads(event.message.body) - print(json.dumps(response, indent=2)) - if response["status"] == 204: - print('[ok]', "sb") - else: - print('[error]') - delete_res() - event.receiver.close() - event.connection.close() - os.kill(os.getpid(), signal.SIGINT) - exit(1) - event.receiver.close() - event.connection.close() - - def on_connection_closed(self, event): - print("[command handler connection closed]") - - -class CommandsInvoker(MessagingHandler): - def __init__(self, server, address, request_id): - super(CommandsInvoker, self).__init__() - self.server = server - self.address = address - self.request_id = request_id - - def on_start(self, event): - conn = event.container.connect(self.server, sasl_enabled=True, allowed_mechs="PLAIN", allow_insecure_mechs=True, - user="consumer@HONO", password="verysecret") - event.container.create_sender(conn, self.address) - - def on_sendable(self, event): - print('[provisioning tenant]') - headers = { - 'Content-Type': 'application/json', - } - tenant_headers = { - 'accept': 'application/json', - 'Content-Type': 'application/json', - } - response = requests.post( - '{}/v1/tenants/{}'.format(hono_ep, new_tenant_id), headers=tenant_headers, - data='{"ext":{"messaging-type": "amqp"}}') - - status_code = response.status_code - print("Creating tenant [{}]".format(status_code)) - if status_code < 200 or status_code > 300: - print("Error creating tenant [{}] with code [{}]".format(new_tenant_id, status_code)) - event.sender.close() - event.connection.close() - os.kill(os.getpid(), signal.SIGINT) - exit(1) - - response = requests.post( - '{}/v1/devices/{}/{}'.format(hono_ep, new_tenant_id, new_device_id), - headers=headers, - data='{"authorities":["auto-provisioning-enabled"]}') - status_code = response.status_code - print("Creating device [{}]".format(status_code)) - if status_code < 200 or status_code > 300: - print("Error creating device [{}] with code [{}]".format(new_device_id, status_code)) - event.sender.close() - event.connection.close() - os.kill(os.getpid(), signal.SIGINT) - exit(1) - - response = requests.put( - '{}/v1/credentials/{}/{}'.format(hono_ep, new_tenant_id, new_device_id), - headers=headers, - data=update_credentials_template.substitute(auth_id=new_authentication_id, pwd=new_password)) - status_code = response.status_code - print("Update credentials [{}]".format(status_code)) - if status_code < 200 or status_code > 300: - print("Error update credentials for device [{}] with code [{}]".format(new_device_id, status_code)) - event.sender.close() - event.connection.close() - os.kill(os.getpid(), signal.SIGINT) - exit(1) - - print('[sending command]') - correlation_id = str(uuid.uuid4()) - namespaced_id = device_id.split(':', 1) - chunk = config_json_template.substitute(tenant_id=new_tenant_id, device_id=new_device_id, - auth_id=new_authentication_id, password=new_password) - chunk_hash = hashlib.sha256(chunk.encode()) - chunk = base64.b64encode(chunk.encode()).decode('ascii') - payload = ditto_live_inbox_msg_template.substitute(namespace=namespaced_id[0], name=namespaced_id[1], - chunk=chunk, hash=chunk_hash.hexdigest(), - request_id=self.request_id, correlation_id=correlation_id) - - print(payload) - msg = Message(body=payload, address='{}/{}'.format(address, device_id), - content_type="application/json", - subject="sb", reply_to=reply_to_address, correlation_id=correlation_id, id=str(uuid.uuid4())) - - event.sender.send(msg) - event.sender.close() - event.connection.close() - print('[sent]') - - -class EventsHandler(MessagingHandler): - def __init__(self, server, receiver_address, tenant_id): - super(EventsHandler, self).__init__() - self.server = server - self.receiver_address = receiver_address - self.tenant_id = tenant_id - - def on_start(self, event): - conn = event.container.connect(self.server, user="consumer@HONO", password="verysecret") - event.container.create_receiver(conn, source=self.receiver_address, options=[AtLeastOnce()]) - print('[events handler connected for tenant {}]'.format(self.tenant_id)) - - def on_message(self, event): - print('[events handler on message for tenant {}]'.format(self.tenant_id)) - if event.message.body is not None: - body = json.loads(event.message.body) - if body["topic"].split("/")[-1] == "request": - print('[request event received]') - print(json.dumps(body, indent=2)) - request_id = body["value"]["requestId"] - Container(CommandsInvoker(uri, address, request_id=request_id)).run() - event.receiver.close() - event.connection.close() - - elif body["topic"].split("/")[0] == new_tenant_id: - print('[event received from new tenant [{}]]'.format(new_tenant_id)) - delete_res() - - event.receiver.close() - event.connection.close() - - def on_connection_closed(self, event): - print("[events handler connection for tenant {} closed]".format(self.tenant_id)) - if self.tenant_id == new_tenant_id: - os.kill(os.getpid(), signal.SIGINT) - - -# Parse command line args -options, reminder = getopt.getopt(sys.argv[1:], 't:d:p:') -opts_dict = dict(options) -tenant_id = opts_dict.get('-t') or os.environ["TENANT"] -device_id = opts_dict.get('-d') or os.environ["DEVICE_ID"] -new_password = opts_dict.get('-p') or os.environ["PASSWORD"] - -hono_ep = 'https://hono.eclipseprojects.io:28443' - -pref = "FromBootstrapping" -new_tenant_id = pref + tenant_id -new_device = device_id.removeprefix("{}:".format(tenant_id)) + pref -new_device_id = '{}:{}'.format(new_tenant_id, new_device) -new_authentication_id = new_device_id.replace(":","_") - -# AMQP global configurations -uri = 'amqps://hono.eclipseprojects.io:15671' -address = 'command/{}'.format(tenant_id) -reply_to_address = 'command_response/{}/replies'.format(tenant_id) -event_address = 'event/{}'.format(tenant_id) -new_tenant_event_address = 'event/{}'.format(new_tenant_id) - -print('[starting] demo suite bootstrapping app for tenant [{}], device [{}] at [{}]'.format(tenant_id, device_id, uri)) - -# Create command invoker and handler -response_handler = Container(CommandResponsesHandler(uri, reply_to_address)) -events_handler = Container(EventsHandler(uri, event_address, tenant_id)) -new_tenant_events_handler = Container(EventsHandler(uri, new_tenant_event_address, new_tenant_id)) - -response_thread = threading.Thread(target=lambda: response_handler.run(), daemon=True) -response_thread.start() -events_thread = threading.Thread(target=lambda: events_handler.run(), daemon=True) -events_thread.start() -new_tenant_events_thread = threading.Thread(target=lambda: new_tenant_events_handler.run(), daemon=True) -# Give it some time to link -time.sleep(2) -new_tenant_events_thread.start() - -def delete_res(): - print('[remove new created resources]') - headers = { - 'Content-Type': 'application/json', - } - response = requests.delete( - '{}/v1/devices/{}/{}'.format(hono_ep, new_tenant_id, new_device_id), headers=headers) - - print("Deleting device [{}] with code [{}]".format(new_device_id, response.status_code)) - response = requests.delete( - '{}/v1/credentials/{}/{}'.format(hono_ep, new_tenant_id, new_device_id), headers=headers) - print("Delete credentials [{}]".format(response.status_code)) - response = requests.delete( - '{}/v1/tenants/{}'.format(hono_ep, new_tenant_id), headers=headers) - print("Deleting tenant [{}] with code[{}]".format(new_tenant_id, response.status_code)) - -def handler(signum, frame): - print('[stopping] demo suite bootstrapping app for tenant [{}], device [{}] at [{}]'.format(tenant_id, device_id, - uri)) - response_thread.join(timeout=5) - events_thread.join(timeout=5) - new_tenant_events_thread.join(timeout=5) - print('[stopped]') - exit(0) - - -signal.signal(signal.SIGINT, handler) -while True: - pass diff --git a/quickstart/post_bootstrap.sh b/quickstart/post_bootstrap.sh deleted file mode 100644 index 3acb5da5..00000000 --- a/quickstart/post_bootstrap.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright (c) 2023 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License 2.0 which is available at -# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -# which is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - -sudo systemctl restart suite-connector.service \ No newline at end of file diff --git a/web/site/content/docs/how-to-guides/bootstrap-device.md b/web/site/content/docs/how-to-guides/bootstrap-device.md deleted file mode 100644 index 15c12f27..00000000 --- a/web/site/content/docs/how-to-guides/bootstrap-device.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -title: "Bootstrap device" -type: docs -description: > - Automatically provision your device via bootstrapping. -weight: 5 ---- - -By following the steps below you will automatically provision a new device via a publicly available Eclipse Hono sandbox using Eclipse Kanto. -A simple Eclipse Hono northbound business application written in Python is -provided to explore the capabilities for device bootstrapping and automatically provision a new device. - -First a bootstrapping request is sent from the edge. -The custom Python application handles the request by automatically -provisioning a new device. Upon successful automatically provisioning it sends back -all mandatory remote communication, identification and authentication data. -On the edge side, the response is handled by updating the connection configuration with the received data -and by executing a basic -{{% refn "https://github.com/eclipse-kanto/kanto/blob/main/quickstart/post_bootstrap.sh" %}}`post_bootstrap.sh`{{% /refn %}} -script to restart the Suite Connector service for the changes to take effect. - -### Before you begin - -To ensure that your edge device is capable to execute the steps in this guide, you need: - -* If you don't have an installed and running Eclipse Kanto, follow {{% relrefn "install" %}} Install Eclipse Kanto {{% /relrefn %}} -* If you don't have a connected Eclipse Kanto to Eclipse Hono sandbox, - follow {{% relrefn "hono" %}} Explore via Eclipse Hono {{% /relrefn %}} -* The {{% refn "https://github.com/eclipse-kanto/kanto/blob/main/quickstart/hono_commands_sb.py" %}} - suite bootstrapping application {{% /refn %}} and {{% refn "https://github.com/eclipse-kanto/kanto/blob/main/quickstart/post_bootstrap.sh" %}} - post bootstrap script{{% /refn %}} - - Navigate to the `quickstart` folder where the resources from the {{% relrefn "hono" %}} Explore via Eclipse Hono {{% /relrefn %}} - guide are located and execute the following script: - - ```shell - wget https://github.com/eclipse-kanto/kanto/raw/main/quickstart/hono_commands_sb.py && \ - wget https://github.com/eclipse-kanto/kanto/raw/main/quickstart/post_bootstrap.sh - ``` -* Grab the post script file and place it in the /var/tmp/suite-bootstrapping directory via executing: - - ```shell - sudo mkdir -p /var/tmp/suite-bootstrapping/ && sudo cp ./post_bootstrap.sh /var/tmp/suite-bootstrapping/ - ``` -* Back up `/etc/suite-connector/config.json` as this file will be modified from this guide -* Stop suite-connector.service. Suite bootstrapping automatically provision device and try to start the suite connector service with new device - ```shell - sudo systemctl stop suite-connector.service - ``` - -### Configure Suite Bootstrapping - -Open file `/etc/suite-connector/config.json`, copy `address`, `tenantId`, `deviceId`, `authId` and `password`. -```json -{ - ... - "address": "mqtts://hono.eclipseprojects.io:8883", - "tenantId": "demo", - "deviceId": "demo:device", - "authId": "demo_device", - "password": "secret" - ... -} -``` -Bootstrapping uses the `/etc/suite-bootstrapping/config.json` to acquire all the remote communication, identification and -authentication data to establish the remote connection for bootstrapping. -It is also where you need to specify the path to the post bootstrapping script and where to store received response data. -Update the configuration as shown below and replace `tenantId`, `deviceId`, `authId` and `password` -with the settings that you copied in the previous step. - -```json -{ - "logFile": "/var/log/suite-bootstrapping/suite-bootstrapping.log", - "postBootstrapFile": "/etc/suite-connector/config.json", - "postBootstrapScript": ["/var/tmp/suite-bootstrapping/post_bootstrap.sh"], - "caCert": "/etc/suite-bootstrapping/iothub.crt", - "address": "mqtts://hono.eclipseprojects.io:8883", - "tenantId": "demo", - "deviceId": "demo:device", - "authId": "demo_device", - "password": "secret" -} -``` - -Restart the suite bootstrapping service for the changes to take effect: - -```shell -sudo systemctl restart suite-bootstrapping.service -``` -When configured correctly the Suite Bootstrapping service automatically sends the bootstrapping request. - -### Automatically provision via bootstrapping - -To explore the suite bootstrapping, we will use a Python script to automatically provision and monitor the new device. -The location where the Python application will run does not have to be your edge device as it communicates remotely -with Eclipse Hono only. - -Now we are ready to handle the bootstrapping request via executing the application -that requires the Eclipse Hono tenant (`-t`), the device identifier (`-d`) and the password (`-p`) you wish to use for the new device: - -```shell -python3 hono_commands_sb.py -t demo -d demo:device -p secret -``` - -### Verify - -The last event received for the application is with the new tenant id that is automatically provisioning for the Suite Connector. -You can check out that the Suite Connector is now connected to the new device via its status. - -```shell -sudo systemctl status suite-connector.service -``` - -### Clean up - -Revert previous back up `/etc/suite-connector/config.json` file. -Remove temporary directory for post bootstrap file /var/tmp/suite-bootstrapping via executing: -```shell -sudo rm -r -f /var/tmp/suite-bootstrapping/ -``` -Stop suite bootstrapping service and restart suite connector service by executing: -```shell -sudo systemctl stop suite-bootstrapping.service && \ -sudo systemctl restart suite-connector.service -``` \ No newline at end of file diff --git a/web/site/content/docs/references/connectivity/suite-bootstrapping-config.md b/web/site/content/docs/references/connectivity/suite-bootstrapping-config.md deleted file mode 100644 index 710b68fa..00000000 --- a/web/site/content/docs/references/connectivity/suite-bootstrapping-config.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: "Suite bootstrapping configuration" -type: docs -description: > - Customize the automatic provisioning. -weight: 2 ---- - -### Properties - -To control all aspects of the suite bootstrapping behavior. - -| Property | Type | Default | Description | -| - | - | - | - | -| preBootstrapScript | string[] | | Path to the script/command with an optional sequence of additional flags/parameters that is executed before a bootstrapping request, optionally producing a `preBootstrapFile` | -| preBootstrapFile | string | | Path to the file used as a bootstrapping request data | -| postBootstrapScript | string[] | | Path to the script/command with an optional sequence of additional flags/parameters that is executed after a bootstrapping response, optionally consuming a `postBootstrapFile` | -| postBootstrapFile | string | | Path to the file used for a bootstrapping response data | -| bootstrapProvisioningFile | string | | Path to the file that stores the provisioning information from a bootstrapping response | -| maxChunkSize | int | 46080 | Maximum chunk size of the request data in bytes | -| **Remote connectivity** | | | | -| address | string | mqtts://mqtt.bosch-iot-hub.com:8883 | Address of the MQTT endpoint that the suite bootstrapping will connect for the remote communication, the format is: `scheme://host:port` | -| deviceId | string | | Device unique identifier | -| authId | string | | Authentication unique identifier that is a part of the credentials | -| tenantId | string | | Tenant unique identifier that the device belongs to | -| password | string | | Password that is a part of the credentials | -| clientId | string | | MQTT client unique identifier | -| policyId | string | | Policy unique identifier of the digital twin | -| **Remote connectivity - TLS** | | | | -| caCert | string | iothub.crt | PEM encoded CA certificates file | -| cert | string | | PEM encoded certificate file to authenticate to the MQTT endpoint | -| key | string | | PEM encoded unencrypted private key file to authenticate to the MQTT endpoint | -| deviceIdPattern | string | | Pattern to generate the device identifier, `{{subject-dn}}` and `{{subject-cn}}` placeholders can be part of it | -| **Remote connectivity - TLS over TPM** | | | | -| tpmDevice | string | | Path to the device file or the unix socket to access the TPM 2.0 | -| tpmHandle | int | | TPM 2.0 storage root key handle, the type is unsigned 64-bit integer | -| tpmKeyPub | string | | File path to the public part of the TPM 2.0 key | -| tpmKey | string | | File path to the private part of the TPM 2.0 key | -| **Logging** | | | | -| logFile | string | log/suite-bootstrapping.log | Path to the file where log messages are written | -| logLevel | string | INFO | All log messages at this or a higher level will be logged, the log levels in descending order are: ERROR, WARN, INFO, DEBUG and TRACE | -| logFileCount | int | 5 | Log file maximum rotations count | -| logFileMaxAge | int | 28 | Log file rotations maximum age in days, use 0 to not remove old log files | -| logFileSize | int | 2 | Log file size in MB before it gets rotated | - -**Example** - -The minimal required configuration to connect the publicly available -{{% refn "https://www.eclipse.org/hono/sandbox/" %}}Eclipse Hono sandbox{{% /refn %}} and request automatic provisioning. - -```json -{ - "address": "hono.eclipseprojects.io:1883", - "tenantId": "org.eclipse.kanto", - "deviceId": "org.eclipse.kanto:exampleDevice", - "authId": "org.eclipse.kanto_example", - "password": "secret", - "logFile": "/var/log/suite-bootstrapping/suite-bootstrapping.log" -} -``` - -### Template - -The configuration can be further adjusted according to the use case. -The following template illustrates all possible properties with their default values. - -{{% warn %}} -Be aware that some combinations may be incompatible -{{% /warn %}} - -```json -{ - "preBootstrapScript": "", - "preBootstrapFile": "", - "postBootstrapScript": "", - "postBootstrapFile": "", - "bootstrapProvisioningFile": "", - "maxChunkSize": 46080, - "provisioningFile": "provisioning.json", - "address": "mqtts://mqtt.bosch-iot-hub.com:8883", - "deviceId": "", - "authId": "", - "tenantId": "", - "password": "", - "clientId": "", - "policyId": "", - "caCert": "iothub.crt", - "cert": "", - "key": "", - "deviceIdPattern": "", - "tpmDevice": "", - "tpmHandle": 0, - "tpmKeyPub": "", - "tpmKey": "", - "logFile": "log/suite-bootstrapping.log", - "logLevel": "INFO", - "logFileCount": 5, - "logFileMaxAge": 28, - "logFileSize": 2 -} -```