diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index facdb517..488993bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,6 +52,6 @@ jobs: run: bash <(curl -s https://codecov.io/bash) - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: "v1.55" + version: "v1.59" diff --git a/.golangci.yml b/.golangci.yml index 2d0df9c5..b435c106 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,11 @@ +run: + go: "1.21" + linters: enable-all: true disable: - cyclop - exhaustive - - exhaustivestruct - exhaustruct - depguard - gci @@ -13,26 +15,17 @@ linters: - nestif - nlreturn - nonamedreturns - - nosnakecase - unparam - varnamelen # deprecated - bodyclose - contextcheck - - deadcode - - golint - - ifshort - - interfacer - - maligned - nilerr - noctx - rowserrcheck - - scopelint - sqlclosecheck - - structcheck - tparallel - unparam - - varcheck - wastedassign linters-settings: @@ -44,19 +37,18 @@ linters-settings: funlen: lines: 100 + statements: 50 + + gocognit: + min-complexity: 40 gosec: excludes: - G204 - gomnd: - settings: - mnd: - ignored-numbers: 0o600,0o755,0o644,5,10,16,32,64,128,100,0xff,3 - ignored-files: config/config.go,fcrypt/utils.go - - gofumpt: - lang-version: "1.21" + mnd: + ignored-numbers: 0o600,0o755,0o644,0.5,3,5,10,16,32,64,128,100,100.0,0xff + ignored-files: config/config.go,fcrypt/utils.go interfacebloat: max: 12 diff --git a/alerts/alerts.go b/alerts/alerts.go index be487d4e..94b7ecd2 100644 --- a/alerts/alerts.go +++ b/alerts/alerts.go @@ -21,7 +21,6 @@ package alerts import ( "context" "encoding/json" - "reflect" "sync" "time" @@ -29,6 +28,7 @@ import ( "github.com/aosedge/aos_common/api/cloudprotocol" log "github.com/sirupsen/logrus" + "github.com/aosedge/aos_common/utils/alertutils" "github.com/aosedge/aos_communicationmanager/amqphandler" "github.com/aosedge/aos_communicationmanager/config" ) @@ -56,7 +56,7 @@ type Sender interface { // Alerts instance. type Alerts struct { sync.RWMutex - alertsChannel chan cloudprotocol.AlertItem + alertsChannel chan interface{} alertsPackageChannel chan cloudprotocol.Alerts currentAlerts cloudprotocol.Alerts senderCancelFunction context.CancelFunc @@ -79,7 +79,7 @@ func New(config config.Alerts, sender Sender) (instance *Alerts, err error) { instance = &Alerts{ config: config, sender: sender, - alertsChannel: make(chan cloudprotocol.AlertItem, alertChannelSize), + alertsChannel: make(chan interface{}, alertChannelSize), alertsPackageChannel: make(chan cloudprotocol.Alerts, config.MaxOfflineMessages), } @@ -110,7 +110,7 @@ func (instance *Alerts) Close() { } // SendAlert sends alert. -func (instance *Alerts) SendAlert(alert cloudprotocol.AlertItem) { +func (instance *Alerts) SendAlert(alert interface{}) { select { case instance.alertsChannel <- alert: @@ -190,12 +190,12 @@ func (instance *Alerts) processAlertChannels(ctx context.Context) { } } -func (instance *Alerts) addAlert(item cloudprotocol.AlertItem) (bufferIsFull bool) { +func (instance *Alerts) addAlert(item interface{}) (bufferIsFull bool) { instance.Lock() defer instance.Unlock() - if len(instance.currentAlerts) != 0 && - reflect.DeepEqual(instance.currentAlerts[len(instance.currentAlerts)-1].Payload, item.Payload) { + if len(instance.currentAlerts.Items) != 0 && + alertutils.AlertsPayloadEqual(instance.currentAlerts.Items[len(instance.currentAlerts.Items)-1], item) { instance.duplicatedAlerts++ return } @@ -206,7 +206,7 @@ func (instance *Alerts) addAlert(item cloudprotocol.AlertItem) (bufferIsFull boo } instance.alertsSize += len(data) - instance.currentAlerts = append(instance.currentAlerts, item) + instance.currentAlerts.Items = append(instance.currentAlerts.Items, item) return instance.alertsSize >= instance.config.MaxMessageSize } @@ -233,7 +233,7 @@ func (instance *Alerts) prepareAlertsPackage() { log.Warn("Skip sending alerts due to channel is full") } - instance.currentAlerts = []cloudprotocol.AlertItem{} + instance.currentAlerts.Items = make([]interface{}, 0) instance.skippedAlerts = 0 instance.duplicatedAlerts = 0 instance.alertsSize = 0 diff --git a/alerts/alerts_test.go b/alerts/alerts_test.go index 8442c5bd..52d7ddbc 100644 --- a/alerts/alerts_test.go +++ b/alerts/alerts_test.go @@ -89,23 +89,21 @@ func TestAlertsMaxMessageSize(t *testing.T) { for i := 0; i < 2; i++ { // alert size = header 96 + message length - alertItem := cloudprotocol.AlertItem{ - Timestamp: time.Now(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: cloudprotocol.SystemAlert{Message: randomString(200)}, + alertItem := cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagSystemError}, + Message: randomString(200), } alertsHandler.SendAlert(alertItem) - expectedAlerts = append(expectedAlerts, alertItem) + expectedAlerts.Items = append(expectedAlerts.Items, alertItem) } for i := 2; i < numMessages; i++ { // alert size = header 96 + message length - alertItem := cloudprotocol.AlertItem{ - Timestamp: time.Now(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: cloudprotocol.SystemAlert{Message: randomString(200)}, + alertItem := cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagSystemError}, + Message: randomString(200), } alertsHandler.SendAlert(alertItem) @@ -139,13 +137,12 @@ func TestAlertsDuplicationMessages(t *testing.T) { expectedAlerts := cloudprotocol.Alerts{} - alertItem := cloudprotocol.AlertItem{ - Timestamp: time.Now(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: cloudprotocol.SystemAlert{Message: randomString(32)}, + alertItem := cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagSystemError}, + Message: randomString(32), } - expectedAlerts = append(expectedAlerts, alertItem) + expectedAlerts.Items = append(expectedAlerts.Items, alertItem) for i := 0; i < 2; i++ { alertsHandler.SendAlert(alertItem) @@ -183,22 +180,20 @@ func TestAlertsOfflineMessages(t *testing.T) { expectedAlerts := cloudprotocol.Alerts{} for i := 0; i < numOfflineMessages; i++ { - alertItem := cloudprotocol.AlertItem{ - Timestamp: time.Now(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: cloudprotocol.SystemAlert{Message: randomString(200)}, + alertItem := cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagSystemError}, + Message: randomString(200), } - expectedAlerts = append(expectedAlerts, alertItem) + expectedAlerts.Items = append(expectedAlerts.Items, alertItem) alertsHandler.SendAlert(alertItem) } for i := 0; i < numExtraMessages; i++ { - alertItem := cloudprotocol.AlertItem{ - Timestamp: time.Now(), - Tag: cloudprotocol.AlertTagAosCore, - Payload: cloudprotocol.SystemAlert{Message: randomString(200)}, + alertItem := cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagAosCore}, + Message: randomString(200), } alertsHandler.SendAlert(alertItem) @@ -220,7 +215,7 @@ func TestAlertsOfflineMessages(t *testing.T) { t.Fatalf("Wait alerts error: %v", err) } - receivedAlerts = append(receivedAlerts, alerts...) + receivedAlerts.Items = append(receivedAlerts.Items, alerts.Items...) } if !reflect.DeepEqual(receivedAlerts, expectedAlerts) { @@ -267,7 +262,7 @@ func (sender *testSender) waitResult(timeout time.Duration) (cloudprotocol.Alert return alerts, nil case <-time.After(timeout): - return nil, errTimeout + return cloudprotocol.Alerts{}, errTimeout } } } diff --git a/amqphandler/amqphandler.go b/amqphandler/amqphandler.go index ba8c9389..d60459a3 100644 --- a/amqphandler/amqphandler.go +++ b/amqphandler/amqphandler.go @@ -102,27 +102,36 @@ type ConnectionEventsConsumer interface { **********************************************************************************************************************/ var messageMap = map[string]func() interface{}{ //nolint:gochecknoglobals - cloudprotocol.DesiredStatusType: func() interface{} { + cloudprotocol.DesiredStatusMessageType: func() interface{} { return &cloudprotocol.DesiredStatus{} }, - cloudprotocol.RequestLogType: func() interface{} { + cloudprotocol.RequestLogMessageType: func() interface{} { return &cloudprotocol.RequestLog{} }, - cloudprotocol.StateAcceptanceType: func() interface{} { + cloudprotocol.StateAcceptanceMessageType: func() interface{} { return &cloudprotocol.StateAcceptance{} }, - cloudprotocol.UpdateStateType: func() interface{} { + cloudprotocol.UpdateStateMessageType: func() interface{} { return &cloudprotocol.UpdateState{} }, - cloudprotocol.RenewCertsNotificationType: func() interface{} { + cloudprotocol.RenewCertsNotificationMessageType: func() interface{} { return &cloudprotocol.RenewCertsNotification{} }, - cloudprotocol.IssuedUnitCertsType: func() interface{} { + cloudprotocol.IssuedUnitCertsMessageType: func() interface{} { return &cloudprotocol.IssuedUnitCerts{} }, - cloudprotocol.OverrideEnvVarsType: func() interface{} { + cloudprotocol.OverrideEnvVarsMessageType: func() interface{} { return &cloudprotocol.OverrideEnvVars{} }, + cloudprotocol.StartProvisioningRequestMessageType: func() interface{} { + return &cloudprotocol.StartProvisioningRequest{} + }, + cloudprotocol.FinishProvisioningRequestMessageType: func() interface{} { + return &cloudprotocol.FinishProvisioningRequest{} + }, + cloudprotocol.DeprovisioningRequestMessageType: func() interface{} { + return &cloudprotocol.DeprovisioningRequest{} + }, } var ( @@ -132,14 +141,6 @@ var ( ErrSendChannelFull = errors.New("send channel full") ) -var importantMessages = []string{ //nolint:gochecknoglobals // used as const - cloudprotocol.DesiredStatusType, cloudprotocol.StateAcceptanceType, - cloudprotocol.RenewCertsNotificationType, cloudprotocol.IssuedUnitCertsType, cloudprotocol.OverrideEnvVarsType, - cloudprotocol.NewStateType, cloudprotocol.StateRequestType, cloudprotocol.UnitStatusType, - cloudprotocol.IssueUnitCertsType, cloudprotocol.InstallUnitCertsConfirmationType, - cloudprotocol.OverrideEnvVarsStatusType, -} - /*********************************************************************************************************************** * Public **********************************************************************************************************************/ @@ -179,8 +180,7 @@ func (handler *AmqpHandler) Connect(cryptoContext CryptoContext, sdURL, systemID ctx, handler.cancelFunc = context.WithCancel(context.Background()) if connectionInfo, err = getConnectionInfo(ctx, sdURL, - handler.createCloudMessage(cloudprotocol.ServiceDiscoveryType, - cloudprotocol.ServiceDiscoveryRequest{}), tlsConfig); err != nil { + handler.createCloudMessage(cloudprotocol.ServiceDiscoveryRequest{}), tlsConfig); err != nil { return aoserrors.Wrap(err) } @@ -234,7 +234,9 @@ func (handler *AmqpHandler) SendUnitStatus(unitStatus cloudprotocol.UnitStatus) handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.UnitStatusType, unitStatus, false) + unitStatus.MessageType = cloudprotocol.UnitStatusMessageType + + return handler.scheduleMessage(unitStatus, false) } // SendMonitoringData sends monitoring data. @@ -242,7 +244,9 @@ func (handler *AmqpHandler) SendMonitoringData(monitoringData cloudprotocol.Moni handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.MonitoringDataType, monitoringData, false) + monitoringData.MessageType = cloudprotocol.MonitoringMessageType + + return handler.scheduleMessage(monitoringData, false) } // SendServiceNewState sends new state message. @@ -250,7 +254,9 @@ func (handler *AmqpHandler) SendInstanceNewState(newState cloudprotocol.NewState handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.NewStateType, newState, false) + newState.MessageType = cloudprotocol.NewStateMessageType + + return handler.scheduleMessage(newState, false) } // SendServiceStateRequest sends state request message. @@ -258,7 +264,9 @@ func (handler *AmqpHandler) SendInstanceStateRequest(request cloudprotocol.State handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.StateRequestType, request, true) + request.MessageType = cloudprotocol.StateRequestMessageType + + return handler.scheduleMessage(request, true) } // SendLog sends system or service logs. @@ -266,7 +274,9 @@ func (handler *AmqpHandler) SendLog(serviceLog cloudprotocol.PushLog) error { handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.PushLogType, serviceLog, true) + serviceLog.MessageType = cloudprotocol.PushLogMessageType + + return handler.scheduleMessage(serviceLog, true) } // SendAlerts sends alerts message. @@ -274,7 +284,9 @@ func (handler *AmqpHandler) SendAlerts(alerts cloudprotocol.Alerts) error { handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.AlertsType, alerts, true) + alerts.MessageType = cloudprotocol.AlertsMessageType + + return handler.scheduleMessage(alerts, true) } // SendIssueUnitCerts sends request to issue new certificates. @@ -282,8 +294,11 @@ func (handler *AmqpHandler) SendIssueUnitCerts(requests []cloudprotocol.IssueCer handler.Lock() defer handler.Unlock() - return handler.scheduleMessage( - cloudprotocol.IssueUnitCertsType, cloudprotocol.IssueUnitCerts{Requests: requests}, true) + issueUnitCerts := cloudprotocol.IssueUnitCerts{ + MessageType: cloudprotocol.IssueUnitCertsMessageType, Requests: requests, + } + + return handler.scheduleMessage(issueUnitCerts, true) } // SendInstallCertsConfirmation sends install certificates confirmation. @@ -291,9 +306,11 @@ func (handler *AmqpHandler) SendInstallCertsConfirmation(confirmations []cloudpr handler.Lock() defer handler.Unlock() - return handler.scheduleMessage( - cloudprotocol.InstallUnitCertsConfirmationType, - cloudprotocol.InstallUnitCertsConfirmation{Certificates: confirmations}, true) + request := cloudprotocol.InstallUnitCertsConfirmation{ + MessageType: cloudprotocol.InstallUnitCertsConfirmationMessageType, Certificates: confirmations, + } + + return handler.scheduleMessage(request, true) } // SendOverrideEnvVarsStatus overrides env vars status. @@ -301,7 +318,33 @@ func (handler *AmqpHandler) SendOverrideEnvVarsStatus(envs cloudprotocol.Overrid handler.Lock() defer handler.Unlock() - return handler.scheduleMessage(cloudprotocol.OverrideEnvVarsStatusType, envs, true) + envs.MessageType = cloudprotocol.OverrideEnvVarsStatusMessageType + + return handler.scheduleMessage(envs, true) +} + +// SendStartProvisioningResponse sends start provisioning response. +func (handler *AmqpHandler) SendStartProvisioningResponse(response cloudprotocol.StartProvisioningResponse) error { + handler.Lock() + defer handler.Unlock() + + return handler.scheduleMessage(response, true) +} + +// SendFinishProvisioningResponse sends finish provisioning response. +func (handler *AmqpHandler) SendFinishProvisioningResponse(response cloudprotocol.FinishProvisioningResponse) error { + handler.Lock() + defer handler.Unlock() + + return handler.scheduleMessage(response, true) +} + +// SendDeprovisioningResponse sends deprovisioning response. +func (handler *AmqpHandler) SendDeprovisioningResponse(response cloudprotocol.DeprovisioningResponse) error { + handler.Lock() + defer handler.Unlock() + + return handler.scheduleMessage(response, true) } // SubscribeForConnectionEvents subscribes for connection events. @@ -580,30 +623,30 @@ func (handler *AmqpHandler) runReceiver(deliveryChannel <-chan amqp.Delivery, pa return } + decryptData, err := handler.cryptoContext.DecryptMetadata(delivery.Body) + if err != nil { + log.Errorf("Can't decrypt message: %v", err) + + continue + } + var incomingMsg cloudprotocol.ReceivedMessage + if err := json.Unmarshal(decryptData, &incomingMsg); err != nil { + log.Errorf("Can't parse message: %v", err) - if err := json.Unmarshal(delivery.Body, &incomingMsg); err != nil { - log.Errorf("Can't parse message header: %s", err) continue } if incomingMsg.Header.Version != cloudprotocol.ProtocolVersion { log.Errorf("Unsupported protocol version: %d", incomingMsg.Header.Version) - continue - } - messageTypeFunc, ok := messageMap[incomingMsg.Header.MessageType] - if !ok { - log.Warnf("AMQP unsupported message type: %s", incomingMsg.Header.MessageType) continue } - decodedData := messageTypeFunc() - - log.Infof("AMQP receive message: %s", incomingMsg.Header.MessageType) + decodedData, err := handler.unmarshalReceiveData(incomingMsg.Data) + if err != nil { + log.Errorf("Can't unmarshal incoming message %s", err) - if err := handler.decodeData(incomingMsg.Data, decodedData); err != nil { - log.Errorf("Can't decode incoming message %s", err) continue } @@ -612,59 +655,67 @@ func (handler *AmqpHandler) runReceiver(deliveryChannel <-chan amqp.Delivery, pa } } -func (handler *AmqpHandler) decodeData(data []byte, result interface{}) error { +func (handler *AmqpHandler) unmarshalReceiveData(data []byte) (Message, error) { if len(data) == 0 { - return nil + //nolint:nilnil + return nil, nil } - decryptData, err := handler.cryptoContext.DecryptMetadata(data) - if err != nil { - return aoserrors.Wrap(err) + // unmarshal type name + var messageType struct { + Type string `json:"messageType"` } - if err = json.Unmarshal(decryptData, result); err != nil { - return aoserrors.Wrap(err) + if err := json.Unmarshal(data, &messageType); err != nil { + return nil, aoserrors.Wrap(err) } - desiredStatus, ok := result.(*cloudprotocol.DesiredStatus) + // unmarshal type message + messageTypeFunc, ok := messageMap[messageType.Type] if !ok { - log.WithField("data", string(decryptData)).Debug("Decrypted data") + log.Warnf("AMQP unsupported message type: %s", messageType.Type) - return nil + return nil, aoserrors.New("AMQP unsupported message type") + } + + messageData := messageTypeFunc() + + if err := json.Unmarshal(data, &messageData); err != nil { + return nil, aoserrors.Wrap(err) + } + + // print DesiredStatus message + desiredStatus, ok := messageData.(*cloudprotocol.DesiredStatus) + if !ok { + return messageData, nil } log.Debug("Decrypted data:") - if len(desiredStatus.UnitConfig) != 0 { - log.Debugf("UnitConfig: %s", desiredStatus.UnitConfig) + if desiredStatus.UnitConfig != nil { + log.Debugf("UnitConfig: %v", desiredStatus.UnitConfig) } for _, service := range desiredStatus.Services { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, - "vendorVersion": service.VendorVersion, - "description": service.Description, + "id": service.ServiceID, + "version": service.Version, }).Debug("Service") } for _, layer := range desiredStatus.Layers { log.WithFields(log.Fields{ - "id": layer.ID, - "digest": layer.Digest, - "aosVersion": layer.AosVersion, - "vendorVersion": layer.VendorVersion, - "description": layer.Description, + "id": layer.LayerID, + "digest": layer.Digest, + "version": layer.Version, }).Debug("Layer") } for _, component := range desiredStatus.Components { log.WithFields(log.Fields{ - "id": component.ID, - "annotations": string(component.Annotations), - "aosVersion": component.AosVersion, - "vendorVersion": component.VendorVersion, - "description": component.Description, + "id": component.ComponentID, + "annotations": string(component.Annotations), + "version": component.Version, }).Debug("Component") } @@ -686,15 +737,14 @@ func (handler *AmqpHandler) decodeData(data []byte, result interface{}) error { log.Debugf("Sota schedule: %s", schedule) } - return nil + return messageData, nil } -func (handler *AmqpHandler) createCloudMessage(messageType string, data interface{}) cloudprotocol.Message { +func (handler *AmqpHandler) createCloudMessage(data interface{}) cloudprotocol.Message { return cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - Version: cloudprotocol.ProtocolVersion, - SystemID: handler.systemID, - MessageType: messageType, + Version: cloudprotocol.ProtocolVersion, + SystemID: handler.systemID, }, Data: data, } @@ -712,13 +762,13 @@ func (handler *AmqpHandler) notifyCloudDisconnected() { } } -func (handler *AmqpHandler) scheduleMessage(messageType string, data interface{}, important bool) error { +func (handler *AmqpHandler) scheduleMessage(data interface{}, important bool) error { if !important && !handler.isConnected { return ErrNotConnected } select { - case handler.sendChannel <- handler.createCloudMessage(messageType, data): + case handler.sendChannel <- handler.createCloudMessage(data): return nil case <-time.After(sendTimeout): @@ -726,18 +776,8 @@ func (handler *AmqpHandler) scheduleMessage(messageType string, data interface{} } } -func isMessageImportant(messageType string) bool { - for _, importantType := range importantMessages { - if messageType == importantType { - return true - } - } - - return false -} - -func getMessageDataForLog(messageType string, data []byte) string { - if len(data) > maxLenLogMessage && !isMessageImportant(messageType) { +func getMessageDataForLog(message interface{}, data []byte) string { + if len(data) > maxLenLogMessage && !isMessageImportant(message) { return string(data[:maxLenLogMessage]) + "..." } @@ -753,9 +793,9 @@ func (handler *AmqpHandler) sendMessage( } if handler.sendTry > 1 { - log.WithField("data", getMessageDataForLog(message.Header.MessageType, data)).Debug("AMQP retry message") + log.WithField("data", getMessageDataForLog(message.Data, data)).Debug("AMQP retry message") } else { - log.WithField("data", getMessageDataForLog(message.Header.MessageType, data)).Debug("AMQP send message") + log.WithField("data", getMessageDataForLog(message.Data, data)).Debug("AMQP send message") } if handler.sendTry++; handler.sendTry > sendMaxTry { @@ -779,3 +819,32 @@ func (handler *AmqpHandler) sendMessage( return nil } + +func isMessageImportant(message interface{}) bool { + switch message.(type) { + case cloudprotocol.DesiredStatus: + return true + case cloudprotocol.StateAcceptance: + return true + case cloudprotocol.RenewCertsNotification: + return true + case cloudprotocol.IssuedUnitCerts: + return true + case cloudprotocol.OverrideEnvVars: + return true + case cloudprotocol.NewState: + return true + case cloudprotocol.StateRequest: + return true + case cloudprotocol.UnitStatus: + return true + case cloudprotocol.IssueUnitCerts: + return true + case cloudprotocol.InstallCertData: + return true + case cloudprotocol.OverrideEnvVarsStatus: + return true + } + + return false +} diff --git a/amqphandler/amqphandler_test.go b/amqphandler/amqphandler_test.go index d0d0d649..ff0a42cc 100644 --- a/amqphandler/amqphandler_test.go +++ b/amqphandler/amqphandler_test.go @@ -19,6 +19,7 @@ package amqphandler_test import ( "crypto/tls" + "encoding/base64" "encoding/json" "errors" "math/rand" @@ -167,14 +168,14 @@ func cleanup() { } func sendCloudMessage(msgType string, message interface{}) error { - rawJSON, err := json.Marshal(message) + jsonMsg, err := json.Marshal(message) if err != nil { return aoserrors.Wrap(err) } dataToSend := cloudprotocol.ReceivedMessage{ - Header: cloudprotocol.MessageHeader{MessageType: msgType, Version: cloudprotocol.ProtocolVersion}, - Data: rawJSON, + Header: cloudprotocol.MessageHeader{Version: cloudprotocol.ProtocolVersion}, + Data: jsonMsg, } dataJSON, err := json.Marshal(dataToSend) @@ -184,6 +185,8 @@ func sendCloudMessage(msgType string, message interface{}) error { log.WithFields(log.Fields{"message": string(dataJSON)}).Debug("Send message") + encryptedData := []byte(base64.StdEncoding.EncodeToString(dataJSON)) + return aoserrors.Wrap(testClient.channel.Publish( "", outQueueName, @@ -191,7 +194,7 @@ func sendCloudMessage(msgType string, message interface{}) error { false, amqp.Publishing{ ContentType: "text/plain", - Body: dataJSON, + Body: encryptedData, })) } @@ -217,6 +220,7 @@ func TestMain(m *testing.M) { func TestReceiveMessages(t *testing.T) { cryptoContext := &testCryptoContext{} + rootfs := "rootfs" amqpHandler, err := amqphandler.New() if err != nil { @@ -240,24 +244,27 @@ func TestReceiveMessages(t *testing.T) { testData := []testDataType{ { - messageType: cloudprotocol.StateAcceptanceType, + messageType: cloudprotocol.StateAcceptanceMessageType, expectedData: &cloudprotocol.StateAcceptance{ + MessageType: cloudprotocol.StateAcceptanceMessageType, InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj0", Instance: 1}, Checksum: "0123456890", Result: "accepted", Reason: "just because", }, }, { - messageType: cloudprotocol.UpdateStateType, + messageType: cloudprotocol.UpdateStateMessageType, expectedData: &cloudprotocol.UpdateState{ + MessageType: cloudprotocol.UpdateStateMessageType, InstanceIdent: aostypes.InstanceIdent{ServiceID: "service1", SubjectID: "subj1", Instance: 1}, Checksum: "0993478847", State: "This is new state", }, }, { - messageType: cloudprotocol.RequestLogType, + messageType: cloudprotocol.RequestLogMessageType, expectedData: &cloudprotocol.RequestLog{ - LogID: "someID", - LogType: cloudprotocol.ServiceLog, + MessageType: cloudprotocol.RequestLogMessageType, + LogID: "someID", + LogType: cloudprotocol.ServiceLog, Filter: cloudprotocol.LogFilter{ InstanceFilter: cloudprotocol.NewInstanceFilter("service2", "", -1), From: nil, Till: nil, @@ -265,10 +272,11 @@ func TestReceiveMessages(t *testing.T) { }, }, { - messageType: cloudprotocol.RequestLogType, + messageType: cloudprotocol.RequestLogMessageType, expectedData: &cloudprotocol.RequestLog{ - LogID: "someID", - LogType: cloudprotocol.CrashLog, + MessageType: cloudprotocol.RequestLogMessageType, + LogID: "someID", + LogType: cloudprotocol.CrashLog, Filter: cloudprotocol.LogFilter{ InstanceFilter: cloudprotocol.NewInstanceFilter("service3", "", -1), From: nil, Till: nil, @@ -276,56 +284,89 @@ func TestReceiveMessages(t *testing.T) { }, }, { - messageType: cloudprotocol.RequestLogType, + messageType: cloudprotocol.RequestLogMessageType, expectedData: &cloudprotocol.RequestLog{ - LogID: "someID", - LogType: cloudprotocol.SystemLog, + MessageType: cloudprotocol.RequestLogMessageType, + LogID: "someID", + LogType: cloudprotocol.SystemLog, Filter: cloudprotocol.LogFilter{ From: nil, Till: nil, }, }, }, { - messageType: cloudprotocol.RenewCertsNotificationType, + messageType: cloudprotocol.RenewCertsNotificationMessageType, expectedData: &cloudprotocol.RenewCertsNotification{ + MessageType: cloudprotocol.RenewCertsNotificationMessageType, Certificates: []cloudprotocol.RenewCertData{ - {Type: "online", Serial: "1234", ValidTill: testTime}, + {NodeID: "node0", Type: "online", Serial: "1234", ValidTill: testTime}, }, - UnitSecret: cloudprotocol.UnitSecret{Version: 1, Data: struct { - OwnerPassword string `json:"ownerPassword"` - }{OwnerPassword: "pwd"}}, + UnitSecrets: cloudprotocol.UnitSecrets{Version: "1.0.0", Nodes: map[string]string{"node0": "pwd"}}, }, }, { - messageType: cloudprotocol.IssuedUnitCertsType, + messageType: cloudprotocol.IssuedUnitCertsMessageType, expectedData: &cloudprotocol.IssuedUnitCerts{ + MessageType: cloudprotocol.IssuedUnitCertsMessageType, Certificates: []cloudprotocol.IssuedCertData{ {Type: "online", NodeID: "mainNode", CertificateChain: "123456"}, }, }, }, { - messageType: cloudprotocol.OverrideEnvVarsType, - expectedData: &cloudprotocol.OverrideEnvVars{OverrideEnvVars: []cloudprotocol.EnvVarsInstanceInfo{}}, + messageType: cloudprotocol.OverrideEnvVarsMessageType, + expectedData: &cloudprotocol.OverrideEnvVars{ + MessageType: cloudprotocol.OverrideEnvVarsMessageType, + Items: []cloudprotocol.EnvVarsInstanceInfo{}, + }, }, { - messageType: cloudprotocol.DesiredStatusType, + messageType: cloudprotocol.DesiredStatusMessageType, expectedData: &cloudprotocol.DesiredStatus{ - UnitConfig: json.RawMessage([]byte("\"config\"")), + MessageType: cloudprotocol.DesiredStatusMessageType, + UnitConfig: &cloudprotocol.UnitConfig{}, Components: []cloudprotocol.ComponentInfo{ - {VersionInfo: aostypes.VersionInfo{AosVersion: 1}, ID: "rootfs"}, + {Version: "1.0.0", ComponentID: &rootfs}, }, Layers: []cloudprotocol.LayerInfo{ - {VersionInfo: aostypes.VersionInfo{AosVersion: 1}, ID: "l1", Digest: "digest"}, + {Version: "1.0", LayerID: "l1", Digest: "digest"}, }, Services: []cloudprotocol.ServiceInfo{ - {VersionInfo: aostypes.VersionInfo{AosVersion: 1}, ID: "serv1", ProviderID: "p1"}, + {Version: "1.0", ServiceID: "serv1", ProviderID: "p1"}, }, Instances: []cloudprotocol.InstanceInfo{{ServiceID: "s1", SubjectID: "subj1", NumInstances: 1}}, FOTASchedule: cloudprotocol.ScheduleRule{TTL: uint64(100), Type: "type"}, SOTASchedule: cloudprotocol.ScheduleRule{TTL: uint64(200), Type: "type2"}, }, }, + { + messageType: cloudprotocol.StartProvisioningRequestMessageType, + expectedData: &cloudprotocol.StartProvisioningRequest{ + MessageType: cloudprotocol.StartProvisioningRequestMessageType, + NodeID: "node-1", + Password: "password-1", + }, + }, + { + messageType: cloudprotocol.FinishProvisioningRequestMessageType, + expectedData: &cloudprotocol.FinishProvisioningRequest{ + MessageType: cloudprotocol.FinishProvisioningRequestMessageType, + NodeID: "node1", + Certificates: []cloudprotocol.IssuedCertData{ + {NodeID: "node1", Type: "online", CertificateChain: "onlineCSR"}, + {NodeID: "node1", Type: "offline", CertificateChain: "offlineCSR"}, + }, + Password: "password-1", + }, + }, + { + messageType: cloudprotocol.DeprovisioningRequestMessageType, + expectedData: &cloudprotocol.DeprovisioningRequest{ + MessageType: cloudprotocol.DeprovisioningRequestMessageType, + NodeID: "node-1", + Password: "password-1", + }, + }, } for _, data := range testData { @@ -373,141 +414,174 @@ func TestSendMessages(t *testing.T) { getDataType func() interface{} } - unitConfigData := []cloudprotocol.UnitConfigStatus{{VendorVersion: "1.0"}} + unitConfigData := []cloudprotocol.UnitConfigStatus{{Version: "1.0"}} serviceSetupData := []cloudprotocol.ServiceStatus{ - {ID: "service0", AosVersion: 1, Status: "running", ErrorInfo: nil}, + {ServiceID: "service0", Version: "1.0", Status: "running", ErrorInfo: nil}, { - ID: "service1", AosVersion: 2, Status: "stopped", + ServiceID: "service1", Version: "2.0", Status: "stopped", ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 1, ExitCode: 100, Message: "crash"}, }, { - ID: "service2", AosVersion: 3, Status: "unknown", + ServiceID: "service2", Version: "3.0", Status: "unknown", ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 1, ExitCode: 100, Message: "unknown"}, }, } instances := []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, - AosVersion: 1, StateChecksum: "12345", RunState: "running", NodeID: "mainNode", + InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, + ServiceVersion: "1.0", StateChecksum: "12345", Status: "running", NodeID: "mainNode", }, } layersSetupData := []cloudprotocol.LayerStatus{ { - ID: "layer0", Digest: "sha256:0", Status: "failed", AosVersion: 1, + LayerID: "layer0", Digest: "sha256:0", Status: "failed", Version: "1.0", ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 1, ExitCode: 100, Message: "bad layer"}, }, - {ID: "layer1", Digest: "sha256:1", Status: "installed", AosVersion: 2}, - {ID: "layer2", Digest: "sha256:2", Status: "installed", AosVersion: 3}, + {LayerID: "layer1", Digest: "sha256:1", Status: "installed", Version: "2.0"}, + {LayerID: "layer2", Digest: "sha256:2", Status: "installed", Version: "3.0"}, } componentSetupData := []cloudprotocol.ComponentStatus{ - {ID: "rootfs", Status: "installed", VendorVersion: "1.0"}, - {ID: "firmware", Status: "installed", VendorVersion: "5", AosVersion: 6}, + {ComponentID: "rootfs", Status: "installed", Version: "1.0"}, + {ComponentID: "firmware", Status: "installed", Version: "5.6"}, { - ID: "bootloader", Status: "error", VendorVersion: "100", + ComponentID: "bootloader", Status: "error", Version: "100", ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 1, ExitCode: 100, Message: "install error"}, }, } nodeConfiguration := []cloudprotocol.NodeInfo{ - {NodeID: "main", NodeType: "mainType", SystemInfo: cloudprotocol.SystemInfo{ - NumCPUs: 2, TotalRAM: 200, - Partitions: []cloudprotocol.PartitionInfo{ - {Name: "p1", Types: []string{"t1"}, TotalSize: 200}, + { + NodeID: "main", NodeType: "mainType", TotalRAM: 200, + CPUs: []cloudprotocol.CPUInfo{ + {ModelName: "Intel(R) Core(TM) i7-1185G7"}, + {ModelName: "Intel(R) Core(TM) i7-1185G7"}, }, - }}, + Partitions: []cloudprotocol.PartitionInfo{{Name: "p1", Types: []string{"t1"}, TotalSize: 200}}, + }, } nodeMonitoring := cloudprotocol.NodeMonitoringData{ - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 1024, CPU: 50, InTraffic: 8192, OutTraffic: 4096, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}, - }, - NodeID: "mainNode", - Timestamp: time.Now().UTC(), - ServiceInstances: []cloudprotocol.InstanceMonitoringData{ + Items: []aostypes.MonitoringData{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 1024, CPU: 50, Disk: []cloudprotocol.PartitionUsage{{ + RAM: 1024, CPU: 50, Download: 8192, Upload: 4096, Disk: []aostypes.PartitionUsage{{ Name: "p1", UsedSize: 100, - }}}, + }}, + Timestamp: time.Now().UTC(), }, - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service1", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 128, CPU: 60, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}}, + }, + } + + instanceMonitoringData := []cloudprotocol.InstanceMonitoringData{ + { + NodeID: "mainNode", InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, + Items: []aostypes.MonitoringData{ + {RAM: 1024, CPU: 50, Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}}, }, - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service2", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 256, CPU: 70, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}}, + }, + { + NodeID: "mainNode", InstanceIdent: aostypes.InstanceIdent{ServiceID: "service1", SubjectID: "subj1", Instance: 1}, + Items: []aostypes.MonitoringData{ + {RAM: 128, CPU: 60, Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}}, }, - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service3", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 512, CPU: 80, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}}, + }, + { + NodeID: "mainNode", InstanceIdent: aostypes.InstanceIdent{ServiceID: "service2", SubjectID: "subj1", Instance: 1}, + Items: []aostypes.MonitoringData{ + {RAM: 256, CPU: 70, Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}}, + }, + }, + { + NodeID: "mainNode", InstanceIdent: aostypes.InstanceIdent{ServiceID: "service3", SubjectID: "subj1", Instance: 1}, + Items: []aostypes.MonitoringData{ + {RAM: 512, CPU: 80, Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}}, }, }, } monitoringData := cloudprotocol.Monitoring{ - Nodes: []cloudprotocol.NodeMonitoringData{nodeMonitoring}, + MessageType: cloudprotocol.MonitoringMessageType, + Nodes: []cloudprotocol.NodeMonitoringData{nodeMonitoring}, + ServiceInstances: instanceMonitoringData, } pushServiceLogData := cloudprotocol.PushLog{ - LogID: "log0", - PartsCount: 2, - Part: 1, - Content: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + MessageType: cloudprotocol.PushLogMessageType, + LogID: "log0", + PartsCount: 2, + Part: 1, + Content: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, ErrorInfo: &cloudprotocol.ErrorInfo{ Message: "Error", }, } + now := time.Now().UTC() + nowFormatted := now.Format(time.RFC3339Nano) + alertsData := cloudprotocol.Alerts{ - cloudprotocol.AlertItem{ - Timestamp: time.Now().UTC(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: map[string]interface{}{"Message": "System error", "nodeId": "mainNode"}, - }, - cloudprotocol.AlertItem{ - Timestamp: time.Now().UTC(), - Tag: cloudprotocol.AlertTagSystemError, - Payload: map[string]interface{}{"Message": "Service crashed", "nodeId": "mainNode"}, - }, - cloudprotocol.AlertItem{ - Timestamp: time.Now().UTC(), - Tag: cloudprotocol.AlertTagResourceValidate, - Payload: map[string]interface{}{"Parameter": "cpu", "Value": float64(100), "nodeId": "mainNode"}, + MessageType: cloudprotocol.AlertsMessageType, + Items: []interface{}{ + cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: now, Tag: cloudprotocol.AlertTagSystemError}, + Message: "System error", NodeID: "mainNode", + }, + cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: now, Tag: cloudprotocol.AlertTagSystemError}, + Message: "Service crashed", NodeID: "mainNode", + }, + cloudprotocol.SystemQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: now, Tag: cloudprotocol.AlertTagSystemQuota}, + NodeID: "mainNode", + Parameter: "cpu", + Value: 1000, + }, }, } overrideEnvStatus := cloudprotocol.OverrideEnvVarsStatus{ - OverrideEnvVarsStatus: []cloudprotocol.EnvVarsInstanceStatus{ + MessageType: cloudprotocol.OverrideEnvVarsStatusMessageType, + Statuses: []cloudprotocol.EnvVarsInstanceStatus{ { InstanceFilter: cloudprotocol.NewInstanceFilter("service0", "subject0", -1), Statuses: []cloudprotocol.EnvVarStatus{ - {ID: "1234"}, - {ID: "345", Error: "some error"}, + {Name: "1234"}, + {Name: "345", ErrorInfo: &cloudprotocol.ErrorInfo{Message: "some error"}}, }, }, { InstanceFilter: cloudprotocol.NewInstanceFilter("service1", "subject1", -1), Statuses: []cloudprotocol.EnvVarStatus{ - {ID: "0000"}, + {Name: "0000"}, }, }, }, } + startProvisioningResponse := cloudprotocol.StartProvisioningResponse{ + MessageType: cloudprotocol.StartProvisioningResponseMessageType, + NodeID: "node-1", + ErrorInfo: nil, + CSRs: []cloudprotocol.IssueCertData{{Type: "online", Csr: "iam"}, {Type: "offline", Csr: "iam"}}, + } + + finishProvisioningResponse := cloudprotocol.FinishProvisioningResponse{ + MessageType: cloudprotocol.FinishProvisioningResponseMessageType, + NodeID: "node-1", + ErrorInfo: nil, + } + + deProvisioningResponse := cloudprotocol.DeprovisioningResponse{ + MessageType: cloudprotocol.DeprovisioningResponseMessageType, + NodeID: "node-1", + ErrorInfo: nil, + } + issueCerts := cloudprotocol.IssueUnitCerts{ + MessageType: cloudprotocol.IssueUnitCertsMessageType, Requests: []cloudprotocol.IssueCertData{ {Type: "online", Csr: "This is online CSR", NodeID: "mainNode"}, {Type: "offline", Csr: "This is offline CSR", NodeID: "mainNode"}, @@ -515,6 +589,7 @@ func TestSendMessages(t *testing.T) { } installCertsConfirmation := cloudprotocol.InstallUnitCertsConfirmation{ + MessageType: cloudprotocol.InstallUnitCertsConfirmationMessageType, Certificates: []cloudprotocol.InstallCertData{ {Type: "online", Serial: "1234", Status: "ok", Description: "This is online cert", NodeID: "mainNode"}, {Type: "offline", Serial: "1234", Status: "ok", Description: "This is offline cert", NodeID: "mainNode"}, @@ -536,11 +611,11 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.UnitStatusType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &cloudprotocol.UnitStatus{ + MessageType: cloudprotocol.UnitStatusMessageType, UnitConfig: unitConfigData, Components: componentSetupData, Layers: layersSetupData, @@ -551,7 +626,7 @@ func TestSendMessages(t *testing.T) { }, }, getDataType: func() interface{} { - return &cloudprotocol.UnitStatus{} + return &cloudprotocol.UnitStatus{MessageType: cloudprotocol.UnitStatusMessageType} }, }, { @@ -560,14 +635,13 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.MonitoringDataType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &monitoringData, }, getDataType: func() interface{} { - return &cloudprotocol.Monitoring{} + return &cloudprotocol.Monitoring{MessageType: cloudprotocol.MonitoringMessageType} }, }, { @@ -581,40 +655,41 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.NewStateType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &cloudprotocol.NewState{ InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, Checksum: "12345679", State: "This is state", + MessageType: cloudprotocol.NewStateMessageType, }, }, getDataType: func() interface{} { - return &cloudprotocol.NewState{} + return &cloudprotocol.NewState{MessageType: cloudprotocol.NewStateMessageType} }, }, { call: func() error { return aoserrors.Wrap(amqpHandler.SendInstanceStateRequest( cloudprotocol.StateRequest{ + MessageType: cloudprotocol.StateRequestMessageType, InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, Default: true, })) }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.StateRequestType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &cloudprotocol.StateRequest{ + MessageType: cloudprotocol.StateRequestMessageType, InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, Default: true, }, }, getDataType: func() interface{} { - return &cloudprotocol.StateRequest{} + return &cloudprotocol.StateRequest{MessageType: cloudprotocol.StateRequestMessageType} }, }, { @@ -623,20 +698,20 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.PushLogType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &cloudprotocol.PushLog{ - LogID: pushServiceLogData.LogID, - PartsCount: pushServiceLogData.PartsCount, - Part: pushServiceLogData.Part, - Content: pushServiceLogData.Content, - ErrorInfo: pushServiceLogData.ErrorInfo, + MessageType: cloudprotocol.PushLogMessageType, + LogID: pushServiceLogData.LogID, + PartsCount: pushServiceLogData.PartsCount, + Part: pushServiceLogData.Part, + Content: pushServiceLogData.Content, + ErrorInfo: pushServiceLogData.ErrorInfo, }, }, getDataType: func() interface{} { - return &cloudprotocol.PushLog{} + return &cloudprotocol.PushLog{MessageType: cloudprotocol.PushLogMessageType} }, }, { @@ -645,14 +720,29 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.AlertsType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, + }, + Data: &cloudprotocol.Alerts{ + MessageType: cloudprotocol.AlertsMessageType, + Items: []interface{}{ + map[string]interface{}{ + "timestamp": nowFormatted, "tag": "systemAlert", + "nodeId": "mainNode", "message": "System error", + }, + map[string]interface{}{ + "timestamp": nowFormatted, "tag": "systemAlert", + "nodeId": "mainNode", "message": "Service crashed", + }, + map[string]interface{}{ + "timestamp": nowFormatted, "tag": "systemQuotaAlert", + "nodeId": "mainNode", "parameter": "cpu", "value": float64(1000), + }, + }, }, - Data: &alertsData, }, getDataType: func() interface{} { - return &cloudprotocol.Alerts{} + return &cloudprotocol.Alerts{MessageType: cloudprotocol.AlertsMessageType} }, }, { @@ -661,14 +751,13 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.IssueUnitCertsType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &issueCerts, }, getDataType: func() interface{} { - return &cloudprotocol.IssueUnitCerts{} + return &cloudprotocol.IssueUnitCerts{MessageType: cloudprotocol.IssueUnitCertsMessageType} }, }, { @@ -677,14 +766,15 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.InstallUnitCertsConfirmationType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &installCertsConfirmation, }, getDataType: func() interface{} { - return &cloudprotocol.InstallUnitCertsConfirmation{} + return &cloudprotocol.InstallUnitCertsConfirmation{ + MessageType: cloudprotocol.InstallUnitCertsConfirmationMessageType, + } }, }, { @@ -693,14 +783,58 @@ func TestSendMessages(t *testing.T) { }, data: cloudprotocol.Message{ Header: cloudprotocol.MessageHeader{ - MessageType: cloudprotocol.OverrideEnvVarsStatusType, - SystemID: systemID, - Version: cloudprotocol.ProtocolVersion, + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, }, Data: &overrideEnvStatus, }, getDataType: func() interface{} { - return &cloudprotocol.OverrideEnvVarsStatus{} + return &cloudprotocol.OverrideEnvVarsStatus{MessageType: cloudprotocol.OverrideEnvVarsStatusMessageType} + }, + }, + { + call: func() error { + return aoserrors.Wrap(amqpHandler.SendStartProvisioningResponse(startProvisioningResponse)) + }, + data: cloudprotocol.Message{ + Header: cloudprotocol.MessageHeader{ + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, + }, + Data: &startProvisioningResponse, + }, + getDataType: func() interface{} { + return &cloudprotocol.StartProvisioningResponse{MessageType: cloudprotocol.StartProvisioningResponseMessageType} + }, + }, + { + call: func() error { + return aoserrors.Wrap(amqpHandler.SendFinishProvisioningResponse(finishProvisioningResponse)) + }, + data: cloudprotocol.Message{ + Header: cloudprotocol.MessageHeader{ + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, + }, + Data: &finishProvisioningResponse, + }, + getDataType: func() interface{} { + return &cloudprotocol.FinishProvisioningResponse{MessageType: cloudprotocol.FinishProvisioningResponseMessageType} + }, + }, + { + call: func() error { + return aoserrors.Wrap(amqpHandler.SendDeprovisioningResponse(deProvisioningResponse)) + }, + data: cloudprotocol.Message{ + Header: cloudprotocol.MessageHeader{ + SystemID: systemID, + Version: cloudprotocol.ProtocolVersion, + }, + Data: &deProvisioningResponse, + }, + getDataType: func() interface{} { + return &cloudprotocol.DeprovisioningResponse{MessageType: cloudprotocol.DeprovisioningResponseMessageType} }, }, } @@ -713,30 +847,31 @@ func TestSendMessages(t *testing.T) { select { case delivery := <-testClient.delivery: - var ( - rawData json.RawMessage - receiveData = cloudprotocol.Message{Data: &rawData} - ) + receivedHeader := cloudprotocol.Message{} - if err = json.Unmarshal(delivery.Body, &receiveData); err != nil { + if err = json.Unmarshal(delivery.Body, &receivedHeader); err != nil { t.Errorf("Error parsing message: %v", err) continue } - if !reflect.DeepEqual(receiveData.Header, message.data.Header) { - t.Errorf("Wrong Header received: %v != %v", receiveData.Header, message.data.Header) + if !reflect.DeepEqual(receivedHeader.Header, message.data.Header) { + t.Errorf("Wrong Header received: %v != %v", receivedHeader.Header, message.data.Header) continue } - decodedMsg := message.getDataType() + var receivedData struct { + Data interface{} `json:"data"` + } + + receivedData.Data = message.getDataType() - if err = json.Unmarshal(rawData, &decodedMsg); err != nil { + if err = json.Unmarshal(delivery.Body, &receivedData); err != nil { t.Errorf("Error parsing message: %v", err) continue } - if !reflect.DeepEqual(message.data.Data, decodedMsg) { - t.Errorf("Wrong data received: %v != %v", decodedMsg, message.data.Data) + if !reflect.DeepEqual(message.data.Data, receivedData.Data) { + t.Errorf("Wrong data received: %v != %v", receivedData.Data, message.data.Data) } case err = <-testClient.errChannel: @@ -840,22 +975,34 @@ func TestSendMultipleMessages(t *testing.T) { testData := []func() error{ func() error { - return aoserrors.Wrap(amqpHandler.SendUnitStatus(cloudprotocol.UnitStatus{})) + return aoserrors.Wrap(amqpHandler.SendUnitStatus( + cloudprotocol.UnitStatus{MessageType: cloudprotocol.UnitStatusMessageType}), + ) }, func() error { - return aoserrors.Wrap(amqpHandler.SendMonitoringData(cloudprotocol.Monitoring{})) + return aoserrors.Wrap(amqpHandler.SendMonitoringData( + cloudprotocol.Monitoring{MessageType: cloudprotocol.MonitoringMessageType}), + ) }, func() error { - return aoserrors.Wrap(amqpHandler.SendInstanceNewState(cloudprotocol.NewState{})) + return aoserrors.Wrap( + amqpHandler.SendInstanceNewState(cloudprotocol.NewState{MessageType: cloudprotocol.NewStateMessageType}), + ) }, func() error { - return aoserrors.Wrap(amqpHandler.SendInstanceStateRequest(cloudprotocol.StateRequest{})) + return aoserrors.Wrap(amqpHandler.SendInstanceStateRequest( + cloudprotocol.StateRequest{MessageType: cloudprotocol.StateRequestMessageType}), + ) }, func() error { - return aoserrors.Wrap(amqpHandler.SendLog(cloudprotocol.PushLog{})) + return aoserrors.Wrap( + amqpHandler.SendLog(cloudprotocol.PushLog{MessageType: cloudprotocol.PushLogMessageType}), + ) }, func() error { - return aoserrors.Wrap(amqpHandler.SendAlerts(cloudprotocol.Alerts{})) + return aoserrors.Wrap( + amqpHandler.SendAlerts(cloudprotocol.Alerts{MessageType: cloudprotocol.AlertsMessageType}), + ) }, func() error { return aoserrors.Wrap(amqpHandler.SendIssueUnitCerts(nil)) @@ -864,7 +1011,9 @@ func TestSendMultipleMessages(t *testing.T) { return aoserrors.Wrap(amqpHandler.SendInstallCertsConfirmation(nil)) }, func() error { - return aoserrors.Wrap(amqpHandler.SendOverrideEnvVarsStatus(cloudprotocol.OverrideEnvVarsStatus{})) + return aoserrors.Wrap(amqpHandler.SendOverrideEnvVarsStatus( + cloudprotocol.OverrideEnvVarsStatus{MessageType: cloudprotocol.OverrideEnvVarsStatusMessageType}), + ) }, } @@ -899,23 +1048,24 @@ func TestSendDisconnectMessages(t *testing.T) { defer amqpHandler.Close() // Send unimportant message - - if err := amqpHandler.SendUnitStatus(cloudprotocol.UnitStatus{}); !errors.Is(err, amqphandler.ErrNotConnected) { + err = amqpHandler.SendUnitStatus(cloudprotocol.UnitStatus{MessageType: cloudprotocol.UnitStatusMessageType}) + if !errors.Is(err, amqphandler.ErrNotConnected) { t.Errorf("Wrong error type: %v", err) } // Send number important messages equals to send channel size - should be accepted without error for i := 0; i < sendQueueSize; i++ { - if err := amqpHandler.SendAlerts(cloudprotocol.Alerts{}); err != nil { + if err := amqpHandler.SendAlerts(cloudprotocol.Alerts{MessageType: cloudprotocol.AlertsMessageType}); err != nil { t.Errorf("Can't send important message: %v", err) } } // Next important message should fail due to send channel size - if err := amqpHandler.SendInstanceStateRequest( - cloudprotocol.StateRequest{}); !errors.Is(err, amqphandler.ErrSendChannelFull) { + err = amqpHandler.SendInstanceStateRequest( + cloudprotocol.StateRequest{MessageType: cloudprotocol.StateRequestMessageType}) + if !errors.Is(err, amqphandler.ErrSendChannelFull) { t.Errorf("Wrong error type: %v", err) } @@ -928,15 +1078,20 @@ func TestSendDisconnectMessages(t *testing.T) { for i := 0; i < sendQueueSize; i++ { select { case delivery := <-testClient.delivery: - var message cloudprotocol.Message + // unmarshal type name + var message struct { + Data struct { + MessageType string `json:"messageType"` + } `json:"data"` + } if err = json.Unmarshal(delivery.Body, &message); err != nil { - t.Errorf("Error parsing message: %v", err) + t.Errorf("Can't parse json message: %v", err) continue } - if message.Header.MessageType != cloudprotocol.AlertsType { - t.Errorf("Wrong message type: %s", message.Header.MessageType) + if message.Data.MessageType != cloudprotocol.AlertsMessageType { + t.Errorf("Wrong message type: %s", message.Data.MessageType) } case err = <-testClient.errChannel: @@ -957,7 +1112,7 @@ func (context *testCryptoContext) GetTLSConfig() (config *tls.Config, err error) } func (context *testCryptoContext) DecryptMetadata(input []byte) (output []byte, err error) { - output, err = json.Marshal(context.currentMessage) + output, err = base64.StdEncoding.DecodeString(string(input)) if err != nil { return output, aoserrors.Wrap(err) } diff --git a/aos_communicationmanager.cfg b/aos_communicationmanager.cfg index 1e8b3ae8..b04a330e 100644 --- a/aos_communicationmanager.cfg +++ b/aos_communicationmanager.cfg @@ -16,13 +16,6 @@ }, "umController": { "cmServerUrl": ":8091", - "umClients": [ - { - "umId": "um", - "priority": 0, - "isLocal": true - } - ] }, "migration": { "migrationPath": "/usr/share/communicationmanager/migration", diff --git a/cmserver/cmserver.go b/cmserver/cmserver.go index ecc1e9fc..ac0af917 100644 --- a/cmserver/cmserver.go +++ b/cmserver/cmserver.go @@ -24,8 +24,9 @@ import ( "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/communicationmanager/v2" + pb "github.com/aosedge/aos_common/api/communicationmanager" "github.com/aosedge/aos_common/utils/cryptutils" + "github.com/aosedge/aos_common/utils/pbconvert" "github.com/golang/protobuf/ptypes/empty" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -61,22 +62,23 @@ type UpdateState int // UpdateStatus represents SOTA/FOTA status. type UpdateStatus struct { State UpdateState - Error string + Error *cloudprotocol.ErrorInfo } // UpdateFOTAStatus FOTA update status for update scheduler service. type UpdateFOTAStatus struct { Components []cloudprotocol.ComponentStatus - UnitConfig *cloudprotocol.UnitConfigStatus UpdateStatus } // UpdateSOTAStatus SOTA update status for update scheduler service. type UpdateSOTAStatus struct { - InstallServices []cloudprotocol.ServiceStatus - RemoveServices []cloudprotocol.ServiceStatus - InstallLayers []cloudprotocol.LayerStatus - RemoveLayers []cloudprotocol.LayerStatus + UnitConfig *cloudprotocol.UnitConfigStatus + InstallServices []cloudprotocol.ServiceStatus + RemoveServices []cloudprotocol.ServiceStatus + InstallLayers []cloudprotocol.LayerStatus + RemoveLayers []cloudprotocol.LayerStatus + RebalanceRequest bool UpdateStatus } @@ -185,7 +187,7 @@ func (server *CMServer) Close() { server.stopChannel <- true } -// SubscribeNotifications sunscribes on SOTA FOTA packages status changes. +// SubscribeNotifications subscribes on SOTA FOTA packages status changes. func (server *CMServer) SubscribeNotifications( req *empty.Empty, stream pb.UpdateSchedulerService_SubscribeNotificationsServer, ) (err error) { @@ -316,37 +318,43 @@ func (server *CMServer) notifyAllClients(notification *pb.SchedulerNotifications } func (updateStatus *UpdateSOTAStatus) convertToPBStatus() (pbStatus *pb.UpdateSOTAStatus) { - pbStatus = new(pb.UpdateSOTAStatus) - - pbStatus.Error = updateStatus.Error + pbStatus = &pb.UpdateSOTAStatus{ + Error: pbconvert.ErrorInfoToPB(updateStatus.Error), + State: updateStatus.State.getPbState(), + RebalanceRequest: updateStatus.RebalanceRequest, + } - pbStatus.State = updateStatus.State.getPbState() + if updateStatus.UnitConfig != nil { + pbStatus.UnitConfig = &pb.UnitConfigInfo{Version: updateStatus.UnitConfig.Version} + } for _, layer := range updateStatus.InstallLayers { pbStatus.InstallLayers = append(pbStatus.GetInstallLayers(), &pb.LayerInfo{ - Id: layer.ID, - AosVersion: layer.AosVersion, Digest: layer.Digest, + LayerId: layer.LayerID, + Digest: layer.Digest, + Version: layer.Version, }) } for _, layer := range updateStatus.RemoveLayers { pbStatus.RemoveLayers = append(pbStatus.GetRemoveLayers(), &pb.LayerInfo{ - Id: layer.ID, - AosVersion: layer.AosVersion, Digest: layer.Digest, + LayerId: layer.LayerID, + Digest: layer.Digest, + Version: layer.Version, }) } for _, service := range updateStatus.InstallServices { pbStatus.InstallServices = append(pbStatus.GetInstallServices(), &pb.ServiceInfo{ - Id: service.ID, - AosVersion: service.AosVersion, + ServiceId: service.ServiceID, + Version: service.Version, }) } for _, service := range updateStatus.RemoveServices { pbStatus.RemoveServices = append(pbStatus.GetRemoveServices(), &pb.ServiceInfo{ - Id: service.ID, - AosVersion: service.AosVersion, + ServiceId: service.ServiceID, + Version: service.Version, }) } @@ -354,21 +362,19 @@ func (updateStatus *UpdateSOTAStatus) convertToPBStatus() (pbStatus *pb.UpdateSO } func (updateStatus *UpdateFOTAStatus) convertToPBStatus() (pbStatus *pb.UpdateFOTAStatus) { - pbStatus = new(pb.UpdateFOTAStatus) - pbStatus.Error = updateStatus.Error - pbStatus.State = updateStatus.State.getPbState() + pbStatus = &pb.UpdateFOTAStatus{ + Error: pbconvert.ErrorInfoToPB(updateStatus.Error), + State: updateStatus.State.getPbState(), + } for _, component := range updateStatus.Components { pbStatus.Components = append(pbStatus.GetComponents(), &pb.ComponentInfo{ - Id: component.ID, - AosVersion: component.AosVersion, VendorVersion: component.VendorVersion, + ComponentId: component.ComponentID, + ComponentType: component.ComponentType, + Version: component.Version, }) } - if updateStatus.UnitConfig != nil { - pbStatus.UnitConfig = &pb.UnitConfigInfo{VendorVersion: updateStatus.UnitConfig.VendorVersion} - } - return pbStatus } diff --git a/cmserver/cmserver_test.go b/cmserver/cmserver_test.go index 518e410a..71fd72cb 100644 --- a/cmserver/cmserver_test.go +++ b/cmserver/cmserver_test.go @@ -25,7 +25,7 @@ import ( "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/communicationmanager/v2" + pb "github.com/aosedge/aos_common/api/communicationmanager" log "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -126,8 +126,13 @@ func TestConnection(t *testing.T) { } statusFotaNotification := cmserver.UpdateFOTAStatus{ - Components: []cloudprotocol.ComponentStatus{{ID: "1234", AosVersion: 123, VendorVersion: "4321"}}, - UnitConfig: &cloudprotocol.UnitConfigStatus{VendorVersion: "bc_version"}, + Components: []cloudprotocol.ComponentStatus{ + { + ComponentID: "testComponent", + ComponentType: "testType", + Version: "2.0.0", + }, + }, UpdateStatus: cmserver.UpdateStatus{State: cmserver.ReadyToUpdate}, } @@ -138,45 +143,41 @@ func TestConnection(t *testing.T) { t.Fatalf("Can't receive notification: %s", err) } - status := notification.GetFotaStatus() - if status == nil { + fotaStatus := notification.GetFotaStatus() + if fotaStatus == nil { t.Fatalf("No FOTA status") } - if status.GetState() != pb.UpdateState_READY_TO_UPDATE { - t.Error("Incorrect state: ", status.GetState().String()) + if fotaStatus.GetState() != pb.UpdateState_READY_TO_UPDATE { + t.Error("Incorrect state: ", fotaStatus.GetState().String()) } - if len(status.GetComponents()) != 1 { + if len(fotaStatus.GetComponents()) != 1 { t.Fatal("Incorrect count of components") } - if status.GetComponents()[0].GetId() != "1234" { + if fotaStatus.GetComponents()[0].GetComponentId() != "testComponent" { t.Error("Incorrect component id") } - if status.GetComponents()[0].GetVendorVersion() != "4321" { - t.Error("Incorrect vendor version") + if fotaStatus.GetComponents()[0].GetComponentType() != "testType" { + t.Error("Incorrect component type") } - if status.GetComponents()[0].GetAosVersion() != 123 { - t.Error("Incorrect aos version") - } - - if status.GetUnitConfig() == nil { - t.Fatal("Unit Config is nil") - } - - if status.GetUnitConfig().GetVendorVersion() != "bc_version" { - t.Error("Incorrect unit config version") + if fotaStatus.GetComponents()[0].GetVersion() != "2.0.0" { + t.Error("Incorrect version") } statusNotification := cmserver.UpdateSOTAStatus{ - InstallServices: []cloudprotocol.ServiceStatus{{ID: "s1", AosVersion: 42}}, - RemoveServices: []cloudprotocol.ServiceStatus{{ID: "s2", AosVersion: 42}}, - InstallLayers: []cloudprotocol.LayerStatus{{ID: "l1", Digest: "someSha", AosVersion: 42}}, - RemoveLayers: []cloudprotocol.LayerStatus{{ID: "l2", Digest: "someSha", AosVersion: 42}}, - UpdateStatus: cmserver.UpdateStatus{State: cmserver.Downloading, Error: "SOTA error"}, + UnitConfig: &cloudprotocol.UnitConfigStatus{Version: "bc_version"}, + InstallServices: []cloudprotocol.ServiceStatus{{ServiceID: "s1", Version: "1.0.0"}}, + RemoveServices: []cloudprotocol.ServiceStatus{{ServiceID: "s2", Version: "2.0.0"}}, + InstallLayers: []cloudprotocol.LayerStatus{{LayerID: "l1", Digest: "someSha", Version: "3.0.0"}}, + RemoveLayers: []cloudprotocol.LayerStatus{{LayerID: "l2", Digest: "someSha", Version: "4.0.0"}}, + UpdateStatus: cmserver.UpdateStatus{State: cmserver.Downloading, Error: &cloudprotocol.ErrorInfo{ + Message: "SOTA error", + }}, + RebalanceRequest: true, } unitStatusHandler.sotaChannel <- statusNotification @@ -192,30 +193,38 @@ func TestConnection(t *testing.T) { } if sotaStatus.GetState() != pb.UpdateState_DOWNLOADING { - t.Error("Incorrect state: ", status.GetState().String()) + t.Error("Incorrect state: ", sotaStatus.GetState().String()) + } + + if sotaStatus.GetError().GetMessage() != "SOTA error" { + t.Error("Incorrect error message: ", sotaStatus.GetError()) } - if sotaStatus.GetError() != "SOTA error" { - t.Error("Incorrect error message: ", status.GetError()) + if sotaStatus.GetUnitConfig() == nil { + t.Fatal("Unit Config is nil") + } + + if sotaStatus.GetUnitConfig().GetVersion() != "bc_version" { + t.Error("Incorrect unit config version") } if len(sotaStatus.GetInstallServices()) != 1 { t.Fatal("Incorrect count of services") } - if sotaStatus.GetInstallServices()[0].GetId() != "s1" { + if sotaStatus.GetInstallServices()[0].GetServiceId() != "s1" { t.Error("Incorrect service id") } - if sotaStatus.GetInstallServices()[0].GetAosVersion() != 42 { - t.Error("Incorrect service aos version") + if sotaStatus.GetInstallServices()[0].GetVersion() != "1.0.0" { + t.Error("Incorrect service version") } if len(sotaStatus.GetInstallLayers()) != 1 { t.Fatal("Incorrect count of layers") } - if sotaStatus.GetInstallLayers()[0].GetId() != "l1" { + if sotaStatus.GetInstallLayers()[0].GetLayerId() != "l1" { t.Error("Incorrect layer id") } @@ -223,8 +232,12 @@ func TestConnection(t *testing.T) { t.Error("Incorrect layer digest") } - if sotaStatus.GetInstallLayers()[0].GetAosVersion() != 42 { - t.Error("Incorrect layer aos version") + if sotaStatus.GetInstallLayers()[0].GetVersion() != "3.0.0" { + t.Error("Incorrect layer version") + } + + if sotaStatus.GetRebalanceRequest() != true { + t.Error("Incorrect rebalance request") } if _, err := client.pbclient.StartFOTAUpdate(ctx, &emptypb.Empty{}); err != nil { diff --git a/communicationmanager.go b/communicationmanager.go index c36415c8..b23d6acd 100644 --- a/communicationmanager.go +++ b/communicationmanager.go @@ -121,7 +121,8 @@ func init() { * CommunicationManager **********************************************************************************************************************/ -func newCommunicationManager(cfg *config.Config) (cm *communicationManager, err error) { //nolint:funlen +//nolint:funlen +func newCommunicationManager(cfg *config.Config) (cm *communicationManager, err error) { defer func() { if err != nil { cm.close() @@ -178,27 +179,38 @@ func newCommunicationManager(cfg *config.Config) (cm *communicationManager, err return cm, aoserrors.Wrap(err) } - if cfg.Monitoring.MonitorConfig != nil { - if cm.resourcemonitor, err = resourcemonitor.New(cm.iam.GetNodeID(), *cfg.Monitoring.MonitorConfig, - cm.alerts, cm.monitorcontroller, nil); err != nil { - return cm, aoserrors.Wrap(err) - } + if cm.smController, err = smcontroller.New( + cfg, cm.amqp, cm.alerts, cm.monitorcontroller, cm.iam, cm.cryptoContext, false); err != nil { + return cm, aoserrors.Wrap(err) } - if cm.downloader, err = downloader.New("CM", cfg, cm.alerts, cm.db); err != nil { + if cm.unitConfig, err = unitconfig.New(cfg, cm.iam, cm.smController); err != nil { return cm, aoserrors.Wrap(err) } - if cm.smController, err = smcontroller.New( - cfg, cm.amqp, cm.alerts, cm.monitorcontroller, cm.iam, cm.cryptoContext, false); err != nil { - return cm, aoserrors.Wrap(err) + if cfg.Monitoring.MonitorConfig != nil { + if cm.resourcemonitor, err = resourcemonitor.New(*cfg.Monitoring.MonitorConfig, cm.iam, cm.unitConfig, + nil, cm.alerts); err != nil { + return cm, aoserrors.Wrap(err) + } + + go func() { + for { + monitoringData, ok := <-cm.resourcemonitor.GetNodeMonitoringChannel() + if !ok { + return + } + + cm.monitorcontroller.SendNodeMonitoring(monitoringData) + } + }() } - if cm.umController, err = umcontroller.New(cfg, cm.db, cm.iam, cm.cryptoContext, cm.crypt, false); err != nil { + if cm.downloader, err = downloader.New("CM", cfg, cm.alerts, cm.db); err != nil { return cm, aoserrors.Wrap(err) } - if cm.unitConfig, err = unitconfig.New(cfg, cm.smController); err != nil { + if cm.umController, err = umcontroller.New(cfg, cm.db, cm.iam, cm.iam, cm.cryptoContext, cm.crypt, false); err != nil { return cm, aoserrors.Wrap(err) } @@ -215,12 +227,12 @@ func newCommunicationManager(cfg *config.Config) (cm *communicationManager, err } if cm.launcher, err = launcher.New( - cfg, cm.db, cm.smController, cm.imagemanager, cm.unitConfig, cm.storageState, cm.network); err != nil { + cfg, cm.db, cm.iam, cm.smController, cm.imagemanager, cm.unitConfig, cm.storageState, cm.network); err != nil { return cm, aoserrors.Wrap(err) } - if cm.statusHandler, err = unitstatushandler.New(cfg, cm.unitConfig, cm.umController, cm.imagemanager, cm.launcher, - cm.downloader, cm.db, cm.amqp); err != nil { + if cm.statusHandler, err = unitstatushandler.New(cfg, cm.iam, cm.unitConfig, cm.umController, + cm.imagemanager, cm.launcher, cm.downloader, cm.db, cm.amqp, cm.smController); err != nil { return cm, aoserrors.Wrap(err) } @@ -382,12 +394,12 @@ func (cm *communicationManager) processMessage(message amqp.Message) (err error) case *cloudprotocol.RenewCertsNotification: log.Info("Receive renew certificates notification message") - if data.UnitSecret.Version != cloudprotocol.UnitSecretVersion { + if data.UnitSecrets.Version != cloudprotocol.UnitSecretVersion { return aoserrors.New("unit secure version mismatch") } if err = cm.iam.RenewCertificatesNotification( - data.UnitSecret.Data.OwnerPassword, data.Certificates); err != nil { + data.UnitSecrets, data.Certificates); err != nil { return aoserrors.Wrap(err) } @@ -398,6 +410,27 @@ func (cm *communicationManager) processMessage(message amqp.Message) (err error) return aoserrors.Wrap(err) } + case *cloudprotocol.StartProvisioningRequest: + log.Info("Receive start provisioning request message") + + if err = cm.iam.StartProvisioning(data.NodeID, data.Password); err != nil { + return aoserrors.Wrap(err) + } + + case *cloudprotocol.FinishProvisioningRequest: + log.Info("Receive finish provisioning request message") + + if err = cm.iam.FinishProvisioning(data.NodeID, data.Password, data.Certificates); err != nil { + return aoserrors.Wrap(err) + } + + case *cloudprotocol.DeprovisioningRequest: + log.Info("Receive deprovisioning request message") + + if err = cm.iam.Deprovision(data.NodeID, data.Password); err != nil { + return aoserrors.Wrap(err) + } + default: log.Warnf("Receive unsupported amqp message: %s", reflect.TypeOf(data)) } @@ -506,7 +539,7 @@ func (hook *journalHook) Fire(entry *log.Entry) (err error) { return aoserrors.Wrap(err) } - err = journal.Print(hook.severityMap[entry.Level], logMessage) + err = journal.Print(hook.severityMap[entry.Level], "%s", logMessage) return aoserrors.Wrap(err) } diff --git a/config/config.go b/config/config.go index 2ea9d199..26a05861 100644 --- a/config/config.go +++ b/config/config.go @@ -45,21 +45,15 @@ type Crypt struct { type UMController struct { FileServerURL string `json:"fileServerUrl"` CMServerURL string `json:"cmServerUrl"` - UMClients []UMClientConfig `json:"umClients"` UpdateTTL aostypes.Duration `json:"updateTtl"` } -// UMClientConfig update manager config. -type UMClientConfig struct { - UMID string `json:"umId"` - Priority uint32 `json:"priority"` - IsLocal bool `json:"isLocal,omitempty"` -} - // Monitoring configuration for system monitoring. type Monitoring struct { MonitorConfig *resourcemonitor.Config `json:"monitorConfig"` MaxOfflineMessages int `json:"maxOfflineMessages"` + SendPeriod aostypes.Duration `json:"sendPeriod"` + MaxMessageSize int `json:"maxMessageSize"` } // Alerts configuration for alerts. @@ -89,7 +83,6 @@ type Downloader struct { type SMController struct { FileServerURL string `json:"fileServerUrl"` CMServerURL string `json:"cmServerUrl"` - NodeIDs []string `json:"nodeIds"` NodesConnectionTimeout aostypes.Duration `json:"nodesConnectionTimeout"` UpdateTTL aostypes.Duration `json:"updateTtl"` } @@ -138,7 +131,9 @@ func New(fileName string) (config *Config, err error) { MaxOfflineMessages: 25, }, Monitoring: Monitoring{ - MaxOfflineMessages: 25, + MaxOfflineMessages: 16, + SendPeriod: aostypes.Duration{Duration: 1 * time.Minute}, + MaxMessageSize: 65536, }, Downloader: Downloader{ MaxConcurrentDownloads: 4, diff --git a/config/config_test.go b/config/config_test.go index 07b66a25..7c0d8cc4 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -64,19 +64,10 @@ const testConfigContent = `{ }, "monitoring": { "monitorConfig": { - "sendPeriod": "5m", - "pollPeriod": "1s", - "ram": { - "minTimeout": "10s", - "minThreshold": 10, - "maxThreshold": 150 - }, - "outTraffic": { - "minTimeout": "20s", - "minThreshold": 10, - "maxThreshold": 150 - } + "pollPeriod": "1s" }, + "sendPeriod": "5m", + "maxMessageSize": 1024, "maxOfflineMessages": 25 }, "alerts": { @@ -101,11 +92,6 @@ const testConfigContent = `{ "umController": { "fileServerUrl":"localhost:8092", "cmServerUrl": "localhost:8091", - "umClients": [{ - "umId": "um", - "priority": 0, - "isLocal": true - }], "updateTTL": "100h" } }` @@ -217,20 +203,20 @@ func TestDurationMarshal(t *testing.T) { } func TestGetMonitoringConfig(t *testing.T) { - if testCfg.Monitoring.MonitorConfig.SendPeriod.Duration != 5*time.Minute { - t.Errorf("Wrong send period value: %s", testCfg.Monitoring.MonitorConfig.SendPeriod) - } - if testCfg.Monitoring.MonitorConfig.PollPeriod.Duration != 1*time.Second { t.Errorf("Wrong poll period value: %s", testCfg.Monitoring.MonitorConfig.PollPeriod) } - if testCfg.Monitoring.MonitorConfig.RAM.MinTimeout.Duration != 10*time.Second { - t.Errorf("Wrong value: %s", testCfg.Monitoring.MonitorConfig.RAM.MinTimeout) + if testCfg.Monitoring.SendPeriod.Duration != 5*time.Minute { + t.Errorf("Wrong send period value: %s", testCfg.Monitoring.SendPeriod) } - if testCfg.Monitoring.MonitorConfig.OutTraffic.MinTimeout.Duration != 20*time.Second { - t.Errorf("Wrong value: %s", testCfg.Monitoring.MonitorConfig.RAM.MinTimeout) + if time.Duration(testCfg.Monitoring.MaxOfflineMessages) != 25 { + t.Errorf("Wrong max offline messages value: %d", testCfg.Monitoring.MaxOfflineMessages) + } + + if time.Duration(testCfg.Monitoring.MaxMessageSize) != 1024 { + t.Errorf("Wrong max message size value: %d", testCfg.Monitoring.MaxMessageSize) } } @@ -255,12 +241,9 @@ func TestGetAlertsConfig(t *testing.T) { } func TestUMControllerConfig(t *testing.T) { - umClient := config.UMClientConfig{UMID: "um", Priority: 0, IsLocal: true} - originalConfig := config.UMController{ FileServerURL: "localhost:8092", CMServerURL: "localhost:8091", - UMClients: []config.UMClientConfig{umClient}, UpdateTTL: aostypes.Duration{Duration: 100 * time.Hour}, } @@ -287,7 +270,6 @@ func TestSMControllerConfig(t *testing.T) { originalConfig := config.SMController{ FileServerURL: "localhost:8094", CMServerURL: "localhost:8093", - NodeIDs: []string{"sm1", "sm2"}, NodesConnectionTimeout: aostypes.Duration{Duration: 100 * time.Second}, UpdateTTL: aostypes.Duration{Duration: 30 * time.Hour}, } diff --git a/database/database.go b/database/database.go index 62f339b8..db3fda70 100644 --- a/database/database.go +++ b/database/database.go @@ -24,7 +24,7 @@ import ( "fmt" "os" "path/filepath" - "time" + "sort" "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" @@ -32,6 +32,7 @@ import ( _ "github.com/mattn/go-sqlite3" // ignore lint log "github.com/sirupsen/logrus" + "github.com/aosedge/aos_common/utils/semverutils" "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/downloader" "github.com/aosedge/aos_communicationmanager/imagemanager" @@ -51,7 +52,7 @@ const ( syncMode = "NORMAL" ) -const dbVersion = 1 +const dbVersion = 2 const dbFileName = "communicationmanager.db" @@ -177,7 +178,7 @@ func (db *Database) GetJournalCursor() (cursor string, err error) { } // SetComponentsUpdateInfo store update data for update managers. -func (db *Database) SetComponentsUpdateInfo(updateInfo []umcontroller.SystemComponent) (err error) { +func (db *Database) SetComponentsUpdateInfo(updateInfo []umcontroller.ComponentStatus) (err error) { dataJSON, err := json.Marshal(&updateInfo) if err != nil { return aoserrors.Wrap(err) @@ -191,7 +192,7 @@ func (db *Database) SetComponentsUpdateInfo(updateInfo []umcontroller.SystemComp } // GetComponentsUpdateInfo returns update data for system components. -func (db *Database) GetComponentsUpdateInfo() (updateInfo []umcontroller.SystemComponent, err error) { +func (db *Database) GetComponentsUpdateInfo() (updateInfo []umcontroller.ComponentStatus, err error) { stmt, err := db.sql.Prepare("SELECT componentsUpdateInfo FROM config") if err != nil { return updateInfo, aoserrors.Wrap(err) @@ -267,28 +268,7 @@ func (db *Database) GetSoftwareUpdateState() (state json.RawMessage, err error) return state, err } -// SetDesiredInstances sets desired instances status. -func (db *Database) SetDesiredInstances(instances json.RawMessage) (err error) { - if err = db.executeQuery(`UPDATE config SET desiredInstances = ?`, instances); err != nil { - return err - } - - return nil -} - -// GetDesiredInstances returns desired instances. -func (db *Database) GetDesiredInstances() (instances json.RawMessage, err error) { - if err = db.getDataFromQuery( - "SELECT desiredInstances FROM config", - []any{}, &instances); err != nil { - if errors.Is(err, errNotExist) { - return instances, launcher.ErrNotExist - } - } - - return instances, err -} - +// GetDownloadInfo returns download info by file path. func (db *Database) GetDownloadInfo(filePath string) (downloadInfo downloader.DownloadInfo, err error) { if err = db.getDataFromQuery( "SELECT * FROM download WHERE path = ?", @@ -302,6 +282,7 @@ func (db *Database) GetDownloadInfo(filePath string) (downloadInfo downloader.Do return downloadInfo, err } +// GetDownloadInfos returns all download info. func (db *Database) GetDownloadInfos() (downloadInfos []downloader.DownloadInfo, err error) { rows, err := db.sql.Query("SELECT * FROM download") if err != nil { @@ -328,6 +309,7 @@ func (db *Database) GetDownloadInfos() (downloadInfos []downloader.DownloadInfo, return downloadInfos, nil } +// RemoveDownloadInfo removes download info by file path. func (db *Database) RemoveDownloadInfo(filePath string) (err error) { if err = db.executeQuery("DELETE FROM download WHERE path = ?", filePath); errors.Is(err, errNotExist) { return nil @@ -336,6 +318,7 @@ func (db *Database) RemoveDownloadInfo(filePath string) (err error) { return err } +// SetDownloadInfo stores download info. func (db *Database) SetDownloadInfo(downloadInfo downloader.DownloadInfo) (err error) { var path string @@ -365,44 +348,59 @@ func (db *Database) SetDownloadInfo(downloadInfo downloader.DownloadInfo) (err e // GetServicesInfo returns services info. func (db *Database) GetServicesInfo() ([]imagemanager.ServiceInfo, error) { - return db.getServicesFromQuery(`SELECT * FROM services WHERE(id, aosVersion) - IN (SELECT id, MAX(aosVersion) FROM services GROUP BY id)`) -} + allServiceVersions, err := db.getServicesFromQuery(`SELECT * FROM services`) + if err != nil { + return nil, err + } -// GetServiceInfo returns service info by ID. -func (db *Database) GetServiceInfo(serviceID string) (service imagemanager.ServiceInfo, err error) { - var ( - configJSON []byte - layers []byte - exposedPorts []byte - ) + maxVersionServices := make(map[string]imagemanager.ServiceInfo) - if err = db.getDataFromQuery( - "SELECT * FROM services WHERE aosVersion = (SELECT MAX(aosVersion) FROM services WHERE id = ?) AND id = ?", - []any{serviceID, serviceID}, - &service.ID, &service.AosVersion, &service.ProviderID, &service.VendorVersion, &service.Description, - &service.URL, &service.RemoteURL, &service.Path, &service.Size, &service.Timestamp, &service.Cached, - &configJSON, &layers, &service.Sha256, &service.Sha512, &exposedPorts, &service.GID); err != nil { - if errors.Is(err, errNotExist) { - return service, imagemanager.ErrNotExist + for _, service := range allServiceVersions { + if storedService, found := maxVersionServices[service.ServiceID]; found { + greater, err := semverutils.GreaterThan(service.Version, storedService.Version) + if err != nil { + return nil, aoserrors.Wrap(err) + } + + if greater { + maxVersionServices[service.ServiceID] = service + } + } else { + maxVersionServices[service.ServiceID] = service } + } + result := make([]imagemanager.ServiceInfo, 0) + for _, value := range maxVersionServices { + result = append(result, value) + } + + return result, nil +} + +// GetServiceInfo returns service info by ID. +func (db *Database) GetServiceInfo(serviceID string) (service imagemanager.ServiceInfo, err error) { + maxVersion, err := db.getMaxServiceVersion(serviceID) + if err != nil { return service, err } - if err = json.Unmarshal(configJSON, &service.Config); err != nil { - return service, aoserrors.Wrap(err) + services, err := db.getServicesFromQuery( + "SELECT * FROM services WHERE id = ? and version = ?", + serviceID, maxVersion) + if err != nil { + return service, err } - if err = json.Unmarshal(layers, &service.Layers); err != nil { - return service, aoserrors.Wrap(err) + if len(services) == 0 { + return imagemanager.ServiceInfo{}, imagemanager.ErrNotExist } - if err = json.Unmarshal(exposedPorts, &service.ExposedPorts); err != nil { - return service, aoserrors.Wrap(err) + if len(services) > 1 { + return imagemanager.ServiceInfo{}, aoserrors.New("wrong number of services returned") } - return service, nil + return services[0], nil } // AddService adds new service. @@ -422,10 +420,10 @@ func (db *Database) AddService(service imagemanager.ServiceInfo) error { return aoserrors.Wrap(err) } - return db.executeQuery("INSERT INTO services values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - service.ID, service.AosVersion, service.ProviderID, service.VendorVersion, service.Description, - service.URL, service.RemoteURL, service.Path, service.Size, service.Timestamp, service.Cached, - configJSON, layers, service.Sha256, service.Sha512, exposedPorts, service.GID) + return db.executeQuery("INSERT INTO services values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + service.ServiceID, service.Version, service.ProviderID, service.URL, service.RemoteURL, + service.Path, service.Size, service.Timestamp, service.Cached, + configJSON, layers, service.Sha256, exposedPorts, service.GID) } // SetServiceCached sets cached status for the service. @@ -439,9 +437,9 @@ func (db *Database) SetServiceCached(serviceID string, cached bool) (err error) } // RemoveService removes existing service. -func (db *Database) RemoveService(serviceID string, aosVersion uint64) (err error) { - if err = db.executeQuery("DELETE FROM services WHERE id = ? AND aosVersion = ?", - serviceID, aosVersion); errors.Is(err, errNotExist) { +func (db *Database) RemoveService(serviceID string, version string) (err error) { + if err = db.executeQuery("DELETE FROM services WHERE id = ? AND version = ?", + serviceID, version); errors.Is(err, errNotExist) { return nil } @@ -451,7 +449,7 @@ func (db *Database) RemoveService(serviceID string, aosVersion uint64) (err erro // GetAllServiceVersions returns all service versions. func (db *Database) GetServiceVersions(serviceID string) (services []imagemanager.ServiceInfo, err error) { if services, err = db.getServicesFromQuery( - "SELECT * FROM services WHERE id = ? ORDER BY aosVersion", serviceID); err != nil { + "SELECT * FROM services WHERE id = ?", serviceID); err != nil { return nil, err } @@ -459,6 +457,12 @@ func (db *Database) GetServiceVersions(serviceID string) (services []imagemanage return nil, imagemanager.ErrNotExist } + sort.SliceStable(services, func(left, right int) bool { + res, _ := semverutils.LessThan(services[left].Version, services[right].Version) + + return res + }) + return services, nil } @@ -470,8 +474,8 @@ func (db *Database) GetLayersInfo() ([]imagemanager.LayerInfo, error) { // GetLayerInfo returns layer info by ID. func (db *Database) GetLayerInfo(digest string) (layer imagemanager.LayerInfo, err error) { if err = db.getDataFromQuery("SELECT * FROM layers WHERE digest = ?", - []any{digest}, &layer.Digest, &layer.ID, &layer.AosVersion, &layer.VendorVersion, &layer.Description, - &layer.URL, &layer.RemoteURL, &layer.Path, &layer.Size, &layer.Timestamp, &layer.Sha256, &layer.Sha512, + []any{digest}, &layer.Digest, &layer.LayerID, &layer.Version, + &layer.URL, &layer.RemoteURL, &layer.Path, &layer.Size, &layer.Timestamp, &layer.Sha256, &layer.Cached); err != nil { if errors.Is(err, errNotExist) { return layer, imagemanager.ErrNotExist @@ -485,9 +489,9 @@ func (db *Database) GetLayerInfo(digest string) (layer imagemanager.LayerInfo, e // AddLayer adds new layer. func (db *Database) AddLayer(layer imagemanager.LayerInfo) error { - return db.executeQuery("INSERT INTO layers values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - layer.Digest, layer.ID, layer.AosVersion, layer.VendorVersion, layer.Description, layer.URL, layer.RemoteURL, - layer.Path, layer.Size, layer.Timestamp, layer.Sha256, layer.Sha512, layer.Cached) + return db.executeQuery("INSERT INTO layers values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + layer.Digest, layer.LayerID, layer.Version, layer.URL, layer.RemoteURL, + layer.Path, layer.Size, layer.Timestamp, layer.Sha256, layer.Cached) } // SetLayerCached sets cached status for the layer. @@ -509,26 +513,47 @@ func (db *Database) RemoveLayer(digest string) (err error) { return err } -// AddInstance adds instanace with uid. +// AddInstance adds instanace info. func (db *Database) AddInstance(instanceInfo launcher.InstanceInfo) error { - return db.executeQuery("INSERT INTO instances values(?, ?, ?, ?, ?, 0)", - instanceInfo.ServiceID, instanceInfo.SubjectID, instanceInfo.Instance, instanceInfo.UID, instanceInfo.Timestamp) + return db.executeQuery("INSERT INTO instances values(?, ?, ?, ?, ?, ?, ?, ?)", + instanceInfo.ServiceID, instanceInfo.SubjectID, instanceInfo.Instance, instanceInfo.NodeID, + instanceInfo.PrevNodeID, instanceInfo.UID, instanceInfo.Timestamp, instanceInfo.Cached) } -// GetInstanceUID gets uid by instanace ident. -func (db *Database) GetInstanceUID(instance aostypes.InstanceIdent) (int, error) { - var uid int +// UpdateInstance updates instance info. +func (db *Database) UpdateInstance(instanceInfo launcher.InstanceInfo) error { + if err := db.executeQuery("UPDATE instances SET "+ + "nodeID = ? prevNodeID = ? uid = ? timestamp = ? cached = ? "+ + "WHERE serviceId = ? AND subjectId = ? AND instance = ?", + instanceInfo.NodeID, instanceInfo.PrevNodeID, instanceInfo.UID, instanceInfo.Timestamp, instanceInfo.Cached, + instanceInfo.ServiceID, instanceInfo.SubjectID, instanceInfo.Instance); err != nil { + if errors.Is(err, errNotExist) { + return launcher.ErrNotExist + } + } - if err := db.getDataFromQuery("SELECT uid FROM instances WHERE serviceId = ? AND subjectId = ? AND instance = ?", - []any{instance.ServiceID, instance.SubjectID, instance.Instance}, &uid); err != nil { + return nil +} + +// GetInstance returns instance by instance ident. +func (db *Database) GetInstance(instance aostypes.InstanceIdent) (launcher.InstanceInfo, error) { + instanceInfo := launcher.InstanceInfo{ + InstanceIdent: instance, + } + + if err := db.getDataFromQuery("SELECT nodeID, prevNodeID, uid, timestamp, cached "+ + "FROM instances WHERE serviceId = ? AND subjectId = ? AND instance = ?", + []any{instance.ServiceID, instance.SubjectID, instance.Instance}, + &instanceInfo.NodeID, &instanceInfo.PrevNodeID, &instanceInfo.UID, + &instanceInfo.Timestamp, &instanceInfo.Cached); err != nil { if errors.Is(err, errNotExist) { - return uid, launcher.ErrNotExist + return instanceInfo, launcher.ErrNotExist } - return uid, err + return instanceInfo, err } - return uid, nil + return instanceInfo, nil } // GetInstances gets all instances. @@ -549,8 +574,8 @@ func (db *Database) GetInstances() ([]launcher.InstanceInfo, error) { for rows.Next() { var instance launcher.InstanceInfo - if err = rows.Scan(&instance.ServiceID, &instance.SubjectID, &instance.Instance, &instance.UID, - &instance.Timestamp, &instance.Cached); err != nil { + if err = rows.Scan(&instance.ServiceID, &instance.SubjectID, &instance.Instance, &instance.NodeID, + &instance.PrevNodeID, &instance.UID, &instance.Timestamp, &instance.Cached); err != nil { return nil, aoserrors.Wrap(err) } @@ -566,13 +591,6 @@ func (db *Database) RemoveInstance(instance aostypes.InstanceIdent) error { instance.ServiceID, instance.SubjectID, instance.Instance) } -// SetInstanceCached sets cached status for the instance. -func (db *Database) SetInstanceCached(instance aostypes.InstanceIdent, cached bool) error { - return db.executeQuery( - "UPDATE instances SET cached = ?, timestamp = ? WHERE serviceId = ? AND subjectId = ? AND instance = ?", - cached, time.Now().UTC(), instance.ServiceID, instance.SubjectID, instance.Instance) -} - // GetStorageStateInfo returns storage and state info by instance ident. func (db *Database) GetStorageStateInfo( instanceIdent aostypes.InstanceIdent, @@ -665,7 +683,7 @@ func (db *Database) RemoveStorageStateInfo(instanceIdent aostypes.InstanceIdent) return err } -func (db *Database) AddNetworkInfo(networkInfo networkmanager.NetworkInfo) error { +func (db *Database) AddNetworkInfo(networkInfo aostypes.NetworkParameters) error { return db.executeQuery("INSERT INTO network values(?, ?, ?, ?)", networkInfo.NetworkID, networkInfo.IP, networkInfo.Subnet, networkInfo.VlanID) } @@ -678,7 +696,7 @@ func (db *Database) RemoveNetworkInfo(networkID string) (err error) { return err } -func (db *Database) GetNetworksInfo() ([]networkmanager.NetworkInfo, error) { +func (db *Database) GetNetworksInfo() ([]aostypes.NetworkParameters, error) { rows, err := db.sql.Query("SELECT * FROM network") if err != nil { return nil, aoserrors.Wrap(err) @@ -689,10 +707,10 @@ func (db *Database) GetNetworksInfo() ([]networkmanager.NetworkInfo, error) { return nil, aoserrors.Wrap(rows.Err()) } - var networks []networkmanager.NetworkInfo + var networks []aostypes.NetworkParameters for rows.Next() { - var networkInfo networkmanager.NetworkInfo + var networkInfo aostypes.NetworkParameters if err = rows.Scan(&networkInfo.NetworkID, &networkInfo.IP, &networkInfo.Subnet, &networkInfo.VlanID); err != nil { return nil, aoserrors.Wrap(err) @@ -761,31 +779,6 @@ func (db *Database) GetNetworkInstancesInfo() (networkInfos []networkmanager.Ins return networkInfos, nil } -// SetNodeState stores node state. -func (db *Database) SetNodeState(nodeID string, state json.RawMessage) error { - if err := db.executeQuery("UPDATE nodes SET state = ? WHERE nodeID = ?", state, nodeID); errors.Is(err, errNotExist) { - return db.executeQuery("INSERT INTO nodes values(?, ?)", nodeID, state) - } else { - return err - } -} - -// GetNodeState retrieves node state. -func (db *Database) GetNodeState(nodeID string) (json.RawMessage, error) { - var state json.RawMessage - - if err := db.getDataFromQuery( - "SELECT state FROM nodes WHERE nodeID = ?", []any{nodeID}, &state); err != nil { - if errors.Is(err, errNotExist) { - return nil, launcher.ErrNotExist - } - - return nil, err - } - - return state, nil -} - // Close closes database. func (db *Database) Close() { db.sql.Close() @@ -852,12 +845,10 @@ func (db *Database) createServiceTable() (err error) { log.Info("Create service table") _, err = db.sql.Exec(`CREATE TABLE IF NOT EXISTS services (id TEXT NOT NULL , - aosVersion INTEGER, + version TEXT NOT NULL, providerId TEXT, - vendorVersion TEXT, - description TEXT, - localURL TEXT, - remoteURL TEXT, + localURL TEXT, + remoteURL TEXT, path TEXT, size INTEGER, timestamp TIMESTAMP, @@ -865,10 +856,9 @@ func (db *Database) createServiceTable() (err error) { config BLOB, layers BLOB, sha256 BLOB, - sha512 BLOB, exposedPorts BLOB, gid INTEGER, - PRIMARY KEY(id, aosVersion))`) + PRIMARY KEY(id, version))`) return aoserrors.Wrap(err) } @@ -878,16 +868,13 @@ func (db *Database) createLayersTable() (err error) { _, err = db.sql.Exec(`CREATE TABLE IF NOT EXISTS layers (digest TEXT NOT NULL PRIMARY KEY, layerId TEXT, - aosVersion INTEGER, - vendorVersion TEXT, - description TEXT, + version TEXT, localURL TEXT, remoteURL TEXT, Path TEXT, Size INTEGER, Timestamp TIMESTAMP, sha256 BLOB, - sha512 BLOB, cached INTEGER)`) return aoserrors.Wrap(err) @@ -899,6 +886,8 @@ func (db *Database) createInstancesTable() (err error) { _, err = db.sql.Exec(`CREATE TABLE IF NOT EXISTS instances (serviceId TEXT, subjectId TEXT, instance INTEGER, + nodeID TEXT, + prevNodeID TEXT, uid integer, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, cached INTEGER DEFAULT 0, @@ -1003,10 +992,6 @@ func (db *Database) getServicesFromQuery( } defer rows.Close() - if rows.Err() != nil { - return nil, aoserrors.Wrap(rows.Err()) - } - for rows.Next() { var ( service imagemanager.ServiceInfo @@ -1015,10 +1000,9 @@ func (db *Database) getServicesFromQuery( exposedPorts []byte ) - if err = rows.Scan(&service.ID, &service.AosVersion, &service.ProviderID, &service.VendorVersion, - &service.Description, &service.URL, &service.RemoteURL, &service.Path, &service.Size, - &service.Timestamp, &service.Cached, &configJSON, &layers, &service.Sha256, - &service.Sha512, &exposedPorts, &service.GID); err != nil { + if err = rows.Scan(&service.ServiceID, &service.Version, &service.ProviderID, &service.URL, &service.RemoteURL, + &service.Path, &service.Size, &service.Timestamp, &service.Cached, &configJSON, &layers, + &service.Sha256, &exposedPorts, &service.GID); err != nil { return nil, aoserrors.Wrap(err) } @@ -1037,9 +1021,52 @@ func (db *Database) getServicesFromQuery( services = append(services, service) } + if rows.Err() != nil { + return nil, aoserrors.Wrap(rows.Err()) + } + return services, nil } +func (db *Database) getMaxServiceVersion(serviceID string) (version string, err error) { + var rows *sql.Rows + if serviceID != "" { + rows, err = db.sql.Query("SELECT version FROM services WHERE id = ?", serviceID) + } else { + rows, err = db.sql.Query("SELECT version FROM services") + } + + if err != nil { + return "", aoserrors.Wrap(err) + } + + defer rows.Close() + + if rows.Err() != nil { + return "", aoserrors.Wrap(rows.Err()) + } + + maxVersion := "0.0.0" + + for rows.Next() { + var version string + if err = rows.Scan(&version); err != nil { + return "", aoserrors.Wrap(err) + } + + greater, err := semverutils.GreaterThan(version, maxVersion) + if err != nil { + return "", aoserrors.Wrap(err) + } + + if greater { + maxVersion = version + } + } + + return maxVersion, nil +} + func (db *Database) getLayersFromQuery( query string, args ...interface{}, ) (layers []imagemanager.LayerInfo, err error) { @@ -1057,8 +1084,8 @@ func (db *Database) getLayersFromQuery( var layer imagemanager.LayerInfo if err = rows.Scan( - &layer.Digest, &layer.ID, &layer.AosVersion, &layer.VendorVersion, &layer.Description, - &layer.URL, &layer.RemoteURL, &layer.Path, &layer.Size, &layer.Timestamp, &layer.Sha256, &layer.Sha512, + &layer.Digest, &layer.LayerID, &layer.Version, + &layer.URL, &layer.RemoteURL, &layer.Path, &layer.Size, &layer.Timestamp, &layer.Sha256, &layer.Cached); err != nil { return layers, aoserrors.Wrap(err) } diff --git a/database/database_internal_test.go b/database/database_internal_test.go index e4852fcc..af5dc6b4 100644 --- a/database/database_internal_test.go +++ b/database/database_internal_test.go @@ -133,12 +133,12 @@ func TestCursor(t *testing.T) { } func TestComponentsUpdateInfo(t *testing.T) { - testData := []umcontroller.SystemComponent{ + testData := []umcontroller.ComponentStatus{ { - ID: "component1", VendorVersion: "v1", AosVersion: 1, - Annotations: "Some annotation", URL: "url12", Sha512: []byte{1, 3, 90, 42}, + ComponentID: "component1", Version: "v1", + Annotations: "Some annotation", URL: "url12", Sha256: []byte{1, 3, 90, 42}, }, - {ID: "component2", VendorVersion: "v1", AosVersion: 1, URL: "url12", Sha512: []byte{1, 3, 90, 42}}, + {ComponentID: "component2", Version: "v1", URL: "url12", Sha256: []byte{1, 3, 90, 42}}, } if err := testDB.SetComponentsUpdateInfo(testData); err != nil { @@ -154,7 +154,7 @@ func TestComponentsUpdateInfo(t *testing.T) { t.Fatalf("Wrong update info value: %v", getUpdateInfo) } - testData = []umcontroller.SystemComponent{} + testData = []umcontroller.ComponentStatus{} if err := testDB.SetComponentsUpdateInfo(testData); err != nil { t.Fatal("Can't set update manager's update info ", err) @@ -173,7 +173,6 @@ func TestComponentsUpdateInfo(t *testing.T) { func TestSotaFotaInstancesFields(t *testing.T) { fotaState := json.RawMessage("fotaState") sotaState := json.RawMessage("sotaState") - desiredInstances := json.RawMessage("desiredInstances") if err := testDB.SetFirmwareUpdateState(fotaState); err != nil { t.Fatalf("Can't set FOTA state: %v", err) @@ -183,10 +182,6 @@ func TestSotaFotaInstancesFields(t *testing.T) { t.Fatalf("Can't set SOTA state: %v", err) } - if err := testDB.SetDesiredInstances(desiredInstances); err != nil { - t.Fatalf("Can't set desired instances: %v", err) - } - retFota, err := testDB.GetFirmwareUpdateState() if err != nil { t.Fatalf("Can't get FOTA state: %v", err) @@ -204,15 +199,6 @@ func TestSotaFotaInstancesFields(t *testing.T) { if string(retSota) != string(sotaState) { t.Errorf("Incorrect SOTA state: %s", string(retSota)) } - - retInstances, err := testDB.GetDesiredInstances() - if err != nil { - t.Fatalf("Can't get desired instances state %v", err) - } - - if string(retInstances) != string(desiredInstances) { - t.Errorf("Incorrect desired instances: %s", string(retInstances)) - } } func TestMultiThread(t *testing.T) { @@ -246,7 +232,7 @@ func TestMultiThread(t *testing.T) { defer wg.Done() for i := 0; i < numIterations; i++ { - if err := testDB.SetComponentsUpdateInfo([]umcontroller.SystemComponent{{AosVersion: uint64(i)}}); err != nil { + if err := testDB.SetComponentsUpdateInfo([]umcontroller.ComponentStatus{{Version: strconv.Itoa(i)}}); err != nil { t.Errorf("Can't set journal cursor: %s", err) } } @@ -275,14 +261,11 @@ func TestServiceStore(t *testing.T) { { service: imagemanager.ServiceInfo{ ServiceInfo: aostypes.ServiceInfo{ - ID: "service1", - VersionInfo: aostypes.VersionInfo{ - AosVersion: 1, - VendorVersion: "1", - }, - URL: "file:///path/service1", - Size: 30, - GID: 1000, + ServiceID: "service1", + Version: "1.1", + URL: "file:///path/service1", + Size: 30, + GID: 1000, }, RemoteURL: "http://path/service1", Path: "/path/service1", Timestamp: time.Now().UTC(), Cached: false, Config: aostypes.ServiceConfig{ @@ -301,14 +284,11 @@ func TestServiceStore(t *testing.T) { { service: imagemanager.ServiceInfo{ ServiceInfo: aostypes.ServiceInfo{ - ID: "service2", - VersionInfo: aostypes.VersionInfo{ - AosVersion: 1, - VendorVersion: "1", - }, - URL: "file:///path/service2", - Size: 60, - GID: 2000, + ServiceID: "service2", + Version: "1.1", + URL: "file:///path/service2", + Size: 60, + GID: 2000, }, RemoteURL: "http://path/service2", Path: "/path/service2", Timestamp: time.Now().UTC(), Cached: true, Config: aostypes.ServiceConfig{ @@ -328,14 +308,11 @@ func TestServiceStore(t *testing.T) { { service: imagemanager.ServiceInfo{ ServiceInfo: aostypes.ServiceInfo{ - ID: "service2", - VersionInfo: aostypes.VersionInfo{ - AosVersion: 2, - VendorVersion: "1", - }, - URL: "file:///path/service2/new", - Size: 20, - GID: 1000, + ServiceID: "service2", + Version: "2.1", + URL: "file:///path/service2/new", + Size: 20, + GID: 1000, }, RemoteURL: "http://path/service2/new", Path: "/path/service2/new", Timestamp: time.Now().UTC(), @@ -351,16 +328,16 @@ func TestServiceStore(t *testing.T) { t.Errorf("Can't add service: %v", err) } - service, err := testDB.GetServiceInfo(tCase.service.ID) + service, err := testDB.GetServiceInfo(tCase.service.ServiceID) if err != nil { t.Errorf("Can't get service: %v", err) } if !reflect.DeepEqual(service, tCase.service) { - t.Errorf("service %s doesn't match stored one", tCase.service.ID) + t.Errorf("service %s doesn't match stored one", tCase.service.ServiceID) } - serviceVersions, err := testDB.GetServiceVersions(tCase.service.ID) + serviceVersions, err := testDB.GetServiceVersions(tCase.service.ServiceID) if err != nil { t.Errorf("Can't get service versions: %v", err) } @@ -378,11 +355,11 @@ func TestServiceStore(t *testing.T) { t.Errorf("Incorrect count of services: %v", len(services)) } - if err := testDB.SetServiceCached(tCase.service.ID, !tCase.service.Cached); err != nil { + if err := testDB.SetServiceCached(tCase.service.ServiceID, !tCase.service.Cached); err != nil { t.Errorf("Can't set service cached: %v", err) } - if service, err = testDB.GetServiceInfo(tCase.service.ID); err != nil { + if service, err = testDB.GetServiceInfo(tCase.service.ServiceID); err != nil { t.Errorf("Can't get service: %v", err) } @@ -392,16 +369,80 @@ func TestServiceStore(t *testing.T) { } for _, tCase := range cases { - if err := testDB.RemoveService(tCase.service.ID, tCase.service.AosVersion); err != nil { + if err := testDB.RemoveService(tCase.service.ServiceID, tCase.service.Version); err != nil { t.Errorf("Can't remove service: %v", err) } - if _, err := testDB.GetServiceInfo(tCase.service.ID); !errors.Is(err, tCase.serviceErrorAfterRemove) { + if _, err := testDB.GetServiceInfo(tCase.service.ServiceID); !errors.Is(err, tCase.serviceErrorAfterRemove) { t.Errorf("Unexpected error: %v", err) } } } +func TestGetServiceInfo(t *testing.T) { + serviceID := "service2" + services := []imagemanager.ServiceInfo{ + { + ServiceInfo: aostypes.ServiceInfo{ + ServiceID: serviceID, + Version: "1.1", + URL: "file:///path/service2", + Size: 60, + GID: 2000, + }, + RemoteURL: "http://path/service2", + Path: "/path/service2", Timestamp: time.Now().UTC(), Cached: true, + Config: aostypes.ServiceConfig{ + Hostname: allocateString("service2"), + Author: "test1", + Quotas: aostypes.ServiceQuotas{ + UploadSpeed: allocateUint64(500), + DownloadSpeed: allocateUint64(500), + }, + Resources: []string{"resource1", "resource2"}, + }, + }, + + { + ServiceInfo: aostypes.ServiceInfo{ + ServiceID: serviceID, + Version: "2.1", + URL: "file:///path/service2/new", + Size: 20, + GID: 1000, + }, + RemoteURL: "http://path/service2/new", + Path: "/path/service2/new", Timestamp: time.Now().UTC(), + }, + } + + latestService := services[1] + + for _, service := range services { + if err := testDB.AddService(service); err != nil { + t.Errorf("Can't add service: %v", err) + } + } + + service, err := testDB.GetServiceInfo(serviceID) + if err != nil { + t.Errorf("Can't get service info: %v", err) + } + + if !reflect.DeepEqual(service, latestService) { + t.Errorf("Wrong service info: actual %v != expected %v", service, latestService) + } + + serviceInfo, err := testDB.GetServicesInfo() + if err != nil { + t.Errorf("Can't get services info: %v", err) + } + + if len(serviceInfo) != 1 || !reflect.DeepEqual(serviceInfo[0], latestService) { + t.Errorf("Wrong service info: actual %v != expected %v", serviceInfo[0], latestService) + } +} + func TestLayerStore(t *testing.T) { cases := []struct { layer imagemanager.LayerInfo @@ -410,13 +451,11 @@ func TestLayerStore(t *testing.T) { { layer: imagemanager.LayerInfo{ LayerInfo: aostypes.LayerInfo{ - VersionInfo: aostypes.VersionInfo{ - AosVersion: 1, - }, - ID: "layer1", - Digest: "digest1", - URL: "file:///path/layer1", - Size: 30, + Version: "1.0", + LayerID: "layer1", + Digest: "digest1", + URL: "file:///path/layer1", + Size: 30, }, RemoteURL: "http://path/layer1", Path: "/path/layer1", Timestamp: time.Now().UTC(), Cached: false, @@ -426,13 +465,11 @@ func TestLayerStore(t *testing.T) { { layer: imagemanager.LayerInfo{ LayerInfo: aostypes.LayerInfo{ - VersionInfo: aostypes.VersionInfo{ - AosVersion: 1, - }, - ID: "layer2", - Digest: "digest2", - URL: "file:///path/layer2", - Size: 60, + Version: "1.0", + LayerID: "layer2", + Digest: "digest2", + URL: "file:///path/layer2", + Size: 60, }, RemoteURL: "http://path/layer2", Path: "/path/layer2", Timestamp: time.Now().UTC(), Cached: true, @@ -452,7 +489,7 @@ func TestLayerStore(t *testing.T) { } if !reflect.DeepEqual(layer, tCase.layer) { - t.Errorf("layer %s doesn't match stored one", tCase.layer.ID) + t.Errorf("layer %s doesn't match stored one", tCase.layer.LayerID) } layers, err := testDB.GetLayersInfo() @@ -499,19 +536,17 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject1", Instance: 1, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network1", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.17.0.0/16", - IP: "172.17.0.1", - VlanID: 1, - FirewallRules: []aostypes.FirewallRule{ - { - Proto: "tcp", - DstIP: "172.18.0.1", - SrcIP: "172.17.0.1", - DstPort: "80", - }, + Subnet: "172.17.0.0/16", + IP: "172.17.0.1", + VlanID: 1, + FirewallRules: []aostypes.FirewallRule{ + { + Proto: "tcp", + DstIP: "172.18.0.1", + SrcIP: "172.17.0.1", + DstPort: "80", }, }, }, @@ -524,13 +559,11 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject2", Instance: 1, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.1", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.1", + VlanID: 1, }, }, }, @@ -541,13 +574,11 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject2", Instance: 2, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.2", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.2", + VlanID: 1, }, }, }, @@ -576,13 +607,11 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject2", Instance: 1, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.1", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.1", + VlanID: 1, }, }, { @@ -591,13 +620,11 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject2", Instance: 2, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.2", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.2", + VlanID: 1, }, }, }, @@ -615,13 +642,11 @@ func TestNetworkInstanceConfiguration(t *testing.T) { SubjectID: "subject2", Instance: 2, }, - NetworkInfo: networkmanager.NetworkInfo{ + NetworkParameters: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.2", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.2", + VlanID: 1, }, }, }, @@ -654,36 +679,30 @@ func TestNetworkInstanceConfiguration(t *testing.T) { func TestNetworkConfiguration(t *testing.T) { casesAdd := []struct { - networkInfo networkmanager.NetworkInfo + networkInfo aostypes.NetworkParameters }{ { - networkInfo: networkmanager.NetworkInfo{ + networkInfo: aostypes.NetworkParameters{ NetworkID: "network1", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.17.0.0/16", - IP: "172.17.0.1", - VlanID: 1, - }, + Subnet: "172.17.0.0/16", + IP: "172.17.0.1", + VlanID: 1, }, }, { - networkInfo: networkmanager.NetworkInfo{ + networkInfo: aostypes.NetworkParameters{ NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.1", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.1", + VlanID: 1, }, }, { - networkInfo: networkmanager.NetworkInfo{ + networkInfo: aostypes.NetworkParameters{ NetworkID: "network3", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.19.0.0/16", - IP: "172.19.0.2", - VlanID: 1, - }, + Subnet: "172.19.0.0/16", + IP: "172.19.0.2", + VlanID: 1, }, }, } @@ -695,40 +714,34 @@ func TestNetworkConfiguration(t *testing.T) { } casesRemove := []struct { - expectedNetworkInfo []networkmanager.NetworkInfo + expectedNetworkInfo []aostypes.NetworkParameters removeNetwork string }{ { removeNetwork: "network1", - expectedNetworkInfo: []networkmanager.NetworkInfo{ + expectedNetworkInfo: []aostypes.NetworkParameters{ { NetworkID: "network2", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.18.0.0/16", - IP: "172.18.0.1", - VlanID: 1, - }, + Subnet: "172.18.0.0/16", + IP: "172.18.0.1", + VlanID: 1, }, { NetworkID: "network3", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.19.0.0/16", - IP: "172.19.0.2", - VlanID: 1, - }, + Subnet: "172.19.0.0/16", + IP: "172.19.0.2", + VlanID: 1, }, }, }, { removeNetwork: "network2", - expectedNetworkInfo: []networkmanager.NetworkInfo{ + expectedNetworkInfo: []aostypes.NetworkParameters{ { NetworkID: "network3", - NetworkParameters: aostypes.NetworkParameters{ - Subnet: "172.19.0.0/16", - IP: "172.19.0.2", - VlanID: 1, - }, + Subnet: "172.19.0.0/16", + IP: "172.19.0.2", + VlanID: 1, }, }, }, @@ -843,7 +856,7 @@ func TestInstance(t *testing.T) { t.Error("Incorrect empty instances") } - if _, err := testDB.GetInstanceUID(aostypes.InstanceIdent{ + if _, err := testDB.GetInstance(aostypes.InstanceIdent{ ServiceID: "notexist", SubjectID: "notexist", Instance: 0, }); !errors.Is(err, launcher.ErrNotExist) { t.Errorf("Incorrect error: %v, should be %v", err, launcher.ErrNotExist) @@ -851,10 +864,12 @@ func TestInstance(t *testing.T) { for i := 100; i < 105; i++ { instanceInfo := launcher.InstanceInfo{ - InstanceIdent: aostypes.InstanceIdent{ - ServiceID: servicePrefix + strconv.Itoa(i), SubjectID: subjectPrefix + strconv.Itoa(i), Instance: 0, - }, - UID: i, + InstanceIdent: createInstanceIdent(i), + NodeID: fmt.Sprintf("node%d", i+1), + PrevNodeID: fmt.Sprintf("node%d", i), + Timestamp: time.Now().UTC(), + UID: i, + Cached: i%2 == 0, } if err := testDB.AddInstance(instanceInfo); err != nil { @@ -864,18 +879,16 @@ func TestInstance(t *testing.T) { expectedInstances = append(expectedInstances, instanceInfo) } - expectedUID := 103 + expectedIndex := 103 - uid, err := testDB.GetInstanceUID(aostypes.InstanceIdent{ - ServiceID: servicePrefix + strconv.Itoa(expectedUID), - SubjectID: subjectPrefix + strconv.Itoa(expectedUID), Instance: 0, - }) + instanceInfo, err := testDB.GetInstance(createInstanceIdent(expectedIndex)) if err != nil { - t.Errorf("Can't get instance uid: %v", err) + t.Fatalf("Can't get instance: %v", err) } - if uid != expectedUID { - t.Error("Incorrect uid for instance") + if !reflect.DeepEqual(instanceInfo, expectedInstances[expectedIndex-100]) { + t.Errorf("Incorrect result for get instance: %v, expected: %v", instanceInfo, + expectedInstances[expectedIndex-100]) } instances, err = testDB.GetInstances() @@ -887,42 +900,37 @@ func TestInstance(t *testing.T) { t.Errorf("Incorrect result for get instances: %v, expected: %v", instances, expectedInstances) } - expectedCachedInstanceIdent := aostypes.InstanceIdent{ - ServiceID: servicePrefix + strconv.Itoa(expectedUID), - SubjectID: subjectPrefix + strconv.Itoa(expectedUID), Instance: 0, - } + updatedIndex := 102 - if err := testDB.SetInstanceCached(expectedCachedInstanceIdent, true); err != nil { - t.Errorf("Can't set instance cached: %v", err) + updatedInstance := launcher.InstanceInfo{ + InstanceIdent: createInstanceIdent(updatedIndex), + NodeID: "updatedNode", + PrevNodeID: "prevUpdatedNode", + Timestamp: time.Now().UTC(), + UID: 5000, + Cached: true, } - instances, err = testDB.GetInstances() - if err != nil { - t.Errorf("Can't get all instances: %v", err) + if err := testDB.UpdateInstance(updatedInstance); err != nil { + t.Errorf("Can't update instance: %v", err) } - for _, instance := range instances { - cached := instance.Cached - if instance.InstanceIdent == expectedCachedInstanceIdent { - if !cached { - t.Error("Instance expected to be cached") - } + if instanceInfo, err = testDB.GetInstance(createInstanceIdent(expectedIndex)); err != nil { + t.Fatalf("Can't get instance: %v", err) + } - break - } + if !reflect.DeepEqual(instanceInfo, expectedInstances[expectedIndex-100]) { + t.Errorf("Incorrect result for get instance: %v, expected: %v", instanceInfo, + expectedInstances[expectedIndex-100]) } - if err := testDB.RemoveInstance(aostypes.InstanceIdent{ - ServiceID: servicePrefix + strconv.Itoa(expectedUID), - SubjectID: subjectPrefix + strconv.Itoa(expectedUID), Instance: 0, - }); err != nil { + removedInstance := 104 + + if err := testDB.RemoveInstance(createInstanceIdent(removedInstance)); err != nil { t.Errorf("Can't remove instance: %v", err) } - if _, err := testDB.GetInstanceUID(aostypes.InstanceIdent{ - ServiceID: servicePrefix + strconv.Itoa(expectedUID), - SubjectID: subjectPrefix + strconv.Itoa(expectedUID), Instance: 0, - }); !errors.Is(err, launcher.ErrNotExist) { + if _, err := testDB.GetInstance(createInstanceIdent(removedInstance)); !errors.Is(err, launcher.ErrNotExist) { t.Errorf("Incorrect error: %v, should be %v", err, launcher.ErrNotExist) } } @@ -1037,38 +1045,6 @@ func TestStorageState(t *testing.T) { } } -func TestNodeState(t *testing.T) { - setNodeState := json.RawMessage("node state 1") - - if err := testDB.SetNodeState("nodeID", setNodeState); err != nil { - t.Fatalf("Can't set node state: %v", err) - } - - getNodeState, err := testDB.GetNodeState("nodeID") - if err != nil { - t.Errorf("Can't get node state: %v", err) - } - - if string(setNodeState) != string(getNodeState) { - t.Errorf("Wrong get node state: %s", string(getNodeState)) - } - - setNodeState = json.RawMessage("node state 2") - - if err := testDB.SetNodeState("nodeID", setNodeState); err != nil { - t.Fatalf("Can't set node state: %v", err) - } - - getNodeState, err = testDB.GetNodeState("nodeID") - if err != nil { - t.Errorf("Can't get node state: %v", err) - } - - if string(setNodeState) != string(getNodeState) { - t.Errorf("Wrong get node state: %s", string(getNodeState)) - } -} - func TestMigration(t *testing.T) { migrationDBName := filepath.Join(tmpDir, "test_migration.db") mergedMigrationDir := filepath.Join(tmpDir, "mergedMigration") @@ -1279,3 +1255,11 @@ func isTableExist(sqlite *sql.DB, tableName string) (bool, error) { return false, aoserrors.Wrap(rows.Err()) } + +func createInstanceIdent(index int) aostypes.InstanceIdent { + return aostypes.InstanceIdent{ + ServiceID: servicePrefix + strconv.Itoa(index), + SubjectID: subjectPrefix + strconv.Itoa(index), + Instance: uint64(index), + } +} diff --git a/downloader/downloader.go b/downloader/downloader.go index a3c82382..216d6049 100644 --- a/downloader/downloader.go +++ b/downloader/downloader.go @@ -22,7 +22,6 @@ import ( "context" "encoding/base64" "errors" - "fmt" "os" "path" "path/filepath" @@ -79,14 +78,12 @@ type DownloadInfo struct { // PackageInfo struct contains package info data. type PackageInfo struct { - URLs []string - Sha256 []byte - Sha512 []byte - Size uint64 - TargetType string - TargetID string - TargetAosVersion uint64 - TargetVendorVersion string + URLs []string + Sha256 []byte + Size uint64 + TargetType string + TargetID string + TargetVersion string } // Storage provides API to add, remove, update or access download info data. @@ -99,7 +96,7 @@ type Storage interface { // AlertSender provides alert sender interface. type AlertSender interface { - SendAlert(alert cloudprotocol.AlertItem) + SendAlert(alert interface{}) } var ( @@ -514,7 +511,6 @@ func (downloader *Downloader) downloadPackage(result *downloadResult) (err error if err = image.CheckFileInfo(result.ctx, result.downloadFileName, image.FileInfo{ Sha256: result.packageInfo.Sha256, - Sha512: result.packageInfo.Sha512, Size: result.packageInfo.Size, }); err != nil { if removeErr := os.RemoveAll(result.downloadFileName); removeErr != nil { @@ -645,20 +641,16 @@ func (downloader *Downloader) download(url string, result *downloadResult) (err func (downloader *Downloader) prepareDownloadAlert( resp *grab.Response, result *downloadResult, msg string, -) cloudprotocol.AlertItem { - return cloudprotocol.AlertItem{ - Timestamp: time.Now(), Tag: cloudprotocol.AlertTagDownloadProgress, - Payload: cloudprotocol.DownloadAlert{ - TargetType: result.packageInfo.TargetType, - TargetID: result.packageInfo.TargetID, - TargetAosVersion: result.packageInfo.TargetAosVersion, - TargetVendorVersion: result.packageInfo.TargetVendorVersion, - Progress: fmt.Sprintf("%.2f%%", resp.Progress()*100), - URL: resp.Request.HTTPRequest.URL.String(), - DownloadedBytes: bytefmt.ByteSize(uint64(resp.BytesComplete())), - TotalBytes: bytefmt.ByteSize(uint64(resp.Size())), - Message: msg, - }, +) cloudprotocol.DownloadAlert { + return cloudprotocol.DownloadAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: time.Now(), Tag: cloudprotocol.AlertTagDownloadProgress}, + TargetType: result.packageInfo.TargetType, + TargetID: result.packageInfo.TargetID, + Version: result.packageInfo.TargetVersion, + Message: msg, + URL: resp.Request.HTTPRequest.URL.String(), + DownloadedBytes: bytefmt.ByteSize(uint64(resp.BytesComplete())), + TotalBytes: bytefmt.ByteSize(uint64(resp.Size())), } } diff --git a/downloader/downloader_test.go b/downloader/downloader_test.go index 904e5fd1..4f52c771 100644 --- a/downloader/downloader_test.go +++ b/downloader/downloader_test.go @@ -757,8 +757,8 @@ func TestReleaseByType(t *testing.T) { * Interfaces **********************************************************************************************************************/ -func (instance *testAlertSender) SendAlert(alert cloudprotocol.AlertItem) { - downloadAlert, ok := alert.Payload.(cloudprotocol.DownloadAlert) +func (instance *testAlertSender) SendAlert(alert interface{}) { + downloadAlert, ok := alert.(cloudprotocol.DownloadAlert) if !ok { log.Error("Received not download alert") } @@ -984,12 +984,10 @@ func preparePackageInfo(host, fileName, targetType string) (packageInfo download } packageInfo.Sha256 = imageFileInfo.Sha256 - packageInfo.Sha512 = imageFileInfo.Sha512 packageInfo.Size = imageFileInfo.Size packageInfo.TargetType = targetType packageInfo.TargetID = "targetID" - packageInfo.TargetAosVersion = 1 - packageInfo.TargetVendorVersion = "vendorVersion1" + packageInfo.TargetVersion = "1.0" return packageInfo } diff --git a/fcrypt/fcrypt.go b/fcrypt/fcrypt.go index 984c2e49..e92d5b68 100644 --- a/fcrypt/fcrypt.go +++ b/fcrypt/fcrypt.go @@ -112,7 +112,7 @@ type SignContext struct { type SignContextInterface interface { AddCertificate(fingerprint string, asn1Bytes []byte) (err error) AddCertificateChain(name string, fingerprints []string) (err error) - VerifySign(ctx context.Context, f *os.File, sign *cloudprotocol.Signs) (err error) + VerifySign(ctx context.Context, f *os.File, sign cloudprotocol.Signs) (err error) } // CertificateProvider interface to get certificate. @@ -134,8 +134,8 @@ type certificateChainInfo struct { type DecryptParams struct { Chains []cloudprotocol.CertificateChain Certs []cloudprotocol.Certificate - DecryptionInfo *cloudprotocol.DecryptionInfo - Signs *cloudprotocol.Signs + DecryptionInfo cloudprotocol.DecryptionInfo + Signs cloudprotocol.Signs } /*********************************************************************************************************************** @@ -393,7 +393,7 @@ func (signContext *SignContext) AddCertificateChain(name string, fingerprints [] // VerifySign verifies signature. func (signContext *SignContext) VerifySign( - ctx context.Context, f *os.File, sign *cloudprotocol.Signs, + ctx context.Context, f *os.File, sign cloudprotocol.Signs, ) (err error) { if len(signContext.signCertificateChains) == 0 || len(signContext.signCertificates) == 0 { return aoserrors.New("sign context not initialized (no certificates)") diff --git a/fcrypt/fcrypt_internal_test.go b/fcrypt/fcrypt_internal_test.go index 87252093..0cb4acca 100644 --- a/fcrypt/fcrypt_internal_test.go +++ b/fcrypt/fcrypt_internal_test.go @@ -96,7 +96,7 @@ type testUpgradeCertificate struct { type testUpgradeFileInfo struct { FileData []byte - Signs *cloudprotocol.Signs + Signs cloudprotocol.Signs } // UpgradeMetadata upgrade metadata. @@ -842,7 +842,7 @@ func TestVerifySignOfComponent(t *testing.T) { Data: []testUpgradeFileInfo{ { FileData: []byte("test"), - Signs: &cloudprotocol.Signs{ + Signs: cloudprotocol.Signs{ ChainName: "8D28D60220B8D08826E283B531A0B1D75359C5EE", Alg: "RSA/SHA256", Value: signValue, @@ -911,6 +911,7 @@ func TestVerifySignOfComponent(t *testing.T) { if err != nil { t.Fatal("Cannot create temporary file", err) } + defer tmpFile.Close() defer os.Remove(tmpFile.Name()) @@ -938,6 +939,7 @@ func TestVerifySignOfComponent(t *testing.T) { t.Fatal("Cannot create temporary file", err) } defer tmpFile.Close() + defer os.Remove(tmpFile.Name()) if _, err = tmpFile.Write(data.FileData); err != nil { diff --git a/fileserver/fileserver_test.go b/fileserver/fileserver_test.go index e57c398c..0bae313e 100644 --- a/fileserver/fileserver_test.go +++ b/fileserver/fileserver_test.go @@ -21,7 +21,6 @@ package fileserver_test import ( "bytes" - "fmt" "io" "net/http" "os" @@ -110,7 +109,7 @@ func TestFileServer(t *testing.T) { t.Fatalf("Can't create package file: %s", err) } - outURL, err = fileServer.TranslateURL(false, fmt.Sprintf("file://%s", filepath.Join(serverDir, filename))) + outURL, err = fileServer.TranslateURL(false, "file://"+filepath.Join(serverDir, filename)) if err != nil { t.Errorf("Can't translate remote url: %s", err) } diff --git a/go.mod b/go.mod index d708d0df..36cf94a3 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ replace github.com/anexia-it/fsquota => github.com/aosedge/fsquota v0.0.0-202311 require ( code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b - github.com/aosedge/aos_common v0.0.0-20240701123742-84e62a5773fc + github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a github.com/apparentlymart/go-cidr v1.1.0 github.com/cavaliergopher/grab/v3 v3.0.1 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf @@ -16,6 +16,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/google/go-tpm v0.9.0 github.com/google/uuid v1.4.0 + github.com/hashicorp/go-version v1.6.0 github.com/jackpal/gateway v1.0.11 github.com/looplab/fsm v1.0.1 github.com/mattn/go-sqlite3 v1.14.18 @@ -40,7 +41,6 @@ require ( github.com/golang-migrate/migrate/v4 v4.16.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f // indirect github.com/moby/sys/mountinfo v0.7.1 // indirect diff --git a/go.sum b/go.sum index f7a0e6d6..3b16eabe 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b h1:/2OEIBwZAaJ8n8iTXrM4v/+bdyLDTLwcW6RZtkO4+r0= code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b/go.mod h1:CKNYSQxmKcMCNIKoRG5rRR4AIgJMIoK65ya+Z5xHnk4= -github.com/aosedge/aos_common v0.0.0-20240701123742-84e62a5773fc h1:+g8nW2vQMq4iS307OKzLtd8u5ZQ9WcvpJNmpfZhtxG4= -github.com/aosedge/aos_common v0.0.0-20240701123742-84e62a5773fc/go.mod h1:fVk+1Za6Vaef1ysZvjJeFaA8NUS/8U4tJuCqLd5fky0= +github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a h1:vTyrUt3lGoPbiAAf+ckr2vreksbK4pGi/KmM9GNoUKI= +github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a/go.mod h1:CG/e1tQPMo2fvdwRHi+Cx5StpNURu7InTZSgyfmBVYM= github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f h1:xL5hA9axQFHnoVVF/Q8CkKl9JiTvA7U72jRDltMBB9M= github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE= github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7 h1:KR+SuYXJ9HigUaJdUwRlkDOOpkCrliFF3liBVKu2GKY= diff --git a/iamclient/iamclient.go b/iamclient/iamclient.go index 9ba81a5e..b2f7758d 100644 --- a/iamclient/iamclient.go +++ b/iamclient/iamclient.go @@ -20,18 +20,24 @@ package iamclient import ( "context" "encoding/base64" + "errors" + "io" "sync" "time" "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/iamanager/v4" + pb "github.com/aosedge/aos_common/api/iamanager" "github.com/aosedge/aos_common/utils/cryptutils" + pbconvert "github.com/aosedge/aos_common/utils/pbconvert" "github.com/golang/protobuf/ptypes/empty" log "github.com/sirupsen/logrus" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" "github.com/aosedge/aos_communicationmanager/config" ) @@ -40,7 +46,10 @@ import ( * Consts **********************************************************************************************************************/ -const iamRequestTimeout = 30 * time.Second +const ( + iamRequestTimeout = 30 * time.Second + iamReconnectInterval = 10 * time.Second +) /*********************************************************************************************************************** * Types @@ -52,8 +61,7 @@ type Client struct { sender Sender - nodeID string - + nodeID string systemID string publicConnection *grpc.ClientConn @@ -61,14 +69,21 @@ type Client struct { publicService pb.IAMPublicServiceClient identService pb.IAMPublicIdentityServiceClient certificateService pb.IAMCertificateServiceClient + provisioningService pb.IAMProvisioningServiceClient - closeChannel chan struct{} + closeChannel chan struct{} + publicNodesService pb.IAMPublicNodesServiceClient + nodesService pb.IAMNodesServiceClient + nodeInfoListeners []chan cloudprotocol.NodeInfo } // Sender provides API to send messages to the cloud. type Sender interface { SendIssueUnitCerts(requests []cloudprotocol.IssueCertData) (err error) SendInstallCertsConfirmation(confirmations []cloudprotocol.InstallCertData) (err error) + SendStartProvisioningResponse(response cloudprotocol.StartProvisioningResponse) (err error) + SendFinishProvisioningResponse(response cloudprotocol.FinishProvisioningResponse) (err error) + SendDeprovisioningResponse(response cloudprotocol.DeprovisioningResponse) (err error) } // CertificateProvider provides certificate info. @@ -91,8 +106,9 @@ func New( } localClient := &Client{ - sender: sender, - closeChannel: make(chan struct{}, 1), + sender: sender, + closeChannel: make(chan struct{}, 1), + nodeInfoListeners: make([]chan cloudprotocol.NodeInfo, 0), } defer func() { @@ -108,6 +124,7 @@ func New( localClient.publicService = pb.NewIAMPublicServiceClient(localClient.publicConnection) localClient.identService = pb.NewIAMPublicIdentityServiceClient(localClient.publicConnection) + localClient.publicNodesService = pb.NewIAMPublicNodesServiceClient(localClient.publicConnection) if localClient.protectedConnection, err = localClient.createProtectedConnection( config, cryptocontext, insecure); err != nil { @@ -115,17 +132,21 @@ func New( } localClient.certificateService = pb.NewIAMCertificateServiceClient(localClient.protectedConnection) + localClient.provisioningService = pb.NewIAMProvisioningServiceClient(localClient.protectedConnection) + localClient.nodesService = pb.NewIAMNodesServiceClient(localClient.protectedConnection) log.Debug("Connected to IAM") if localClient.nodeID, _, err = localClient.getNodeInfo(); err != nil { - return client, aoserrors.Wrap(err) + return nil, aoserrors.Wrap(err) } if localClient.systemID, err = localClient.getSystemID(); err != nil { return nil, aoserrors.Wrap(err) } + go localClient.connectPublicNodeService() + return localClient, nil } @@ -139,8 +160,60 @@ func (client *Client) GetSystemID() (systemID string) { return client.systemID } +// GetCurrentNodeInfo returns info for current node. +func (client *Client) GetCurrentNodeInfo() (nodeInfo cloudprotocol.NodeInfo, err error) { + return client.GetNodeInfo(client.GetNodeID()) +} + +// GetNodeInfo returns node info. +func (client *Client) GetNodeInfo(nodeID string) (nodeInfo cloudprotocol.NodeInfo, err error) { + log.WithField("nodeID", nodeID).Debug("Get node info") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + request := &pb.GetNodeInfoRequest{NodeId: nodeID} + + response, err := client.publicNodesService.GetNodeInfo(ctx, request) + if err != nil { + return cloudprotocol.NodeInfo{}, aoserrors.Wrap(err) + } + + return pbconvert.NodeInfoFromPB(response), nil +} + +// GetAllNodeIDs returns node ids. +func (client *Client) GetAllNodeIDs() (nodeIDs []string, err error) { + log.Debug("Get all node ids") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.publicNodesService.GetAllNodeIDs(ctx, &emptypb.Empty{}) + if err != nil { + return nil, aoserrors.Wrap(err) + } + + return response.GetIds(), err +} + +// SubscribeNodeInfoChange subscribes client on NodeInfoChange events. +func (client *Client) SubscribeNodeInfoChange() <-chan cloudprotocol.NodeInfo { + client.Lock() + defer client.Unlock() + + log.Debug("Subscribe on node info change event") + + ch := make(chan cloudprotocol.NodeInfo) + client.nodeInfoListeners = append(client.nodeInfoListeners, ch) + + return ch +} + // RenewCertificatesNotification renew certificates notification. -func (client *Client) RenewCertificatesNotification(pwd string, certInfo []cloudprotocol.RenewCertData) (err error) { +func (client *Client) RenewCertificatesNotification(secrets cloudprotocol.UnitSecrets, + certInfo []cloudprotocol.RenewCertData, +) (err error) { newCerts := make([]cloudprotocol.IssueCertData, 0, len(certInfo)) for _, cert := range certInfo { @@ -151,6 +224,11 @@ func (client *Client) RenewCertificatesNotification(pwd string, certInfo []cloud ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) defer cancel() + pwd, ok := secrets.Nodes[cert.NodeID] + if !ok { + return aoserrors.New("not found password for node: " + cert.NodeID) + } + request := &pb.CreateKeyRequest{Type: cert.Type, Password: pwd, NodeId: cert.NodeID} response, err := client.certificateService.CreateKey(ctx, request) @@ -243,6 +321,157 @@ func (client *Client) GetCertificate( return response.GetCertUrl(), response.GetKeyUrl(), nil } +// StartProvisioning starts provisioning. +func (client *Client) StartProvisioning(nodeID, password string) (err error) { + log.WithField("nodeID", nodeID).Debug("Start provisioning") + + var ( + errorInfo *cloudprotocol.ErrorInfo + csrs []cloudprotocol.IssueCertData + ) + + defer func() { + errSend := client.sender.SendStartProvisioningResponse(cloudprotocol.StartProvisioningResponse{ + MessageType: cloudprotocol.StartProvisioningResponseMessageType, + NodeID: nodeID, + ErrorInfo: errorInfo, + CSRs: csrs, + }) + if errSend != nil && err == nil { + err = aoserrors.Wrap(errSend) + } + }() + + errorInfo = client.startProvisioning(nodeID, password) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + csrs, errorInfo = client.createKeys(nodeID, password) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + return nil +} + +// FinishProvisioning starts provisioning. +func (client *Client) FinishProvisioning( + nodeID, password string, certificates []cloudprotocol.IssuedCertData, +) (err error) { + log.WithField("nodeID", nodeID).Debug("Finish provisioning") + + var errorInfo *cloudprotocol.ErrorInfo + + defer func() { + errSend := client.sender.SendFinishProvisioningResponse(cloudprotocol.FinishProvisioningResponse{ + MessageType: cloudprotocol.FinishProvisioningResponseMessageType, + NodeID: nodeID, + ErrorInfo: errorInfo, + }) + if errSend != nil && err == nil { + err = aoserrors.Wrap(errSend) + } + }() + + errorInfo = client.applyCertificates(nodeID, certificates) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + errorInfo = client.finishProvisioning(nodeID, password) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + return nil +} + +// Deprovision deprovisions node. +func (client *Client) Deprovision(nodeID, password string) (err error) { + log.WithField("nodeID", nodeID).Debug("Deprovision node") + + var errorInfo *cloudprotocol.ErrorInfo + + defer func() { + errSend := client.sender.SendDeprovisioningResponse(cloudprotocol.DeprovisioningResponse{ + MessageType: cloudprotocol.DeprovisioningResponseMessageType, + NodeID: nodeID, + ErrorInfo: errorInfo, + }) + if errSend != nil && err == nil { + err = aoserrors.Wrap(errSend) + } + }() + + if nodeID == client.GetNodeID() { + err = aoserrors.New("Can't deprovision main node") + errorInfo = &cloudprotocol.ErrorInfo{ + Message: err.Error(), + } + + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.provisioningService.Deprovision( + ctx, &pb.DeprovisionRequest{NodeId: nodeID, Password: password}) + if err != nil { + errorInfo = &cloudprotocol.ErrorInfo{Message: err.Error()} + + return aoserrors.Wrap(err) + } + + errorInfo = pbconvert.ErrorInfoFromPB(response.GetError()) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + return nil +} + +// PauseNode pauses node. +func (client *Client) PauseNode(nodeID string) error { + log.WithField("nodeID", nodeID).Debug("Pause node") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.nodesService.PauseNode(ctx, &pb.PauseNodeRequest{NodeId: nodeID}) + if err != nil { + return aoserrors.Wrap(err) + } + + errorInfo := pbconvert.ErrorInfoFromPB(response.GetError()) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + return nil +} + +// ResumeNode resumes node. +func (client *Client) ResumeNode(nodeID string) error { + log.WithField("nodeID", nodeID).Debug("Resume node") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.nodesService.ResumeNode(ctx, &pb.ResumeNodeRequest{NodeId: nodeID}) + if err != nil { + return aoserrors.Wrap(err) + } + + errorInfo := pbconvert.ErrorInfoFromPB(response.GetError()) + if errorInfo != nil { + return aoserrors.New(errorInfo.Message) + } + + return nil +} + // Close closes IAM client. func (client *Client) Close() (err error) { if client.publicConnection != nil || client.protectedConnection != nil { @@ -257,6 +486,8 @@ func (client *Client) Close() (err error) { client.protectedConnection.Close() } + client.nodeInfoListeners = nil + log.Debug("Disconnected from IAM") return nil @@ -356,3 +587,178 @@ func (client *Client) getSystemID() (systemID string, err error) { return response.GetSystemId(), nil } + +func (client *Client) processMessages(listener pb.IAMPublicNodesService_SubscribeNodeChangedClient) (err error) { + for { + nodeInfo, err := listener.Recv() + if err != nil { + if code, ok := status.FromError(err); ok { + if code.Code() == codes.Canceled { + log.Debug("IAM client connection closed") + return nil + } + } + + return aoserrors.Wrap(err) + } + + client.Lock() + for _, listener := range client.nodeInfoListeners { + listener <- pbconvert.NodeInfoFromPB(nodeInfo) + } + client.Unlock() + } +} + +func (client *Client) connectPublicNodeService() { + listener, err := client.subscribeNodeInfoChange() + + for { + if err != nil { + log.Errorf("Error register to IAM: %v", aoserrors.Wrap(err)) + } else { + if err = client.processMessages(listener); err != nil { + if errors.Is(err, io.EOF) { + log.Debug("Connection is closed") + } else { + log.Errorf("Connection error: %v", aoserrors.Wrap(err)) + } + } + } + + log.Debugf("Reconnect to IAM in %v...", iamReconnectInterval) + + select { + case <-client.closeChannel: + log.Debugf("Disconnected from IAM") + + return + + case <-time.After(iamReconnectInterval): + listener, err = client.subscribeNodeInfoChange() + } + } +} + +func (client *Client) subscribeNodeInfoChange() ( + listener pb.IAMPublicNodesService_SubscribeNodeChangedClient, err error, +) { + client.Lock() + defer client.Unlock() + + client.publicNodesService = pb.NewIAMPublicNodesServiceClient(client.publicConnection) + + listener, err = client.publicNodesService.SubscribeNodeChanged(context.Background(), &emptypb.Empty{}) + if err != nil { + log.WithField("error", err).Error("Can't subscribe on NodeChange event") + + return nil, aoserrors.Wrap(err) + } + + return listener, aoserrors.Wrap(err) +} + +func (client *Client) getCertTypes(nodeID string) ([]string, error) { + log.WithField("nodeID", nodeID).Debug("Get certificate types") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.provisioningService.GetCertTypes( + ctx, &pb.GetCertTypesRequest{NodeId: nodeID}) + if err != nil { + return nil, aoserrors.Wrap(err) + } + + return response.GetTypes(), nil +} + +func (client *Client) createKeys(nodeID, password string) ( + certs []cloudprotocol.IssueCertData, errorInfo *cloudprotocol.ErrorInfo, +) { + certTypes, err := client.getCertTypes(nodeID) + if err != nil { + return nil, &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + for _, certType := range certTypes { + log.WithFields(log.Fields{"nodeID": nodeID, "type": certType}).Debug("Create key") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.certificateService.CreateKey(ctx, &pb.CreateKeyRequest{ + Type: certType, + NodeId: nodeID, + Password: password, + }) + if err != nil { + return nil, &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + if response.GetError() != nil { + return nil, pbconvert.ErrorInfoFromPB(response.GetError()) + } + + certs = append(certs, cloudprotocol.IssueCertData{ + Type: certType, + Csr: response.GetCsr(), + NodeID: nodeID, + }) + } + + return certs, nil +} + +func (client *Client) startProvisioning(nodeID, password string) (errorInfo *cloudprotocol.ErrorInfo) { + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.provisioningService.StartProvisioning( + ctx, &pb.StartProvisioningRequest{NodeId: nodeID, Password: password}) + if err != nil { + return &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + return pbconvert.ErrorInfoFromPB(response.GetError()) +} + +func (client *Client) applyCertificates( + nodeID string, certificates []cloudprotocol.IssuedCertData, +) (errorInfo *cloudprotocol.ErrorInfo) { + for _, certificate := range certificates { + log.WithFields(log.Fields{"nodeID": nodeID, "type": certificate.Type}).Debug("Apply certificate") + + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.certificateService.ApplyCert( + ctx, &pb.ApplyCertRequest{ + NodeId: nodeID, + Type: certificate.Type, + Cert: certificate.CertificateChain, + }) + if err != nil { + return &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + if response.GetError() != nil { + return pbconvert.ErrorInfoFromPB(response.GetError()) + } + } + + return nil +} + +func (client *Client) finishProvisioning(nodeID, password string) (errorInfo *cloudprotocol.ErrorInfo) { + ctx, cancel := context.WithTimeout(context.Background(), iamRequestTimeout) + defer cancel() + + response, err := client.provisioningService.FinishProvisioning( + ctx, &pb.FinishProvisioningRequest{NodeId: nodeID, Password: password}) + if err != nil { + return &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + return pbconvert.ErrorInfoFromPB(response.GetError()) +} diff --git a/iamclient/iamclient_test.go b/iamclient/iamclient_test.go index 1a0f9d86..15b9e6d0 100644 --- a/iamclient/iamclient_test.go +++ b/iamclient/iamclient_test.go @@ -32,11 +32,12 @@ import ( "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/iamanager/v4" + pb "github.com/aosedge/aos_common/api/iamanager" "github.com/aosedge/aos_common/utils/cryptutils" "github.com/golang/protobuf/ptypes/empty" log "github.com/sirupsen/logrus" "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/iamclient" @@ -55,9 +56,18 @@ const ( * Types **********************************************************************************************************************/ +type testIAMPublicNodesServiceServer struct { + pb.UnimplementedIAMPublicNodesServiceServer + nodeInfo chan *pb.NodeInfo + + currentID string + currentNodeName string +} + type testPublicServer struct { pb.UnimplementedIAMPublicServiceServer pb.UnimplementedIAMPublicIdentityServiceServer + testIAMPublicNodesServiceServer grpcServer *grpc.Server systemID string @@ -67,6 +77,8 @@ type testPublicServer struct { type testProtectedServer struct { pb.UnimplementedIAMCertificateServiceServer + pb.UnimplementedIAMProvisioningServiceServer + pb.UnimplementedIAMNodesServiceServer grpcServer *grpc.Server csr map[string]string @@ -74,8 +86,11 @@ type testProtectedServer struct { } type testSender struct { - csr map[string]string - currentConfirmations []cloudprotocol.InstallCertData + csr map[string]string + currentConfirmations []cloudprotocol.InstallCertData + startProvisioningResponse *cloudprotocol.StartProvisioningResponse + finishProvisioningResponse *cloudprotocol.FinishProvisioningResponse + deprovisioningResponse *cloudprotocol.DeprovisioningResponse } type testCertProvider struct{} @@ -173,11 +188,12 @@ func TestRenewCertificatesNotification(t *testing.T) { defer client.Close() certInfo := []cloudprotocol.RenewCertData{ - {Type: "online", Serial: "serail1", ValidTill: time.Now()}, - {Type: "offline", Serial: "serail2", ValidTill: time.Now()}, + {NodeID: "node0", Type: "online", Serial: "serial1", ValidTill: time.Now()}, + {NodeID: "node0", Type: "offline", Serial: "serial2", ValidTill: time.Now()}, } + secrets := cloudprotocol.UnitSecrets{Nodes: map[string]string{"node0": "pwd"}} - if err = client.RenewCertificatesNotification("pwd", certInfo); err != nil { + if err = client.RenewCertificatesNotification(secrets, certInfo); err != nil { t.Fatalf("Can't process renew certificate notification: %s", err) } @@ -331,6 +347,302 @@ func TestGetCertificates(t *testing.T) { } } +func TestGetNodeInfo(t *testing.T) { + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, &testSender{}, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + nodeInfo, err := client.GetNodeInfo(publicServer.currentID) + if err != nil { + t.Errorf("Error is not expected: %s", err) + } + + if nodeInfo.NodeID != publicServer.currentID { + t.Errorf("Not expected NodeId: %s", nodeInfo.NodeID) + } + + if nodeInfo.Name != publicServer.currentNodeName { + t.Errorf("Not expected NodeId: %s", nodeInfo.Name) + } +} + +func TestGetCurrentNodeInfo(t *testing.T) { + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %v", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, &testSender{}, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %v", err) + } + defer client.Close() + + nodeInfo, err := client.GetCurrentNodeInfo() + if err != nil { + t.Errorf("Error is not expected: %v", err) + } + + if nodeInfo.NodeID != publicServer.currentID { + t.Errorf("Not expected NodeId: %s", nodeInfo.NodeID) + } + + if nodeInfo.Name != publicServer.currentNodeName { + t.Errorf("Not expected NodeId: %s", nodeInfo.Name) + } +} + +func TestSubscribeNodeInfoChange(t *testing.T) { + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, &testSender{}, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + + stream := client.SubscribeNodeInfoChange() + + secondaryNodeInfo := pb.NodeInfo{NodeId: "secondary", NodeType: "secondary"} + + publicServer.nodeInfo <- &secondaryNodeInfo + + receivedNodeInfo := <-stream + + defer client.Close() + + if secondaryNodeInfo.GetNodeId() != receivedNodeInfo.NodeID { + t.Errorf("NodeInfo with not expected Id: %s", receivedNodeInfo.NodeID) + } + + if secondaryNodeInfo.GetName() != receivedNodeInfo.Name { + t.Errorf("NodeInfo with not expected Name: %s", receivedNodeInfo.Name) + } +} + +func TestStartProvisioning(t *testing.T) { + sender := &testSender{} + + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + protectedServer.csr = map[string]string{"online": "onlineCSR", "offline": "offlineCSR"} + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, sender, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.StartProvisioning("node1", "password") + if err != nil { + t.Errorf("Error is not expected: %s", err) + } + + expectedResponse := cloudprotocol.StartProvisioningResponse{ + MessageType: cloudprotocol.StartProvisioningResponseMessageType, + NodeID: "node1", + CSRs: []cloudprotocol.IssueCertData{ + {NodeID: "node1", Type: "online", Csr: "onlineCSR"}, + {NodeID: "node1", Type: "offline", Csr: "offlineCSR"}, + }, + } + + if sender.startProvisioningResponse == nil { + t.Error("Sender didn't receive start provisioning response") + } + + if !reflect.DeepEqual(expectedResponse, *sender.startProvisioningResponse) { + log.Debug(expectedResponse) + log.Debug(*sender.startProvisioningResponse) + t.Error("Wrong start provisioning response") + } +} + +func TestFinishProvisioning(t *testing.T) { + sender := &testSender{} + + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + protectedServer.certURL = map[string]string{"online": "onlineCSR", "offline": "offlineCSR"} + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, sender, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.FinishProvisioning("node2", "password", + []cloudprotocol.IssuedCertData{ + {NodeID: "node1", Type: "online", CertificateChain: "onlineCSR"}, + {NodeID: "node1", Type: "offline", CertificateChain: "offlineCSR"}, + }, + ) + if err != nil { + t.Errorf("Error is not expected: %v", err) + } + + if sender.finishProvisioningResponse == nil { + t.Error("Sender didn't receive finish provisioning response") + } + + if sender.finishProvisioningResponse.ErrorInfo != nil { + t.Errorf("Error is not expected: %v", sender.finishProvisioningResponse.ErrorInfo) + } +} + +func TestDeprovisioning(t *testing.T) { + sender := &testSender{} + + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, sender, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.Deprovision("test-node-id", "password") + if err != nil { + t.Errorf("Error is not expected: %s", err) + } + + if sender.deprovisioningResponse == nil { + t.Error("Sender didn't receive deprovisioning response") + } + + if sender.deprovisioningResponse.ErrorInfo != nil { + t.Errorf("Error is not expected: %v", sender.deprovisioningResponse.ErrorInfo) + } +} + +func TestFailDeprovisionMainNode(t *testing.T) { + sender := &testSender{} + + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, sender, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.Deprovision(publicServer.currentID, "password") + if err == nil { + t.Errorf("Deprovisioning main node should fail") + } +} + +func TestPauseNode(t *testing.T) { + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, &testSender{}, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.PauseNode("test-node-id") + if err != nil { + t.Errorf("Error is not expected: %s", err) + } +} + +func TestResumeNode(t *testing.T) { + publicServer, protectedServer, err := newTestServer(publicServerURL, protectedServerURL) + if err != nil { + t.Fatalf("Can't create test server: %s", err) + } + + defer publicServer.close() + defer protectedServer.close() + + client, err := iamclient.New(&config.Config{ + IAMProtectedServerURL: protectedServerURL, + IAMPublicServerURL: publicServerURL, + }, &testSender{}, nil, true) + if err != nil { + t.Fatalf("Can't create IAM client: %s", err) + } + defer client.Close() + + err = client.ResumeNode("test-node-id") + if err != nil { + t.Errorf("Error is not expected: %s", err) + } +} + /******************************************************************************* * Private ******************************************************************************/ @@ -346,9 +658,11 @@ func newTestServer( } publicServer.grpcServer = grpc.NewServer() + publicServer.nodeInfo = make(chan *pb.NodeInfo) pb.RegisterIAMPublicServiceServer(publicServer.grpcServer, publicServer) pb.RegisterIAMPublicIdentityServiceServer(publicServer.grpcServer, publicServer) + pb.RegisterIAMPublicNodesServiceServer(publicServer.grpcServer, &publicServer.testIAMPublicNodesServiceServer) go func() { if err := publicServer.grpcServer.Serve(publicListener); err != nil { @@ -366,6 +680,8 @@ func newTestServer( protectedServer.grpcServer = grpc.NewServer() pb.RegisterIAMCertificateServiceServer(protectedServer.grpcServer, protectedServer) + pb.RegisterIAMProvisioningServiceServer(protectedServer.grpcServer, protectedServer) + pb.RegisterIAMNodesServiceServer(protectedServer.grpcServer, protectedServer) go func() { if err := protectedServer.grpcServer.Serve(protectedListener); err != nil { @@ -422,6 +738,54 @@ func (server *testProtectedServer) ApplyCert( return rsp, nil } +func (server *testProtectedServer) GetCertTypes( + context context.Context, req *pb.GetCertTypesRequest, +) (rsp *pb.CertTypes, err error) { + rsp = &pb.CertTypes{Types: []string{"online", "offline"}} + + return rsp, nil +} + +func (server *testProtectedServer) StartProvisioning( + context context.Context, req *pb.StartProvisioningRequest, +) (rsp *pb.StartProvisioningResponse, err error) { + rsp = &pb.StartProvisioningResponse{} + + return rsp, nil +} + +func (server *testProtectedServer) FinishProvisioning( + context context.Context, req *pb.FinishProvisioningRequest, +) (rsp *pb.FinishProvisioningResponse, err error) { + rsp = &pb.FinishProvisioningResponse{} + + return rsp, nil +} + +func (server *testProtectedServer) Deprovision( + context context.Context, req *pb.DeprovisionRequest, +) (rsp *pb.DeprovisionResponse, err error) { + rsp = &pb.DeprovisionResponse{} + + return rsp, nil +} + +func (server *testProtectedServer) PauseNode( + context context.Context, req *pb.PauseNodeRequest, +) (rsp *pb.PauseNodeResponse, err error) { + rsp = &pb.PauseNodeResponse{} + + return rsp, nil +} + +func (server *testProtectedServer) ResumeNode( + context context.Context, req *pb.ResumeNodeRequest, +) (rsp *pb.ResumeNodeResponse, err error) { + rsp = &pb.ResumeNodeResponse{} + + return rsp, nil +} + func (server *testPublicServer) GetCert( context context.Context, req *pb.GetCertRequest, ) (rsp *pb.GetCertResponse, err error) { @@ -447,32 +811,42 @@ func (server *testPublicServer) GetCertTypes(context context.Context, req *empty return rsp, nil } -func (server *testProtectedServer) FinishProvisioning( +func (server *testPublicServer) GetSystemInfo( context context.Context, req *empty.Empty, -) (rsp *empty.Empty, err error) { +) (rsp *pb.SystemInfo, err error) { + rsp = &pb.SystemInfo{SystemId: server.systemID} + return rsp, nil } -func (server *testProtectedServer) Clear(context context.Context, req *pb.ClearRequest) (rsp *empty.Empty, err error) { - return rsp, nil +func (server *testPublicServer) GetNodeInfo(context context.Context, req *empty.Empty) (*pb.NodeInfo, error) { + return &pb.NodeInfo{}, nil } -func (server *testProtectedServer) SetOwner( - context context.Context, req *pb.SetOwnerRequest, -) (rsp *empty.Empty, err error) { - return rsp, nil +func (server *testIAMPublicNodesServiceServer) GetAllNodeIDs(context context.Context, req *emptypb.Empty) ( + *pb.NodesID, error, +) { + return &pb.NodesID{}, nil } -func (server *testPublicServer) GetSystemInfo( - context context.Context, req *empty.Empty, -) (rsp *pb.SystemInfo, err error) { - rsp = &pb.SystemInfo{SystemId: server.systemID} +func (server *testIAMPublicNodesServiceServer) GetNodeInfo(context context.Context, req *pb.GetNodeInfoRequest) ( + *pb.NodeInfo, error, +) { + return &pb.NodeInfo{NodeId: server.currentID, Name: server.currentNodeName}, nil +} - return rsp, nil +func (server *testIAMPublicNodesServiceServer) SubscribeNodeChanged( + empty *emptypb.Empty, stream pb.IAMPublicNodesService_SubscribeNodeChangedServer, +) error { + log.Error("testIAMPublicNodesServiceServer SubscribeNodeChanged") + + nodeInfo := <-server.nodeInfo + + return aoserrors.Wrap(stream.Send(nodeInfo)) } -func (server *testPublicServer) GetNodeInfo(context context.Context, req *empty.Empty) (*pb.NodeInfo, error) { - return &pb.NodeInfo{}, nil +func (server *testIAMPublicNodesServiceServer) RegisterNode(pb.IAMPublicNodesService_RegisterNodeServer) error { + return nil } func (sender *testSender) SendIssueUnitCerts(requests []cloudprotocol.IssueCertData) (err error) { @@ -497,6 +871,30 @@ func (sender *testSender) SendInstallCertsConfirmation(confirmations []cloudprot return nil } +func (sender *testSender) SendStartProvisioningResponse( + response cloudprotocol.StartProvisioningResponse, +) (err error) { + sender.startProvisioningResponse = &response + + return nil +} + +func (sender *testSender) SendFinishProvisioningResponse( + response cloudprotocol.FinishProvisioningResponse, +) (err error) { + sender.finishProvisioningResponse = &response + + return nil +} + +func (sender *testSender) SendDeprovisioningResponse( + response cloudprotocol.DeprovisioningResponse, +) (err error) { + sender.deprovisioningResponse = &response + + return nil +} + func (provider *testCertProvider) GetCertSerial(certURLStr string) (serial string, err error) { certURL, err := url.Parse(certURLStr) if err != nil { diff --git a/imagemanager/imagemanager.go b/imagemanager/imagemanager.go index 3c531ed4..dbc4bd8f 100644 --- a/imagemanager/imagemanager.go +++ b/imagemanager/imagemanager.go @@ -40,6 +40,7 @@ import ( "github.com/aosedge/aos_communicationmanager/fileserver" "github.com/aosedge/aos_communicationmanager/unitstatushandler" "github.com/aosedge/aos_communicationmanager/utils/uidgidpool" + semver "github.com/hashicorp/go-version" ) /*********************************************************************************************************************** @@ -71,7 +72,7 @@ type Storage interface { AddService(service ServiceInfo) error SetLayerCached(digest string, cached bool) error SetServiceCached(serviceID string, cached bool) error - RemoveService(serviceID string, aosVersion uint64) error + RemoveService(serviceID string, version string) error RemoveLayer(digest string) error } @@ -244,9 +245,9 @@ func (imagemanager *Imagemanager) GetServicesStatus() ([]unitstatushandler.Servi for i, service := range servicesInfo { servicesStatus[i] = unitstatushandler.ServiceStatus{ ServiceStatus: cloudprotocol.ServiceStatus{ - ID: service.ID, - AosVersion: service.AosVersion, - Status: cloudprotocol.InstalledStatus, + ServiceID: service.ServiceID, + Version: service.Version, + Status: cloudprotocol.InstalledStatus, }, Cached: service.Cached, } } @@ -268,10 +269,10 @@ func (imagemanager *Imagemanager) GetLayersStatus() ([]unitstatushandler.LayerSt for i, layer := range layersInfo { layersStatus[i] = unitstatushandler.LayerStatus{ LayerStatus: cloudprotocol.LayerStatus{ - ID: layer.ID, - AosVersion: layer.AosVersion, - Digest: layer.Digest, - Status: cloudprotocol.InstalledStatus, + LayerID: layer.LayerID, + Version: layer.Version, + Digest: layer.Digest, + Status: cloudprotocol.InstalledStatus, }, Cached: layer.Cached, } } @@ -287,9 +288,9 @@ func (imagemanager *Imagemanager) GetRemoveServiceChannel() (channel <-chan stri func (imagemanager *Imagemanager) InstallService(serviceInfo cloudprotocol.ServiceInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate, ) error { - log.WithFields(log.Fields{"id": serviceInfo.ID}).Debug("Install service") + log.WithFields(log.Fields{"id": serviceInfo.ServiceID}).Debug("Install service") - serviceFromStorage, err := imagemanager.storage.GetServiceInfo(serviceInfo.ID) + serviceFromStorage, err := imagemanager.storage.GetServiceInfo(serviceInfo.ServiceID) if err != nil && !errors.Is(err, ErrNotExist) { return aoserrors.Wrap(err) } @@ -299,7 +300,17 @@ func (imagemanager *Imagemanager) InstallService(serviceInfo cloudprotocol.Servi if err == nil { isServiceExist = true - if serviceInfo.AosVersion <= serviceFromStorage.AosVersion { + version, err := semver.NewSemver(serviceInfo.Version) + if err != nil { + return aoserrors.Wrap(err) + } + + versionInStorage, err := semver.NewSemver(serviceFromStorage.Version) + if err != nil { + return aoserrors.Wrap(err) + } + + if version.LessThanOrEqual(versionInStorage) { return ErrVersionMismatch } } @@ -316,9 +327,9 @@ func (imagemanager *Imagemanager) InstallService(serviceInfo cloudprotocol.Servi releaseAllocatedSpace(decryptedFile, space) log.WithFields(log.Fields{ - "id": serviceInfo.ID, - "aosVersion": serviceInfo.AosVersion, - "imagePath": decryptedFile, + "id": serviceInfo.ServiceID, + "version": serviceInfo.Version, + "imagePath": decryptedFile, }).Errorf("Can't install service: %v", err) return @@ -385,14 +396,13 @@ func (imagemanager *Imagemanager) addService( if err = imagemanager.storage.AddService(ServiceInfo{ ServiceInfo: aostypes.ServiceInfo{ - VersionInfo: serviceInfo.VersionInfo, - ID: serviceInfo.ID, - ProviderID: serviceInfo.ProviderID, - URL: createLocalURL(decryptedFile), - Size: fileInfo.Size, - GID: uint32(gid), - Sha256: fileInfo.Sha256, - Sha512: fileInfo.Sha512, + Version: serviceInfo.Version, + ServiceID: serviceInfo.ServiceID, + ProviderID: serviceInfo.ProviderID, + URL: createLocalURL(decryptedFile), + Size: fileInfo.Size, + GID: uint32(gid), + Sha256: fileInfo.Sha256, }, RemoteURL: remoteURL, Path: decryptedFile, @@ -456,8 +466,8 @@ func (imagemanager *Imagemanager) RemoveService(serviceID string) error { if err = imagemanager.setServiceCached(ServiceInfo{ ServiceInfo: aostypes.ServiceInfo{ - ID: serviceID, - Size: serviceSize, + ServiceID: serviceID, + Size: serviceSize, }, Timestamp: services[len(services)-1].Timestamp, }, true); err != nil { @@ -471,7 +481,7 @@ func (imagemanager *Imagemanager) RemoveService(serviceID string) error { func (imagemanager *Imagemanager) InstallLayer(layerInfo cloudprotocol.LayerInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate, ) error { - log.WithFields(log.Fields{"id": layerInfo.ID, "digest": layerInfo.Digest}).Debug("Install layer") + log.WithFields(log.Fields{"id": layerInfo.LayerID, "digest": layerInfo.Digest}).Debug("Install layer") if layerInfo, err := imagemanager.storage.GetLayerInfo(layerInfo.Digest); err == nil { if layerInfo.Cached { @@ -497,9 +507,9 @@ func (imagemanager *Imagemanager) InstallLayer(layerInfo cloudprotocol.LayerInfo releaseAllocatedSpace(decryptedFile, space) log.WithFields(log.Fields{ - "id": layerInfo.ID, - "aosVersion": layerInfo.AosVersion, - "imagePath": decryptedFile, + "id": layerInfo.LayerID, + "version": layerInfo.Version, + "imagePath": decryptedFile, }).Errorf("Can't install layer: %v", err) return @@ -537,13 +547,12 @@ func (imagemanager *Imagemanager) InstallLayer(layerInfo cloudprotocol.LayerInfo if err := imagemanager.storage.AddLayer(LayerInfo{ LayerInfo: aostypes.LayerInfo{ - VersionInfo: layerInfo.VersionInfo, - ID: layerInfo.ID, - Digest: layerInfo.Digest, - URL: createLocalURL(decryptedFile), - Sha256: fileInfo.Sha256, - Sha512: fileInfo.Sha512, - Size: fileInfo.Size, + Version: layerInfo.Version, + LayerID: layerInfo.LayerID, + Digest: layerInfo.Digest, + URL: createLocalURL(decryptedFile), + Sha256: fileInfo.Sha256, + Size: fileInfo.Size, }, Path: decryptedFile, RemoteURL: remoteURL, @@ -644,20 +653,20 @@ func (imagemanager *Imagemanager) RevertService(serviceID string) error { **********************************************************************************************************************/ func (imagemanager *Imagemanager) setServiceCached(service ServiceInfo, cached bool) error { - if err := imagemanager.storage.SetServiceCached(service.ID, cached); err != nil { + if err := imagemanager.storage.SetServiceCached(service.ServiceID, cached); err != nil { return aoserrors.Wrap(err) } if cached { if err := imagemanager.serviceAllocator.AddOutdatedItem( - service.ID, service.Size, service.Timestamp); err != nil { + service.ServiceID, service.Size, service.Timestamp); err != nil { return aoserrors.Wrap(err) } return nil } - imagemanager.serviceAllocator.RestoreOutdatedItem(service.ID) + imagemanager.serviceAllocator.RestoreOutdatedItem(service.ServiceID) return nil } @@ -682,17 +691,17 @@ func (imagemanager *Imagemanager) setLayerCached(layer LayerInfo, cached bool) e } func (imagemanager *Imagemanager) removeObsoleteServiceVersions(service ServiceInfo) error { - services, err := imagemanager.storage.GetServiceVersions(service.ID) + services, err := imagemanager.storage.GetServiceVersions(service.ServiceID) if err != nil && !errors.Is(err, ErrNotExist) { return aoserrors.Wrap(err) } for _, storageService := range services { - if service.AosVersion != storageService.AosVersion { + if service.Version != storageService.Version { if removeErr := imagemanager.removeService(storageService); removeErr != nil { log.WithFields(log.Fields{ - "serviceID": storageService.ID, - "AosVersion": storageService.AosVersion, + "serviceID": storageService.ServiceID, + "version": storageService.Version, }).Errorf("Can't remove service: %v", removeErr) if err == nil { @@ -704,7 +713,7 @@ func (imagemanager *Imagemanager) removeObsoleteServiceVersions(service ServiceI if service.Cached { if cacheErr := imagemanager.setServiceCached(service, false); cacheErr != nil { - log.WithField("serviceID", service.ID).Errorf("Can't cached service: %v", cacheErr) + log.WithField("serviceID", service.ServiceID).Errorf("Can't cached service: %v", cacheErr) if err == nil { err = cacheErr @@ -790,7 +799,7 @@ func (imagemanager *Imagemanager) clearServiceResource(service ServiceInfo) erro } if service.Cached { - imagemanager.serviceAllocator.RestoreOutdatedItem(service.ID) + imagemanager.serviceAllocator.RestoreOutdatedItem(service.ServiceID) } imagemanager.serviceAllocator.FreeSpace(service.Size) @@ -817,11 +826,11 @@ func (imagemanager *Imagemanager) removeService(service ServiceInfo) error { return err } - if err := imagemanager.storage.RemoveService(service.ID, service.AosVersion); err != nil { + if err := imagemanager.storage.RemoveService(service.ServiceID, service.Version); err != nil { return aoserrors.Wrap(err) } - log.WithFields(log.Fields{"serviceID": service.ID}).Info("Service successfully removed") + log.WithFields(log.Fields{"serviceID": service.ServiceID}).Info("Service successfully removed") return nil } @@ -885,7 +894,7 @@ func (imagemanager *Imagemanager) removeOutdatedService(serviceID string) error err = errRem } - if errRem = imagemanager.storage.RemoveService(service.ID, service.AosVersion); errRem != nil && err == nil { + if errRem = imagemanager.storage.RemoveService(service.ServiceID, service.Version); errRem != nil && err == nil { err = errRem } } @@ -911,13 +920,13 @@ func (imagemanager *Imagemanager) setOutdatedServices() error { } if service.Cached { - size, err := imagemanager.getServiceSize(service.ID) + size, err := imagemanager.getServiceSize(service.ServiceID) if err != nil { return err } if err = imagemanager.serviceAllocator.AddOutdatedItem( - service.ID, size, service.Timestamp); err != nil { + service.ServiceID, size, service.Timestamp); err != nil { return aoserrors.Wrap(err) } } @@ -967,7 +976,7 @@ func (imagemanager *Imagemanager) removeOutdatedServices() error { if service.Cached && service.Timestamp.Add(time.Hour*24*time.Duration(imagemanager.serviceTTLDays)).Before(time.Now()) { if removeErr := imagemanager.removeService(service); removeErr != nil { - log.WithField("serviceID", service.ID).Errorf("Can't remove outdated service: %v", removeErr) + log.WithField("serviceID", service.ServiceID).Errorf("Can't remove outdated service: %v", removeErr) if err == nil { err = removeErr diff --git a/imagemanager/imagemanager_test.go b/imagemanager/imagemanager_test.go index 2c29c7eb..432234d7 100644 --- a/imagemanager/imagemanager_test.go +++ b/imagemanager/imagemanager_test.go @@ -161,7 +161,7 @@ func TestInstallService(t *testing.T) { cases := []struct { serviceID string - aosVersion uint64 + version string size uint64 expectedCountService int installErr error @@ -169,7 +169,7 @@ func TestInstallService(t *testing.T) { }{ { serviceID: "service1", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, expectedCountService: 1, installErr: nil, @@ -184,7 +184,7 @@ func TestInstallService(t *testing.T) { }, { serviceID: "service2", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, expectedCountService: 2, installErr: nil, @@ -199,7 +199,7 @@ func TestInstallService(t *testing.T) { }, { serviceID: "service3", - aosVersion: 1, + version: "1.0", size: 2 * megabyte, expectedCountService: 2, installErr: spaceallocator.ErrNoSpace, @@ -230,7 +230,7 @@ func TestInstallService(t *testing.T) { t.Errorf("Can't prepare service file: %v", err) } - serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.aosVersion) + serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.version) if err != nil { t.Errorf("Can't prepare service info: %v", err) } @@ -245,7 +245,7 @@ func TestInstallService(t *testing.T) { t.Errorf("Can't get service: %v", err) } - if service.ID != tCase.serviceID || service.AosVersion != tCase.aosVersion { + if service.ServiceID != tCase.serviceID || service.Version != tCase.version { t.Error("Unexpected service info") } @@ -295,14 +295,14 @@ func TestRevertService(t *testing.T) { cases := []struct { serviceID string - aosVersion uint64 + version string size uint64 serviceConfig aostypes.ServiceConfig }{ { - serviceID: "service1", - aosVersion: 1, - size: 1 * megabyte, + serviceID: "service1", + version: "1.0", + size: 1 * megabyte, serviceConfig: aostypes.ServiceConfig{ Hostname: allocateString("service1"), Quotas: aostypes.ServiceQuotas{ @@ -313,9 +313,9 @@ func TestRevertService(t *testing.T) { }, }, { - serviceID: "service1", - aosVersion: 2, - size: 1 * megabyte, + serviceID: "service1", + version: "2.0", + size: 1 * megabyte, serviceConfig: aostypes.ServiceConfig{ Hostname: allocateString("service1"), Quotas: aostypes.ServiceQuotas{ @@ -338,7 +338,7 @@ func TestRevertService(t *testing.T) { t.Errorf("Can't prepare service file: %v", err) } - serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.aosVersion) + serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.version) if err != nil { t.Errorf("Can't prepare service info: %v", err) } @@ -349,14 +349,14 @@ func TestRevertService(t *testing.T) { } casesRevert := []struct { - revertServiceID string - expectedAosVersion uint64 - err error + revertServiceID string + expectedVersion string + err error }{ { - revertServiceID: "service1", - expectedAosVersion: 1, - err: nil, + revertServiceID: "service1", + expectedVersion: "1.0", + err: nil, }, { revertServiceID: "service1", @@ -374,7 +374,7 @@ func TestRevertService(t *testing.T) { t.Errorf("Can't get service: %v", err) } - if service.AosVersion != tCase.expectedAosVersion { + if service.Version != tCase.expectedVersion { t.Error("Unexpected service version") } } @@ -410,7 +410,7 @@ func TestRemoveService(t *testing.T) { cases := []struct { serviceID string removeServiceID string - aosVersion uint64 + version string size uint64 expectedCountService int installErr error @@ -418,7 +418,7 @@ func TestRemoveService(t *testing.T) { }{ { serviceID: "service1", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, expectedCountService: 1, installErr: nil, @@ -434,7 +434,7 @@ func TestRemoveService(t *testing.T) { { serviceID: "service2", removeServiceID: "service1", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, expectedCountService: 1, installErr: spaceallocator.ErrNoSpace, @@ -460,7 +460,7 @@ func TestRemoveService(t *testing.T) { t.Errorf("Can't prepare service file: %v", err) } - serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.aosVersion) + serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.version) if err != nil { t.Errorf("Can't prepare service info: %v", err) } @@ -543,14 +543,14 @@ func TestRestoreService(t *testing.T) { cases := []struct { serviceID string removeServiceID string - aosVersion uint64 + version string size uint64 installErr error serviceConfig aostypes.ServiceConfig }{ { serviceID: "service1", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, installErr: nil, serviceConfig: aostypes.ServiceConfig{ @@ -565,7 +565,7 @@ func TestRestoreService(t *testing.T) { { serviceID: "service2", removeServiceID: "service1", - aosVersion: 1, + version: "1.0", size: 1 * megabyte, installErr: spaceallocator.ErrNoSpace, serviceConfig: aostypes.ServiceConfig{ @@ -590,7 +590,7 @@ func TestRestoreService(t *testing.T) { t.Errorf("Can't prepare service file: %v", err) } - serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.aosVersion) + serviceInfo, err := prepareServiceInfo(servicePath, tCase.serviceID, tCase.version) if err != nil { t.Errorf("Can't prepare service info: %v", err) } @@ -989,9 +989,8 @@ func TestFileServer(t *testing.T) { decryptFilePath := path.Join("layers", base64.URLEncoding.EncodeToString(layerInfo.Sha256)+".dec") - if layer.RemoteURL != fmt.Sprintf("http://localhost:8092/%s", decryptFilePath) || - layer.URL != fmt.Sprintf("file://%s", - path.Join(layersDir, base64.URLEncoding.EncodeToString(layerInfo.Sha256)+".dec")) { + if layer.RemoteURL != "http://localhost:8092/"+decryptFilePath || + layer.URL != "file://"+path.Join(layersDir, base64.URLEncoding.EncodeToString(layerInfo.Sha256)+".dec") { t.Fatalf("Unexpected urls") } @@ -1185,11 +1184,11 @@ func (storage *testStorageProvider) AddLayer(layer imagemanager.LayerInfo) error } func (storage *testStorageProvider) AddService(service imagemanager.ServiceInfo) error { - services := storage.services[service.ID] + services := storage.services[service.ServiceID] services = append(services, service) - storage.services[service.ID] = services + storage.services[service.ServiceID] = services return nil } @@ -1219,7 +1218,7 @@ func (storage *testStorageProvider) SetServiceCached(serviceID string, cached bo return nil } -func (storage *testStorageProvider) RemoveService(serviceID string, aosVersion uint64) error { +func (storage *testStorageProvider) RemoveService(serviceID string, version string) error { services, ok := storage.services[serviceID] if !ok { return nil @@ -1232,7 +1231,7 @@ func (storage *testStorageProvider) RemoveService(serviceID string, aosVersion u } for i := 0; i < len(services); i++ { - if services[i].AosVersion == aosVersion { + if services[i].Version == version { services = append(services[:i], services[i+1:]...) } } @@ -1276,24 +1275,20 @@ func prepareLayerInfo(filePath, digest string, index int) (layerInfo cloudprotoc } installRequest := cloudprotocol.LayerInfo{ - VersionInfo: aostypes.VersionInfo{ - AosVersion: uint64(index), Description: "description" + strconv.Itoa(index), - }, - ID: "testLayer" + strconv.Itoa(index), - Digest: digest, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{ + Version: "v" + strconv.Itoa(index), + LayerID: "testLayer" + strconv.Itoa(index), + Digest: digest, + DownloadInfo: cloudprotocol.DownloadInfo{ URLs: []string{url.String()}, Sha256: imageFileInfo.Sha256, - Sha512: imageFileInfo.Sha512, Size: imageFileInfo.Size, - DecryptionInfo: &cloudprotocol.DecryptionInfo{ - BlockAlg: "AES256/CBC/pkcs7", - BlockIv: []byte{}, - BlockKey: []byte{}, - AsymAlg: "RSA/PKCS1v1_5", - ReceiverInfo: &recInfo, - }, - Signs: &cloudprotocol.Signs{}, + }, + DecryptionInfo: cloudprotocol.DecryptionInfo{ + BlockAlg: "AES256/CBC/pkcs7", + BlockIv: []byte{}, + BlockKey: []byte{}, + AsymAlg: "RSA/PKCS1v1_5", + ReceiverInfo: &recInfo, }, } @@ -1301,7 +1296,7 @@ func prepareLayerInfo(filePath, digest string, index int) (layerInfo cloudprotoc } func prepareServiceInfo( - filePath, serviceID string, aosVersion uint64, + filePath, serviceID string, version string, ) (layerInfo cloudprotocol.ServiceInfo, err error) { imageFileInfo, err := image.CreateFileInfo(context.Background(), filePath) if err != nil { @@ -1322,24 +1317,20 @@ func prepareServiceInfo( } installRequest := cloudprotocol.ServiceInfo{ - VersionInfo: aostypes.VersionInfo{ - AosVersion: aosVersion, Description: "description", - }, - ID: serviceID, + Version: version, + ServiceID: serviceID, ProviderID: serviceID, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{ + DownloadInfo: cloudprotocol.DownloadInfo{ URLs: []string{url.String()}, Sha256: imageFileInfo.Sha256, - Sha512: imageFileInfo.Sha512, Size: imageFileInfo.Size, - DecryptionInfo: &cloudprotocol.DecryptionInfo{ - BlockAlg: "AES256/CBC/pkcs7", - BlockIv: []byte{}, - BlockKey: []byte{}, - AsymAlg: "RSA/PKCS1v1_5", - ReceiverInfo: &recInfo, - }, - Signs: &cloudprotocol.Signs{}, + }, + DecryptionInfo: cloudprotocol.DecryptionInfo{ + BlockAlg: "AES256/CBC/pkcs7", + BlockIv: []byte{}, + BlockKey: []byte{}, + AsymAlg: "RSA/PKCS1v1_5", + ReceiverInfo: &recInfo, }, } diff --git a/launcher/instancemanager.go b/launcher/instancemanager.go index 9b5e6be1..8315aeb2 100644 --- a/launcher/instancemanager.go +++ b/launcher/instancemanager.go @@ -24,9 +24,14 @@ import ( "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" + "github.com/aosedge/aos_common/api/cloudprotocol" log "github.com/sirupsen/logrus" + "golang.org/x/exp/maps" + "golang.org/x/exp/slices" "github.com/aosedge/aos_communicationmanager/config" + "github.com/aosedge/aos_communicationmanager/imagemanager" + "github.com/aosedge/aos_communicationmanager/storagestate" "github.com/aosedge/aos_communicationmanager/utils/uidgidpool" ) @@ -40,26 +45,50 @@ const removePeriod = time.Hour * 24 * Types **********************************************************************************************************************/ +type InstanceInfo struct { + aostypes.InstanceIdent + NodeID string + PrevNodeID string + UID int + Timestamp time.Time + Cached bool +} + +// Storage storage interface. +type Storage interface { + AddInstance(instanceInfo InstanceInfo) error + UpdateInstance(instanceInfo InstanceInfo) error + RemoveInstance(instanceIdent aostypes.InstanceIdent) error + GetInstance(instanceIdent aostypes.InstanceIdent) (InstanceInfo, error) + GetInstances() ([]InstanceInfo, error) +} + type instanceManager struct { - config *config.Config - storage Storage - storageStateProvider StorageStateProvider - cancelFunc context.CancelFunc - uidPool *uidgidpool.IdentifierPool - removeServiceChannel <-chan string + config *config.Config + imageProvider ImageProvider + storageStateProvider StorageStateProvider + storage Storage + cancelFunc context.CancelFunc + uidPool *uidgidpool.IdentifierPool + errorStatus map[aostypes.InstanceIdent]cloudprotocol.InstanceStatus + instances map[aostypes.InstanceIdent]aostypes.InstanceInfo + removeServiceChannel <-chan string + curInstances []InstanceInfo + availableStorage, availableState uint64 } /*********************************************************************************************************************** * Private **********************************************************************************************************************/ -func newInstanceManager(config *config.Config, storage Storage, storageStateProvider StorageStateProvider, - removeServiceChannel <-chan string, +func newInstanceManager(config *config.Config, imageProvider ImageProvider, storageStateProvider StorageStateProvider, + storage Storage, removeServiceChannel <-chan string, ) (im *instanceManager, err error) { im = &instanceManager{ config: config, - storage: storage, + imageProvider: imageProvider, storageStateProvider: storageStateProvider, + storage: storage, removeServiceChannel: removeServiceChannel, uidPool: uidgidpool.NewUserIDPool(), } @@ -91,6 +120,220 @@ func newInstanceManager(config *config.Config, storage Storage, storageStateProv return im, nil } +func (im *instanceManager) initInstances() { + im.instances = make(map[aostypes.InstanceIdent]aostypes.InstanceInfo) + im.errorStatus = make(map[aostypes.InstanceIdent]cloudprotocol.InstanceStatus) + + var err error + + instances, err := im.storage.GetInstances() + if err != nil { + log.Errorf("Can't get current instances: %v", err) + } + + im.curInstances = make([]InstanceInfo, 0, len(instances)) + + for _, instance := range instances { + if instance.Cached { + continue + } + + im.curInstances = append(im.curInstances, instance) + } +} + +func (im *instanceManager) getCurrentInstances() []InstanceInfo { + return im.curInstances +} + +func (im *instanceManager) getCurrentInstance(instanceIdent aostypes.InstanceIdent) (InstanceInfo, error) { + curIndex := slices.IndexFunc(im.curInstances, func(curInstance InstanceInfo) bool { + return curInstance.InstanceIdent == instanceIdent + }) + + if curIndex == -1 { + return InstanceInfo{}, aoserrors.Wrap(ErrNotExist) + } + + return im.curInstances[curIndex], nil +} + +func (im *instanceManager) resetStorageStateUsage(storageSize, stateSize uint64) { + im.availableStorage, im.availableState = storageSize, stateSize +} + +func (im *instanceManager) setupInstance( + instance cloudprotocol.InstanceInfo, index uint64, node *nodeHandler, service imagemanager.ServiceInfo, + rebalancing bool, +) (aostypes.InstanceInfo, error) { + instanceInfo := aostypes.InstanceInfo{ + InstanceIdent: aostypes.InstanceIdent{ + ServiceID: instance.ServiceID, SubjectID: instance.SubjectID, Instance: index, + }, + Priority: instance.Priority, + } + + if _, ok := im.instances[instanceInfo.InstanceIdent]; ok { + return aostypes.InstanceInfo{}, aoserrors.Errorf("instance already set up") + } + + storedInstance, err := im.storage.GetInstance(instanceInfo.InstanceIdent) + if err != nil { + if !errors.Is(err, ErrNotExist) { + return aostypes.InstanceInfo{}, aoserrors.Wrap(err) + } + + uid, err := im.acquireUID() + if err != nil { + return aostypes.InstanceInfo{}, err + } + + storedInstance = InstanceInfo{ + InstanceIdent: instanceInfo.InstanceIdent, + NodeID: node.nodeInfo.NodeID, + UID: uid, + Timestamp: time.Now(), + } + + if err := im.storage.AddInstance(storedInstance); err != nil { + log.Errorf("Can't add instance: %v", err) + } + } else { + if rebalancing { + storedInstance.PrevNodeID = storedInstance.NodeID + } else { + storedInstance.PrevNodeID = "" + } + + storedInstance.NodeID = node.nodeInfo.NodeID + storedInstance.Timestamp = time.Now() + storedInstance.Cached = false + + err = im.storage.UpdateInstance(storedInstance) + if err != nil { + log.Errorf("Can't update instance: %v", err) + } + } + + instanceInfo.UID = uint32(storedInstance.UID) + + if err = im.setupInstanceStateStorage(&instanceInfo, service, + getStorageRequestRatio(service.Config.ResourceRatios, node.nodeConfig.ResourceRatios)); err != nil { + return aostypes.InstanceInfo{}, err + } + + im.instances[instanceInfo.InstanceIdent] = instanceInfo + + return instanceInfo, nil +} + +func createInstanceIdent(instance cloudprotocol.InstanceInfo, instanceIndex uint64) aostypes.InstanceIdent { + return aostypes.InstanceIdent{ + ServiceID: instance.ServiceID, SubjectID: instance.SubjectID, Instance: instanceIndex, + } +} + +func (im *instanceManager) setInstanceError( + instanceIdent aostypes.InstanceIdent, serviceVersion string, err error, +) { + instanceStatus := cloudprotocol.InstanceStatus{ + InstanceIdent: instanceIdent, + ServiceVersion: serviceVersion, + Status: cloudprotocol.InstanceStateFailed, + } + + if err != nil { + log.WithFields(instanceIdentLogFields(instanceStatus.InstanceIdent, nil)).Errorf( + "Schedule instance error: %v", err) + + instanceStatus.ErrorInfo = &cloudprotocol.ErrorInfo{Message: err.Error()} + } + + im.errorStatus[instanceStatus.InstanceIdent] = instanceStatus +} + +func (im *instanceManager) setAllInstanceError( + instance cloudprotocol.InstanceInfo, serviceVersion string, err error, +) { + for i := uint64(0); i < instance.NumInstances; i++ { + im.setInstanceError(createInstanceIdent(instance, i), serviceVersion, err) + } +} + +func (im *instanceManager) isInstanceScheduled(instanceIdent aostypes.InstanceIdent) bool { + if _, ok := im.instances[instanceIdent]; ok { + return true + } + + if _, ok := im.errorStatus[instanceIdent]; ok { + return true + } + + return false +} + +func (im *instanceManager) getInstanceCheckSum(instance aostypes.InstanceIdent) string { + return im.storageStateProvider.GetInstanceCheckSum(instance) +} + +func (im *instanceManager) setupInstanceStateStorage( + instanceInfo *aostypes.InstanceInfo, serviceInfo imagemanager.ServiceInfo, + requestRation float64, +) error { + stateStorageParams := storagestate.SetupParams{ + InstanceIdent: instanceInfo.InstanceIdent, + UID: int(instanceInfo.UID), GID: int(serviceInfo.GID), + } + + if serviceInfo.Config.Quotas.StateLimit != nil { + stateStorageParams.StateQuota = *serviceInfo.Config.Quotas.StateLimit + } + + if serviceInfo.Config.Quotas.StorageLimit != nil { + stateStorageParams.StorageQuota = *serviceInfo.Config.Quotas.StorageLimit + } + + requestedStorage := uint64(float64(stateStorageParams.StorageQuota)*requestRation + 0.5) + requestedState := uint64(float64(stateStorageParams.StateQuota)*requestRation + 0.5) + + if requestedStorage > im.availableStorage { + return aoserrors.Errorf("not enough storage space") + } + + if requestedState > im.availableState { + return aoserrors.Errorf("not enough state space") + } + + var err error + + instanceInfo.StoragePath, instanceInfo.StatePath, err = im.storageStateProvider.Setup(stateStorageParams) + if err != nil { + return aoserrors.Wrap(err) + } + + im.availableStorage -= requestedStorage + im.availableState -= requestedState + + return nil +} + +func (im *instanceManager) cacheInstance(instanceInfo InstanceInfo) error { + log.WithFields(instanceIdentLogFields(instanceInfo.InstanceIdent, nil)).Debug("Cache instance") + + instanceInfo.Cached = true + instanceInfo.NodeID = "" + + if err := im.storage.UpdateInstance(instanceInfo); err != nil { + log.Errorf("Can't update instance: %v", err) + } + + if err := im.storageStateProvider.Cleanup(instanceInfo.InstanceIdent); err != nil { + return aoserrors.Wrap(err) + } + + return nil +} + func (im *instanceManager) acquireUID() (int, error) { uid, err := im.uidPool.GetFreeID() if err != nil { @@ -177,7 +420,7 @@ func (im *instanceManager) clearInstancesWithDeletedService() error { } for _, instance := range instances { - if _, err := im.storage.GetServiceInfo(instance.ServiceID); err == nil { + if _, err := im.imageProvider.GetServiceInfo(instance.ServiceID); err == nil { continue } @@ -189,6 +432,10 @@ func (im *instanceManager) clearInstancesWithDeletedService() error { return nil } +func (im *instanceManager) getErrorInstanceStatuses() []cloudprotocol.InstanceStatus { + return maps.Values(im.errorStatus) +} + func (im *instanceManager) instanceRemover(ctx context.Context) { removeTicker := time.NewTicker(removePeriod) defer removeTicker.Stop() diff --git a/launcher/launcher.go b/launcher/launcher.go index 72bfad01..2662d18f 100644 --- a/launcher/launcher.go +++ b/launcher/launcher.go @@ -19,9 +19,7 @@ package launcher import ( "context" - "encoding/json" "errors" - "reflect" "sort" "sync" "time" @@ -30,13 +28,13 @@ import ( "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" log "github.com/sirupsen/logrus" + "golang.org/x/exp/maps" "golang.org/x/exp/slices" "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/imagemanager" "github.com/aosedge/aos_communicationmanager/networkmanager" "github.com/aosedge/aos_communicationmanager/storagestate" - "github.com/aosedge/aos_communicationmanager/unitstatushandler" ) /********************************************************************************************************************** @@ -45,10 +43,7 @@ import ( var ErrNotExist = errors.New("entry not exist") -const defaultRunner = "crun" - -//nolint:gochecknoglobals -var defaultRunnerFeatures = []string{"crun", "runc"} +const defaultResourceRation = 50.0 /*********************************************************************************************************************** * Types @@ -61,30 +56,19 @@ type NodeRunInstanceStatus struct { Instances []cloudprotocol.InstanceStatus } -// NodeConfiguration node static configuration. -type NodeInfo struct { - cloudprotocol.NodeInfo - RemoteNode bool - RunnerFeature []string -} - // Launcher service instances launcher. type Launcher struct { sync.Mutex - config *config.Config - storage Storage - nodeManager NodeManager - imageProvider ImageProvider - resourceManager ResourceManager - storageStateProvider StorageStateProvider - networkManager NetworkManager - runStatusChannel chan unitstatushandler.RunInstancesStatus - nodes []*nodeStatus - currentDesiredInstances []cloudprotocol.InstanceInfo - currentRunStatus []cloudprotocol.InstanceStatus - currentErrorStatus []cloudprotocol.InstanceStatus - pendingNewServices []string + config *config.Config + nodeInfoProvider NodeInfoProvider + nodeManager NodeManager + imageProvider ImageProvider + resourceManager ResourceManager + networkManager NetworkManager + + runStatusChannel chan []cloudprotocol.InstanceStatus + nodes map[string]*nodeHandler cancelFunc context.CancelFunc connectionTimer *time.Timer @@ -92,27 +76,6 @@ type Launcher struct { instanceManager *instanceManager } -type InstanceInfo struct { - aostypes.InstanceIdent - UID int - Timestamp time.Time - Cached bool -} - -// Storage storage interface. -type Storage interface { - AddInstance(instanceInfo InstanceInfo) error - RemoveInstance(instanceIdent aostypes.InstanceIdent) error - SetInstanceCached(instance aostypes.InstanceIdent, cached bool) error - GetInstanceUID(instance aostypes.InstanceIdent) (int, error) - GetInstances() ([]InstanceInfo, error) - GetServiceInfo(serviceID string) (imagemanager.ServiceInfo, error) - GetDesiredInstances() (json.RawMessage, error) - SetDesiredInstances(instances json.RawMessage) error - SetNodeState(nodeID string, state json.RawMessage) error - GetNodeState(nodeID string) (json.RawMessage, error) -} - // NetworkManager network manager interface. type NetworkManager interface { PrepareInstanceNetworkParameters( @@ -128,25 +91,29 @@ type NetworkManager interface { type ImageProvider interface { GetServiceInfo(serviceID string) (imagemanager.ServiceInfo, error) GetLayerInfo(digest string) (imagemanager.LayerInfo, error) - RevertService(serviceID string) error GetRemoveServiceChannel() (channel <-chan string) } // NodeManager nodes controller. type NodeManager interface { - GetNodeConfiguration(nodeID string) (NodeInfo, error) RunInstances( nodeID string, services []aostypes.ServiceInfo, layers []aostypes.LayerInfo, instances []aostypes.InstanceInfo, forceRestart bool, ) error GetRunInstancesStatusChannel() <-chan NodeRunInstanceStatus - GetSystemLimitAlertChannel() <-chan cloudprotocol.SystemQuotaAlert - GetNodeMonitoringData(nodeID string) (data cloudprotocol.NodeMonitoringData, err error) + GetAverageMonitoring(nodeID string) (aostypes.NodeMonitoring, error) +} + +// NodeInfoProvider node information. +type NodeInfoProvider interface { + GetNodeID() string + GetNodeInfo(nodeID string) (cloudprotocol.NodeInfo, error) + GetAllNodeIDs() (nodeIDs []string, err error) } // ResourceManager provides node resources. type ResourceManager interface { - GetUnitConfiguration(nodeType string) aostypes.NodeUnitConfig + GetNodeConfig(nodeID, nodeType string) (cloudprotocol.NodeConfig, error) } // StorageStateProvider instances storage state provider. @@ -157,59 +124,31 @@ type StorageStateProvider interface { GetInstanceCheckSum(instance aostypes.InstanceIdent) string } -type nodeStatus struct { - NodeInfo - availableResources []string - availableLabels []string - availableDevices []nodeDevice - priority uint32 - receivedRunInstances []cloudprotocol.InstanceStatus - currentRunRequest *runRequestInfo - waitStatus bool -} - -type nodeDevice struct { - name string - sharedCount int - allocatedCount int -} - -type runRequestInfo struct { - Services []aostypes.ServiceInfo `json:"services"` - Layers []aostypes.LayerInfo `json:"layers"` - Instances []aostypes.InstanceInfo `json:"instances"` -} - /*********************************************************************************************************************** * Public **********************************************************************************************************************/ // New creates launcher instance. func New( - config *config.Config, storage Storage, nodeManager NodeManager, imageProvider ImageProvider, - resourceManager ResourceManager, storageStateProvider StorageStateProvider, networkManager NetworkManager, + config *config.Config, storage Storage, nodeInfoProvider NodeInfoProvider, nodeManager NodeManager, + imageProvider ImageProvider, resourceManager ResourceManager, storageStateProvider StorageStateProvider, + networkManager NetworkManager, ) (launcher *Launcher, err error) { log.Debug("Create launcher") launcher = &Launcher{ - config: config, storage: storage, nodeManager: nodeManager, imageProvider: imageProvider, - resourceManager: resourceManager, storageStateProvider: storageStateProvider, - networkManager: networkManager, - runStatusChannel: make(chan unitstatushandler.RunInstancesStatus, 10), - nodes: []*nodeStatus{}, + config: config, nodeInfoProvider: nodeInfoProvider, nodeManager: nodeManager, imageProvider: imageProvider, + resourceManager: resourceManager, networkManager: networkManager, + runStatusChannel: make(chan []cloudprotocol.InstanceStatus, 10), } - if launcher.instanceManager, err = newInstanceManager(config, storage, storageStateProvider, + if launcher.instanceManager, err = newInstanceManager(config, imageProvider, storageStateProvider, storage, launcher.imageProvider.GetRemoveServiceChannel()); err != nil { - return nil, aoserrors.Wrap(err) + return nil, err } - if rawDesiredInstances, err := launcher.storage.GetDesiredInstances(); err != nil { - log.Errorf("Can't get desired instances: %v", err) - } else { - if err = json.Unmarshal(rawDesiredInstances, &launcher.currentDesiredInstances); err != nil { - log.Debugf("Can't parse desire instances: %v", err) - } + if err := launcher.initNodes(false); err != nil { + return nil, err } ctx, cancelFunction := context.WithCancel(context.Background()) @@ -235,30 +174,41 @@ func (launcher *Launcher) Close() { } // RunInstances performs run service instances. -func (launcher *Launcher) RunInstances(instances []cloudprotocol.InstanceInfo, newServices []string) error { +func (launcher *Launcher) RunInstances(instances []cloudprotocol.InstanceInfo, rebalancing bool) error { launcher.Lock() defer launcher.Unlock() - log.Debug("Run instances") - - launcher.connectionTimer = time.AfterFunc( - launcher.config.SMController.NodesConnectionTimeout.Duration, launcher.sendCurrentStatus) + log.WithField("rebalancing", rebalancing).Debug("Run instances") - if rawDesiredInstances, err := json.Marshal(instances); err != nil { - log.Errorf("Can't marshall desired instances: %v", err) - } else { - if err := launcher.storage.SetDesiredInstances(rawDesiredInstances); err != nil { - log.Errorf("Can't store desired instances: %v", err) + sort.Slice(instances, func(i, j int) bool { + if instances[i].Priority == instances[j].Priority { + return instances[i].ServiceID < instances[j].ServiceID } + + return instances[i].Priority > instances[j].Priority + }) + + launcher.prepareBalancing(rebalancing) + + if err := launcher.processRemovedInstances(instances); err != nil { + log.Errorf("Can't process removed instances: %v", err) } if err := launcher.updateNetworks(instances); err != nil { log.Errorf("Can't update networks: %v", err) } - launcher.currentDesiredInstances = instances - launcher.pendingNewServices = newServices - launcher.currentErrorStatus = launcher.performNodeBalancing(instances) + if rebalancing { + launcher.performPolicyBalancing(instances) + } + + launcher.performNodeBalancing(instances, rebalancing) + + // first prepare network for instance which have exposed ports + launcher.prepareNetworkForInstances(true) + + // then prepare network for rest of instances + launcher.prepareNetworkForInstances(false) if err := launcher.networkManager.RestartDNSServer(); err != nil { log.Errorf("Can't restart DNS server: %v", err) @@ -267,55 +217,76 @@ func (launcher *Launcher) RunInstances(instances []cloudprotocol.InstanceInfo, n return launcher.sendRunInstances(false) } -// RestartInstances performs restart service instances. -func (launcher *Launcher) RestartInstances() error { - launcher.Lock() - defer launcher.Unlock() +// GetRunStatusesChannel gets channel with run status instances status. +func (launcher *Launcher) GetRunStatusesChannel() <-chan []cloudprotocol.InstanceStatus { + return launcher.runStatusChannel +} - launcher.connectionTimer = time.AfterFunc( - launcher.config.SMController.NodesConnectionTimeout.Duration, launcher.sendCurrentStatus) +/*********************************************************************************************************************** + * Private + **********************************************************************************************************************/ - for _, node := range launcher.nodes { - launcher.initNodeUnitConfiguration(node, node.NodeType) +func (launcher *Launcher) prepareBalancing(rebalancing bool) { + if err := launcher.initNodes(rebalancing); err != nil { + log.Errorf("Can't init nodes: %v", err) } - launcher.currentErrorStatus = launcher.performNodeBalancing(launcher.currentDesiredInstances) + launcher.instanceManager.initInstances() - return launcher.sendRunInstances(true) -} + localNode := launcher.getLocalNode() -// GetRunStatusesChannel gets channel with run status instances status. -func (launcher *Launcher) GetRunStatusesChannel() <-chan unitstatushandler.RunInstancesStatus { - return launcher.runStatusChannel + if localNode != nil { + launcher.instanceManager.resetStorageStateUsage( + localNode.getPartitionSize(aostypes.StoragesPartition), + localNode.getPartitionSize(aostypes.StatesPartition)) + } else { + log.Errorf("Local node not found") + } } -// GetNodesConfiguration gets nodes configuration. -func (launcher *Launcher) GetNodesConfiguration() []cloudprotocol.NodeInfo { - nodes := make([]cloudprotocol.NodeInfo, len(launcher.nodes)) +func (launcher *Launcher) initNodes(rebalancing bool) error { + launcher.nodes = make(map[string]*nodeHandler) + + nodes, err := launcher.nodeInfoProvider.GetAllNodeIDs() + if err != nil { + return aoserrors.Wrap(err) + } + + for _, nodeID := range nodes { + nodeInfo, err := launcher.nodeInfoProvider.GetNodeInfo(nodeID) + if err != nil { + log.WithField("nodeID", nodeID).Errorf("Can't get node info: %v", err) + + continue + } + + if nodeInfo.Status == cloudprotocol.NodeStatusUnprovisioned { + log.WithField("nodeID", nodeID).Debug("Skip not provisioned node") + + continue + } + + nodeHandler, err := newNodeHandler( + nodeInfo, launcher.nodeManager, launcher.resourceManager, + nodeInfo.NodeID == launcher.nodeInfoProvider.GetNodeID(), rebalancing) + if err != nil { + log.WithField("nodeID", nodeID).Errorf("Can't create node handler: %v", err) - i := 0 + continue + } - for _, v := range launcher.nodes { - nodes[i] = v.NodeInfo.NodeInfo - i++ + launcher.nodes[nodeID] = nodeHandler } - return nodes + return nil } -/*********************************************************************************************************************** - * Private - **********************************************************************************************************************/ - func (launcher *Launcher) processChannels(ctx context.Context) { for { select { case instances := <-launcher.nodeManager.GetRunInstancesStatusChannel(): launcher.processRunInstanceStatus(instances) - case alert := <-launcher.nodeManager.GetSystemLimitAlertChannel(): - launcher.performRebalancing(alert) - case <-ctx.Done(): return } @@ -323,17 +294,16 @@ func (launcher *Launcher) processChannels(ctx context.Context) { } func (launcher *Launcher) sendRunInstances(forceRestart bool) (err error) { - for _, node := range launcher.nodes { - node.waitStatus = true + launcher.connectionTimer = time.AfterFunc( + launcher.config.SMController.NodesConnectionTimeout.Duration, launcher.sendCurrentStatus) - if err := launcher.saveNodeRunRequest(node); err != nil { - log.WithFields(log.Fields{"nodeID": node.NodeID}).Errorf("Can't save node run request: %v", err) - } + for _, node := range launcher.getNodesByPriorities() { + node.waitStatus = true if runErr := launcher.nodeManager.RunInstances( - node.NodeID, node.currentRunRequest.Services, node.currentRunRequest.Layers, - node.currentRunRequest.Instances, forceRestart); runErr != nil { - log.WithField("nodeID", node.NodeID).Errorf("Can't run instances %v", runErr) + node.nodeInfo.NodeID, node.runRequest.Services, node.runRequest.Layers, + node.runRequest.Instances, forceRestart); runErr != nil { + log.WithField("nodeID", node.nodeInfo.NodeID).Errorf("Can't run instances: %v", runErr) if err == nil { err = runErr @@ -352,43 +322,14 @@ func (launcher *Launcher) processRunInstanceStatus(runStatus NodeRunInstanceStat currentStatus := launcher.getNode(runStatus.NodeID) if currentStatus == nil { - if !slices.Contains(launcher.config.SMController.NodeIDs, runStatus.NodeID) { - log.Errorf("Received status for unknown nodeID %s", runStatus.NodeID) - - return - } - - var err error - - currentStatus, err = launcher.initNodeStatus(runStatus.NodeID, runStatus.NodeType) - if err != nil { - log.Errorf("Can't init node: %v", err) - - return - } - - launcher.nodes = append(launcher.nodes, currentStatus) - - if len(launcher.nodes) == len(launcher.config.SMController.NodeIDs) { - log.Debug("All clients connected") - } - - slices.SortFunc(launcher.nodes, func(a, b *nodeStatus) bool { - if a.priority == b.priority { - return a.NodeID < b.NodeID - } + log.Errorf("Received status for unknown nodeID %s", runStatus.NodeID) - return a.priority > b.priority - }) + return } - currentStatus.receivedRunInstances = runStatus.Instances + currentStatus.runStatus = runStatus.Instances currentStatus.waitStatus = false - if len(launcher.nodes) != len(launcher.config.SMController.NodeIDs) { - return - } - for _, node := range launcher.nodes { if node.waitStatus { return @@ -402,447 +343,272 @@ func (launcher *Launcher) processRunInstanceStatus(runStatus NodeRunInstanceStat launcher.sendCurrentStatus() } -//nolint:funlen -func (launcher *Launcher) performRebalancing(alert cloudprotocol.SystemQuotaAlert) { - launcher.Lock() - defer launcher.Unlock() +func (launcher *Launcher) sendCurrentStatus() { + instancesStatus := make([]cloudprotocol.InstanceStatus, 0) - log.Debug("Perform rebalancing") + for _, node := range launcher.getNodesByPriorities() { + if node.waitStatus { + node.waitStatus = false - nodeWithIssue := launcher.getNode(alert.NodeID) - if nodeWithIssue == nil { - log.Errorf("Can't get node: %s", alert.NodeID) + for _, errInstance := range node.runRequest.Instances { + instancesStatus = append(instancesStatus, cloudprotocol.InstanceStatus{ + InstanceIdent: errInstance.InstanceIdent, + NodeID: node.nodeInfo.NodeID, Status: cloudprotocol.InstanceStateFailed, + ErrorInfo: &cloudprotocol.ErrorInfo{Message: "wait run status timeout"}, + }) + } - return - } + continue + } - if len(nodeWithIssue.currentRunRequest.Instances) <= 1 { - log.Warn("No instances for rebalancing") + instancesStatus = append(instancesStatus, node.runStatus...) + } - return + for i := range instancesStatus { + instancesStatus[i].StateChecksum = launcher.instanceManager.getInstanceCheckSum( + instancesStatus[i].InstanceIdent) } - nodes := launcher.getLowerPriorityNodes(nodeWithIssue) - if len(nodes) == 0 { - log.Error("No nodes with lower priority for rebalancing") + instancesStatus = append(instancesStatus, launcher.instanceManager.getErrorInstanceStatuses()...) + launcher.runStatusChannel <- instancesStatus +} - return +func (launcher *Launcher) processRemovedInstances(instances []cloudprotocol.InstanceInfo) error { + launcher.removeInstanceNetworkParameters(instances) + + for _, curInstance := range launcher.instanceManager.getCurrentInstances() { + if !slices.ContainsFunc(instances, func(info cloudprotocol.InstanceInfo) bool { + return curInstance.ServiceID == info.ServiceID && curInstance.SubjectID == info.SubjectID && + curInstance.Instance < info.NumInstances + }) { + if err := launcher.instanceManager.cacheInstance(curInstance); err != nil { + log.WithFields(instanceIdentLogFields(curInstance.InstanceIdent, nil)).Errorf( + "Can't cache instance: %v", err) + } + } } - for i := len(nodeWithIssue.currentRunRequest.Instances) - 1; i >= 0; i-- { - currentInstance := nodeWithIssue.currentRunRequest.Instances[i] + return nil +} - serviceInfo, err := launcher.imageProvider.GetServiceInfo(currentInstance.ServiceID) - if err != nil { - log.Errorf("Can't get service: %v", err) - continue - } +func (launcher *Launcher) updateNetworks(instances []cloudprotocol.InstanceInfo) error { + providers := make([]string, len(instances)) - labels, err := launcher.getLabelsForInstance(currentInstance.InstanceIdent) + for i, instance := range instances { + serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) if err != nil { - log.Errorf("Can't get labels for instance %v", err) + return aoserrors.Wrap(err) } - nodes, err := launcher.getNodesByStaticResources(nodes, serviceInfo, cloudprotocol.InstanceInfo{ - ServiceID: currentInstance.ServiceID, SubjectID: currentInstance.SubjectID, Labels: labels, - }) - if err != nil { - continue - } + providers[i] = serviceInfo.ProviderID + } - nodes, err = launcher.getNodesByDevices(nodes, serviceInfo.Config.Devices) - if err != nil { - continue + for _, node := range launcher.nodes { + if err := launcher.networkManager.UpdateProviderNetwork(providers, node.nodeInfo.NodeID); err != nil { + return aoserrors.Wrap(err) } + } + + return nil +} - nodes = launcher.getNodeByMonitoringData(nodes, alert.Parameter) +func (launcher *Launcher) performPolicyBalancing(instances []cloudprotocol.InstanceInfo) { + for _, instance := range instances { + log.WithFields(log.Fields{ + "serviceID": instance.ServiceID, + "subjectID": instance.SubjectID, + "numInstances": instance.NumInstances, + "priority": instance.Priority, + }).Debug("Check balancing policy") - layersForService, err := launcher.getLayersForService(serviceInfo.Layers) + service, layers, err := launcher.getServiceLayers(instance) if err != nil { - log.Errorf("Can't get layer: %v", err) + launcher.instanceManager.setAllInstanceError(instance, service.Version, err) continue } - if err = launcher.allocateDevices(nodes[0], serviceInfo.Config.Devices); err != nil { - log.Errorf("Can't allocate devices: %v", err) - + if service.Config.BalancingPolicy != aostypes.BalancingDisabled { continue } - launcher.addRunRequest(currentInstance, serviceInfo, layersForService, nodes[0]) + for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { + curInstance, err := launcher.instanceManager.getCurrentInstance( + createInstanceIdent(instance, instanceIndex)) + if err != nil { + launcher.instanceManager.setInstanceError( + createInstanceIdent(instance, instanceIndex), + service.Version, err) - if err := launcher.releaseDevices(nodeWithIssue, serviceInfo.Config.Devices); err != nil { - log.Errorf("Can't release devices: %v", err) + continue + } - continue - } + node := launcher.getNode(curInstance.NodeID) + if node == nil { + launcher.instanceManager.setInstanceError( + createInstanceIdent(instance, instanceIndex), + service.Version, aoserrors.Errorf("node not found")) - sort.Slice(nodeWithIssue.currentRunRequest.Instances, func(i, j int) bool { - if nodeWithIssue.currentRunRequest.Instances[i].Priority == - nodeWithIssue.currentRunRequest.Instances[j].Priority { - return nodeWithIssue.currentRunRequest.Instances[i].ServiceID < - nodeWithIssue.currentRunRequest.Instances[j].ServiceID + continue } - return nodeWithIssue.currentRunRequest.Instances[i].Priority > - nodeWithIssue.currentRunRequest.Instances[j].Priority - }) + instanceInfo, err := launcher.instanceManager.setupInstance( + instance, instanceIndex, node, service, true) + if err != nil { + launcher.instanceManager.setInstanceError( + createInstanceIdent(instance, instanceIndex), service.Version, err) - launcher.removeRunRequest(currentInstance, nodeWithIssue) + continue + } - launcher.connectionTimer = time.AfterFunc( - launcher.config.SMController.NodesConnectionTimeout.Duration, launcher.sendCurrentStatus) + if err = node.addRunRequest(instanceInfo, service, layers); err != nil { + launcher.instanceManager.setInstanceError( + createInstanceIdent(instance, instanceIndex), service.Version, err) - if err := launcher.sendRunInstances(false); err != nil { - log.Errorf("Can't send run instance while rebalancing: %v", err) + continue + } } - - return } - - log.Warn("No appropriate condition for rebalancing found") } -func (launcher *Launcher) initNodeStatus(nodeID, nodeType string) (*nodeStatus, error) { - status := &nodeStatus{currentRunRequest: &runRequestInfo{}} - - log.WithFields(log.Fields{"nodeID": nodeID}).Debug("Init node status") - - config, err := launcher.nodeManager.GetNodeConfiguration(nodeID) - if err != nil { - return nil, aoserrors.Errorf("can't get node configuration fot nodeID %s: %v", nodeID, err) - } - - status.NodeInfo = config +func (launcher *Launcher) performNodeBalancing(instances []cloudprotocol.InstanceInfo, rebalancing bool) { + for _, instance := range instances { + log.WithFields(log.Fields{ + "serviceID": instance.ServiceID, + "subjectID": instance.SubjectID, + "numInstances": instance.NumInstances, + "priority": instance.Priority, + }).Debug("Balance instances") - if err := launcher.loadNodeRunRequest(status); err != nil && !errors.Is(err, ErrNotExist) { - log.WithFields(log.Fields{"nodeID": nodeID}).Errorf("Can't load node run request") - } + service, layers, err := launcher.getServiceLayers(instance) + if err != nil { + launcher.instanceManager.setAllInstanceError(instance, service.Version, err) + continue + } - launcher.initNodeUnitConfiguration(status, nodeType) + nodes, err := getNodesByStaticResources(launcher.getNodesByPriorities(), service.Config, instance) + if err != nil { + launcher.instanceManager.setAllInstanceError(instance, service.Version, err) + continue + } - return status, nil -} + for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { + instanceIdent := createInstanceIdent(instance, instanceIndex) -func (launcher *Launcher) initNodeUnitConfiguration(nodeStatus *nodeStatus, nodeType string) { - nodeUnitConfig := launcher.resourceManager.GetUnitConfiguration(nodeType) + if launcher.instanceManager.isInstanceScheduled(instanceIdent) { + continue + } - nodeStatus.priority = nodeUnitConfig.Priority - nodeStatus.availableLabels = nodeUnitConfig.Labels - nodeStatus.availableResources = make([]string, len(nodeUnitConfig.Resources)) - nodeStatus.availableDevices = make([]nodeDevice, len(nodeUnitConfig.Devices)) + if rebalancing { + curInstance, err := launcher.instanceManager.getCurrentInstance(instanceIdent) + if err != nil { + launcher.instanceManager.setInstanceError(instanceIdent, service.Version, err) + continue + } - for i, resource := range nodeUnitConfig.Resources { - nodeStatus.availableResources[i] = resource.Name - } + if curInstance.PrevNodeID != "" && curInstance.PrevNodeID != curInstance.NodeID { + nodes = excludeNodes(nodes, []string{curInstance.PrevNodeID}) + if len(nodes) == 0 { + launcher.instanceManager.setInstanceError(instanceIdent, service.Version, + aoserrors.Errorf("can't find node for rebalancing")) + continue + } + } + } - for i, device := range nodeUnitConfig.Devices { - nodeStatus.availableDevices[i] = nodeDevice{ - name: device.Name, sharedCount: device.SharedCount, allocatedCount: 0, - } - } + node, err := getInstanceNode(nodes, instanceIdent, service.Config) + if err != nil { + launcher.instanceManager.setInstanceError(instanceIdent, service.Version, err) + continue + } - for _, instance := range nodeStatus.currentRunRequest.Instances { - serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) - if err != nil { - log.WithFields(log.Fields{"serviceID": instance.ServiceID}).Errorf("Can't get service info: %v", err) - continue - } + instanceInfo, err := launcher.instanceManager.setupInstance( + instance, instanceIndex, node, service, rebalancing) + if err != nil { + launcher.instanceManager.setInstanceError(instanceIdent, service.Version, err) + continue + } - if err = launcher.allocateDevices(nodeStatus, serviceInfo.Config.Devices); err != nil { - log.WithFields( - instanceIdentLogFields(instance.InstanceIdent, nil)).Errorf("Can't allocate devices: %v", err) + if err = node.addRunRequest(instanceInfo, service, layers); err != nil { + launcher.instanceManager.setInstanceError(instanceIdent, service.Version, err) + continue + } } } } -func (launcher *Launcher) resetDeviceAllocation() { - for _, node := range launcher.nodes { - for i := range node.availableDevices { - node.availableDevices[i].allocatedCount = 0 - } +func (launcher *Launcher) getServiceLayers(instance cloudprotocol.InstanceInfo) ( + imagemanager.ServiceInfo, []imagemanager.LayerInfo, error, +) { + service, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) + if err != nil { + return service, nil, aoserrors.Wrap(err) } -} -func (launcher *Launcher) sendCurrentStatus() { - runStatusToSend := unitstatushandler.RunInstancesStatus{ - UnitSubjects: []string{}, Instances: []cloudprotocol.InstanceStatus{}, + if service.Cached { + return service, nil, aoserrors.New("service deleted") } - for _, node := range launcher.nodes { - if node.waitStatus { - node.waitStatus = false - - for _, errInstance := range node.currentRunRequest.Instances { - runStatusToSend.Instances = append(runStatusToSend.Instances, cloudprotocol.InstanceStatus{ - InstanceIdent: errInstance.InstanceIdent, - NodeID: node.NodeID, RunState: cloudprotocol.InstanceStateFailed, - ErrorInfo: &cloudprotocol.ErrorInfo{Message: "wait run status timeout"}, - }) - } - } else { - runStatusToSend.Instances = append(runStatusToSend.Instances, node.receivedRunInstances...) - } + layers, err := launcher.getLayersForService(service.Layers) + if err != nil { + return service, layers, err } - errorInstances := []aostypes.InstanceIdent{} - - for i := range runStatusToSend.Instances { - if runStatusToSend.Instances[i].ErrorInfo != nil { - errorInstances = append(errorInstances, runStatusToSend.Instances[i].InstanceIdent) + return service, layers, nil +} - continue - } +func (launcher *Launcher) prepareNetworkForInstances(onlyExposedPorts bool) { + for _, node := range launcher.getNodesByPriorities() { + for i, instance := range node.runRequest.Instances { + serviceVersion := "" - runStatusToSend.Instances[i].StateChecksum = launcher.storageStateProvider.GetInstanceCheckSum( - runStatusToSend.Instances[i].InstanceIdent) - } + if err := func() error { + serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) + if err != nil { + return aoserrors.Wrap(err) + } -newServicesLoop: - for _, newService := range launcher.pendingNewServices { - for _, instance := range runStatusToSend.Instances { - if instance.ServiceID == newService && instance.ErrorInfo == nil { - continue newServicesLoop - } - } + serviceVersion = serviceInfo.Version - errorService := cloudprotocol.ServiceStatus{ - ID: newService, Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{}, - } + if onlyExposedPorts && len(serviceInfo.ExposedPorts) == 0 { + return nil + } - service, err := launcher.imageProvider.GetServiceInfo(newService) - if err != nil { - errorService.ErrorInfo.Message = err.Error() - } else { - errorService.AosVersion = service.AosVersion - errorService.ErrorInfo.Message = "can't run any instances" - } + if instance.NetworkParameters, err = launcher.networkManager.PrepareInstanceNetworkParameters( + instance.InstanceIdent, serviceInfo.ProviderID, + prepareNetworkParameters(serviceInfo)); err != nil { + return aoserrors.Wrap(err) + } - runStatusToSend.ErrorServices = append(runStatusToSend.ErrorServices, errorService) + node.runRequest.Instances[i] = instance - if err := launcher.imageProvider.RevertService(newService); err != nil { - log.WithField("serviceID:", newService).Errorf("Can't revert service: %v", err) + return nil + }(); err != nil { + launcher.instanceManager.setInstanceError(instance.InstanceIdent, serviceVersion, err) + } } } +} + +func prepareNetworkParameters(serviceInfo imagemanager.ServiceInfo) networkmanager.NetworkParameters { + var hosts []string - launcher.pendingNewServices = []string{} + if serviceInfo.Config.Hostname != nil { + hosts = append(hosts, *serviceInfo.Config.Hostname) + } - launcher.processStoppedInstances(runStatusToSend.Instances, errorInstances) + params := networkmanager.NetworkParameters{ + Hosts: hosts, + ExposePorts: serviceInfo.ExposedPorts, + } - runStatusToSend.Instances = append(runStatusToSend.Instances, launcher.currentErrorStatus...) + params.AllowConnections = make([]string, 0, len(serviceInfo.Config.AllowedConnections)) - launcher.runStatusChannel <- runStatusToSend + for key := range serviceInfo.Config.AllowedConnections { + params.AllowConnections = append(params.AllowConnections, key) + } - launcher.currentRunStatus = runStatusToSend.Instances - launcher.currentErrorStatus = []cloudprotocol.InstanceStatus{} -} - -func (launcher *Launcher) processStoppedInstances( - newStatus []cloudprotocol.InstanceStatus, errorInstances []aostypes.InstanceIdent, -) { - stoppedInstances := errorInstances - -currentInstancesLoop: - for _, currentStatus := range launcher.currentRunStatus { - for _, newStatus := range newStatus { - if currentStatus.InstanceIdent != newStatus.InstanceIdent { - continue - } - - if newStatus.ErrorInfo != nil && currentStatus.ErrorInfo == nil { - stoppedInstances = append(stoppedInstances, currentStatus.InstanceIdent) - } - - continue currentInstancesLoop - } - - if currentStatus.ErrorInfo == nil { - stoppedInstances = append(stoppedInstances, currentStatus.InstanceIdent) - } - } - - for _, stopIdent := range stoppedInstances { - if err := launcher.storageStateProvider.Cleanup(stopIdent); err != nil { - log.Errorf("Can't cleanup state storage for instance: %v", err) - } - } -} - -func (launcher *Launcher) updateNetworks(instances []cloudprotocol.InstanceInfo) error { - providers := make([]string, len(instances)) - - for i, instance := range instances { - serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) - if err != nil { - return aoserrors.Wrap(err) - } - - providers[i] = serviceInfo.ProviderID - } - - for _, node := range launcher.nodes { - if err := launcher.networkManager.UpdateProviderNetwork(providers, node.NodeID); err != nil { - return aoserrors.Wrap(err) - } - } - - return nil -} - -//nolint:funlen -func (launcher *Launcher) performNodeBalancing(instances []cloudprotocol.InstanceInfo, -) (errStatus []cloudprotocol.InstanceStatus) { - for _, node := range launcher.nodes { - node.currentRunRequest = &runRequestInfo{} - } - - launcher.resetDeviceAllocation() - - sort.Slice(instances, func(i, j int) bool { - if instances[i].Priority == instances[j].Priority { - return instances[i].ServiceID < instances[j].ServiceID - } - - return instances[i].Priority > instances[j].Priority - }) - - launcher.cacheInstances(instances) - launcher.removeInstanceNetworkParameters(instances) - - for _, instance := range instances { - log.WithFields(log.Fields{ - "serviceID": instance.ServiceID, - "subjectID": instance.SubjectID, - "numInstances": instance.NumInstances, - "priority": instance.Priority, - }).Debug("Balance instances") - - serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) - if err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, 0, 0, - cloudprotocol.InstanceStateFailed, err.Error())) - - continue - } - - if serviceInfo.Cached { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, 0, 0, - cloudprotocol.InstanceStateFailed, "service deleted")) - - continue - } - - layers, err := launcher.getLayersForService(serviceInfo.Layers) - if err != nil { - for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instanceIndex, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - } - - continue - } - - nodes, err := launcher.getNodesByStaticResources(launcher.nodes, serviceInfo, instance) - if err != nil { - for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instanceIndex, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - } - - continue - } - - // createInstanceStatusFromInfo - - for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { - nodeForInstance, err := launcher.getNodesByDevices(nodes, serviceInfo.Config.Devices) - if err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instanceIndex, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - - continue - } - - instanceInfo, err := launcher.prepareInstanceStartInfo(serviceInfo, instance, instanceIndex) - if err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instanceIndex, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - } - - node := launcher.getMostPriorityNode(nodeForInstance, serviceInfo) - - if err = launcher.allocateDevices(node, serviceInfo.Config.Devices); err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instanceIndex, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - - continue - } - - launcher.addRunRequest(instanceInfo, serviceInfo, layers, node) - } - } - - // first prepare network for instance which have exposed ports - errNetworkStatus := launcher.prepareNetworkForInstances(true) - errStatus = append(errStatus, errNetworkStatus...) - - // then prepare network for rest of instances - errNetworkStatus = launcher.prepareNetworkForInstances(false) - errStatus = append(errStatus, errNetworkStatus...) - - return errStatus -} - -func (launcher *Launcher) prepareNetworkForInstances(onlyExposedPorts bool) (errStatus []cloudprotocol.InstanceStatus) { - for _, node := range launcher.nodes { - for i, instance := range node.currentRunRequest.Instances { - serviceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) - if err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, 0, 0, - cloudprotocol.InstanceStateFailed, err.Error())) - - continue - } - - if onlyExposedPorts && len(serviceInfo.ExposedPorts) == 0 { - continue - } - - if instance.NetworkParameters, err = launcher.networkManager.PrepareInstanceNetworkParameters( - instance.InstanceIdent, serviceInfo.ProviderID, - prepareNetworkParameters(instance, serviceInfo)); err != nil { - errStatus = append(errStatus, createInstanceStatusFromInfo(instance.ServiceID, instance.SubjectID, - instance.Instance, serviceInfo.AosVersion, cloudprotocol.InstanceStateFailed, err.Error())) - } - - node.currentRunRequest.Instances[i] = instance - } - } - - return errStatus -} - -func prepareNetworkParameters( - instance aostypes.InstanceInfo, serviceInfo imagemanager.ServiceInfo, -) networkmanager.NetworkParameters { - var hosts []string - if serviceInfo.Config.Hostname != nil { - hosts = append(hosts, *serviceInfo.Config.Hostname) - } - - params := networkmanager.NetworkParameters{ - Hosts: hosts, - ExposePorts: serviceInfo.ExposedPorts, - } - - params.AllowConnections = make([]string, 0, len(serviceInfo.Config.AllowedConnections)) - - for key := range serviceInfo.Config.AllowedConnections { - params.AllowConnections = append(params.AllowConnections, key) - } - - return params + return params } func (launcher *Launcher) removeInstanceNetworkParameters(instances []cloudprotocol.InstanceInfo) { @@ -873,494 +639,32 @@ nextNetInstance: } } -func (launcher *Launcher) cacheInstances(instances []cloudprotocol.InstanceInfo) { - storeInstances, err := launcher.storage.GetInstances() - if err != nil { - log.Errorf("Can't get instances from storage: %v", err) - return - } - -nextStoreInstance: - for _, storeInstance := range storeInstances { - for _, instance := range instances { - for instanceIndex := uint64(0); instanceIndex < instance.NumInstances; instanceIndex++ { - instanceIdent := aostypes.InstanceIdent{ - ServiceID: instance.ServiceID, SubjectID: instance.SubjectID, - Instance: instanceIndex, - } - - if storeInstance.InstanceIdent == instanceIdent { - continue nextStoreInstance - } - } - } - - log.WithFields(instanceIdentLogFields(storeInstance.InstanceIdent, nil)).Debug("Cache instance") - - if err := launcher.storage.SetInstanceCached(storeInstance.InstanceIdent, true); err != nil { - log.WithFields( - instanceIdentLogFields(storeInstance.InstanceIdent, nil)).Errorf("Can't mark instance as cached: %v", err) - } - } -} - -func (launcher *Launcher) prepareInstanceStartInfo(service imagemanager.ServiceInfo, - instance cloudprotocol.InstanceInfo, index uint64, -) (aostypes.InstanceInfo, error) { - instanceInfo := aostypes.InstanceInfo{InstanceIdent: aostypes.InstanceIdent{ - ServiceID: instance.ServiceID, SubjectID: instance.SubjectID, - Instance: index, - }, Priority: instance.Priority} - - uid, err := launcher.storage.GetInstanceUID(instanceInfo.InstanceIdent) - if err != nil { - if !errors.Is(err, ErrNotExist) { - return instanceInfo, aoserrors.Wrap(err) - } - - uid, err = launcher.instanceManager.acquireUID() - if err != nil { - return instanceInfo, aoserrors.Wrap(err) - } - - if err := launcher.storage.AddInstance(InstanceInfo{ - InstanceIdent: instanceInfo.InstanceIdent, - UID: uid, - Timestamp: time.Now(), - }); err != nil { - log.Errorf("Can't store uid: %v", err) - } - } - - instanceInfo.UID = uint32(uid) - - stateStorageParams := storagestate.SetupParams{ - InstanceIdent: instanceInfo.InstanceIdent, - UID: uid, GID: int(service.GID), - } - - if service.Config.Quotas.StateLimit != nil { - stateStorageParams.StateQuota = *service.Config.Quotas.StateLimit - } - - if service.Config.Quotas.StorageLimit != nil { - stateStorageParams.StorageQuota = *service.Config.Quotas.StorageLimit - } - - instanceInfo.StoragePath, instanceInfo.StatePath, err = launcher.storageStateProvider.Setup(stateStorageParams) - if err != nil { - _ = launcher.instanceManager.releaseUID(uid) - - return instanceInfo, aoserrors.Wrap(err) - } - - // make sure that instance is not cached - if err := launcher.storage.SetInstanceCached(instanceInfo.InstanceIdent, false); err != nil { - log.WithFields(instanceIdentLogFields(instanceInfo.InstanceIdent, - nil)).Errorf("Can't mark instance as not cached: %v", err) - - return instanceInfo, aoserrors.Wrap(err) - } - - return instanceInfo, nil -} - -func (launcher *Launcher) getNodesByStaticResources(allNodes []*nodeStatus, - serviceInfo imagemanager.ServiceInfo, instanceInfo cloudprotocol.InstanceInfo, -) ([]*nodeStatus, error) { - nodes := launcher.getNodeByRunner(allNodes, serviceInfo.Config.Runner) - if len(nodes) == 0 { - return nodes, aoserrors.Errorf("no node with runner: %s", serviceInfo.Config.Runner) - } - - nodes = launcher.getNodesByLabels(nodes, instanceInfo.Labels) - if len(nodes) == 0 { - return nodes, aoserrors.Errorf("no node with labels %v", instanceInfo.Labels) - } - - nodes = launcher.getNodesByResources(nodes, serviceInfo.Config.Resources) - if len(nodes) == 0 { - return nodes, aoserrors.Errorf("no node with resources %v", serviceInfo.Config.Resources) - } - - return nodes, nil -} - -func (launcher *Launcher) getNodesByDevices( - availableNodes []*nodeStatus, desiredDevices []aostypes.ServiceDevice, -) ([]*nodeStatus, error) { - if len(desiredDevices) == 0 { - return slices.Clone(availableNodes), nil - } - - nodes := make([]*nodeStatus, 0) - - for _, node := range availableNodes { - if !launcher.nodeHasDesiredDevices(node, desiredDevices) { - continue - } - - nodes = append(nodes, node) - } - - if len(nodes) == 0 { - return nodes, aoserrors.New("no available device found") - } - - return nodes, nil -} - -func (launcher *Launcher) getNodeByMonitoringData(nodes []*nodeStatus, alertType string) (newNodes []*nodeStatus) { - if len(nodes) == 1 { - return nodes - } - - type freeNodeResources struct { - node *nodeStatus - freeRAM uint64 - freeCPU uint64 - } - - nodesResources := []freeNodeResources{} - - for _, node := range nodes { - monitoringData, err := launcher.nodeManager.GetNodeMonitoringData(node.NodeID) - if err != nil { - log.Errorf("Can't get node monitoring data: %v", err) - } - - nodesResources = append(nodesResources, freeNodeResources{ - node: node, - freeRAM: node.TotalRAM - monitoringData.RAM, - freeCPU: node.NumCPUs*100 - monitoringData.CPU, - }) - } - - if alertType == "cpu" { - slices.SortFunc(nodesResources, func(a, b freeNodeResources) bool { - return a.freeCPU > b.freeCPU - }) - } else { - slices.SortFunc(nodesResources, func(a, b freeNodeResources) bool { - return a.freeRAM > b.freeRAM - }) - } - - for _, sortedResources := range nodesResources { - newNodes = append(newNodes, sortedResources.node) - } - - return newNodes -} - -func (launcher *Launcher) nodeHasDesiredDevices(node *nodeStatus, desiredDevices []aostypes.ServiceDevice) bool { -devicesLoop: - for _, desiredDevice := range desiredDevices { - for _, nodeDevice := range node.availableDevices { - if desiredDevice.Name != nodeDevice.name { - continue - } +func (launcher *Launcher) getNodesByPriorities() []*nodeHandler { + nodes := maps.Values(launcher.nodes) - if nodeDevice.sharedCount == 0 || nodeDevice.allocatedCount != nodeDevice.sharedCount { - continue devicesLoop - } + sort.Slice(nodes, func(i, j int) bool { + if nodes[i].nodeConfig.Priority == nodes[j].nodeConfig.Priority { + return nodes[i].nodeInfo.NodeID < nodes[j].nodeInfo.NodeID } - return false - } - - return true -} - -func (launcher *Launcher) allocateDevices(node *nodeStatus, serviceDevices []aostypes.ServiceDevice) error { -serviceDeviceLoop: - for _, serviceDevice := range serviceDevices { - for i := range node.availableDevices { - if node.availableDevices[i].name != serviceDevice.Name { - continue - } - - if node.availableDevices[i].sharedCount != 0 { - if node.availableDevices[i].allocatedCount == node.availableDevices[i].sharedCount { - return aoserrors.Errorf("can't allocate device: %s", serviceDevice.Name) - } - - node.availableDevices[i].allocatedCount++ - - continue serviceDeviceLoop - } - } - - return aoserrors.Errorf("can't allocate device: %s", serviceDevice.Name) - } - - return nil -} - -func (launcher *Launcher) releaseDevices(node *nodeStatus, serviceDevices []aostypes.ServiceDevice) error { -serviceDeviceLoop: - for _, serviceDevice := range serviceDevices { - for i := range node.availableDevices { - if node.availableDevices[i].name != serviceDevice.Name { - continue - } - - if node.availableDevices[i].sharedCount != 0 { - if node.availableDevices[i].allocatedCount == 0 { - return aoserrors.Errorf("can't release device: %s", serviceDevice.Name) - } - - node.availableDevices[i].allocatedCount-- - - continue serviceDeviceLoop - } - } - - return aoserrors.Errorf("can't release device: %s", serviceDevice.Name) - } - - return nil -} - -func (launcher *Launcher) getNodesByResources(nodes []*nodeStatus, desiredResources []string) (newNodes []*nodeStatus) { - if len(desiredResources) == 0 { - return nodes - } - -nodeLoop: - for _, node := range nodes { - if len(node.availableResources) == 0 { - continue - } - - for _, resource := range desiredResources { - if !slices.Contains(node.availableResources, resource) { - continue nodeLoop - } - } - - newNodes = append(newNodes, node) - } - - return newNodes -} - -func (launcher *Launcher) getNodesByLabels(nodes []*nodeStatus, desiredLabels []string) (newNodes []*nodeStatus) { - if len(desiredLabels) == 0 { - return nodes - } - -nodeLoop: - for _, node := range nodes { - if len(node.availableLabels) == 0 { - continue - } - - for _, label := range desiredLabels { - if !slices.Contains(node.availableLabels, label) { - continue nodeLoop - } - } - - newNodes = append(newNodes, node) - } - - return newNodes -} - -func (launcher *Launcher) getNodeByRunner(allNodes []*nodeStatus, runner string) (nodes []*nodeStatus) { - if runner == "" { - runner = defaultRunner - } - - for _, node := range allNodes { - if (len(node.RunnerFeature) == 0 && slices.Contains(defaultRunnerFeatures, runner)) || - slices.Contains(node.RunnerFeature, runner) { - nodes = append(nodes, node) - } - } + return nodes[i].nodeConfig.Priority > nodes[j].nodeConfig.Priority + }) return nodes } -func (launcher *Launcher) getMostPriorityNode(nodes []*nodeStatus, serviceInfo imagemanager.ServiceInfo) *nodeStatus { - if len(nodes) == 1 { - return nodes[0] - } - - maxNodePriorityIndex := 0 - - for i := 1; i < len(nodes); i++ { - if nodes[maxNodePriorityIndex].priority < nodes[i].priority { - maxNodePriorityIndex = i - } +func (launcher *Launcher) getNode(nodeID string) *nodeHandler { + node, ok := launcher.nodes[nodeID] + if !ok { + return nil } - return nodes[maxNodePriorityIndex] + return node } -func (launcher *Launcher) addRunRequest(instance aostypes.InstanceInfo, service imagemanager.ServiceInfo, - layers []imagemanager.LayerInfo, node *nodeStatus, -) { - log.WithFields(instanceIdentLogFields( - instance.InstanceIdent, log.Fields{"node": node.NodeID})).Debug("Schedule instance on node") - - node.currentRunRequest.Instances = append(node.currentRunRequest.Instances, instance) - - serviceInfo := service.ServiceInfo - - if node.RemoteNode { - serviceInfo.URL = service.RemoteURL - } - - isNewService := true - - for _, oldService := range node.currentRunRequest.Services { - if reflect.DeepEqual(oldService, serviceInfo) { - isNewService = false - break - } - } - - if isNewService { - log.WithFields(log.Fields{"serviceID": serviceInfo.ID, "node": node.NodeID}).Debug("Schedule service on node") - - node.currentRunRequest.Services = append(node.currentRunRequest.Services, serviceInfo) - } - -layerLoopLabel: - for _, layer := range layers { - newLayer := layer.LayerInfo - - if node.RemoteNode { - newLayer.URL = layer.RemoteURL - } - - for _, oldLayer := range node.currentRunRequest.Layers { - if reflect.DeepEqual(newLayer, oldLayer) { - continue layerLoopLabel - } - } - - log.WithFields(log.Fields{"digest": newLayer.Digest, "node": node.NodeID}).Debug("Schedule layer on node") - - node.currentRunRequest.Layers = append(node.currentRunRequest.Layers, newLayer) - } -} - -func (launcher *Launcher) removeInstanceFromNode(ident aostypes.InstanceIdent, node *nodeStatus) { - log.WithFields(log.Fields{"ident": ident, "node": node.NodeID}).Debug("Remove instance from node") - - i := 0 - - for _, instance := range node.currentRunRequest.Instances { - if instance.InstanceIdent != ident { - node.currentRunRequest.Instances[i] = instance - i++ - } - } - - node.currentRunRequest.Instances = node.currentRunRequest.Instances[:i] -} - -func (launcher *Launcher) removeServiceFromNode(serviceID string, node *nodeStatus) { - log.WithFields(log.Fields{"serviceID": serviceID, "node": node.NodeID}).Debug("Remove service from node") - - i := 0 - - for _, service := range node.currentRunRequest.Services { - if service.ID != serviceID { - node.currentRunRequest.Services[i] = service - i++ - } - } - - node.currentRunRequest.Services = node.currentRunRequest.Services[:i] -} - -func (launcher *Launcher) removeLayerFromNode(digest string, node *nodeStatus) { - log.WithFields(log.Fields{"digest": digest, "node": node.NodeID}).Debug("Remove layer from node") - - i := 0 - - for _, layer := range node.currentRunRequest.Layers { - if layer.Digest != digest { - node.currentRunRequest.Layers[i] = layer - i++ - } - } - - node.currentRunRequest.Layers = node.currentRunRequest.Layers[:i] -} - -func (launcher *Launcher) removeRunRequest(instance aostypes.InstanceInfo, node *nodeStatus) { - launcher.removeInstanceFromNode(instance.InstanceIdent, node) - - // check if we need to remove service - removeService := true - - for _, currentInstance := range node.currentRunRequest.Instances { - if currentInstance.ServiceID == instance.ServiceID { - removeService = false - } - } - - if removeService { - launcher.removeServiceFromNode(instance.ServiceID, node) - - currentServiceInfo, err := launcher.imageProvider.GetServiceInfo(instance.ServiceID) - if err != nil { - log.Errorf("Can't get service info: %v", err) - - return - } - - layerLoop: - for _, currentDigest := range currentServiceInfo.Layers { - for _, service := range node.currentRunRequest.Services { - serviceInfo, err := launcher.imageProvider.GetServiceInfo(service.ID) - if err != nil { - log.Errorf("Can't get service info: %v", err) - - continue layerLoop - } - - for _, digest := range serviceInfo.Layers { - if currentDigest == digest { - continue layerLoop - } - } - } - - launcher.removeLayerFromNode(currentDigest, node) - } - } -} - -func createInstanceStatusFromInfo( - serviceID, subjectID string, instanceIndex, serviceVersion uint64, runState, errorMsg string, -) cloudprotocol.InstanceStatus { - ident := aostypes.InstanceIdent{ - ServiceID: serviceID, SubjectID: subjectID, Instance: instanceIndex, - } - - instanceStatus := cloudprotocol.InstanceStatus{ - InstanceIdent: ident, - AosVersion: serviceVersion, RunState: runState, - } - - if errorMsg != "" { - log.WithFields(instanceIdentLogFields(ident, nil)).Errorf("Can't schedule instance: %s", errorMsg) - - instanceStatus.ErrorInfo = &cloudprotocol.ErrorInfo{Message: errorMsg} - } - - return instanceStatus -} - -func (launcher *Launcher) getNode(nodeID string) *nodeStatus { +func (launcher *Launcher) getLocalNode() *nodeHandler { for _, node := range launcher.nodes { - if node.NodeID == nodeID { + if node.isLocalNode { return node } } @@ -1368,28 +672,6 @@ func (launcher *Launcher) getNode(nodeID string) *nodeStatus { return nil } -func (launcher *Launcher) getLowerPriorityNodes(node *nodeStatus) (nodes []*nodeStatus) { - for _, currentNode := range launcher.nodes { - if currentNode.priority > node.priority || currentNode.NodeID == node.NodeID { - continue - } - - nodes = append(nodes, currentNode) - } - - return nodes -} - -func (launcher *Launcher) getLabelsForInstance(ident aostypes.InstanceIdent) ([]string, error) { - for _, instance := range launcher.currentDesiredInstances { - if instance.ServiceID == ident.ServiceID && instance.SubjectID == ident.SubjectID { - return instance.Labels, nil - } - } - - return nil, aoserrors.New("no labels for instance") -} - func (launcher *Launcher) getLayersForService(digests []string) ([]imagemanager.LayerInfo, error) { layers := make([]imagemanager.LayerInfo, len(digests)) @@ -1405,30 +687,46 @@ func (launcher *Launcher) getLayersForService(digests []string) ([]imagemanager. return layers, nil } -func (launcher *Launcher) loadNodeRunRequest(node *nodeStatus) error { - currentRunRequestJSON, err := launcher.storage.GetNodeState(node.NodeID) - if err != nil { - return aoserrors.Wrap(err) +func getStorageRequestRatio( + serviceRatios *aostypes.ResourceRatiosInfo, nodeRatios *aostypes.ResourceRatiosInfo, +) float64 { + if serviceRatios != nil && serviceRatios.Storage != nil { + return float64(*serviceRatios.Storage) / 100 } - if err = json.Unmarshal(currentRunRequestJSON, &node.currentRunRequest); err != nil { - return aoserrors.Wrap(err) + if nodeRatios != nil && nodeRatios.Storage != nil { + return float64(*nodeRatios.Storage) / 100 } - return nil + return defaultResourceRation / 100 } -func (launcher *Launcher) saveNodeRunRequest(node *nodeStatus) error { - runRequestJSON, err := json.Marshal(node.currentRunRequest) - if err != nil { - return aoserrors.Wrap(err) +func getCPURequestRatio( + serviceRatios *aostypes.ResourceRatiosInfo, nodeRatios *aostypes.ResourceRatiosInfo, +) float64 { + if serviceRatios != nil && serviceRatios.CPU != nil { + return float64(*serviceRatios.CPU) / 100 } - if err := launcher.storage.SetNodeState(node.NodeID, runRequestJSON); err != nil { - log.Errorf("Can't store desired instances: %v", err) + if nodeRatios != nil && nodeRatios.CPU != nil { + return float64(*nodeRatios.CPU) / 100 } - return nil + return defaultResourceRation / 100 +} + +func getRAMRequestRatio( + serviceRatios *aostypes.ResourceRatiosInfo, nodeRatios *aostypes.ResourceRatiosInfo, +) float64 { + if serviceRatios != nil && serviceRatios.RAM != nil { + return float64(*serviceRatios.RAM) / 100 + } + + if nodeRatios != nil && nodeRatios.CPU != nil { + return float64(*nodeRatios.CPU) / 100 + } + + return defaultResourceRation / 100 } func instanceIdentLogFields(instance aostypes.InstanceIdent, extraFields log.Fields) log.Fields { diff --git a/launcher/launcher_test.go b/launcher/launcher_test.go index 9e2ba4a8..85176c42 100644 --- a/launcher/launcher_test.go +++ b/launcher/launcher_test.go @@ -18,7 +18,6 @@ package launcher_test import ( - "encoding/json" "errors" "net" "os" @@ -39,7 +38,6 @@ import ( "github.com/aosedge/aos_communicationmanager/launcher" "github.com/aosedge/aos_communicationmanager/networkmanager" "github.com/aosedge/aos_communicationmanager/storagestate" - "github.com/aosedge/aos_communicationmanager/unitstatushandler" ) /*********************************************************************************************************************** @@ -92,29 +90,29 @@ type runRequest struct { forceRestart bool } +type testNodeInfoProvider struct { + nodeID string + nodeInfo map[string]cloudprotocol.NodeInfo +} + type testNodeManager struct { - runStatusChan chan launcher.NodeRunInstanceStatus - alertsChannel chan cloudprotocol.SystemQuotaAlert - nodeInformation map[string]launcher.NodeInfo - runRequest map[string]runRequest + runStatusChan chan launcher.NodeRunInstanceStatus + runRequest map[string]runRequest + monitoring map[string]aostypes.NodeMonitoring } type testImageProvider struct { services map[string]imagemanager.ServiceInfo layers map[string]imagemanager.LayerInfo - revertedServices []string removeServiceInstancesChannel chan string } type testResourceManager struct { - nodeResources map[string]aostypes.NodeUnitConfig + nodeConfigs map[string]cloudprotocol.NodeConfig } type testStorage struct { - instanceInfo []launcher.InstanceInfo - desiredInstances json.RawMessage - nodeState map[string]json.RawMessage - services map[string][]imagemanager.ServiceInfo + instanceInfo map[aostypes.InstanceIdent]*launcher.InstanceInfo } type testStateStorage struct { @@ -128,6 +126,18 @@ type testNetworkManager struct { networkInfo map[string]map[aostypes.InstanceIdent]struct{} } +type testData struct { + testCaseName string + nodeConfigs map[string]cloudprotocol.NodeConfig + serviceConfigs map[string]aostypes.ServiceConfig + desiredInstances []cloudprotocol.InstanceInfo + storedInstances []launcher.InstanceInfo + expectedRunRequests map[string]runRequest + expectedRunStatus []cloudprotocol.InstanceStatus + monitoring map[string]aostypes.NodeMonitoring + rebalancing bool +} + /*********************************************************************************************************************** * Init **********************************************************************************************************************/ @@ -150,13 +160,13 @@ func TestInstancesWithRemovedServiceInfoAreRemovedOnStart(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{"localSM", "remoteSM"}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, } - nodeManager = newTestNodeManager() - imageManager = &testImageProvider{} - testStorage = newTestStorage() + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) + nodeManager = newTestNodeManager() + imageManager = newTestImageProvider() + testStorage = newTestStorage(nil) ) err := testStorage.AddInstance(launcher.InstanceInfo{ @@ -166,8 +176,8 @@ func TestInstancesWithRemovedServiceInfoAreRemovedOnStart(t *testing.T) { t.Fatalf("Can't add instance %v", err) } - launcherInstance, err := launcher.New(cfg, testStorage, nodeManager, imageManager, &testResourceManager{}, - &testStateStorage{}, newTestNetworkManager("")) + launcherInstance, err := launcher.New(cfg, testStorage, nodeInfoProvider, nodeManager, imageManager, + &testResourceManager{}, &testStateStorage{}, newTestNetworkManager("")) if err != nil { t.Fatalf("Can't create launcher %v", err) } @@ -187,14 +197,14 @@ func TestInstancesWithOutdatedTTLRemovedOnStart(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{"localSM", "remoteSM"}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, ServiceTTLDays: 1, } + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) nodeManager = newTestNodeManager() - imageManager = &testImageProvider{} - testStorage = newTestStorage() + imageManager = newTestImageProvider() + testStorage = newTestStorage(nil) testStateStorage = &testStateStorage{} ) @@ -202,6 +212,7 @@ func TestInstancesWithOutdatedTTLRemovedOnStart(t *testing.T) { InstanceIdent: aostypes.InstanceIdent{ServiceID: service1}, Cached: true, Timestamp: time.Now().Add(-time.Hour * 25).UTC(), + UID: 5000, }) if err != nil { t.Fatalf("Can't add instance %v", err) @@ -211,20 +222,23 @@ func TestInstancesWithOutdatedTTLRemovedOnStart(t *testing.T) { InstanceIdent: aostypes.InstanceIdent{ServiceID: service2}, Cached: true, Timestamp: time.Now().UTC(), + UID: 5001, }) if err != nil { t.Fatalf("Can't add instance %v", err) } // add a service to the storage - testStorage.services[service1] = make([]imagemanager.ServiceInfo, 1) - testStorage.services[service1][0].ServiceInfo.ID = service1 - testStorage.services[service2] = make([]imagemanager.ServiceInfo, 1) - testStorage.services[service2][0].ServiceInfo.ID = service2 + imageManager.services[service1] = imagemanager.ServiceInfo{ + ServiceInfo: createServiceInfo(service1, 0, ""), + } + imageManager.services[service2] = imagemanager.ServiceInfo{ + ServiceInfo: createServiceInfo(service2, 0, ""), + } - launcherInstance, err := launcher.New(cfg, testStorage, nodeManager, imageManager, &testResourceManager{}, - testStateStorage, newTestNetworkManager("")) + launcherInstance, err := launcher.New(cfg, testStorage, nodeInfoProvider, nodeManager, imageManager, + &testResourceManager{}, testStateStorage, newTestNetworkManager("")) if err != nil { t.Fatalf("Can't create launcher %v", err) } @@ -256,14 +270,14 @@ func TestInstancesAreRemovedViaChannel(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{"localSM", "remoteSM"}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, ServiceTTLDays: 1, } + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) nodeManager = newTestNodeManager() testImageManager = newTestImageProvider() - testStorage = newTestStorage() + testStorage = newTestStorage(nil) testStateStorage = &testStateStorage{} ) @@ -275,19 +289,13 @@ func TestInstancesAreRemovedViaChannel(t *testing.T) { t.Fatalf("Can't add instance %v", err) } - // add a service to the storage - testStorage.services[service1] = make([]imagemanager.ServiceInfo, 1) - testStorage.services[service1][0].ServiceInfo.ID = service1 - - launcherInstance, err := launcher.New(cfg, testStorage, nodeManager, testImageManager, &testResourceManager{}, - testStateStorage, newTestNetworkManager("")) + launcherInstance, err := launcher.New(cfg, testStorage, nodeInfoProvider, nodeManager, testImageManager, + &testResourceManager{}, testStateStorage, newTestNetworkManager("")) if err != nil { t.Fatalf("Can't create launcher %v", err) } defer launcherInstance.Close() - defer testImageManager.close() - testImageManager.removeServiceInstancesChannel <- service1 instancesWereRemoved := false @@ -330,45 +338,49 @@ func TestInstancesAreRemovedViaChannel(t *testing.T) { func TestInitialStatus(t *testing.T) { var ( - cfg = &config.Config{ + nodeIDs = []string{nodeIDLocalSM, nodeIDRemoteSM1} + cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{"localSM", "remoteSM"}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, } + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) nodeManager = newTestNodeManager() - expectedRunStatus = unitstatushandler.RunInstancesStatus{} - expectedNodeInfo = []cloudprotocol.NodeInfo{} - imageManager = &testImageProvider{} + expectedRunStatus = []cloudprotocol.InstanceStatus{} + imageManager = newTestImageProvider() ) - launcherInstance, err := launcher.New(cfg, newTestStorage(), nodeManager, imageManager, &testResourceManager{}, - &testStateStorage{}, newTestNetworkManager("")) + for _, id := range nodeIDs { + nodeInfo := cloudprotocol.NodeInfo{ + NodeID: id, NodeType: "nodeType", + Status: cloudprotocol.NodeStatusProvisioned, + TotalRAM: 100, + CPUs: []cloudprotocol.CPUInfo{ + {ModelName: "Intel(R) Core(TM) i7-1185G7"}, + }, + Partitions: []cloudprotocol.PartitionInfo{ + {Name: "id", TotalSize: 200}, + }, + } + + nodeInfoProvider.nodeInfo[id] = nodeInfo + } + + launcherInstance, err := launcher.New(cfg, newTestStorage(nil), nodeInfoProvider, nodeManager, imageManager, + &testResourceManager{}, &testStateStorage{}, newTestNetworkManager("")) if err != nil { t.Fatalf("Can't create launcher %v", err) } defer launcherInstance.Close() - for i, id := range cfg.SMController.NodeIDs { + for i, id := range nodeIDs { instances := []cloudprotocol.InstanceStatus{{ - InstanceIdent: aostypes.InstanceIdent{ServiceID: "s1", SubjectID: "subj1", Instance: uint64(i)}, - AosVersion: 1, StateChecksum: magicSum, RunState: "running", + InstanceIdent: aostypes.InstanceIdent{ServiceID: "s1", SubjectID: "subj1", Instance: uint64(i)}, + ServiceVersion: "1.0", StateChecksum: magicSum, Status: "running", NodeID: id, }} - nodeInfo := cloudprotocol.NodeInfo{ - NodeID: id, NodeType: "nodeType", SystemInfo: cloudprotocol.SystemInfo{ - NumCPUs: 1, TotalRAM: 100, - Partitions: []cloudprotocol.PartitionInfo{ - {Name: "id", TotalSize: 200}, - }, - }, - } - - nodeManager.nodeInformation[id] = launcher.NodeInfo{NodeInfo: nodeInfo} - - expectedNodeInfo = append(expectedNodeInfo, nodeInfo) - expectedRunStatus.Instances = append(expectedRunStatus.Instances, instances...) + expectedRunStatus = append(expectedRunStatus, instances...) nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{NodeID: id, Instances: instances} } @@ -377,42 +389,53 @@ func TestInitialStatus(t *testing.T) { launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { t.Errorf("Incorrect run status: %v", err) } - - nodesInfo := launcherInstance.GetNodesConfiguration() - if !reflect.DeepEqual(expectedNodeInfo, nodesInfo) { - t.Error("Incorrect nodes info") - } } func TestBalancing(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM, nodeIDRemoteSM1, nodeIDRemoteSM2, nodeIDRunxSM}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, } - nodeManager = newTestNodeManager() - resourceManager = newTestResourceManager() - imageManager = &testImageProvider{} + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) + nodeManager = newTestNodeManager() + resourceManager = newTestResourceManager() + imageManager = newTestImageProvider() ) - nodeManager.nodeInformation = map[string]launcher.NodeInfo{ + nodeInfoProvider.nodeInfo = map[string]cloudprotocol.NodeInfo{ nodeIDLocalSM: { - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, RunnerFeature: []string{runnerRunc}, + NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, + Partitions: []cloudprotocol.PartitionInfo{ + {Name: "storages", Types: []string{aostypes.StoragesPartition}, TotalSize: 1024}, + {Name: "states", Types: []string{aostypes.StatesPartition}, TotalSize: 1024}, + }, }, nodeIDRemoteSM1: { - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunc}, + NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, }, nodeIDRemoteSM2: { - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM2, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunc}, + NodeID: nodeIDRemoteSM2, NodeType: nodeTypeRemoteSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, }, nodeIDRunxSM: { - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRunxSM, NodeType: nodeTypeRunxSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunx}, + NodeID: nodeIDRunxSM, NodeType: nodeTypeRunxSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunx}, + MaxDMIPs: 1000, + TotalRAM: 1024, }, } @@ -444,392 +467,21 @@ func TestBalancing(t *testing.T) { }, } - type testData struct { - nodeResources map[string]aostypes.NodeUnitConfig - serviceConfigs map[string]aostypes.ServiceConfig - desiredInstances []cloudprotocol.InstanceInfo - expectedRunRequests map[string]runRequest - expectedRunStatus unitstatushandler.RunInstancesStatus - } - testItems := []testData{ - // Check node priority and runner: all service instances should be start on higher priority node according to - // supported runner - { - nodeResources: map[string]aostypes.NodeUnitConfig{ - nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, - nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50}, - nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, - }, - serviceConfigs: map[string]aostypes.ServiceConfig{ - service1: {Runner: runnerRunc}, - service2: {Runner: runnerRunc}, - service3: {Runner: runnerRunx}, - }, - desiredInstances: []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2}, - }, - expectedRunRequests: map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - createServiceInfo(service2, 5001, service2LocalURL), - }, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1LocalURL), - createLayerInfo(layer2, layer2LocalURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5001, 3, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, 100), - createInstanceInfo(5002, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - createInstanceInfo(5003, 5, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, 50), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - nodeIDRunxSM: { - services: []aostypes.ServiceInfo{createServiceInfo(service3, 5002, service3RemoteURL)}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5004, 6, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - createInstanceInfo(5005, 7, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, 0), - }, - }, - }, - expectedRunStatus: unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDRunxSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, nodeIDRunxSM, nil), - }, - }, - }, - // Check labels: label low priority service to run on high priority node - { - nodeResources: map[string]aostypes.NodeUnitConfig{ - nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Labels: []string{"label1"}}, - nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50, Labels: []string{"label2"}}, - nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, - }, - serviceConfigs: map[string]aostypes.ServiceConfig{ - service1: {Runner: runnerRunc}, - service2: {Runner: runnerRunc}, - service3: {Runner: runnerRunx}, - }, - desiredInstances: []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2, Labels: []string{"label2"}}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2, Labels: []string{"label1"}}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label1"}}, - }, - expectedRunRequests: map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{createServiceInfo(service2, 5001, service2LocalURL)}, - layers: []aostypes.LayerInfo{createLayerInfo(layer1, layer1LocalURL)}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5002, 2, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - createInstanceInfo(5003, 3, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, 50), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1RemoteURL), - createLayerInfo(layer2, layer2RemoteURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 4, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5001, 5, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, 100), - }, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - nodeIDRunxSM: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - }, - expectedRunStatus: unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, "", errors.New("no node with labels [label1]")), //nolint:goerr113 - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, "", errors.New("no node with labels [label1]")), //nolint:goerr113 - }, - }, - }, - // Check available resources - { - nodeResources: map[string]aostypes.NodeUnitConfig{ - nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Resources: []aostypes.ResourceInfo{ - {Name: "resource1"}, - {Name: "resource3"}, - }}, - nodeTypeRemoteSM: { - NodeType: nodeTypeRemoteSM, Priority: 50, Labels: []string{"label2"}, - Resources: []aostypes.ResourceInfo{ - {Name: "resource1"}, - {Name: "resource2"}, - }, - }, - nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, - }, - serviceConfigs: map[string]aostypes.ServiceConfig{ - service1: {Runner: runnerRunc, Resources: []string{"resource1", "resource2"}}, - service2: {Runner: runnerRunc, Resources: []string{"resource1"}}, - service3: {Runner: runnerRunc, Resources: []string{"resource3"}}, - }, - desiredInstances: []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label2"}}, - }, - expectedRunRequests: map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{createServiceInfo(service2, 5001, service2LocalURL)}, - layers: []aostypes.LayerInfo{createLayerInfo(layer1, layer1LocalURL)}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5002, 2, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - createInstanceInfo(5003, 3, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, 50), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1RemoteURL), - createLayerInfo(layer2, layer2RemoteURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 4, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5001, 5, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, 100), - }, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - nodeIDRunxSM: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - }, - expectedRunStatus: unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, "", errors.New("no node with resources [resource3]")), //nolint:goerr113 - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, "", errors.New("no node with resources [resource3]")), //nolint:goerr113 - }, - }, - }, - // Check available devices - { - nodeResources: map[string]aostypes.NodeUnitConfig{ - nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Devices: []aostypes.DeviceInfo{ - {Name: "dev1", SharedCount: 1}, - {Name: "dev2", SharedCount: 2}, - {Name: "dev3"}, - }}, - nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50, Devices: []aostypes.DeviceInfo{ - {Name: "dev1", SharedCount: 1}, - {Name: "dev2", SharedCount: 3}, - }, Labels: []string{"label2"}}, - nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0, Devices: []aostypes.DeviceInfo{ - {Name: "dev1", SharedCount: 1}, - {Name: "dev2", SharedCount: 2}, - }}, - }, - serviceConfigs: map[string]aostypes.ServiceConfig{ - service1: {Runner: runnerRunc, Devices: []aostypes.ServiceDevice{{Name: "dev1"}, {Name: "dev2"}}}, - service2: {Runner: runnerRunc, Devices: []aostypes.ServiceDevice{{Name: "dev2"}}}, - service3: {Runner: runnerRunc, Devices: []aostypes.ServiceDevice{{Name: "dev3"}}}, - }, - desiredInstances: []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 4}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 3}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label2"}}, - }, - expectedRunRequests: map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - createServiceInfo(service2, 5001, service2LocalURL), - }, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1LocalURL), - createLayerInfo(layer2, layer2LocalURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5003, 3, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1RemoteURL), - createServiceInfo(service2, 5001, service2RemoteURL), - }, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1RemoteURL), - createLayerInfo(layer2, layer2RemoteURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, 100), - createInstanceInfo(5004, 5, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, 50), - createInstanceInfo(5005, 6, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 2, - }, 50), - }, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, - layers: []aostypes.LayerInfo{ - createLayerInfo(layer1, layer1RemoteURL), - createLayerInfo(layer2, layer2RemoteURL), - }, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5002, 7, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 2, - }, 100), - }, - }, - nodeIDRunxSM: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - }, - expectedRunStatus: unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 2, - }, nodeIDRemoteSM2, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 3, - }, "", errors.New("no available device found")), //nolint:goerr113 - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 2, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, "", errors.New("no available device found")), //nolint:goerr113 - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, "", errors.New("no available device found")), //nolint:goerr113 - }, - }, - }, + testItemNodePriority(), + testItemLabels(), + testItemResources(), + testItemDevices(), + testItemStorageRatio(), + testItemStateRatio(), + testItemCPURatio(), + testItemRAMRatio(), } for _, testItem := range testItems { - resourceManager.nodeResources = testItem.nodeResources + t.Logf("Test case: %s", testItem.testCaseName) + + resourceManager.nodeConfigs = testItem.nodeConfigs for serviceID, config := range testItem.serviceConfigs { service := imageManager.services[serviceID] @@ -837,28 +489,30 @@ func TestBalancing(t *testing.T) { imageManager.services[serviceID] = service } - launcherInstance, err := launcher.New(cfg, newTestStorage(), nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) + storage := newTestStorage(testItem.storedInstances) + + launcherInstance, err := launcher.New(cfg, storage, nodeInfoProvider, nodeManager, imageManager, + resourceManager, &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) if err != nil { t.Fatalf("Can't create launcher %v", err) } // Wait initial run status - for nodeID, info := range nodeManager.nodeInformation { + for nodeID, info := range nodeInfoProvider.nodeInfo { nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, } } if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { + launcherInstance.GetRunStatusesChannel(), []cloudprotocol.InstanceStatus{}, time.Second); err != nil { t.Errorf("Incorrect run status: %v", err) } // Run instances - if err := launcherInstance.RunInstances(testItem.desiredInstances, nil); err != nil { + if err := launcherInstance.RunInstances(testItem.desiredInstances, testItem.rebalancing); err != nil { t.Fatalf("Can't run instances %v", err) } @@ -875,102 +529,117 @@ func TestBalancing(t *testing.T) { } } -func TestServiceRevert(t *testing.T) { +func TestRebalancing(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, } - nodeManager = newTestNodeManager() - imageManager = &testImageProvider{} - resourceManager = newTestResourceManager() + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) + nodeManager = newTestNodeManager() + resourceManager = newTestResourceManager() + imageManager = newTestImageProvider() ) - nodeManager.nodeInformation[nodeIDLocalSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, + nodeInfoProvider.nodeInfo = map[string]cloudprotocol.NodeInfo{ + nodeIDLocalSM: { + NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, + Partitions: []cloudprotocol.PartitionInfo{ + {Name: "storages", Types: []string{aostypes.StoragesPartition}, TotalSize: 1024}, + {Name: "states", Types: []string{aostypes.StatesPartition}, TotalSize: 1024}, + }, + }, + nodeIDRemoteSM1: { + NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, + }, + nodeIDRemoteSM2: { + NodeID: nodeIDRemoteSM2, NodeType: nodeTypeRemoteSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, + MaxDMIPs: 1000, + TotalRAM: 1024, + }, } - resourceManager.nodeResources[nodeTypeLocalSM] = aostypes.NodeUnitConfig{NodeType: nodeTypeLocalSM, Priority: 100} imageManager.services = map[string]imagemanager.ServiceInfo{ service1: { ServiceInfo: createServiceInfo(service1, 5000, service1LocalURL), RemoteURL: service1RemoteURL, - Layers: []string{layer1}, }, service2: { ServiceInfo: createServiceInfo(service2, 5001, service2LocalURL), RemoteURL: service2RemoteURL, - Layers: []string{layer2}, }, - } - - imageManager.layers = map[string]imagemanager.LayerInfo{ - layer1: { - LayerInfo: createLayerInfo(layer1, layer1LocalURL), - RemoteURL: layer1RemoteURL, + service3: { + ServiceInfo: createServiceInfo(service3, 5002, service3LocalURL), + RemoteURL: service3RemoteURL, }, } - launcherInstance, err := launcher.New(cfg, newTestStorage(), nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) - if err != nil { - t.Fatalf("Can't create launcher %v", err) + testItems := []testData{ + testItemRebalancing(), + testItemRebalancingPolicy(), + testItemRebalancingPrevNode(), } - // Wait initial run status + for _, testItem := range testItems { + t.Logf("Test case: %s", testItem.testCaseName) - for nodeID, info := range nodeManager.nodeInformation { - nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, + resourceManager.nodeConfigs = testItem.nodeConfigs + nodeManager.monitoring = testItem.monitoring + + for serviceID, config := range testItem.serviceConfigs { + service := imageManager.services[serviceID] + service.Config = config + imageManager.services[serviceID] = service } - } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + storage := newTestStorage(testItem.storedInstances) - // Run instances + launcherInstance, err := launcher.New(cfg, storage, nodeInfoProvider, nodeManager, imageManager, + resourceManager, &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) + if err != nil { + t.Fatalf("Can't create launcher %v", err) + } - desiredInstances := []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2}, - } + // Wait initial run status - if err := launcherInstance.RunInstances(desiredInstances, []string{service2}); err != nil { - t.Fatalf("Can't run instances %v", err) - } + for nodeID, info := range nodeInfoProvider.nodeInfo { + nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ + NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, + } + } - expectedRunStatus := unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, "", errors.New("layer does't exist")), //nolint:goerr113 - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 1, - }, "", errors.New("layer does't exist")), //nolint:goerr113 - }, - ErrorServices: []cloudprotocol.ServiceStatus{ - {ID: service2, AosVersion: 1, Status: cloudprotocol.ErrorStatus}, - }, - } + if err := waitRunInstancesStatus( + launcherInstance.GetRunStatusesChannel(), []cloudprotocol.InstanceStatus{}, time.Second); err != nil { + t.Errorf("Incorrect run status: %v", err) + } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + // Run instances + + if err := launcherInstance.RunInstances(testItem.desiredInstances, testItem.rebalancing); err != nil { + t.Fatalf("Can't run instances %v", err) + } + + if err := waitRunInstancesStatus( + launcherInstance.GetRunStatusesChannel(), testItem.expectedRunStatus, time.Second); err != nil { + t.Errorf("Incorrect run status: %v", err) + } + + if err := nodeManager.compareRunRequests(testItem.expectedRunRequests); err != nil { + t.Errorf("Incorrect run request: %v", err) + } - if !reflect.DeepEqual([]string{service2}, imageManager.revertedServices) { - t.Errorf("Incorrect reverted services: %v", imageManager.revertedServices) + launcherInstance.Close() } } @@ -978,59 +647,60 @@ func TestStorageCleanup(t *testing.T) { var ( cfg = &config.Config{ SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM, nodeIDRunxSM}, NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, }, } + nodeInfoProvider = newTestNodeInfoProvider(nodeIDLocalSM) nodeManager = newTestNodeManager() resourceManager = newTestResourceManager() - imageManager = &testImageProvider{} + imageManager = newTestImageProvider() stateStorageProvider = &testStateStorage{} ) - nodeManager.nodeInformation[nodeIDLocalSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, - RunnerFeature: []string{runnerRunc}, + nodeInfoProvider.nodeInfo[nodeIDLocalSM] = cloudprotocol.NodeInfo{ + NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunc}, } - resourceManager.nodeResources[nodeTypeLocalSM] = aostypes.NodeUnitConfig{Priority: 100} + resourceManager.nodeConfigs[nodeTypeLocalSM] = cloudprotocol.NodeConfig{Priority: 100} - nodeManager.nodeInformation[nodeIDRunxSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeRunxSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunx}, + nodeInfoProvider.nodeInfo[nodeIDRunxSM] = cloudprotocol.NodeInfo{ + NodeID: nodeIDRunxSM, NodeType: nodeTypeRunxSM, + Status: cloudprotocol.NodeStatusProvisioned, + Attrs: map[string]interface{}{cloudprotocol.NodeAttrRunners: runnerRunx}, } - resourceManager.nodeResources[nodeTypeRunxSM] = aostypes.NodeUnitConfig{Priority: 0} + resourceManager.nodeConfigs[nodeTypeRunxSM] = cloudprotocol.NodeConfig{Priority: 0} imageManager.services = map[string]imagemanager.ServiceInfo{ service1: { ServiceInfo: createServiceInfo(service1, 5000, service1LocalURL), - RemoteURL: service1RemoteURL, Config: aostypes.ServiceConfig{Runner: runnerRunc}, + RemoteURL: service1RemoteURL, Config: aostypes.ServiceConfig{Runners: []string{runnerRunc}}, }, service2: { ServiceInfo: createServiceInfo(service2, 5001, service2LocalURL), - RemoteURL: service2RemoteURL, Config: aostypes.ServiceConfig{Runner: runnerRunc}, + RemoteURL: service2RemoteURL, Config: aostypes.ServiceConfig{Runners: []string{runnerRunc}}, }, service3: { ServiceInfo: createServiceInfo(service3, 5002, service3LocalURL), - RemoteURL: service3RemoteURL, Config: aostypes.ServiceConfig{Runner: runnerRunx}, + RemoteURL: service3RemoteURL, Config: aostypes.ServiceConfig{Runners: []string{runnerRunx}}, }, } - launcherInstance, err := launcher.New(cfg, newTestStorage(), nodeManager, imageManager, resourceManager, - stateStorageProvider, newTestNetworkManager("172.17.0.1/16")) + launcherInstance, err := launcher.New(cfg, newTestStorage(nil), nodeInfoProvider, nodeManager, imageManager, + resourceManager, stateStorageProvider, newTestNetworkManager("172.17.0.1/16")) if err != nil { t.Fatalf("Can't create launcher %v", err) } defer launcherInstance.Close() - for nodeID, info := range nodeManager.nodeInformation { + for nodeID, info := range nodeInfoProvider.nodeInfo { nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, } } if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { + launcherInstance.GetRunStatusesChannel(), []cloudprotocol.InstanceStatus{}, time.Second); err != nil { t.Errorf("Incorrect run status: %v", err) } @@ -1040,7 +710,7 @@ func TestStorageCleanup(t *testing.T) { {ServiceID: service3, SubjectID: subject1, Priority: 100, NumInstances: 1}, } - if err := launcherInstance.RunInstances(desiredInstances, nil); err != nil { + if err := launcherInstance.RunInstances(desiredInstances, false); err != nil { t.Fatalf("Can't run instances %v", err) } @@ -1075,26 +745,24 @@ func TestStorageCleanup(t *testing.T) { }, } - expectedRunStatus := unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 1, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDRunxSM, nil), - }, + expectedRunStatus := []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, nodeIDRunxSM, nil), } if err := waitRunInstancesStatus( launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) + t.Errorf("Error waiting for run instances status: %v", err) } if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { @@ -1105,7 +773,7 @@ func TestStorageCleanup(t *testing.T) { {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1}, } - expectedRunStatus.Instances = []cloudprotocol.InstanceStatus{ + expectedRunStatus = []cloudprotocol.InstanceStatus{ createInstanceStatus(aostypes.InstanceIdent{ ServiceID: service1, SubjectID: subject1, Instance: 0, }, nodeIDLocalSM, nil), @@ -1117,7 +785,7 @@ func TestStorageCleanup(t *testing.T) { {ServiceID: service3, SubjectID: subject1, Instance: 0}, } - if err := launcherInstance.RunInstances(desiredInstances, []string{}); err != nil { + if err := launcherInstance.RunInstances(desiredInstances, false); err != nil { t.Fatalf("Can't run instances %v", err) } @@ -1126,1032 +794,1383 @@ func TestStorageCleanup(t *testing.T) { t.Errorf("Incorrect run status: %v", err) } - if !reflect.DeepEqual(expectedCleanInstances, stateStorageProvider.cleanedInstances) { - t.Errorf("Incorrect state storage cleanup: %v", stateStorageProvider.cleanedInstances) + if err := deepSlicesCompare(expectedCleanInstances, stateStorageProvider.cleanedInstances); err != nil { + t.Errorf("Incorrect state storage cleanup: %v", err) } } -func TestRebalancing(t *testing.T) { - var ( - cfg = &config.Config{ - SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM, nodeIDRemoteSM1, nodeIDRemoteSM2}, - NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, - }, - } - nodeManager = newTestNodeManager() - resourceManager = newTestResourceManager() - imageManager = &testImageProvider{} - ) +/*********************************************************************************************************************** + * Interfaces + **********************************************************************************************************************/ - nodeManager.nodeInformation[nodeIDLocalSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, RunnerFeature: []string{runnerRunc, "crun"}, +// testNodeInfoProvider + +func newTestNodeInfoProvider(nodeID string) *testNodeInfoProvider { + return &testNodeInfoProvider{ + nodeID: nodeID, + nodeInfo: make(map[string]cloudprotocol.NodeInfo), } +} - resourceManager.nodeResources[nodeTypeLocalSM] = aostypes.NodeUnitConfig{ - Priority: 100, - NodeType: nodeTypeLocalSM, Devices: []aostypes.DeviceInfo{ - {Name: "dev1", SharedCount: 1}, - }, +func (provider *testNodeInfoProvider) GetAllNodeIDs() (nodeIDs []string, err error) { + if provider.nodeInfo == nil { + return nil, aoserrors.New("node info not found") } - nodeManager.nodeInformation[nodeIDRemoteSM1] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunc}, + nodeIDs = make([]string, 0, len(provider.nodeInfo)) + for nodeID := range provider.nodeInfo { + nodeIDs = append(nodeIDs, nodeID) } - nodeManager.nodeInformation[nodeIDRemoteSM2] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM2, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, RunnerFeature: []string{runnerRunc}, + return nodeIDs, nil +} + +func (provider *testNodeInfoProvider) GetNodeID() string { + return provider.nodeID +} + +func (provider *testNodeInfoProvider) GetNodeInfo(nodeID string) (cloudprotocol.NodeInfo, error) { + nodeInfo, ok := provider.nodeInfo[nodeID] + if !ok { + return cloudprotocol.NodeInfo{}, aoserrors.New("node info not found") } - resourceManager.nodeResources[nodeTypeRemoteSM] = aostypes.NodeUnitConfig{ - Priority: 50, - NodeType: nodeTypeRemoteSM, - Devices: []aostypes.DeviceInfo{ - {Name: "dev1", SharedCount: 2}, - }, - Resources: []aostypes.ResourceInfo{{Name: "resource1"}}, + return nodeInfo, nil +} + +// testNodeManager + +func newTestNodeManager() *testNodeManager { + nodeManager := &testNodeManager{ + runStatusChan: make(chan launcher.NodeRunInstanceStatus, 10), + runRequest: make(map[string]runRequest), + monitoring: make(map[string]aostypes.NodeMonitoring), } - launcherInstance, err := launcher.New(cfg, newTestStorage(), nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) - if err != nil { - t.Fatalf("Can't create launcher %v", err) + return nodeManager +} + +func (nodeManager *testNodeManager) RunInstances(nodeID string, + services []aostypes.ServiceInfo, layers []aostypes.LayerInfo, instances []aostypes.InstanceInfo, forceRestart bool, +) error { + nodeManager.runRequest[nodeID] = runRequest{ + services: services, layers: layers, instances: instances, + forceRestart: forceRestart, } - defer launcherInstance.Close() - for nodeID, info := range nodeManager.nodeInformation { - nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, - } + successStatus := launcher.NodeRunInstanceStatus{ + NodeID: nodeID, + Instances: make([]cloudprotocol.InstanceStatus, len(instances)), } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) + for i, instance := range instances { + successStatus.Instances[i] = cloudprotocol.InstanceStatus{ + InstanceIdent: instance.InstanceIdent, + ServiceVersion: "1.0", + Status: cloudprotocol.InstanceStateActive, NodeID: nodeID, + } } - imageManager.services = map[string]imagemanager.ServiceInfo{ - service1: { - ServiceInfo: createServiceInfo(service1, 5000, service1LocalURL), - RemoteURL: service1RemoteURL, - Config: aostypes.ServiceConfig{ - Runner: runnerRunc, - Resources: []string{"resource1"}, - }, - }, - service2: { - ServiceInfo: createServiceInfo(service2, 5001, service1LocalURL), - RemoteURL: service2RemoteURL, - Config: aostypes.ServiceConfig{ - Runner: runnerRunc, - }, - }, - service3: { - ServiceInfo: createServiceInfo(service3, 5002, service3LocalURL), - RemoteURL: service3RemoteURL, - Config: aostypes.ServiceConfig{ - Runner: runnerRunc, - Devices: []aostypes.ServiceDevice{ - {Name: "dev1"}, - }, - }, - }, - } + nodeManager.runStatusChan <- successStatus - desiredInstances := []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1}, - {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 1}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 3}, - } + return nil +} - expectedRunRequests := map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service1LocalURL), - createServiceInfo(service3, 5002, service3LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 2, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1RemoteURL), - createServiceInfo(service3, 5002, service3RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 4, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5003, 5, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, 0), - createInstanceInfo(5004, 6, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 2, - }, 0), - }, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{}, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{}, - }, - } +func (nodeManager *testNodeManager) GetRunInstancesStatusChannel() <-chan launcher.NodeRunInstanceStatus { + return nodeManager.runStatusChan +} - expectedRunStatus := unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 2, - }, nodeIDRemoteSM1, nil), - }, - } +func (nodeManager *testNodeManager) GetUpdateInstancesStatusChannel() <-chan []cloudprotocol.InstanceStatus { + return nil +} - if err := launcherInstance.RunInstances(desiredInstances, []string{}); err != nil { - t.Fatalf("Can't run instances %v", err) +func (nodeManager *testNodeManager) GetAverageMonitoring(nodeID string) (aostypes.NodeMonitoring, error) { + monitoring, ok := nodeManager.monitoring[nodeID] + if ok { + return monitoring, nil } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + return aostypes.NodeMonitoring{}, nil +} - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) - } +func (nodeManager *testNodeManager) compareRunRequests(expectedRunRequests map[string]runRequest) error { + for nodeID, runRequest := range nodeManager.runRequest { + if err := deepSlicesCompare(expectedRunRequests[nodeID].services, runRequest.services); err != nil { + return aoserrors.Errorf("incorrect services for node %s: %v", nodeID, err) + } - nodeManager.alertsChannel <- cloudprotocol.SystemQuotaAlert{NodeID: nodeIDLocalSM, Parameter: "cpu"} + if err := deepSlicesCompare(expectedRunRequests[nodeID].layers, runRequest.layers); err != nil { + return aoserrors.Errorf("incorrect layers for node %s: %v", nodeID, err) + } - expectedRunRequests = map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service1LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 2, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 50), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1RemoteURL), - createServiceInfo(service3, 5002, service3RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 4, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5003, 5, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, 0), - createInstanceInfo(5004, 6, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 2, - }, 0), - }, - }, - nodeIDRemoteSM2: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service3, 5002, service3RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, - }, - } + if err := deepSlicesCompare(expectedRunRequests[nodeID].instances, runRequest.instances); err != nil { + return aoserrors.Errorf("incorrect instances for node %s: %v", nodeID, err) + } - expectedRunStatus = unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 1, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 2, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM2, nil), - }, + if expectedRunRequests[nodeID].forceRestart { + return aoserrors.Errorf("incorrect force restart flag") + } } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + return nil +} - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("incorrect run request: %v", err) +// testResourceManager + +func newTestResourceManager() *testResourceManager { + resourceManager := &testResourceManager{ + nodeConfigs: make(map[string]cloudprotocol.NodeConfig), } - nodeManager.alertsChannel <- cloudprotocol.SystemQuotaAlert{NodeID: nodeIDRemoteSM2, Parameter: "cpu"} + return resourceManager +} - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err == nil || - !strings.Contains(err.Error(), "message timeout") { - t.Error("Timeout expected") - } +func (resourceManager *testResourceManager) GetNodeConfig(nodeID, nodeType string) (cloudprotocol.NodeConfig, error) { + resource := resourceManager.nodeConfigs[nodeType] + resource.NodeType = nodeType + + return resource, nil } -func TestRebalancingSameNodePriority(t *testing.T) { - var ( - cfg = &config.Config{ - SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM, nodeIDRemoteSM1}, - NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, - }, - } - nodeManager = newTestNodeManager() - resourceManager = newTestResourceManager() - imageManager = &testImageProvider{} - storage = newTestStorage() - ) +// testStorage - nodeManager.nodeInformation[nodeIDLocalSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, - } - resourceManager.nodeResources[nodeTypeLocalSM] = aostypes.NodeUnitConfig{ - NodeType: nodeTypeLocalSM, - Labels: []string{"label1"}, +func newTestStorage(instances []launcher.InstanceInfo) *testStorage { + storage := &testStorage{ + instanceInfo: make(map[aostypes.InstanceIdent]*launcher.InstanceInfo), } - nodeManager.nodeInformation[nodeIDRemoteSM1] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, - } - resourceManager.nodeResources[nodeTypeRemoteSM] = aostypes.NodeUnitConfig{ - NodeType: nodeTypeRemoteSM, - Labels: []string{"label2"}, + for _, instance := range instances { + storage.instanceInfo[instance.InstanceIdent] = &launcher.InstanceInfo{} + *storage.instanceInfo[instance.InstanceIdent] = instance } - launcherInstance, err := launcher.New(cfg, storage, nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) - if err != nil { - t.Fatalf("Can't create launcher %v", err) - } - defer launcherInstance.Close() + return storage +} - for nodeID, info := range nodeManager.nodeInformation { - nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, - } +func (storage *testStorage) AddInstance(instanceInfo launcher.InstanceInfo) error { + if _, ok := storage.instanceInfo[instanceInfo.InstanceIdent]; ok { + return aoserrors.New("instance already exist") } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + storage.instanceInfo[instanceInfo.InstanceIdent] = &instanceInfo - imageManager.services = map[string]imagemanager.ServiceInfo{ - service1: { - ServiceInfo: createServiceInfo(service1, 5000, service1LocalURL), - RemoteURL: service1RemoteURL, - }, - service2: { - ServiceInfo: createServiceInfo(service2, 5001, service2LocalURL), - RemoteURL: service2RemoteURL, - }, - service3: { - ServiceInfo: createServiceInfo(service3, 5002, service3LocalURL), - RemoteURL: service3RemoteURL, - }, - } + return nil +} - desiredInstances := []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1, Labels: []string{"label1"}}, - {ServiceID: service2, SubjectID: subject1, Priority: 100, NumInstances: 1, Labels: []string{"label2"}}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 1}, +func (storage *testStorage) UpdateInstance(instanceInfo launcher.InstanceInfo) error { + if _, ok := storage.instanceInfo[instanceInfo.InstanceIdent]; !ok { + return launcher.ErrNotExist } - expectedRunRequests := map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - createServiceInfo(service3, 5002, service3LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service2RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 100), - }, - }, - } + storage.instanceInfo[instanceInfo.InstanceIdent] = &instanceInfo - expectedRunStatus := unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - }, - } + return nil +} - if err := launcherInstance.RunInstances(desiredInstances, []string{}); err != nil { - t.Fatalf("Can't run instances %v", err) +func (storage *testStorage) GetInstance(instanceIdent aostypes.InstanceIdent) (launcher.InstanceInfo, error) { + instanceInfo, ok := storage.instanceInfo[instanceIdent] + if !ok { + return launcher.InstanceInfo{}, launcher.ErrNotExist } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) + return *instanceInfo, nil +} + +func (storage *testStorage) GetInstances() ([]launcher.InstanceInfo, error) { + instances := make([]launcher.InstanceInfo, 0, len(storage.instanceInfo)) + + for _, instanceInfo := range storage.instanceInfo { + instances = append(instances, *instanceInfo) } - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) + return instances, nil +} + +func (storage *testStorage) RemoveInstance(instanceIdent aostypes.InstanceIdent) error { + if _, ok := storage.instanceInfo[instanceIdent]; !ok { + return launcher.ErrNotExist } - nodeManager.alertsChannel <- cloudprotocol.SystemQuotaAlert{NodeID: nodeIDLocalSM, Parameter: "cpu"} + delete(storage.instanceInfo, instanceIdent) - expectedRunRequests = map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service2RemoteURL), - createServiceInfo(service3, 5002, service3RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, - }, - } + return nil +} - expectedRunStatus = unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - }, - } +// testStateStorage - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } +func (provider *testStateStorage) Setup( + params storagestate.SetupParams, +) (storagePath string, statePath string, err error) { + return "", "", nil +} - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) - } +func (provider *testStateStorage) Cleanup(instanceIdent aostypes.InstanceIdent) error { + provider.cleanedInstances = append(provider.cleanedInstances, instanceIdent) - nodeManager.alertsChannel <- cloudprotocol.SystemQuotaAlert{NodeID: nodeIDRemoteSM1, Parameter: "cpu"} + return nil +} - expectedRunRequests = map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - createServiceInfo(service3, 5002, service3LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, - }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service2RemoteURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 100), - }, - }, - } +func (provider *testStateStorage) GetInstanceCheckSum(instance aostypes.InstanceIdent) string { + return magicSum +} - expectedRunStatus = unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, nodeIDLocalSM, nil), - createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), - }, +func (provider *testStateStorage) RemoveServiceInstance(instanceIdent aostypes.InstanceIdent) error { + provider.removedInstances = append(provider.removedInstances, instanceIdent) + + return nil +} + +// testImageProvider + +func newTestImageProvider() *testImageProvider { + return &testImageProvider{ + services: make(map[string]imagemanager.ServiceInfo), + layers: make(map[string]imagemanager.LayerInfo), + removeServiceInstancesChannel: make(chan string, 1), } +} - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) +func (testProvider *testImageProvider) GetServiceInfo(serviceID string) (imagemanager.ServiceInfo, error) { + if service, ok := testProvider.services[serviceID]; ok { + return service, nil } - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) + return imagemanager.ServiceInfo{}, errors.New("service does't exist") //nolint:goerr113 +} + +func (testProvider *testImageProvider) GetLayerInfo(digest string) (imagemanager.LayerInfo, error) { + if layer, ok := testProvider.layers[digest]; ok { + return layer, nil } + + return imagemanager.LayerInfo{}, errors.New("layer does't exist") //nolint:goerr113 } -func TestRebalancingAfterRestart(t *testing.T) { - var ( - cfg = &config.Config{ - SMController: config.SMController{ - NodeIDs: []string{nodeIDLocalSM, nodeIDRemoteSM1}, - NodesConnectionTimeout: aostypes.Duration{Duration: time.Second}, - }, - } - nodeManager = newTestNodeManager() - resourceManager = newTestResourceManager() - imageManager = &testImageProvider{} - storage = newTestStorage() - ) +func (testProvider *testImageProvider) GetRemoveServiceChannel() (channel <-chan string) { + return testProvider.removeServiceInstancesChannel +} - nodeManager.nodeInformation[nodeIDLocalSM] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDLocalSM, NodeType: nodeTypeLocalSM}, - RemoteNode: false, - } - resourceManager.nodeResources[nodeTypeLocalSM] = aostypes.NodeUnitConfig{ - NodeType: nodeTypeLocalSM, - Labels: []string{"label1"}, - } +// testNetworkManager - nodeManager.nodeInformation[nodeIDRemoteSM1] = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{NodeID: nodeIDRemoteSM1, NodeType: nodeTypeRemoteSM}, - RemoteNode: true, +func newTestNetworkManager(network string) *testNetworkManager { + networkManager := &testNetworkManager{ + networkInfo: make(map[string]map[aostypes.InstanceIdent]struct{}), } - resourceManager.nodeResources[nodeTypeRemoteSM] = aostypes.NodeUnitConfig{ - NodeType: nodeTypeRemoteSM, - Labels: []string{"label2"}, + + if len(network) != 0 { + ip, ipNet, err := net.ParseCIDR(network) + if err != nil { + log.Fatalf("Can't parse CIDR: %v", err) + } + + networkManager.currentIP = ip + networkManager.subnet = *ipNet } - launcherInstance, err := launcher.New(cfg, storage, nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) - if err != nil { - t.Fatalf("Can't create launcher %v", err) + return networkManager +} + +func (network *testNetworkManager) UpdateProviderNetwork(providers []string, nodeID string) error { + return nil +} + +func (network *testNetworkManager) PrepareInstanceNetworkParameters( + instanceIdent aostypes.InstanceIdent, networkID string, + params networkmanager.NetworkParameters, +) (aostypes.NetworkParameters, error) { + if len(network.networkInfo[networkID]) == 0 { + network.networkInfo[networkID] = make(map[aostypes.InstanceIdent]struct{}) } - for nodeID, info := range nodeManager.nodeInformation { - nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, + network.currentIP = cidr.Inc(network.currentIP) + + network.networkInfo[networkID][instanceIdent] = struct{}{} + + return aostypes.NetworkParameters{ + IP: network.currentIP.String(), + Subnet: network.subnet.String(), + DNSServers: []string{"10.10.0.1"}, + }, nil +} + +func (network *testNetworkManager) RemoveInstanceNetworkParameters( + instanceIdent aostypes.InstanceIdent, networkID string, +) { + delete(network.networkInfo[networkID], instanceIdent) +} + +func (network *testNetworkManager) GetInstances() (instances []aostypes.InstanceIdent) { + for networkID := range network.networkInfo { + for instanceIdent := range network.networkInfo[networkID] { + instances = append(instances, instanceIdent) } } - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } + return instances +} - imageManager.services = map[string]imagemanager.ServiceInfo{ - service1: { - ServiceInfo: createServiceInfo(service1, 5000, service1LocalURL), - RemoteURL: service1RemoteURL, - }, - service2: { - ServiceInfo: createServiceInfo(service2, 5001, service2LocalURL), - RemoteURL: service2RemoteURL, - }, - service3: { - ServiceInfo: createServiceInfo(service3, 5002, service3LocalURL), - RemoteURL: service3RemoteURL, - }, - } +func (network *testNetworkManager) RestartDNSServer() error { + return nil +} - desiredInstances := []cloudprotocol.InstanceInfo{ - {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1, Labels: []string{"label1"}}, - {ServiceID: service2, SubjectID: subject1, Priority: 100, NumInstances: 1, Labels: []string{"label2"}}, - {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 1}, - } +/*********************************************************************************************************************** + * Balancing test items + **********************************************************************************************************************/ - expectedRunRequests := map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), - createServiceInfo(service3, 5002, service3LocalURL), - }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), - }, +func testItemNodePriority() testData { + return testData{ + testCaseName: "node priority", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50}, + nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service2RemoteURL), + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: {Runners: []string{runnerRunc}}, + service2: {Runners: []string{runnerRunc}}, + service3: {Runners: []string{runnerRunx}}, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + createServiceInfo(service2, 5001, service2LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + createInstanceInfo(5003, 5, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, 50), + }, }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 100), + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + nodeIDRunxSM: { + services: []aostypes.ServiceInfo{createServiceInfo(service3, 5002, service3RemoteURL)}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5004, 6, aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, 0), + createInstanceInfo(5005, 7, aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 1, + }, 0), + }, }, }, - } - - expectedRunStatus := unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ + expectedRunStatus: []cloudprotocol.InstanceStatus{ createInstanceStatus(aostypes.InstanceIdent{ ServiceID: service1, SubjectID: subject1, Instance: 0, }, nodeIDLocalSM, nil), createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, + ServiceID: service1, SubjectID: subject1, Instance: 1, }, nodeIDLocalSM, nil), createInstanceStatus(aostypes.InstanceIdent{ ServiceID: service2, SubjectID: subject1, Instance: 0, - }, nodeIDRemoteSM1, nil), + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, nodeIDRunxSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 1, + }, nodeIDRunxSM, nil), }, } +} - if err := launcherInstance.RunInstances(desiredInstances, []string{}); err != nil { - t.Fatalf("Can't run instances %v", err) - } - - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } - - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) - } - - launcherInstance.Close() - - // Restart - - launcherInstance, err = launcher.New(cfg, storage, nodeManager, imageManager, resourceManager, - &testStateStorage{}, newTestNetworkManager("172.17.0.1/16")) - if err != nil { - t.Fatalf("Can't create launcher %v", err) - } - - for nodeID, info := range nodeManager.nodeInformation { - nodeManager.runStatusChan <- launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: info.NodeType, Instances: []cloudprotocol.InstanceStatus{}, - } +func testItemLabels() testData { + return testData{ + testCaseName: "labels", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Labels: []string{"label1"}}, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50, Labels: []string{"label2"}}, + nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: {Runners: []string{runnerRunc}}, + service2: {Runners: []string{runnerRunc}}, + service3: {Runners: []string{runnerRunx}}, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2, Labels: []string{"label2"}}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2, Labels: []string{"label1"}}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label1"}}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{createServiceInfo(service2, 5001, service2LocalURL)}, + layers: []aostypes.LayerInfo{createLayerInfo(layer1, layer1LocalURL)}, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 2, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + createInstanceInfo(5003, 3, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, 50), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + nodeIDRunxSM: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, "", errors.New("no nodes with labels [label1]")), //nolint:goerr113 + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 1, + }, "", errors.New("no nodes with labels [label1]")), //nolint:goerr113 + }, } +} - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), unitstatushandler.RunInstancesStatus{}, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) +func testItemResources() testData { + return testData{ + testCaseName: "resources", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Resources: []cloudprotocol.ResourceInfo{ + {Name: "resource1"}, + {Name: "resource3"}, + }}, + nodeTypeRemoteSM: { + NodeType: nodeTypeRemoteSM, Priority: 50, Labels: []string{"label2"}, + Resources: []cloudprotocol.ResourceInfo{ + {Name: "resource1"}, + {Name: "resource2"}, + }, + }, + nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: {Runners: []string{runnerRunc}, Resources: []string{"resource1", "resource2"}}, + service2: {Runners: []string{runnerRunc}, Resources: []string{"resource1"}}, + service3: {Runners: []string{runnerRunc}, Resources: []string{"resource3"}}, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 2}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 2}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label2"}}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{createServiceInfo(service2, 5001, service2LocalURL)}, + layers: []aostypes.LayerInfo{createLayerInfo(layer1, layer1LocalURL)}, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 2, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + createInstanceInfo(5003, 3, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, 50), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + nodeIDRunxSM: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, "", errors.New("no nodes with resources [resource3]")), //nolint:goerr113 + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 1, + }, "", errors.New("no nodes with resources [resource3]")), //nolint:goerr113 + }, } +} - nodeManager.alertsChannel <- cloudprotocol.SystemQuotaAlert{NodeID: nodeIDLocalSM, Parameter: "cpu"} - - expectedRunRequests = map[string]runRequest{ - nodeIDLocalSM: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service1, 5000, service1LocalURL), +func testItemDevices() testData { + return testData{ + testCaseName: "devices", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100, Devices: []cloudprotocol.DeviceInfo{ + {Name: "dev1", SharedCount: 1}, + {Name: "dev2", SharedCount: 2}, + {Name: "dev3"}, + }}, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50, Devices: []cloudprotocol.DeviceInfo{ + {Name: "dev1", SharedCount: 1}, + {Name: "dev2", SharedCount: 3}, + }, Labels: []string{"label2"}}, + nodeTypeRunxSM: {NodeType: nodeTypeRunxSM, Priority: 0, Devices: []cloudprotocol.DeviceInfo{ + {Name: "dev1", SharedCount: 1}, + {Name: "dev2", SharedCount: 2}, + }}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Runners: []string{runnerRunc}, + Devices: []aostypes.ServiceDevice{{Name: "dev1"}, {Name: "dev2"}}, }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5000, 2, aostypes.InstanceIdent{ - ServiceID: service1, SubjectID: subject1, Instance: 0, - }, 100), + service2: { + Runners: []string{runnerRunc}, + Devices: []aostypes.ServiceDevice{{Name: "dev2"}}, + }, + service3: { + Runners: []string{runnerRunc}, + Devices: []aostypes.ServiceDevice{{Name: "dev3"}}, }, }, - nodeIDRemoteSM1: { - services: []aostypes.ServiceInfo{ - createServiceInfo(service2, 5001, service2RemoteURL), - createServiceInfo(service3, 5002, service3RemoteURL), + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 4}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 3}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 2, Labels: []string{"label2"}}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + createServiceInfo(service2, 5001, service2LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5003, 3, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + }, }, - layers: []aostypes.LayerInfo{}, - instances: []aostypes.InstanceInfo{ - createInstanceInfo(5001, 4, aostypes.InstanceIdent{ - ServiceID: service2, SubjectID: subject1, Instance: 0, - }, 100), - createInstanceInfo(5002, 3, aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, - }, 0), + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1RemoteURL), + createServiceInfo(service2, 5001, service2RemoteURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5001, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + createInstanceInfo(5004, 5, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, + }, 50), + createInstanceInfo(5005, 6, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 2, + }, 50), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{createServiceInfo(service1, 5000, service1RemoteURL)}, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 7, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, 100), + }, + }, + nodeIDRunxSM: { + services: []aostypes.ServiceInfo{}, + layers: []aostypes.LayerInfo{}, + instances: []aostypes.InstanceInfo{}, }, }, - } - - expectedRunStatus = unitstatushandler.RunInstancesStatus{ - Instances: []cloudprotocol.InstanceStatus{ + expectedRunStatus: []cloudprotocol.InstanceStatus{ createInstanceStatus(aostypes.InstanceIdent{ ServiceID: service1, SubjectID: subject1, Instance: 0, }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, nodeIDRemoteSM2, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, "", errors.New("no nodes with devices")), //nolint:goerr113 createInstanceStatus(aostypes.InstanceIdent{ ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 1, }, nodeIDRemoteSM1, nil), createInstanceStatus(aostypes.InstanceIdent{ - ServiceID: service3, SubjectID: subject1, Instance: 0, + ServiceID: service2, SubjectID: subject1, Instance: 2, }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, "", errors.New("no nodes with devices")), //nolint:goerr113 + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 1, + }, "", errors.New("no nodes with devices")), //nolint:goerr113 }, } - - if err := waitRunInstancesStatus( - launcherInstance.GetRunStatusesChannel(), expectedRunStatus, time.Second); err != nil { - t.Errorf("Incorrect run status: %v", err) - } - - if err := nodeManager.compareRunRequests(expectedRunRequests); err != nil { - t.Errorf("Incorrect run request: %v", err) - } } -/*********************************************************************************************************************** - * Interfaces - **********************************************************************************************************************/ - -// testNodeManager - -func newTestNodeManager() *testNodeManager { - nodeManager := &testNodeManager{ - runStatusChan: make(chan launcher.NodeRunInstanceStatus, 10), - nodeInformation: make(map[string]launcher.NodeInfo), - runRequest: make(map[string]runRequest), - alertsChannel: make(chan cloudprotocol.SystemQuotaAlert, 10), - } - - return nodeManager -} - -func (nodeManager *testNodeManager) GetNodeConfiguration(nodeID string) (launcher.NodeInfo, error) { - config, ok := nodeManager.nodeInformation[nodeID] - if !ok { - return launcher.NodeInfo{}, aoserrors.New("node config doesn't exist") - } - - config.NodeID = nodeID - - return config, nil -} - -func (nodeManager *testNodeManager) RunInstances(nodeID string, - services []aostypes.ServiceInfo, layers []aostypes.LayerInfo, instances []aostypes.InstanceInfo, forceRestart bool, -) error { - nodeManager.runRequest[nodeID] = runRequest{ - services: services, layers: layers, instances: instances, - forceRestart: forceRestart, - } - - successStatus := launcher.NodeRunInstanceStatus{ - NodeID: nodeID, - Instances: make([]cloudprotocol.InstanceStatus, len(instances)), - } - - for i, instance := range instances { - successStatus.Instances[i] = cloudprotocol.InstanceStatus{ - InstanceIdent: instance.InstanceIdent, - AosVersion: 1, - RunState: cloudprotocol.InstanceStateActive, NodeID: nodeID, - } - } - - nodeManager.runStatusChan <- successStatus - - return nil -} - -func (nodeManager *testNodeManager) GetRunInstancesStatusChannel() <-chan launcher.NodeRunInstanceStatus { - return nodeManager.runStatusChan -} - -func (nodeManager *testNodeManager) GetUpdateInstancesStatusChannel() <-chan []cloudprotocol.InstanceStatus { - return nil -} - -func (nodeManager *testNodeManager) GetSystemLimitAlertChannel() <-chan cloudprotocol.SystemQuotaAlert { - return nodeManager.alertsChannel -} - -func (nodeManager *testNodeManager) GetNodeMonitoringData(nodeID string) (cloudprotocol.NodeMonitoringData, error) { - return cloudprotocol.NodeMonitoringData{}, nil -} - -func (nodeManager *testNodeManager) compareRunRequests(expectedRunRequests map[string]runRequest) error { - for nodeID, runRequest := range nodeManager.runRequest { - if err := deepSlicesCompare(expectedRunRequests[nodeID].services, runRequest.services); err != nil { - return aoserrors.Errorf("incorrect services for node %s: %v", nodeID, err) - } - - if err := deepSlicesCompare(expectedRunRequests[nodeID].layers, runRequest.layers); err != nil { - return aoserrors.Errorf("incorrect layers for node %s: %v", nodeID, err) - } - - if err := deepSlicesCompare(expectedRunRequests[nodeID].instances, runRequest.instances); err != nil { - return aoserrors.Errorf("incorrect instances for node %s: %v", nodeID, err) - } - - if expectedRunRequests[nodeID].forceRestart { - return aoserrors.Errorf("incorrect force restart flag") - } - } - - return nil -} - -// testResourceManager - -func newTestResourceManager() *testResourceManager { - resourceManager := &testResourceManager{ - nodeResources: make(map[string]aostypes.NodeUnitConfig), - } - - return resourceManager -} - -func (resourceManager *testResourceManager) GetUnitConfiguration(nodeType string) aostypes.NodeUnitConfig { - resource := resourceManager.nodeResources[nodeType] - resource.NodeType = nodeType - - return resource -} - -// testStorage - -func newTestStorage() *testStorage { - return &testStorage{ - desiredInstances: json.RawMessage("[]"), - nodeState: make(map[string]json.RawMessage), - services: make(map[string][]imagemanager.ServiceInfo), - } -} - -func (storage *testStorage) AddInstance(instanceInfo launcher.InstanceInfo) error { - for _, uid := range storage.instanceInfo { - if uid.InstanceIdent == instanceInfo.InstanceIdent { - return aoserrors.New("uid for instance already exist") - } - } - - storage.instanceInfo = append(storage.instanceInfo, instanceInfo) - - return nil -} - -func (storage *testStorage) GetInstanceUID(instance aostypes.InstanceIdent) (int, error) { - for _, instanceInfo := range storage.instanceInfo { - if instanceInfo.InstanceIdent == instance { - return instanceInfo.UID, nil - } - } - - return 0, launcher.ErrNotExist -} - -func (storage *testStorage) GetInstances() ([]launcher.InstanceInfo, error) { - instances := make([]launcher.InstanceInfo, len(storage.instanceInfo)) - copy(instances, storage.instanceInfo) - - return instances, nil -} - -func (storage *testStorage) RemoveInstance(instanceIdent aostypes.InstanceIdent) error { - for i, instanceInfo := range storage.instanceInfo { - if instanceInfo.InstanceIdent == instanceIdent { - storage.instanceInfo = append(storage.instanceInfo[:i], storage.instanceInfo[i+1:]...) - - return nil - } - } - - return launcher.ErrNotExist -} - -func (storage *testStorage) SetDesiredInstances(instances json.RawMessage) error { - storage.desiredInstances = instances - return nil -} - -func (storage *testStorage) SetInstanceCached(instance aostypes.InstanceIdent, cached bool) error { - for i, instanceInfo := range storage.instanceInfo { - if instanceInfo.InstanceIdent == instance { - storage.instanceInfo[i].Cached = cached - - return nil - } - } - - return launcher.ErrNotExist -} - -func (storage *testStorage) GetDesiredInstances() (instances json.RawMessage, err error) { - return storage.desiredInstances, nil -} - -func (storage *testStorage) SetNodeState(nodeID string, runRequest json.RawMessage) error { - storage.nodeState[nodeID] = runRequest - - return nil -} - -func (storage *testStorage) GetNodeState(nodeID string) (json.RawMessage, error) { - runRequestJSON, ok := storage.nodeState[nodeID] - if !ok { - return nil, launcher.ErrNotExist - } - - return runRequestJSON, nil -} - -func (storage *testStorage) GetServiceInfo(serviceID string) (imagemanager.ServiceInfo, error) { - services, ok := storage.services[serviceID] - if !ok { - return imagemanager.ServiceInfo{}, imagemanager.ErrNotExist - } - - return services[len(services)-1], nil -} - -// testStateStorage - -func (provider *testStateStorage) Setup( - params storagestate.SetupParams, -) (storagePath string, statePath string, err error) { - return "", "", nil -} - -func (provider *testStateStorage) Cleanup(instanceIdent aostypes.InstanceIdent) error { - provider.cleanedInstances = append(provider.cleanedInstances, instanceIdent) - - return nil -} - -func (provider *testStateStorage) GetInstanceCheckSum(instance aostypes.InstanceIdent) string { - return magicSum -} - -func (provider *testStateStorage) RemoveServiceInstance(instanceIdent aostypes.InstanceIdent) error { - provider.removedInstances = append(provider.removedInstances, instanceIdent) - - return nil -} - -// testImageProvider - -func newTestImageProvider() *testImageProvider { - return &testImageProvider{ - services: make(map[string]imagemanager.ServiceInfo), - layers: make(map[string]imagemanager.LayerInfo), - removeServiceInstancesChannel: make(chan string, 1), - } -} - -func (testProvider *testImageProvider) close() { - close(testProvider.removeServiceInstancesChannel) -} - -func (testProvider *testImageProvider) GetServiceInfo(serviceID string) (imagemanager.ServiceInfo, error) { - if service, ok := testProvider.services[serviceID]; ok { - return service, nil - } - - return imagemanager.ServiceInfo{}, errors.New("service does't exist") //nolint:goerr113 -} - -func (testProvider *testImageProvider) GetLayerInfo(digest string) (imagemanager.LayerInfo, error) { - if layer, ok := testProvider.layers[digest]; ok { - return layer, nil +func testItemStorageRatio() testData { + return testData{ + testCaseName: "storage ratio", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + StorageLimit: newQuota(500), + }, + Runners: []string{runnerRunc}, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 5}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, 100), + createInstanceInfo(5003, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, 100), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, "", errors.New("not enough storage space")), //nolint:goerr113 + }, } - - return imagemanager.LayerInfo{}, errors.New("layer does't exist") //nolint:goerr113 -} - -func (testProvider *testImageProvider) GetRemoveServiceChannel() (channel <-chan string) { - return testProvider.removeServiceInstancesChannel -} - -func (testProvider *testImageProvider) RevertService(serviceID string) error { - testProvider.revertedServices = append(testProvider.revertedServices, serviceID) - - return nil } -// testNetworkManager - -func newTestNetworkManager(network string) *testNetworkManager { - networkManager := &testNetworkManager{ - networkInfo: make(map[string]map[aostypes.InstanceIdent]struct{}), - } - - if len(network) != 0 { - ip, ipNet, err := net.ParseCIDR(network) - if err != nil { - log.Fatalf("Can't parse CIDR: %v", err) - } - - networkManager.currentIP = ip - networkManager.subnet = *ipNet +func testItemStateRatio() testData { + return testData{ + testCaseName: "state ratio", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + StateLimit: newQuota(500), + }, + Runners: []string{runnerRunc}, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 5}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, 100), + createInstanceInfo(5003, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, 100), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, "", errors.New("not enough state space")), //nolint:goerr113 + }, } - - return networkManager } -func (network *testNetworkManager) UpdateProviderNetwork(providers []string, nodeID string) error { - return nil +func testItemCPURatio() testData { + return testData{ + testCaseName: "CPU ratio", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + Runners: []string{runnerRunc}, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 8}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1RemoteURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, 100), + createInstanceInfo(5004, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, 100), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1RemoteURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5003, 6, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, 100), + createInstanceInfo(5005, 7, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 5, + }, 100), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, nodeIDRemoteSM2, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 5, + }, nodeIDRemoteSM2, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 6, + }, "", errors.New("no nodes with available CPU")), //nolint:goerr113 + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 7, + }, "", errors.New("no nodes with available CPU")), //nolint:goerr113 + }, + } } -func (network *testNetworkManager) PrepareInstanceNetworkParameters( - instanceIdent aostypes.InstanceIdent, networkID string, - params networkmanager.NetworkParameters, -) (aostypes.NetworkParameters, error) { - if len(network.networkInfo[networkID]) == 0 { - network.networkInfo[networkID] = make(map[aostypes.InstanceIdent]struct{}) +func testItemRAMRatio() testData { + return testData{ + testCaseName: "RAM ratio", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: {NodeType: nodeTypeLocalSM, Priority: 100}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + RAMLimit: newQuota(1024), + }, + Runners: []string{runnerRunc}, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 8}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1LocalURL), + createLayerInfo(layer2, layer2LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, 100), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1RemoteURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, 100), + createInstanceInfo(5003, 5, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, 100), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1RemoteURL), + }, + layers: []aostypes.LayerInfo{ + createLayerInfo(layer1, layer1RemoteURL), + createLayerInfo(layer2, layer2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5004, 6, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, 100), + createInstanceInfo(5005, 7, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 5, + }, 100), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 1, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 2, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 3, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 4, + }, nodeIDRemoteSM2, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 5, + }, nodeIDRemoteSM2, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 6, + }, "", errors.New("no nodes with available RAM")), //nolint:goerr113 + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 7, + }, "", errors.New("no nodes with available RAM")), //nolint:goerr113 + }, } - - network.currentIP = cidr.Inc(network.currentIP) - - network.networkInfo[networkID][instanceIdent] = struct{}{} - - return aostypes.NetworkParameters{ - IP: network.currentIP.String(), - Subnet: network.subnet.String(), - DNSServers: []string{"10.10.0.1"}, - }, nil } -func (network *testNetworkManager) RemoveInstanceNetworkParameters( - instanceIdent aostypes.InstanceIdent, networkID string, -) { - delete(network.networkInfo[networkID], instanceIdent) +func testItemRebalancing() testData { + return testData{ + testCaseName: "rebalancing", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: { + NodeType: nodeTypeLocalSM, Priority: 100, + AlertRules: &aostypes.AlertRules{ + CPU: &aostypes.AlertRulePercents{ + MinThreshold: 75.0, MaxThreshold: 85.0, + }, + }, + }, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service2: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service3: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + }, + monitoring: map[string]aostypes.NodeMonitoring{ + nodeIDLocalSM: { + NodeData: aostypes.MonitoringData{CPU: 1000}, + InstancesData: []aostypes.InstanceMonitoring{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + }, + }, + }, + storedInstances: []launcher.InstanceInfo{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5000, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5001, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service3, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDRemoteSM1, + UID: 5002, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 1}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 1}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service2, 5001, service2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5001, 3, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service3, 5002, service3RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 4, aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, 0), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM2, nil), + }, + rebalancing: true, + } } -func (network *testNetworkManager) GetInstances() (instances []aostypes.InstanceIdent) { - for networkID := range network.networkInfo { - for instanceIdent := range network.networkInfo[networkID] { - instances = append(instances, instanceIdent) - } +func testItemRebalancingPolicy() testData { + return testData{ + testCaseName: "rebalancing policy", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: { + NodeType: nodeTypeLocalSM, Priority: 100, + AlertRules: &aostypes.AlertRules{ + CPU: &aostypes.AlertRulePercents{ + MinThreshold: 75.0, MaxThreshold: 85.0, + }, + }, + }, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service2: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service3: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + BalancingPolicy: aostypes.BalancingDisabled, + }, + }, + monitoring: map[string]aostypes.NodeMonitoring{ + nodeIDLocalSM: { + NodeData: aostypes.MonitoringData{CPU: 1000}, + InstancesData: []aostypes.InstanceMonitoring{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + }, + }, + }, + storedInstances: []launcher.InstanceInfo{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5000, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5001, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service3, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDRemoteSM1, + UID: 5002, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 1}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 1}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service3, 5002, service3RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 3, aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, 0), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service2, 5001, service2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5001, 4, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM2, nil), + }, + rebalancing: true, } - - return instances } -func (network *testNetworkManager) RestartDNSServer() error { - return nil +func testItemRebalancingPrevNode() testData { + return testData{ + testCaseName: "rebalancing prev node", + nodeConfigs: map[string]cloudprotocol.NodeConfig{ + nodeTypeLocalSM: { + NodeType: nodeTypeLocalSM, Priority: 100, + AlertRules: &aostypes.AlertRules{ + CPU: &aostypes.AlertRulePercents{ + MinThreshold: 75.0, MaxThreshold: 85.0, + }, + }, + }, + nodeTypeRemoteSM: {NodeType: nodeTypeRemoteSM, Priority: 50}, + }, + serviceConfigs: map[string]aostypes.ServiceConfig{ + service1: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service2: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + service3: { + Quotas: aostypes.ServiceQuotas{ + CPUDMIPSLimit: newQuota(1000), + }, + }, + }, + monitoring: map[string]aostypes.NodeMonitoring{ + nodeIDLocalSM: { + NodeData: aostypes.MonitoringData{CPU: 1000}, + InstancesData: []aostypes.InstanceMonitoring{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + MonitoringData: aostypes.MonitoringData{CPU: 500}, + }, + }, + }, + }, + storedInstances: []launcher.InstanceInfo{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service1, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5000, + PrevNodeID: nodeIDLocalSM, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service2, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDLocalSM, + UID: 5001, + PrevNodeID: nodeIDRemoteSM1, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: service3, SubjectID: subject1, Instance: 0}, + NodeID: nodeIDRemoteSM1, + UID: 5002, + PrevNodeID: nodeIDRemoteSM2, + }, + }, + desiredInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: service1, SubjectID: subject1, Priority: 100, NumInstances: 1}, + {ServiceID: service2, SubjectID: subject1, Priority: 50, NumInstances: 1}, + {ServiceID: service3, SubjectID: subject1, Priority: 0, NumInstances: 1}, + }, + expectedRunRequests: map[string]runRequest{ + nodeIDLocalSM: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service1, 5000, service1LocalURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5000, 2, aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, 100), + }, + }, + nodeIDRemoteSM1: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service3, 5002, service3RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5002, 3, aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, 0), + }, + }, + nodeIDRemoteSM2: { + services: []aostypes.ServiceInfo{ + createServiceInfo(service2, 5001, service2RemoteURL), + }, + instances: []aostypes.InstanceInfo{ + createInstanceInfo(5001, 4, aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, 50), + }, + }, + }, + expectedRunStatus: []cloudprotocol.InstanceStatus{ + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service1, SubjectID: subject1, Instance: 0, + }, nodeIDLocalSM, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service3, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM1, nil), + createInstanceStatus(aostypes.InstanceIdent{ + ServiceID: service2, SubjectID: subject1, Instance: 0, + }, nodeIDRemoteSM2, nil), + }, + rebalancing: true, + } } /*********************************************************************************************************************** @@ -2160,31 +2179,31 @@ func (network *testNetworkManager) RestartDNSServer() error { func createServiceInfo(id string, gid uint32, url string) aostypes.ServiceInfo { return aostypes.ServiceInfo{ - ID: id, - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - URL: url, - GID: gid, + ServiceID: id, + Version: "1.0", + URL: url, + GID: gid, } } func createLayerInfo(digest string, url string) aostypes.LayerInfo { return aostypes.LayerInfo{ - Digest: digest, - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - URL: url, + Digest: digest, + Version: "1.0", + URL: url, } } func createInstanceStatus(ident aostypes.InstanceIdent, nodeID string, err error) cloudprotocol.InstanceStatus { status := cloudprotocol.InstanceStatus{ - InstanceIdent: ident, - RunState: cloudprotocol.InstanceStateActive, - AosVersion: 1, - NodeID: nodeID, + InstanceIdent: ident, + Status: cloudprotocol.InstanceStateActive, + ServiceVersion: "1.0", + NodeID: nodeID, } if err != nil { - status.RunState = cloudprotocol.InstanceStateFailed + status.Status = cloudprotocol.InstanceStateFailed status.ErrorInfo = &cloudprotocol.ErrorInfo{ Message: err.Error(), } @@ -2208,46 +2227,43 @@ func createInstanceInfo(uid uint32, ip int, ident aostypes.InstanceIdent, priori } } -func waitRunInstancesStatus( - messageChannel <-chan unitstatushandler.RunInstancesStatus, expectedMsg unitstatushandler.RunInstancesStatus, - timeout time.Duration, -) (err error) { - var message unitstatushandler.RunInstancesStatus - +func waitRunInstancesStatus(runStatusChannel <-chan []cloudprotocol.InstanceStatus, + expectedStatus []cloudprotocol.InstanceStatus, timeout time.Duration, +) error { select { case <-time.After(timeout): return aoserrors.New("wait message timeout") - case message = <-messageChannel: - if len(message.Instances) != len(expectedMsg.Instances) { + case receivedStatus := <-runStatusChannel: + if len(receivedStatus) != len(expectedStatus) { return aoserrors.New("incorrect length") } topLoop: - for _, receivedEl := range message.Instances { - for _, expectedEl := range expectedMsg.Instances { - if receivedEl.ErrorInfo == nil && expectedEl.ErrorInfo != nil { + for _, receivedItem := range receivedStatus { + for _, expectedItem := range expectedStatus { + if receivedItem.ErrorInfo == nil && expectedItem.ErrorInfo != nil { continue } - if receivedEl.ErrorInfo != nil && expectedEl.ErrorInfo == nil { + if receivedItem.ErrorInfo != nil && expectedItem.ErrorInfo == nil { continue } - if receivedEl.ErrorInfo != nil && expectedEl.ErrorInfo != nil { - if receivedEl.ErrorInfo.AosCode != expectedEl.ErrorInfo.AosCode || - receivedEl.ErrorInfo.ExitCode != expectedEl.ErrorInfo.ExitCode || - !strings.Contains(receivedEl.ErrorInfo.Message, expectedEl.ErrorInfo.Message) { + if receivedItem.ErrorInfo != nil && expectedItem.ErrorInfo != nil { + if receivedItem.ErrorInfo.AosCode != expectedItem.ErrorInfo.AosCode || + receivedItem.ErrorInfo.ExitCode != expectedItem.ErrorInfo.ExitCode || + !strings.Contains(receivedItem.ErrorInfo.Message, expectedItem.ErrorInfo.Message) { continue } } - receivedForCheck := receivedEl + receivedForCheck := receivedItem receivedForCheck.ErrorInfo = nil - expectedEl.ErrorInfo = nil + expectedItem.ErrorInfo = nil - if reflect.DeepEqual(receivedForCheck, expectedEl) { + if reflect.DeepEqual(receivedForCheck, expectedItem) { continue topLoop } } @@ -2255,18 +2271,6 @@ func waitRunInstancesStatus( return aoserrors.New("incorrect instances in run status") } - if err := deepSlicesCompare(expectedMsg.UnitSubjects, message.UnitSubjects); err != nil { - return aoserrors.New("incorrect subjects in run status") - } - - for i := range message.ErrorServices { - message.ErrorServices[i].ErrorInfo = nil - } - - if err := deepSlicesCompare(expectedMsg.ErrorServices, message.ErrorServices); err != nil { - return aoserrors.New("incorrect error services in run status") - } - return nil } } @@ -2289,3 +2293,7 @@ topLabel: return nil } + +func newQuota(value uint64) *uint64 { + return &value +} diff --git a/launcher/nodehandler.go b/launcher/nodehandler.go new file mode 100644 index 00000000..9c3cd1f3 --- /dev/null +++ b/launcher/nodehandler.go @@ -0,0 +1,592 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2022 Renesas Electronics Corporation. +// Copyright (C) 2022 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package launcher + +import ( + "errors" + "math" + + "golang.org/x/exp/slices" + + "github.com/aosedge/aos_common/aoserrors" + "github.com/aosedge/aos_common/aostypes" + "github.com/aosedge/aos_common/api/cloudprotocol" + "github.com/aosedge/aos_communicationmanager/imagemanager" + "github.com/aosedge/aos_communicationmanager/unitconfig" + log "github.com/sirupsen/logrus" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +type runRequest struct { + Services []aostypes.ServiceInfo `json:"services"` + Layers []aostypes.LayerInfo `json:"layers"` + Instances []aostypes.InstanceInfo `json:"instances"` +} + +type nodeHandler struct { + nodeInfo cloudprotocol.NodeInfo + nodeConfig cloudprotocol.NodeConfig + deviceAllocations map[string]int + runStatus []cloudprotocol.InstanceStatus + runRequest runRequest + isLocalNode bool + waitStatus bool + averageMonitoring aostypes.NodeMonitoring + needRebalancing bool + availableCPU uint64 + availableRAM uint64 +} + +/*********************************************************************************************************************** + * Vars + **********************************************************************************************************************/ + +//nolint:gochecknoglobals +var defaultRunners = []string{"crun", "runc"} + +/*********************************************************************************************************************** + * Private + **********************************************************************************************************************/ + +func newNodeHandler( + nodeInfo cloudprotocol.NodeInfo, nodeManager NodeManager, resourceManager ResourceManager, + isLocalNode bool, rebalancing bool, +) (*nodeHandler, error) { + log.WithFields(log.Fields{"nodeID": nodeInfo.NodeID}).Debug("Init node handler") + + node := &nodeHandler{ + nodeInfo: nodeInfo, + isLocalNode: isLocalNode, + waitStatus: true, + } + + nodeConfig, err := resourceManager.GetNodeConfig(node.nodeInfo.NodeID, node.nodeInfo.NodeType) + if err != nil && !errors.Is(err, unitconfig.ErrNotFound) { + return nil, aoserrors.Wrap(err) + } + + node.nodeConfig = nodeConfig + node.resetDeviceAllocations() + + node.initAvailableResources(nodeManager, rebalancing) + + return node, nil +} + +func (node *nodeHandler) initAvailableResources(nodeManager NodeManager, rebalancing bool) { + var err error + + if rebalancing && node.nodeConfig.AlertRules != nil && + (node.nodeConfig.AlertRules.CPU != nil || node.nodeConfig.AlertRules.RAM != nil) { + node.averageMonitoring, err = nodeManager.GetAverageMonitoring(node.nodeInfo.NodeID) + if err != nil { + log.WithField("nodeID", node.nodeInfo.NodeID).Errorf("Can't get average monitoring: %v", err) + } + + if (node.nodeConfig.AlertRules.CPU != nil && + node.averageMonitoring.NodeData.CPU > + uint64(math.Round(float64(node.nodeInfo.MaxDMIPs)* + node.nodeConfig.AlertRules.CPU.MaxThreshold/100.0))) || + (node.nodeConfig.AlertRules.RAM != nil && + node.averageMonitoring.NodeData.RAM > + uint64(math.Round(float64(node.nodeInfo.TotalRAM)* + node.nodeConfig.AlertRules.RAM.MaxThreshold/100.0))) { + node.needRebalancing = true + } + } + + nodeCPU := node.getNodeCPU() + nodeRAM := node.getNodeRAM() + totalCPU := node.nodeInfo.MaxDMIPs + totalRAM := node.nodeInfo.TotalRAM + + // For nodes required rebalancing, we need to decrease resource consumption below the low threshold + if node.needRebalancing { + if node.nodeConfig.AlertRules.CPU != nil { + totalCPU = uint64(math.Round(float64(node.nodeInfo.MaxDMIPs) * + node.nodeConfig.AlertRules.CPU.MinThreshold / 100.0)) + } + + if node.nodeConfig.AlertRules.RAM != nil { + totalRAM = uint64(math.Round(float64(node.nodeInfo.TotalRAM) * + node.nodeConfig.AlertRules.RAM.MinThreshold / 100.0)) + } + } + + if nodeCPU > totalCPU { + node.availableCPU = 0 + } else { + node.availableCPU = totalCPU - nodeCPU + } + + if nodeRAM > totalRAM { + node.availableRAM = 0 + } else { + node.availableRAM = totalRAM - nodeRAM + } + + if node.needRebalancing { + log.WithFields(log.Fields{ + "nodeID": node.nodeInfo.NodeID, "RAM": nodeRAM, "CPU": nodeCPU, + }).Debug("Node resources usage") + } + + log.WithFields(log.Fields{ + "nodeID": node.nodeInfo.NodeID, "RAM": node.availableRAM, "CPU": node.availableCPU, + }).Debug("Available resources on node") +} + +func (node *nodeHandler) getNodeCPU() uint64 { + instancesCPU := uint64(0) + + for _, instance := range node.averageMonitoring.InstancesData { + instancesCPU += instance.CPU + } + + if instancesCPU > node.averageMonitoring.NodeData.CPU { + return 0 + } + + return node.averageMonitoring.NodeData.CPU - instancesCPU +} + +func (node *nodeHandler) getNodeRAM() uint64 { + instancesRAM := uint64(0) + + for _, instance := range node.averageMonitoring.InstancesData { + instancesRAM += instance.RAM + } + + if instancesRAM > node.averageMonitoring.NodeData.RAM { + return 0 + } + + return node.averageMonitoring.NodeData.RAM - instancesRAM +} + +func (node *nodeHandler) resetDeviceAllocations() { + node.deviceAllocations = make(map[string]int) + + for _, device := range node.nodeConfig.Devices { + node.deviceAllocations[device.Name] = device.SharedCount + } +} + +func (node *nodeHandler) allocateDevices(serviceDevices []aostypes.ServiceDevice) error { + for _, serviceDevice := range serviceDevices { + count, ok := node.deviceAllocations[serviceDevice.Name] + if !ok { + return aoserrors.Errorf("device not found: %s", serviceDevice.Name) + } + + if count == 0 { + return aoserrors.Errorf("can't allocate device: %s", serviceDevice.Name) + } + + node.deviceAllocations[serviceDevice.Name] = count - 1 + } + + return nil +} + +func (node *nodeHandler) nodeHasDesiredDevices(desiredDevices []aostypes.ServiceDevice) bool { + for _, desiredDevice := range desiredDevices { + count, ok := node.deviceAllocations[desiredDevice.Name] + if !ok || count == 0 { + return false + } + } + + return true +} + +func (node *nodeHandler) addRunRequest(instanceInfo aostypes.InstanceInfo, service imagemanager.ServiceInfo, + layers []imagemanager.LayerInfo, +) error { + log.WithFields(instanceIdentLogFields( + instanceInfo.InstanceIdent, log.Fields{"node": node.nodeInfo.NodeID})).Debug("Schedule instance on node") + + if err := node.allocateDevices(service.Config.Devices); err != nil { + return err + } + + node.runRequest.Instances = append(node.runRequest.Instances, instanceInfo) + + node.addService(service) + node.addLayers(layers) + + requestedCPU := node.getRequestedCPU(instanceInfo.InstanceIdent, service.Config) + if requestedCPU > node.availableCPU { + return aoserrors.Errorf("not enough CPU") + } + + requestedRAM := node.getRequestedRAM(instanceInfo.InstanceIdent, service.Config) + if requestedRAM > node.availableRAM { + return aoserrors.Errorf("not enough CPU") + } + + node.availableCPU -= requestedCPU + node.availableRAM -= requestedRAM + + log.WithFields(log.Fields{ + "nodeID": node.nodeInfo.NodeID, "RAM": node.availableRAM, "CPU": node.availableCPU, + }).Debug("Remaining resources on node") + + return nil +} + +func (node *nodeHandler) addService(service imagemanager.ServiceInfo) { + serviceInfo := service.ServiceInfo + + if !node.isLocalNode { + serviceInfo.URL = service.RemoteURL + } + + if slices.ContainsFunc(node.runRequest.Services, func(info aostypes.ServiceInfo) bool { + return info.ServiceID == serviceInfo.ServiceID + }) { + return + } + + log.WithFields(log.Fields{ + "serviceID": serviceInfo.ServiceID, "node": node.nodeInfo.NodeID, + }).Debug("Schedule service on node") + + node.runRequest.Services = append(node.runRequest.Services, serviceInfo) +} + +func (node *nodeHandler) addLayers(layers []imagemanager.LayerInfo) { + for _, layer := range layers { + layerInfo := layer.LayerInfo + + if !node.isLocalNode { + layerInfo.URL = layer.RemoteURL + } + + if slices.ContainsFunc(node.runRequest.Layers, func(info aostypes.LayerInfo) bool { + return info.Digest == layerInfo.Digest + }) { + continue + } + + log.WithFields(log.Fields{ + "digest": layerInfo.Digest, "node": node.nodeInfo.NodeID, + }).Debug("Schedule layer on node") + + node.runRequest.Layers = append(node.runRequest.Layers, layerInfo) + } +} + +func (node *nodeHandler) getPartitionSize(partitionType string) uint64 { + partitionIndex := slices.IndexFunc(node.nodeInfo.Partitions, func(partition cloudprotocol.PartitionInfo) bool { + return slices.Contains(partition.Types, partitionType) + }) + + if partitionIndex == -1 { + return 0 + } + + return node.nodeInfo.Partitions[partitionIndex].TotalSize +} + +func (node *nodeHandler) getRequestedCPU( + instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, +) uint64 { + requestedCPU := uint64(0) + + if serviceConfig.Quotas.CPUDMIPSLimit != nil { + requestedCPU = uint64(float64(*serviceConfig.Quotas.CPUDMIPSLimit)*getCPURequestRatio( + serviceConfig.ResourceRatios, node.nodeConfig.ResourceRatios) + 0.5) + } + + if node.needRebalancing { + index := slices.IndexFunc(node.averageMonitoring.InstancesData, func(instance aostypes.InstanceMonitoring) bool { + return instance.InstanceIdent == instanceIdent + }) + + if index != -1 { + if node.averageMonitoring.InstancesData[index].CPU > requestedCPU { + return node.averageMonitoring.InstancesData[index].CPU + } + } + } + + return requestedCPU +} + +func (node *nodeHandler) getRequestedRAM( + instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, +) uint64 { + requestedRAM := uint64(0) + + if serviceConfig.Quotas.RAMLimit != nil { + requestedRAM = uint64(float64(*serviceConfig.Quotas.RAMLimit)*getRAMRequestRatio( + serviceConfig.ResourceRatios, node.nodeConfig.ResourceRatios) + 0.5) + } + + if node.needRebalancing { + index := slices.IndexFunc(node.averageMonitoring.InstancesData, func(instance aostypes.InstanceMonitoring) bool { + return instance.InstanceIdent == instanceIdent + }) + + if index != -1 { + if node.averageMonitoring.InstancesData[index].RAM > requestedRAM { + return node.averageMonitoring.InstancesData[index].RAM + } + } + } + + return requestedRAM +} + +func getNodesByStaticResources(nodes []*nodeHandler, + serviceConfig aostypes.ServiceConfig, instanceInfo cloudprotocol.InstanceInfo, +) ([]*nodeHandler, error) { + resultNodes := getActiveNodes(nodes) + if len(resultNodes) == 0 { + return resultNodes, aoserrors.Errorf("no active nodes") + } + + resultNodes = getNodeByRunners(resultNodes, serviceConfig.Runners) + if len(resultNodes) == 0 { + return resultNodes, aoserrors.Errorf("no nodes with runner: %s", serviceConfig.Runners) + } + + resultNodes = getNodesByLabels(resultNodes, instanceInfo.Labels) + if len(resultNodes) == 0 { + return resultNodes, aoserrors.Errorf("no nodes with labels %v", instanceInfo.Labels) + } + + resultNodes = getNodesByResources(resultNodes, serviceConfig.Resources) + if len(resultNodes) == 0 { + return resultNodes, aoserrors.Errorf("no nodes with resources %v", serviceConfig.Resources) + } + + return resultNodes, nil +} + +func getActiveNodes(nodes []*nodeHandler) []*nodeHandler { + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if node.nodeInfo.Status == cloudprotocol.NodeStatusProvisioned { + resultNodes = append(resultNodes, node) + } + } + + return resultNodes +} + +func getNodesByDevices(nodes []*nodeHandler, desiredDevices []aostypes.ServiceDevice) []*nodeHandler { + if len(desiredDevices) == 0 { + return nodes + } + + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if !node.nodeHasDesiredDevices(desiredDevices) { + continue + } + + resultNodes = append(resultNodes, node) + } + + return resultNodes +} + +func getNodesByResources(nodes []*nodeHandler, desiredResources []string) []*nodeHandler { + if len(desiredResources) == 0 { + return nodes + } + + resultNodes := make([]*nodeHandler, 0) + +nodeLoop: + for _, node := range nodes { + if len(node.nodeConfig.Resources) == 0 { + continue + } + + for _, resource := range desiredResources { + if !slices.ContainsFunc(node.nodeConfig.Resources, func(info cloudprotocol.ResourceInfo) bool { + return info.Name == resource + }) { + continue nodeLoop + } + } + + resultNodes = append(resultNodes, node) + } + + return resultNodes +} + +func getNodesByLabels(nodes []*nodeHandler, desiredLabels []string) []*nodeHandler { + if len(desiredLabels) == 0 { + return nodes + } + + resultNodes := make([]*nodeHandler, 0) + +nodeLoop: + for _, node := range nodes { + if len(node.nodeConfig.Labels) == 0 { + continue + } + + for _, label := range desiredLabels { + if !slices.Contains(node.nodeConfig.Labels, label) { + continue nodeLoop + } + } + + resultNodes = append(resultNodes, node) + } + + return resultNodes +} + +func getNodeByRunners(nodes []*nodeHandler, runners []string) []*nodeHandler { + if len(runners) == 0 { + runners = defaultRunners + } + + resultNodes := make([]*nodeHandler, 0) + + for _, runner := range runners { + for _, node := range nodes { + nodeRunners, err := node.nodeInfo.GetNodeRunners() + if err != nil { + log.WithField("nodeID", node.nodeInfo.NodeID).Errorf("Can't get node runners: %v", err) + + continue + } + + if (len(nodeRunners) == 0 && slices.Contains(defaultRunners, runner)) || + slices.Contains(nodeRunners, runner) { + resultNodes = append(resultNodes, node) + } + } + } + + return resultNodes +} + +func getNodesByCPU( + nodes []*nodeHandler, instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, +) []*nodeHandler { + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if node.availableCPU >= node.getRequestedCPU(instanceIdent, serviceConfig) { + resultNodes = append(resultNodes, node) + } + } + + return resultNodes +} + +func getNodesByRAM( + nodes []*nodeHandler, instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, +) []*nodeHandler { + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if node.availableRAM >= node.getRequestedRAM(instanceIdent, serviceConfig) { + resultNodes = append(resultNodes, node) + } + } + + return resultNodes +} + +func getTopPriorityNodes(nodes []*nodeHandler) []*nodeHandler { + if len(nodes) == 0 { + return nodes + } + + topPriority := nodes[0].nodeConfig.Priority + + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if node.nodeConfig.Priority == topPriority { + resultNodes = append(resultNodes, node) + } + } + + return resultNodes +} + +func excludeNodes(nodes []*nodeHandler, excludeNodes []string) []*nodeHandler { + if len(excludeNodes) == 0 { + return nodes + } + + resultNodes := make([]*nodeHandler, 0) + + for _, node := range nodes { + if !slices.Contains(excludeNodes, node.nodeInfo.NodeID) { + resultNodes = append(resultNodes, node) + } + } + + return resultNodes +} + +func getInstanceNode( + nodes []*nodeHandler, instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, +) (*nodeHandler, error) { + resultNodes := getNodesByDevices(nodes, serviceConfig.Devices) + if len(resultNodes) == 0 { + return nil, aoserrors.Errorf("no nodes with devices %v", serviceConfig.Devices) + } + + resultNodes = getNodesByCPU(resultNodes, instanceIdent, serviceConfig) + if len(resultNodes) == 0 { + return nil, aoserrors.Errorf("no nodes with available CPU") + } + + resultNodes = getNodesByRAM(resultNodes, instanceIdent, serviceConfig) + if len(resultNodes) == 0 { + return nil, aoserrors.Errorf("no nodes with available RAM") + } + + resultNodes = getTopPriorityNodes(resultNodes) + if len(resultNodes) == 0 { + return nil, aoserrors.Errorf("can't get top priority nodes") + } + + slices.SortStableFunc(resultNodes, func(node1, node2 *nodeHandler) bool { + if node1.availableCPU < node2.availableCPU { + return false + } + + if node1.availableCPU > node2.availableCPU { + return true + } + + return false + }) + + return resultNodes[0], nil +} diff --git a/monitorcontroller/monitorcontroller.go b/monitorcontroller/monitorcontroller.go index f96e8cde..ee4dce1c 100644 --- a/monitorcontroller/monitorcontroller.go +++ b/monitorcontroller/monitorcontroller.go @@ -19,11 +19,13 @@ package monitorcontroller import ( "context" + "encoding/json" "errors" "sync" "time" "github.com/aosedge/aos_common/aoserrors" + "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" log "github.com/sirupsen/logrus" @@ -45,21 +47,17 @@ type MonitoringSender interface { // MonitorController instance. type MonitorController struct { sync.Mutex - monitoringQueue []cloudprotocol.NodeMonitoringData - monitoringQueueSize int - monitoringSender MonitoringSender - cancelFunction context.CancelFunc - isConnected bool -} + offlineMessages []cloudprotocol.Monitoring -/*********************************************************************************************************************** - * Vars - **********************************************************************************************************************/ + sendMessageEvent chan struct{} + maxMessageSize int + currentMessageSize int + sendPeriod aostypes.Duration -// MinSendPeriod used to adjust min send period. -// -//nolint:gochecknoglobals -var MinSendPeriod = 1 * time.Second + monitoringSender MonitoringSender + cancelFunction context.CancelFunc + isConnected bool +} /*********************************************************************************************************************** * Public @@ -70,9 +68,16 @@ func New( config *config.Config, monitoringSender MonitoringSender, ) (monitor *MonitorController, err error) { monitor = &MonitorController{ - monitoringSender: monitoringSender, - monitoringQueue: make([]cloudprotocol.NodeMonitoringData, 0, config.Monitoring.MaxOfflineMessages), - monitoringQueueSize: config.Monitoring.MaxOfflineMessages, + monitoringSender: monitoringSender, + offlineMessages: make([]cloudprotocol.Monitoring, 0, config.Monitoring.MaxOfflineMessages), + sendMessageEvent: make(chan struct{}, 1), + maxMessageSize: config.Monitoring.MaxMessageSize, + sendPeriod: config.Monitoring.SendPeriod, + } + + if monitor.sendPeriod.Seconds() < 1.0 { + log.Warningf("MonitorController send interval is less than 1sec.: %v", monitor.sendPeriod) + monitor.sendPeriod = aostypes.Duration{Duration: 1 * time.Second} } if err = monitor.monitoringSender.SubscribeForConnectionEvents(monitor); err != nil { @@ -98,16 +103,43 @@ func (monitor *MonitorController) Close() { } } -// SendMonitoringData sends monitoring data. -func (monitor *MonitorController) SendMonitoringData(monitoringData cloudprotocol.NodeMonitoringData) { +// SendNodeMonitoring sends monitoring data. +func (monitor *MonitorController) SendNodeMonitoring(nodeMonitoring aostypes.NodeMonitoring) { monitor.Lock() - defer monitor.Unlock() - if len(monitor.monitoringQueue) >= monitor.monitoringQueueSize { - monitor.monitoringQueue = monitor.monitoringQueue[1:] + // calculate size of input parameter + messageSize := 0 + + message, err := json.Marshal(nodeMonitoring) + if err == nil { + messageSize = len(message) + } else { + log.Errorf("Can't marshal nodeMonitoring: %v", err) } - monitor.monitoringQueue = append(monitor.monitoringQueue, monitoringData) + // allocate new offline message + currentMessageOverflows := monitor.currentMessageSize+messageSize > monitor.maxMessageSize + + if len(monitor.offlineMessages) == 0 || currentMessageOverflows { + if len(monitor.offlineMessages) == cap(monitor.offlineMessages) { + monitor.offlineMessages = monitor.offlineMessages[1:] + } + + monitor.offlineMessages = append(monitor.offlineMessages, cloudprotocol.Monitoring{}) + monitor.currentMessageSize = 0 + } + + monitor.currentMessageSize += messageSize + + // add monitoring data + monitor.addNodeMonitoring(nodeMonitoring) + + // send notification message + monitor.Unlock() + + if currentMessageOverflows { + monitor.sendMessageEvent <- struct{}{} + } } /*********************************************************************************************************************** @@ -135,27 +167,83 @@ func (monitor *MonitorController) CloudDisconnected() { **********************************************************************************************************************/ func (monitor *MonitorController) processQueue(ctx context.Context) { - sendTicker := time.NewTicker(MinSendPeriod) + sendTicker := time.NewTicker(monitor.sendPeriod.Duration) for { select { case <-sendTicker.C: - monitor.Lock() - - if len(monitor.monitoringQueue) > 0 && monitor.isConnected { - if err := monitor.monitoringSender.SendMonitoringData( - cloudprotocol.Monitoring{Nodes: monitor.monitoringQueue}); err != nil && - !errors.Is(err, amqphandler.ErrNotConnected) { - log.Errorf("Can't send monitoring data: %v", err) - } else { - monitor.monitoringQueue = make([]cloudprotocol.NodeMonitoringData, 0, monitor.monitoringQueueSize) - } - } + monitor.sendMessages() - monitor.Unlock() + case <-monitor.sendMessageEvent: + monitor.sendMessages() + sendTicker.Reset(monitor.sendPeriod.Duration) case <-ctx.Done(): return } } } + +func (monitor *MonitorController) sendMessages() { + monitor.Lock() + defer monitor.Unlock() + + if len(monitor.offlineMessages) > 0 && monitor.isConnected { + for _, offlineMessage := range monitor.offlineMessages { + err := monitor.monitoringSender.SendMonitoringData(offlineMessage) + if err != nil && !errors.Is(err, amqphandler.ErrNotConnected) { + log.Errorf("Can't send monitoring data: %v", err) + } + } + + monitor.offlineMessages = make([]cloudprotocol.Monitoring, 0, cap(monitor.offlineMessages)) + monitor.currentMessageSize = 0 + } +} + +func (monitor *MonitorController) addNodeMonitoring(nodeMonitoring aostypes.NodeMonitoring) { + latestMessage := &monitor.offlineMessages[len(monitor.offlineMessages)-1] + + // add node monitoring data + nodeDataFound := false + + for i, nodeData := range latestMessage.Nodes { + if nodeData.NodeID == nodeMonitoring.NodeID { + latestMessage.Nodes[i].Items = append(latestMessage.Nodes[i].Items, nodeMonitoring.NodeData) + nodeDataFound = true + + break + } + } + + if !nodeDataFound { + latestMessage.Nodes = append(latestMessage.Nodes, + cloudprotocol.NodeMonitoringData{ + NodeID: nodeMonitoring.NodeID, Items: []aostypes.MonitoringData{nodeMonitoring.NodeData}, + }) + } + + // add instance monitoring data + for _, instanceData := range nodeMonitoring.InstancesData { + instanceDataFound := false + + for i, item := range latestMessage.ServiceInstances { + if item.NodeID == nodeMonitoring.NodeID && item.InstanceIdent == instanceData.InstanceIdent { + latestMessage.ServiceInstances[i].Items = append(latestMessage.ServiceInstances[i].Items, + instanceData.MonitoringData) + instanceDataFound = true + + break + } + } + + if !instanceDataFound { + latestMessage.ServiceInstances = append(latestMessage.ServiceInstances, + cloudprotocol.InstanceMonitoringData{ + NodeID: nodeMonitoring.NodeID, + InstanceIdent: instanceData.InstanceIdent, + Items: []aostypes.MonitoringData{instanceData.MonitoringData}, + }) + } + } +} diff --git a/monitorcontroller/monitorcontroller_test.go b/monitorcontroller/monitorcontroller_test.go index a6e888a4..d6eea03c 100644 --- a/monitorcontroller/monitorcontroller_test.go +++ b/monitorcontroller/monitorcontroller_test.go @@ -56,18 +56,6 @@ func init() { log.SetOutput(os.Stdout) } -/*********************************************************************************************************************** - * Main - **********************************************************************************************************************/ - -func TestMain(m *testing.M) { - monitorcontroller.MinSendPeriod = 100 * time.Millisecond - - ret := m.Run() - - os.Exit(ret) -} - /*********************************************************************************************************************** * Tests **********************************************************************************************************************/ @@ -76,7 +64,7 @@ func TestSendMonitorData(t *testing.T) { sender := newTestMonitoringSender() controller, err := monitorcontroller.New(&config.Config{ - Monitoring: config.Monitoring{MaxOfflineMessages: 8}, + Monitoring: config.Monitoring{MaxOfflineMessages: 8, SendPeriod: aostypes.Duration{Duration: 1 * time.Second}}, }, sender) if err != nil { t.Fatalf("Can't create monitoring controller: %v", err) @@ -85,33 +73,14 @@ func TestSendMonitorData(t *testing.T) { sender.consumer.CloudConnected() - nodeMonitoring := cloudprotocol.NodeMonitoringData{ - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 1024, CPU: 50, InTraffic: 8192, OutTraffic: 4096, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}, - }, - NodeID: "mainNode", - Timestamp: time.Now().UTC(), - ServiceInstances: []cloudprotocol.InstanceMonitoringData{ - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 1024, CPU: 50, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}}, - }, - }, - } - - controller.SendMonitoringData(nodeMonitoring) + inputData, expectedData := getTestMonitoringData() + controller.SendNodeMonitoring(inputData) receivedMonitoringData, err := sender.waitMonitoringData() if err != nil { t.Fatalf("Error waiting for monitoring data: %v", err) } - expectedData := cloudprotocol.Monitoring{Nodes: []cloudprotocol.NodeMonitoringData{nodeMonitoring}} - if !reflect.DeepEqual(receivedMonitoringData, expectedData) { t.Errorf("Incorrect monitoring data: %v", receivedMonitoringData) } @@ -119,44 +88,32 @@ func TestSendMonitorData(t *testing.T) { func TestSendMonitorOffline(t *testing.T) { const ( - numOfflineMessages = 32 - numExtraMessages = 16 + numOfflineMessages = 2 + numExtraMessages = 1 + maxMessageSize = 400 ) sender := newTestMonitoringSender() - controller, err := monitorcontroller.New(&config.Config{ - Monitoring: config.Monitoring{MaxOfflineMessages: numOfflineMessages}, - }, sender) + controller, err := monitorcontroller.New( + &config.Config{Monitoring: config.Monitoring{ + MaxOfflineMessages: numOfflineMessages, + SendPeriod: aostypes.Duration{Duration: 1 * time.Second}, + MaxMessageSize: maxMessageSize, + }}, sender) if err != nil { t.Fatalf("Can't create monitoring controller: %v", err) } defer controller.Close() - var sentData []cloudprotocol.NodeMonitoringData + var sentData []cloudprotocol.Monitoring for i := 0; i < numOfflineMessages+numExtraMessages; i++ { - nodeMonitoring := cloudprotocol.NodeMonitoringData{ - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 1024, CPU: 50, InTraffic: 8192, OutTraffic: 4096, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}, - }, - NodeID: "mainNode", - Timestamp: time.Now().UTC(), - ServiceInstances: []cloudprotocol.InstanceMonitoringData{ - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{RAM: 1024, CPU: 50, Disk: []cloudprotocol.PartitionUsage{{ - Name: "p1", UsedSize: 100, - }}}, - }, - }, - } + inputData, expectedData := getTestMonitoringData() - controller.SendMonitoringData(nodeMonitoring) + controller.SendNodeMonitoring(inputData) - sentData = append(sentData, nodeMonitoring) + sentData = append(sentData, expectedData) } if _, err := sender.waitMonitoringData(); err == nil { @@ -165,13 +122,18 @@ func TestSendMonitorOffline(t *testing.T) { sender.consumer.CloudConnected() - receivedData, err := sender.waitMonitoringData() - if err != nil { - t.Fatalf("Error waiting for monitoring data: %v", err) - } + expectedList := sentData[len(sentData)-numOfflineMessages:] + for _, message := range expectedList { + receivedData, err := sender.waitMonitoringData() + if err != nil { + t.Fatalf("Error waiting for monitoring data: %v", err) + return + } - if !reflect.DeepEqual(receivedData.Nodes, sentData[len(sentData)-numOfflineMessages:]) { - t.Errorf("Wrong monitoring data received: %v", receivedData) + if !reflect.DeepEqual(receivedData, message) { + t.Errorf("Wrong monitoring data received: %v", receivedData) + return + } } if data, err := sender.waitMonitoringData(); err == nil { @@ -210,7 +172,46 @@ func (sender *testMonitoringSender) waitMonitoringData() (cloudprotocol.Monitori case monitoringData := <-sender.monitoringData: return monitoringData, nil - case <-time.After(1 * time.Second): + case <-time.After(2 * time.Second): return cloudprotocol.Monitoring{}, aoserrors.New("wait monitoring data timeout") } } + +func getTestMonitoringData() (aostypes.NodeMonitoring, cloudprotocol.Monitoring) { + timestamp := time.Now().UTC() + nodeMonitoring := cloudprotocol.NodeMonitoringData{ + NodeID: "mainNode", + Items: []aostypes.MonitoringData{ + { + RAM: 1024, CPU: 50, Download: 8192, Upload: 4096, Timestamp: timestamp, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + }, + }, + } + + instanceMonitoring := cloudprotocol.InstanceMonitoringData{ + NodeID: "mainNode", + InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subj1", Instance: 1}, + Items: []aostypes.MonitoringData{ + { + RAM: 1024, CPU: 50, Timestamp: timestamp, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + }, + }, + } + + input := aostypes.NodeMonitoring{ + NodeID: "mainNode", + NodeData: nodeMonitoring.Items[0], + InstancesData: []aostypes.InstanceMonitoring{ + {InstanceIdent: instanceMonitoring.InstanceIdent, MonitoringData: instanceMonitoring.Items[0]}, + }, + } + + output := cloudprotocol.Monitoring{ + Nodes: []cloudprotocol.NodeMonitoringData{nodeMonitoring}, + ServiceInstances: []cloudprotocol.InstanceMonitoringData{instanceMonitoring}, + } + + return input, output +} diff --git a/networkmanager/dnsserver.go b/networkmanager/dnsserver.go index d81207b9..8c0ea688 100644 --- a/networkmanager/dnsserver.go +++ b/networkmanager/dnsserver.go @@ -21,7 +21,6 @@ package networkmanager import ( "bytes" - "fmt" "html/template" "os" "os/exec" @@ -154,7 +153,7 @@ func (dns *dnsServer) rewriteHostsFile() error { entry := ip for _, alias := range hosts { - entry += fmt.Sprintf("\t%s", alias) + entry += "\t" + alias } entry += "\n" @@ -251,7 +250,7 @@ func (dns *dnsServer) start() error { args := []string{ "-u", "root", - fmt.Sprintf("--conf-file=%s", dns.configFile), + "--conf-file=" + dns.configFile, } output, err := ExecContext(dns.binary, args...) diff --git a/networkmanager/ipamalloc.go b/networkmanager/ipamalloc.go index be323b9c..55afc069 100644 --- a/networkmanager/ipamalloc.go +++ b/networkmanager/ipamalloc.go @@ -24,6 +24,7 @@ import ( "sync" "github.com/aosedge/aos_common/aoserrors" + "github.com/aosedge/aos_common/aostypes" "github.com/apparentlymart/go-cidr/cidr" log "github.com/sirupsen/logrus" ) @@ -172,7 +173,9 @@ func (ipam *ipSubnet) getAvailableSubnet(networkID string) (*net.IPNet, error) { return subnet.ipNet, nil } -func (ipam *ipSubnet) removeAllocatedSubnets(networks []NetworkInfo, networkInstances []InstanceNetworkInfo) { +func (ipam *ipSubnet) removeAllocatedSubnets(networks []aostypes.NetworkParameters, + networkInstances []InstanceNetworkInfo, +) { ipam.Lock() defer ipam.Unlock() diff --git a/networkmanager/networkmanager.go b/networkmanager/networkmanager.go index 3f355100..328e57e9 100644 --- a/networkmanager/networkmanager.go +++ b/networkmanager/networkmanager.go @@ -56,8 +56,8 @@ type Storage interface { RemoveNetworkInstanceInfo(instance aostypes.InstanceIdent) error GetNetworkInstancesInfo() ([]InstanceNetworkInfo, error) RemoveNetworkInfo(networkID string) error - AddNetworkInfo(info NetworkInfo) error - GetNetworksInfo() ([]NetworkInfo, error) + AddNetworkInfo(info aostypes.NetworkParameters) error + GetNetworksInfo() ([]aostypes.NetworkParameters, error) } // NodeManager nodes controller. @@ -76,23 +76,17 @@ type NetworkManager struct { nodeManager NodeManager } -// NetworkInfo represents network info for instance. -type NetworkInfo struct { - aostypes.NetworkParameters - NetworkID string -} - // FirewallRule represents firewall rule. type FirewallRule struct { - Protocol string - Port string + Protocol string `json:"protocol"` + Port string `json:"port"` } // InstanceNetworkInfo represents network info for instance. type InstanceNetworkInfo struct { aostypes.InstanceIdent - NetworkInfo - Rules []FirewallRule + aostypes.NetworkParameters + Rules []FirewallRule `json:"rules"` } // NetworkParameters represents network parameters. @@ -162,8 +156,7 @@ func New(storage Storage, nodeManager NodeManager, config *config.Config) (*Netw } for _, networkInfo := range networksInfo { - networkInfo.NetworkParameters.NetworkID = networkInfo.NetworkID - networkManager.providerNetworks[networkInfo.NetworkID] = networkInfo.NetworkParameters + networkManager.providerNetworks[networkInfo.NetworkID] = networkInfo } networkInstancesInfos, err := storage.GetNetworkInstancesInfo() @@ -188,14 +181,16 @@ func New(storage Storage, nodeManager NodeManager, config *config.Config) (*Netw // RemoveInstanceNetworkConf removes stored instance network parameters. func (manager *NetworkManager) RemoveInstanceNetworkParameters(instanceIdent aostypes.InstanceIdent, networkID string) { + manager.Lock() + defer manager.Unlock() + networkParameters, found := manager.getNetworkParametersToCache(networkID, instanceIdent) if !found { return } - manager.deleteNetworkParametersFromCache(networkID, instanceIdent, net.IP(networkParameters.IP)) - - if err := manager.storage.RemoveNetworkInstanceInfo(instanceIdent); err != nil { + if err := manager.removeInstanceNetworkParameters( + networkID, instanceIdent, net.IP(networkParameters.IP)); err != nil { log.Errorf("Can't remove network info: %v", err) } } @@ -283,6 +278,18 @@ func (manager *NetworkManager) PrepareInstanceNetworkParameters( * Private **********************************************************************************************************************/ +func (manager *NetworkManager) removeInstanceNetworkParameters( + networkID string, instanceIdent aostypes.InstanceIdent, ip net.IP, +) error { + manager.deleteNetworkParametersFromCache(networkID, instanceIdent, ip) + + if err := manager.storage.RemoveNetworkInstanceInfo(instanceIdent); err != nil { + return aoserrors.Wrap(err) + } + + return nil +} + func (manager *NetworkManager) createNetwork( instanceIdent aostypes.InstanceIdent, networkID string, params NetworkParameters, ) (networkParameters aostypes.NetworkParameters, err error) { @@ -302,16 +309,14 @@ func (manager *NetworkManager) createNetwork( return networkParameters, err } + networkParameters.NetworkID = networkID networkParameters.IP = ip.String() networkParameters.Subnet = subnet.String() networkParameters.DNSServers = []string{manager.dns.IPAddress} instanceNetworkInfo := InstanceNetworkInfo{ - InstanceIdent: instanceIdent, - NetworkInfo: NetworkInfo{ - NetworkID: networkID, - NetworkParameters: networkParameters, - }, + InstanceIdent: instanceIdent, + NetworkParameters: networkParameters, } if len(params.ExposePorts) > 0 { @@ -403,9 +408,6 @@ func checkIPInSubnet(subnet, ip string) (bool, error) { func (manager *NetworkManager) deleteNetworkParametersFromCache( networkID string, instanceIdent aostypes.InstanceIdent, ip net.IP, ) { - manager.Lock() - defer manager.Unlock() - delete(manager.instancesData[networkID], instanceIdent) delete(manager.dns.hosts, ip.String()) @@ -426,9 +428,6 @@ func (manager *NetworkManager) addNetworkParametersToCache(instanceNetworkInfo I func (manager *NetworkManager) getNetworkParametersToCache( networkID string, instanceIdent aostypes.InstanceIdent, ) (aostypes.NetworkParameters, bool) { - manager.RLock() - defer manager.RUnlock() - if instances, ok := manager.instancesData[networkID]; ok { if networkParameter, ok := instances[instanceIdent]; ok { return networkParameter.NetworkParameters, true @@ -447,6 +446,15 @@ next: } } + log.Debugf("Remove provider network %s", networkID) + + for instanceIdent, netInfo := range manager.instancesData[networkID] { + if err := manager.removeInstanceNetworkParameters( + networkID, instanceIdent, net.IP(netInfo.IP)); err != nil { + log.Errorf("Can't remove network info: %v", err) + } + } + delete(manager.providerNetworks, networkID) manager.ipamSubnet.releaseIPNetPool(networkID) @@ -482,12 +490,10 @@ func (manager *NetworkManager) addProviderNetworks( networkParameter.Subnet = subnet.String() networkParameter.IP = cidr.Inc(subnet.IP).String() + networkParameter.NetworkID = providerID manager.providerNetworks[providerID] = networkParameter - if err := manager.storage.AddNetworkInfo(NetworkInfo{ - NetworkID: providerID, - NetworkParameters: networkParameter, - }); err != nil { + if err := manager.storage.AddNetworkInfo(networkParameter); err != nil { return nil, aoserrors.Wrap(err) } diff --git a/networkmanager/networkmanager_test.go b/networkmanager/networkmanager_test.go index 7e9c1d2f..e48009aa 100644 --- a/networkmanager/networkmanager_test.go +++ b/networkmanager/networkmanager_test.go @@ -579,11 +579,11 @@ func (storage *testStore) RemoveNetworkInfo(networkID string) error { return nil } -func (storage *testStore) AddNetworkInfo(networkInfo networkmanager.NetworkInfo) error { +func (storage *testStore) AddNetworkInfo(networkInfo aostypes.NetworkParameters) error { return nil } -func (storage *testStore) GetNetworksInfo() (networkInfos []networkmanager.NetworkInfo, err error) { +func (storage *testStore) GetNetworksInfo() (networkInfos []aostypes.NetworkParameters, err error) { return nil, nil } diff --git a/smcontroller/smcontroller.go b/smcontroller/smcontroller.go index 6f4fc9c1..577eb3f6 100644 --- a/smcontroller/smcontroller.go +++ b/smcontroller/smcontroller.go @@ -18,21 +18,26 @@ package smcontroller import ( + "errors" + "io" "net" "sync" "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/servicemanager/v3" + pb "github.com/aosedge/aos_common/api/servicemanager" "github.com/aosedge/aos_common/utils/cryptutils" log "github.com/sirupsen/logrus" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/status" "github.com/aosedge/aos_communicationmanager/amqphandler" "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/launcher" + "github.com/aosedge/aos_communicationmanager/unitconfig" ) /*********************************************************************************************************************** @@ -58,7 +63,8 @@ type Controller struct { monitoringSender MonitoringSender updateInstancesStatusChan chan []cloudprotocol.InstanceStatus runInstancesStatusChan chan launcher.NodeRunInstanceStatus - systemLimitAlertChan chan cloudprotocol.SystemQuotaAlert + systemQuotaAlertChan chan cloudprotocol.SystemQuotaAlert + nodeConfigStatusChan chan unitconfig.NodeConfigStatus isCloudConnected bool grpcServer *grpc.Server @@ -68,12 +74,12 @@ type Controller struct { // AlertSender sends alert. type AlertSender interface { - SendAlert(alert cloudprotocol.AlertItem) + SendAlert(alert interface{}) } // MonitoringSender sends monitoring data. type MonitoringSender interface { - SendMonitoringData(monitoringData cloudprotocol.NodeMonitoringData) + SendNodeMonitoring(monitoring aostypes.NodeMonitoring) } // MessageSender sends messages to the cloud. @@ -107,7 +113,8 @@ func New( monitoringSender: monitoringSender, runInstancesStatusChan: make(chan launcher.NodeRunInstanceStatus, statusChanSize), updateInstancesStatusChan: make(chan []cloudprotocol.InstanceStatus, statusChanSize), - systemLimitAlertChan: make(chan cloudprotocol.SystemQuotaAlert, statusChanSize), + systemQuotaAlertChan: make(chan cloudprotocol.SystemQuotaAlert, statusChanSize), + nodeConfigStatusChan: make(chan unitconfig.NodeConfigStatus, statusChanSize), nodes: make(map[string]*smHandler), } @@ -123,10 +130,6 @@ func New( cloudprotocol.CrashLog: controller.getCrashLog, } - for _, nodeID := range cfg.SMController.NodeIDs { - controller.nodes[nodeID] = nil - } - var opts []grpc.ServerOption if !insecureConn { @@ -170,67 +173,70 @@ func (controller *Controller) Close() error { } } + close(controller.nodeConfigStatusChan) + return nil } -// GetNodeConfiguration gets node static configuration. -func (controller *Controller) GetNodeConfiguration(nodeID string) (cfg launcher.NodeInfo, err error) { +// GetNodeConfigStatus gets node configuration status. +func (controller *Controller) GetNodeConfigStatus(nodeID string) (unitconfig.NodeConfigStatus, error) { handler, err := controller.getNodeHandlerByID(nodeID) if err != nil { - return cfg, aoserrors.Wrap(err) + return unitconfig.NodeConfigStatus{}, err } - return handler.config, nil + return handler.nodeConfigStatus, nil } -// GetUnitConfigStatus gets unit configuration status fot he node. -func (controller *Controller) GetUnitConfigStatus(nodeID string) (string, error) { +// CheckNodeConfig checks node config. +func (controller *Controller) CheckNodeConfig(nodeID, version string, nodeConfig cloudprotocol.NodeConfig) error { handler, err := controller.getNodeHandlerByID(nodeID) if err != nil { - return "", aoserrors.Wrap(err) + return err } - return handler.getUnitConfigState() + if err = handler.checkNodeConfig(version, nodeConfig); err != nil { + return err + } + + return nil } -// CheckUnitConfig checks unit config for the node. -func (controller *Controller) CheckUnitConfig(unitConfig aostypes.UnitConfig) error { - for _, nodeConfig := range unitConfig.Nodes { - for _, node := range controller.nodes { - if node == nil { - continue - } +// SetNodeConfig sets node config. +func (controller *Controller) SetNodeConfig(nodeID, version string, nodeConfig cloudprotocol.NodeConfig) error { + handler, err := controller.getNodeHandlerByID(nodeID) + if err != nil { + return err + } - if node.config.NodeType == nodeConfig.NodeType { - err := node.checkUnitConfigState(nodeConfig, unitConfig.VendorVersion) - if err != nil { - return err - } - } - } + if err = handler.setNodeConfig(version, nodeConfig); err != nil { + return err + } + + if handler.nodeConfigStatus, err = handler.getNodeConfigStatus(); err != nil { + return err } return nil } -// SetUnitConfig sets unit config for the node. -func (controller *Controller) SetUnitConfig(unitConfig aostypes.UnitConfig) error { - for _, nodeConfig := range unitConfig.Nodes { - for _, node := range controller.nodes { - if node == nil { - continue - } +// GetNodeConfigStatuses returns node configuration statuses. +func (controller *Controller) GetNodeConfigStatuses() ([]unitconfig.NodeConfigStatus, error) { + controller.Lock() + defer controller.Unlock() - if node.config.NodeType == nodeConfig.NodeType { - err := node.setUnitConfig(nodeConfig, unitConfig.VendorVersion) - if err != nil { - return err - } - } - } + statuses := make([]unitconfig.NodeConfigStatus, 0, len(controller.nodes)) + + for _, handler := range controller.nodes { + statuses = append(statuses, handler.nodeConfigStatus) } - return nil + return statuses, nil +} + +// NodeConfigStatusChannel returns channel used to send new node configuration statuses. +func (controller *Controller) NodeConfigStatusChannel() <-chan unitconfig.NodeConfigStatus { + return controller.nodeConfigStatusChan } // RunInstances runs desired services instances. @@ -279,14 +285,14 @@ func (controller *Controller) GetLog(logRequest cloudprotocol.RequestLog) error return handler(logRequest) } -// GetNodeMonitoringData requests node monitoring data from SM. -func (controller *Controller) GetNodeMonitoringData(nodeID string) (data cloudprotocol.NodeMonitoringData, err error) { +// GetAverageMonitoring returns average monitoring data for the node. +func (controller *Controller) GetAverageMonitoring(nodeID string) (aostypes.NodeMonitoring, error) { handler, err := controller.getNodeHandlerByID(nodeID) if err != nil { - return data, err + return aostypes.NodeMonitoring{}, err } - return handler.getNodeMonitoring() + return handler.getAverageMonitoring() } // GetUpdateInstancesStatusChannel returns channel with update instances status. @@ -299,67 +305,68 @@ func (controller *Controller) GetRunInstancesStatusChannel() <-chan launcher.Nod return controller.runInstancesStatusChan } -// GetSystemLimitAlertChannel returns channel with alerts about RAM CLU system limits. -func (controller *Controller) GetSystemLimitAlertChannel() <-chan cloudprotocol.SystemQuotaAlert { - return controller.systemLimitAlertChan +// GetSystemQuoteAlertChannel returns channel with alerts about RAM, CPU system limits. +func (controller *Controller) GetSystemQuoteAlertChannel() <-chan cloudprotocol.SystemQuotaAlert { + return controller.systemQuotaAlertChan } // RegisterSM registers new SM client connection. func (controller *Controller) RegisterSM(stream pb.SMService_RegisterSMServer) error { - message, err := stream.Recv() - if err != nil { - log.Errorf("Error receive message from SM: %v", err) + var handler *smHandler - return aoserrors.Wrap(err) - } + for { + message, err := stream.Recv() + if err != nil { + if handler != nil { + controller.handleCloseConnection(handler.nodeID) + } - nodeConfig, ok := message.GetSMOutgoingMessage().(*pb.SMOutgoingMessages_NodeConfiguration) - if !ok { - log.Error("Unexpected first message from stream") + if !errors.Is(err, io.EOF) && codes.Canceled != status.Code(err) { + log.Errorf("Close SM client connection error: %v", err) - return aoserrors.New("unexpected first message from stream") - } + return aoserrors.Wrap(err) + } - log.WithFields(log.Fields{"nodeID": nodeConfig.NodeConfiguration.GetNodeId()}).Debug("Register SM") + return nil + } - nodeCfg := launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{ - NodeID: nodeConfig.NodeConfiguration.GetNodeId(), NodeType: nodeConfig.NodeConfiguration.GetNodeType(), - SystemInfo: cloudprotocol.SystemInfo{ - NumCPUs: nodeConfig.NodeConfiguration.GetNumCpus(), TotalRAM: nodeConfig.NodeConfiguration.GetTotalRam(), - Partitions: make([]cloudprotocol.PartitionInfo, len(nodeConfig.NodeConfiguration.GetPartitions())), - }, - }, - RemoteNode: nodeConfig.NodeConfiguration.GetRemoteNode(), - RunnerFeature: message.GetNodeConfiguration().GetRunnerFeatures(), - } + if handler == nil { + nodeConfigStatus, ok := message.GetSMOutgoingMessage().(*pb.SMOutgoingMessages_NodeConfigStatus) + if !ok { + log.Error("Unexpected first message from stream") - for i, pbPartition := range nodeConfig.NodeConfiguration.GetPartitions() { - nodeCfg.Partitions[i] = cloudprotocol.PartitionInfo{ - Name: pbPartition.GetName(), - Types: pbPartition.GetTypes(), - TotalSize: pbPartition.GetTotalSize(), - } - } + continue + } - handler, err := newSMHandler( - stream, controller.messageSender, controller.alertSender, controller.monitoringSender, nodeCfg, - controller.runInstancesStatusChan, controller.updateInstancesStatusChan, controller.systemLimitAlertChan) - if err != nil { - return err - } + nodeID := nodeConfigStatus.NodeConfigStatus.GetNodeId() + nodeType := nodeConfigStatus.NodeConfigStatus.GetNodeType() - if err := controller.handleNewConnection(nodeConfig.NodeConfiguration.GetNodeId(), handler); err != nil { - log.Errorf("Can't register new SM connection: %v", err) + log.WithFields(log.Fields{ + "nodeID": nodeID, + "nodeType": nodeType, + }).Debug("Register SM") - return err - } + handler, err = newSMHandler(nodeID, nodeType, stream, controller.messageSender, controller.alertSender, + controller.monitoringSender, controller.runInstancesStatusChan, controller.updateInstancesStatusChan, + controller.systemQuotaAlertChan) + if err != nil { + log.Errorf("Can't crate SM handler: %v", err) - handler.processSMMessages() + return err + } - controller.handleCloseConnection(nodeConfig.NodeConfiguration.GetNodeId()) + if err := controller.handleNewConnection( + nodeConfigStatusFromPB(nodeConfigStatus.NodeConfigStatus), handler); err != nil { + log.Errorf("Can't register new SM connection: %v", err) - return nil + return err + } + + continue + } + + handler.processSMMessages(message) + } } /*********************************************************************************************************************** @@ -486,32 +493,24 @@ func (controller *Controller) stopServer() { } } -func (controller *Controller) handleNewConnection(nodeID string, newHandler *smHandler) error { +func (controller *Controller) handleNewConnection( + nodeConfigStatus unitconfig.NodeConfigStatus, newHandler *smHandler, +) error { controller.Lock() defer controller.Unlock() - if handler, ok := controller.nodes[nodeID]; ok { - if handler != nil { - return aoserrors.Errorf("connection for nodeID %s already exist", nodeID) - } - } else { - return aoserrors.Errorf("unknown nodeID connection with nodeID %s", nodeID) + if _, ok := controller.nodes[nodeConfigStatus.NodeID]; ok { + return aoserrors.Errorf("connection for node ID %s already exist", nodeConfigStatus.NodeID) } - controller.nodes[nodeID] = newHandler + controller.nodes[nodeConfigStatus.NodeID] = newHandler + newHandler.nodeConfigStatus = nodeConfigStatus + controller.nodeConfigStatusChan <- nodeConfigStatus if err := newHandler.sendConnectionStatus(controller.isCloudConnected); err != nil { log.Errorf("Can't send connection status: %v", err) } - for _, node := range controller.nodes { - if node == nil { - return nil - } - } - - log.Info("All SM client connected") - return nil } @@ -525,7 +524,7 @@ func (controller *Controller) handleCloseConnection(nodeID string) { return } - controller.nodes[nodeID] = nil + delete(controller.nodes, nodeID) } func (controller *Controller) getNodeHandlerByID(nodeID string) (*smHandler, error) { diff --git a/smcontroller/smcontroller_test.go b/smcontroller/smcontroller_test.go index 505aba5b..aa98a947 100644 --- a/smcontroller/smcontroller_test.go +++ b/smcontroller/smcontroller_test.go @@ -28,7 +28,12 @@ import ( "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/servicemanager/v3" + "github.com/aosedge/aos_common/resourcemonitor" + "github.com/aosedge/aos_common/utils/alertutils" + "github.com/aosedge/aos_common/utils/pbconvert" + + pbcommon "github.com/aosedge/aos_common/api/common" + pbsm "github.com/aosedge/aos_common/api/servicemanager" log "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -41,6 +46,7 @@ import ( "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/launcher" "github.com/aosedge/aos_communicationmanager/smcontroller" + "github.com/aosedge/aos_communicationmanager/unitconfig" ) /*********************************************************************************************************************** @@ -57,10 +63,10 @@ const messageTimeout = 5 * time.Second type testSMClient struct { connection *grpc.ClientConn - pbClient pb.SMServiceClient - stream pb.SMService_RegisterSMClient - sendMessageChannel chan *pb.SMOutgoingMessages - receivedMessagesChannel chan *pb.SMIncomingMessages + pbClient pbsm.SMServiceClient + stream pbsm.SMService_RegisterSMClient + sendMessageChannel chan *pbsm.SMOutgoingMessages + receivedMessagesChannel chan *pbsm.SMIncomingMessages cancelFunction context.CancelFunc } @@ -69,11 +75,11 @@ type testMessageSender struct { } type testAlertSender struct { - messageChannel chan cloudprotocol.AlertItem + messageChannel chan interface{} } type testMonitoringSender struct { - messageChannel chan cloudprotocol.NodeMonitoringData + messageChannel chan aostypes.NodeMonitoring } /*********************************************************************************************************************** @@ -96,42 +102,19 @@ func init() { func TestSMInstancesStatusNotifications(t *testing.T) { var ( - nodeID = "mainSM" - nodeType = "mainSMType" - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, NodeType: nodeType, RemoteNode: true, - RunnerFeatures: []string{"runc"}, NumCpus: 1, TotalRam: 100, - Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - expectedNodeConfiguration = launcher.NodeInfo{ - NodeInfo: cloudprotocol.NodeInfo{ - NodeID: nodeID, NodeType: nodeType, - SystemInfo: cloudprotocol.SystemInfo{ - NumCPUs: 1, TotalRAM: 100, - Partitions: []cloudprotocol.PartitionInfo{ - {Name: "services", Types: []string{"t1"}, TotalSize: 50}, - }, - }, - }, - RemoteNode: true, - RunnerFeature: []string{"runc"}, - } - sendRuntimeStatus = &pb.RunInstancesStatus{ - Instances: []*pb.InstanceStatus{ + nodeID = "mainSM" + nodeType = "mainSMType" + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + sendRuntimeStatus = &pbsm.RunInstancesStatus{ + Instances: []*pbsm.InstanceStatus{ { - Instance: &pb.InstanceIdent{ServiceId: "serv1", SubjectId: "subj1", Instance: 1}, - AosVersion: 1, RunState: "running", + Instance: &pbcommon.InstanceIdent{ServiceId: "serv1", SubjectId: "subj1", Instance: 1}, + ServiceVersion: "1.0.0", RunState: "running", }, { - Instance: &pb.InstanceIdent{ServiceId: "serv2", SubjectId: "subj2", Instance: 1}, - AosVersion: 1, RunState: "fail", - ErrorInfo: &pb.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, + Instance: &pbcommon.InstanceIdent{ServiceId: "serv2", SubjectId: "subj2", Instance: 1}, + ServiceVersion: "1.0.0", RunState: "fail", + ErrorInfo: &pbcommon.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, }, }, } @@ -139,29 +122,33 @@ func TestSMInstancesStatusNotifications(t *testing.T) { NodeID: nodeID, NodeType: nodeType, Instances: []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv1", SubjectID: "subj1", Instance: 1}, - AosVersion: 1, RunState: "running", NodeID: nodeID, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv1", SubjectID: "subj1", Instance: 1}, + ServiceVersion: "1.0.0", Status: "running", NodeID: nodeID, }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv2", SubjectID: "subj2", Instance: 1}, - AosVersion: 1, RunState: "fail", NodeID: nodeID, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv2", SubjectID: "subj2", Instance: 1}, + ServiceVersion: "1.0.0", Status: "fail", NodeID: nodeID, ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, }, }, } - sendUpdateStatus = &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_UpdateInstancesStatus{ - UpdateInstancesStatus: &pb.UpdateInstancesStatus{ - Instances: []*pb.InstanceStatus{ + sendUpdateStatus = &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_UpdateInstancesStatus{ + UpdateInstancesStatus: &pbsm.UpdateInstancesStatus{ + Instances: []*pbsm.InstanceStatus{ { - Instance: &pb.InstanceIdent{ServiceId: "serv1", SubjectId: "subj1", Instance: 1}, - AosVersion: 1, RunState: "running", + Instance: &pbcommon.InstanceIdent{ + ServiceId: "serv1", SubjectId: "subj1", Instance: 1, + }, + ServiceVersion: "1.0.0", RunState: "running", }, { - Instance: &pb.InstanceIdent{ServiceId: "serv2", SubjectId: "subj2", Instance: 1}, - AosVersion: 1, RunState: "fail", - ErrorInfo: &pb.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, + Instance: &pbcommon.InstanceIdent{ + ServiceId: "serv2", SubjectId: "subj2", Instance: 1, + }, + ServiceVersion: "1.0.0", RunState: "fail", + ErrorInfo: &pbcommon.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, }, }, }, @@ -169,12 +156,12 @@ func TestSMInstancesStatusNotifications(t *testing.T) { } expectedUpdateState = []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv1", SubjectID: "subj1", Instance: 1}, - AosVersion: 1, RunState: "running", NodeID: nodeID, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv1", SubjectID: "subj1", Instance: 1}, + ServiceVersion: "1.0.0", Status: "running", NodeID: nodeID, }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv2", SubjectID: "subj2", Instance: 1}, - AosVersion: 1, RunState: "fail", NodeID: nodeID, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "serv2", SubjectID: "subj2", Instance: 1}, + ServiceVersion: "1.0.0", Status: "fail", NodeID: nodeID, ErrorInfo: &cloudprotocol.ErrorInfo{AosCode: 200, ExitCode: 300, Message: "superError"}, }, } @@ -186,7 +173,9 @@ func TestSMInstancesStatusNotifications(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, sendRuntimeStatus) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, sendRuntimeStatus) if err != nil { t.Fatalf("Can't create test SM: %v", err) } @@ -198,15 +187,6 @@ func TestSMInstancesStatusNotifications(t *testing.T) { t.Errorf("Incorrect runtime status notification: %v", err) } - cfg, err := controller.GetNodeConfiguration(nodeID) - if err != nil { - t.Errorf("Can't get node configuration: %v", err) - } - - if !reflect.DeepEqual(cfg, expectedNodeConfiguration) { - t.Error("Incorrect node configuration") - } - smClient.sendMessageChannel <- sendUpdateStatus if err := waitMessage( @@ -215,28 +195,19 @@ func TestSMInstancesStatusNotifications(t *testing.T) { } } -func TestUnitConfigMessages(t *testing.T) { +func TestNodeConfigMessages(t *testing.T) { var ( - nodeID = "mainSM" - nodeType = "mainType" - messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, NodeType: nodeType, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - testWaitChan = make(chan struct{}) - originalVersion = "version_1" - configStatus = &pb.SMOutgoingMessages{SMOutgoingMessage: &pb.SMOutgoingMessages_UnitConfigStatus{ - UnitConfigStatus: &pb.UnitConfigStatus{VendorVersion: originalVersion}, + nodeID = "mainSM" + nodeType = "mainType" + messageSender = newTestMessageSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + testWaitChan = make(chan struct{}) + originalVersion = "1.0.0" + nodeConfigStatus = &pbsm.SMOutgoingMessages{SMOutgoingMessage: &pbsm.SMOutgoingMessages_NodeConfigStatus{ + NodeConfigStatus: &pbsm.NodeConfigStatus{Version: originalVersion}, }} - newVersion = "version_2" - unitConfig = fmt.Sprintf(`{"nodeType":"%s"}`, nodeType) + newVersion = "2.0.0" + nodeConfig = fmt.Sprintf(`{"nodeType":"%s"}`, nodeType) ) controller, err := smcontroller.New(&config, messageSender, nil, nil, nil, nil, true) @@ -245,124 +216,111 @@ func TestUnitConfigMessages(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, Version: originalVersion, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, NodeType: nodeType, Instances: make([]cloudprotocol.InstanceStatus, 0), - }, messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) + if err := waitMessage( + controller.NodeConfigStatusChannel(), unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, Version: originalVersion, + }, messageTimeout); err != nil { + t.Errorf("Incorrect runtime status notification: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ConnectionStatus: &pbsm.ConnectionStatus{}}, + }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } go func() { - version, err := controller.GetUnitConfigStatus(nodeID) + nodeConfigStatus, err := controller.GetNodeConfigStatus(nodeID) if err != nil { - t.Errorf("Can't get unit config status: %v", err) + t.Errorf("Can't get node config status: %v", err) } - if version != originalVersion { - t.Error("Incorrect unit config version") + if nodeConfigStatus.Version != originalVersion { + t.Errorf("Incorrect node config version: %s", nodeConfigStatus.Version) } testWaitChan <- struct{}{} }() - if err := smClient.waitMessage( - &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_GetUnitConfigStatus{}}, - messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) - } - - if err := smClient.stream.Send(configStatus); err != nil { - t.Errorf("Can't send unit config status: %v", err) - } - <-testWaitChan go func() { - if err := controller.CheckUnitConfig(aostypes.UnitConfig{ - VendorVersion: newVersion, - Nodes: []aostypes.NodeUnitConfig{ - { - NodeType: nodeType, - }, - }, - }); err != nil { + if err := controller.CheckNodeConfig(nodeID, newVersion, + cloudprotocol.NodeConfig{NodeType: nodeType}); err != nil { t.Errorf("Error check unit config: %v", err) } testWaitChan <- struct{}{} }() - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_CheckUnitConfig{ - CheckUnitConfig: &pb.CheckUnitConfig{UnitConfig: unitConfig, VendorVersion: newVersion}, - }}, messageTimeout); err != nil { + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_CheckNodeConfig{ + CheckNodeConfig: &pbsm.CheckNodeConfig{NodeConfig: nodeConfig, Version: newVersion}, + }, + }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - configStatus.GetUnitConfigStatus().VendorVersion = newVersion + nodeConfigStatus.GetNodeConfigStatus().Version = newVersion - if err := smClient.stream.Send(configStatus); err != nil { + if err := smClient.stream.Send(nodeConfigStatus); err != nil { t.Errorf("Can't send unit config status") } <-testWaitChan go func() { - if err := controller.SetUnitConfig(aostypes.UnitConfig{ - VendorVersion: newVersion, - Nodes: []aostypes.NodeUnitConfig{ - { - NodeType: nodeType, - }, - }, - }); err != nil { + if err := controller.SetNodeConfig(nodeID, newVersion, + cloudprotocol.NodeConfig{NodeType: nodeType}); err != nil { t.Errorf("Error check unit config: %v", err) } testWaitChan <- struct{}{} }() - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_SetUnitConfig{ - SetUnitConfig: &pb.SetUnitConfig{UnitConfig: unitConfig, VendorVersion: newVersion}, - }}, messageTimeout); err != nil { + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_SetNodeConfig{ + SetNodeConfig: &pbsm.SetNodeConfig{NodeConfig: nodeConfig, Version: newVersion}, + }, + }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - configStatus.GetUnitConfigStatus().VendorVersion = newVersion + if err := smClient.stream.Send(nodeConfigStatus); err != nil { + t.Errorf("Can't send node config status: %v", err) + } - if err := smClient.stream.Send(configStatus); err != nil { - t.Errorf("Can't send unit config status") + if err := smClient.waitMessage( + &pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_GetNodeConfigStatus{}}, + messageTimeout); err != nil { + t.Fatalf("Wait message error: %v", err) } + if err := smClient.stream.Send(nodeConfigStatus); err != nil { + t.Errorf("Can't send node config status: %v", err) + } + + nodeConfigStatus.GetNodeConfigStatus().Version = newVersion + <-testWaitChan } func TestSMAlertNotifications(t *testing.T) { var ( nodeID = "mainSM" + nodeType = "mainSMType" messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - alertSender = newTestAlertSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + alertSender = newTestAlertSender() ) controller, err := smcontroller.New(&config, messageSender, alertSender, nil, nil, nil, true) @@ -371,7 +329,9 @@ func TestSMAlertNotifications(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, nil) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } @@ -380,129 +340,141 @@ func TestSMAlertNotifications(t *testing.T) { // Test alert notifications type testAlert struct { - sendAlert *pb.Alert - expectedAlert cloudprotocol.AlertItem + sendAlert *pbsm.Alert + expectedAlert interface{} } + now := time.Now().UTC() + testData := []testAlert{ { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagSystemError, - Payload: cloudprotocol.SystemAlert{Message: "SystemAlertMessage", NodeID: nodeID}, + expectedAlert: cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagSystemError, Timestamp: now}, + Message: "SystemAlertMessage", NodeID: nodeID, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagSystemError, - Payload: &pb.Alert_SystemAlert{SystemAlert: &pb.SystemAlert{Message: "SystemAlertMessage"}}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagSystemError, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_SystemAlert{ + SystemAlert: &pbsm.SystemAlert{Message: "SystemAlertMessage"}, + }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagAosCore, - Payload: cloudprotocol.CoreAlert{CoreComponent: "SM", Message: "CoreAlertMessage", NodeID: nodeID}, + expectedAlert: cloudprotocol.CoreAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagAosCore, Timestamp: now}, + CoreComponent: "SM", Message: "CoreAlertMessage", NodeID: nodeID, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagAosCore, - Payload: &pb.Alert_CoreAlert{CoreAlert: &pb.CoreAlert{CoreComponent: "SM", Message: "CoreAlertMessage"}}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagAosCore, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_CoreAlert{ + CoreAlert: &pbsm.CoreAlert{CoreComponent: "SM", Message: "CoreAlertMessage"}, + }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagResourceValidate, - Payload: cloudprotocol.ResourceValidateAlert{ - ResourcesErrors: []cloudprotocol.ResourceValidateError{ - {Name: "someName1", Errors: []string{"error1", "error2"}}, - {Name: "someName2", Errors: []string{"error3", "error4"}}, - }, - NodeID: nodeID, + expectedAlert: cloudprotocol.ResourceValidateAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagResourceValidate, Timestamp: now}, + NodeID: nodeID, + Name: "someName", + Errors: []cloudprotocol.ErrorInfo{ + {AosCode: 200, Message: "error1"}, + {AosCode: 300, Message: "error2"}, }, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagResourceValidate, - Payload: &pb.Alert_ResourceValidateAlert{ - ResourceValidateAlert: &pb.ResourceValidateAlert{ - Errors: []*pb.ResourceValidateErrors{ - {Name: "someName1", ErrorMsg: []string{"error1", "error2"}}, - {Name: "someName2", ErrorMsg: []string{"error3", "error4"}}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagResourceValidate, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_ResourceValidateAlert{ + ResourceValidateAlert: &pbsm.ResourceValidateAlert{ + Name: "someName", + Errors: []*pbcommon.ErrorInfo{ + {AosCode: 200, Message: "error1"}, + {AosCode: 300, Message: "error2"}, }, }, }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagDeviceAllocate, - Payload: cloudprotocol.DeviceAllocateAlert{ - InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, - Device: "someDevice", Message: "someMessage", - NodeID: nodeID, - }, + expectedAlert: cloudprotocol.DeviceAllocateAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagDeviceAllocate, Timestamp: now}, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, + Device: "someDevice", Message: "someMessage", + NodeID: nodeID, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagDeviceAllocate, - Payload: &pb.Alert_DeviceAllocateAlert{ - DeviceAllocateAlert: &pb.DeviceAllocateAlert{ - Instance: &pb.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagDeviceAllocate, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_DeviceAllocateAlert{ + DeviceAllocateAlert: &pbsm.DeviceAllocateAlert{ + Instance: &pbcommon.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, Device: "someDevice", Message: "someMessage", }, }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagSystemQuota, - Payload: cloudprotocol.SystemQuotaAlert{Parameter: "cpu", Value: 42, NodeID: nodeID}, + expectedAlert: cloudprotocol.SystemQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagSystemQuota, Timestamp: now}, + Parameter: "cpu", Value: 42, NodeID: nodeID, Status: resourcemonitor.AlertStatusRaise, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagSystemQuota, - Payload: &pb.Alert_SystemQuotaAlert{ - SystemQuotaAlert: &pb.SystemQuotaAlert{Parameter: "cpu", Value: 42}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagSystemQuota, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_SystemQuotaAlert{ + SystemQuotaAlert: &pbsm.SystemQuotaAlert{ + Parameter: "cpu", Value: 42, Status: resourcemonitor.AlertStatusRaise, + }, }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagSystemQuota, - Payload: cloudprotocol.SystemQuotaAlert{Parameter: "ram", Value: 99, NodeID: nodeID}, + expectedAlert: cloudprotocol.SystemQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagSystemQuota, Timestamp: now}, + Parameter: "ram", Value: 99, NodeID: nodeID, Status: resourcemonitor.AlertStatusRaise, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagSystemQuota, - Payload: &pb.Alert_SystemQuotaAlert{ - SystemQuotaAlert: &pb.SystemQuotaAlert{Parameter: "ram", Value: 99}, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagSystemQuota, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_SystemQuotaAlert{ + SystemQuotaAlert: &pbsm.SystemQuotaAlert{ + Parameter: "ram", Value: 99, Status: resourcemonitor.AlertStatusRaise, + }, }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagInstanceQuota, - Payload: cloudprotocol.InstanceQuotaAlert{ - InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, - Parameter: "param1", Value: 42, - }, + expectedAlert: cloudprotocol.InstanceQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagInstanceQuota, Timestamp: now}, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, + Parameter: "param1", Value: 42, Status: resourcemonitor.AlertStatusRaise, }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagInstanceQuota, - Payload: &pb.Alert_InstanceQuotaAlert{ - InstanceQuotaAlert: &pb.InstanceQuotaAlert{ - Instance: &pb.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, - Parameter: "param1", Value: 42, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagInstanceQuota, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_InstanceQuotaAlert{ + InstanceQuotaAlert: &pbsm.InstanceQuotaAlert{ + Instance: &pbcommon.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, + Parameter: "param1", Value: 42, Status: resourcemonitor.AlertStatusRaise, }, }, }, }, { - expectedAlert: cloudprotocol.AlertItem{ - Tag: cloudprotocol.AlertTagServiceInstance, - Payload: cloudprotocol.ServiceInstanceAlert{ - InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, - Message: "ServiceInstanceAlert", AosVersion: 42, - }, + expectedAlert: cloudprotocol.ServiceInstanceAlert{ + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagServiceInstance, Timestamp: now}, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "id1", SubjectID: "s1", Instance: 1}, + Message: "ServiceInstanceAlert", ServiceVersion: "42.0.0", }, - sendAlert: &pb.Alert{ - Tag: cloudprotocol.AlertTagServiceInstance, - Payload: &pb.Alert_InstanceAlert{ - InstanceAlert: &pb.InstanceAlert{ - Instance: &pb.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, - Message: "ServiceInstanceAlert", AosVersion: 42, + sendAlert: &pbsm.Alert{ + Tag: cloudprotocol.AlertTagServiceInstance, + Timestamp: timestamppb.New(now), + AlertItem: &pbsm.Alert_InstanceAlert{ + InstanceAlert: &pbsm.InstanceAlert{ + Instance: &pbcommon.InstanceIdent{ServiceId: "id1", SubjectId: "s1", Instance: 1}, + Message: "ServiceInstanceAlert", ServiceVersion: "42.0.0", }, }, }, @@ -510,26 +482,28 @@ func TestSMAlertNotifications(t *testing.T) { } for _, testAlert := range testData { - currentTime := time.Now().UTC() - testAlert.expectedAlert.Timestamp = currentTime - testAlert.sendAlert.Timestamp = timestamppb.New(currentTime) - - smClient.sendMessageChannel <- &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_Alert{Alert: testAlert.sendAlert}, + smClient.sendMessageChannel <- &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_Alert{Alert: testAlert.sendAlert}, } - if err := waitMessage(alertSender.messageChannel, testAlert.expectedAlert, messageTimeout); err != nil { + if err := waitAlerts(alertSender.messageChannel, testAlert.expectedAlert, messageTimeout); err != nil { t.Errorf("Incorrect alert notification: %v", err) } } expectedSystemLimitAlert := []cloudprotocol.SystemQuotaAlert{ - {Parameter: "cpu", Value: 42, NodeID: nodeID}, - {Parameter: "ram", Value: 99, NodeID: nodeID}, + { + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagSystemQuota}, + Parameter: "cpu", Value: 42, NodeID: nodeID, Status: resourcemonitor.AlertStatusRaise, + }, + { + AlertItem: cloudprotocol.AlertItem{Tag: cloudprotocol.AlertTagSystemQuota}, + Parameter: "ram", Value: 99, NodeID: nodeID, Status: resourcemonitor.AlertStatusRaise, + }, } for _, limitAlert := range expectedSystemLimitAlert { - if err := waitMessage(controller.GetSystemLimitAlertChannel(), limitAlert, messageTimeout); err != nil { + if err := waitAlerts(controller.GetSystemQuoteAlertChannel(), limitAlert, messageTimeout); err != nil { t.Errorf("Incorrect system limit alert: %v", err) } } @@ -537,18 +511,10 @@ func TestSMAlertNotifications(t *testing.T) { func TestSMMonitoringNotifications(t *testing.T) { var ( - nodeID = "mainSM" - messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } + nodeID = "mainSM" + nodeType = "mainSMType" + messageSender = newTestMessageSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} monitoringSender = newTestMonitoringSender() ) @@ -558,7 +524,9 @@ func TestSMMonitoringNotifications(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, nil) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } @@ -566,69 +534,79 @@ func TestSMMonitoringNotifications(t *testing.T) { defer smClient.close() type testMonitoringElement struct { - expectedMonitoring cloudprotocol.NodeMonitoringData - sendMonitoring *pb.NodeMonitoring + expectedMonitoring aostypes.NodeMonitoring + sendMonitoring *pbsm.InstantMonitoring } + now := time.Now().UTC() + testMonitoringData := []testMonitoringElement{ { - expectedMonitoring: cloudprotocol.NodeMonitoringData{ + expectedMonitoring: aostypes.NodeMonitoring{ NodeID: nodeID, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 10, CPU: 20, InTraffic: 40, OutTraffic: 50, - Disk: []cloudprotocol.PartitionUsage{{Name: "p1", UsedSize: 100}}, + NodeData: aostypes.MonitoringData{ + RAM: 10, CPU: 20, Download: 40, Upload: 50, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: now, }, - ServiceInstances: []cloudprotocol.InstanceMonitoringData{}, + InstancesData: []aostypes.InstanceMonitoring{}, }, - sendMonitoring: &pb.NodeMonitoring{ - MonitoringData: &pb.MonitoringData{ - Ram: 10, Cpu: 20, InTraffic: 40, OutTraffic: 50, - Disk: []*pb.PartitionUsage{{Name: "p1", UsedSize: 100}}, + sendMonitoring: &pbsm.InstantMonitoring{ + NodeMonitoring: &pbsm.MonitoringData{ + Ram: 10, Cpu: 20, Download: 40, Upload: 50, + Disk: []*pbsm.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: timestamppb.New(now), }, }, }, { - expectedMonitoring: cloudprotocol.NodeMonitoringData{ + expectedMonitoring: aostypes.NodeMonitoring{ NodeID: nodeID, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 10, CPU: 20, InTraffic: 40, OutTraffic: 50, - Disk: []cloudprotocol.PartitionUsage{{Name: "p1", UsedSize: 100}}, + NodeData: aostypes.MonitoringData{ + RAM: 10, CPU: 20, Download: 40, Upload: 50, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: now, }, - ServiceInstances: []cloudprotocol.InstanceMonitoringData{ + InstancesData: []aostypes.InstanceMonitoring{ { InstanceIdent: aostypes.InstanceIdent{ServiceID: "service1", SubjectID: "s1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 10, CPU: 20, InTraffic: 40, OutTraffic: 0, - Disk: []cloudprotocol.PartitionUsage{{Name: "p1", UsedSize: 100}}, + MonitoringData: aostypes.MonitoringData{ + RAM: 10, CPU: 20, Download: 40, Upload: 0, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: now, }, }, { InstanceIdent: aostypes.InstanceIdent{ServiceID: "service2", SubjectID: "s1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 20, CPU: 30, InTraffic: 50, OutTraffic: 10, - Disk: []cloudprotocol.PartitionUsage{{Name: "p2", UsedSize: 50}}, + MonitoringData: aostypes.MonitoringData{ + RAM: 20, CPU: 30, Download: 50, Upload: 10, + Disk: []aostypes.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Timestamp: now, }, }, }, }, - sendMonitoring: &pb.NodeMonitoring{ - MonitoringData: &pb.MonitoringData{ - Ram: 10, Cpu: 20, InTraffic: 40, OutTraffic: 50, - Disk: []*pb.PartitionUsage{{Name: "p1", UsedSize: 100}}, + sendMonitoring: &pbsm.InstantMonitoring{ + NodeMonitoring: &pbsm.MonitoringData{ + Ram: 10, Cpu: 20, Download: 40, Upload: 50, + Disk: []*pbsm.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: timestamppb.New(now), }, - InstanceMonitoring: []*pb.InstanceMonitoring{ + InstancesMonitoring: []*pbsm.InstanceMonitoring{ { - Instance: &pb.InstanceIdent{ServiceId: "service1", SubjectId: "s1", Instance: 1}, - MonitoringData: &pb.MonitoringData{ - Ram: 10, Cpu: 20, InTraffic: 40, OutTraffic: 0, - Disk: []*pb.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Instance: &pbcommon.InstanceIdent{ServiceId: "service1", SubjectId: "s1", Instance: 1}, + MonitoringData: &pbsm.MonitoringData{ + Ram: 10, Cpu: 20, Download: 40, Upload: 0, + Disk: []*pbsm.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: timestamppb.New(now), }, }, { - Instance: &pb.InstanceIdent{ServiceId: "service2", SubjectId: "s1", Instance: 1}, - MonitoringData: &pb.MonitoringData{ - Ram: 20, Cpu: 30, InTraffic: 50, OutTraffic: 10, - Disk: []*pb.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Instance: &pbcommon.InstanceIdent{ServiceId: "service2", SubjectId: "s1", Instance: 1}, + MonitoringData: &pbsm.MonitoringData{ + Ram: 20, Cpu: 30, Download: 50, Upload: 10, + Disk: []*pbsm.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Timestamp: timestamppb.New(now), }, }, }, @@ -637,13 +615,11 @@ func TestSMMonitoringNotifications(t *testing.T) { } for _, testMonitoring := range testMonitoringData { - currentTime := time.Now().UTC() - testMonitoring.expectedMonitoring.Timestamp = currentTime - testMonitoring.sendMonitoring.Timestamp = timestamppb.New(currentTime) - - smClient.sendMessageChannel <- &pb.SMOutgoingMessages{SMOutgoingMessage: &pb.SMOutgoingMessages_NodeMonitoring{ - NodeMonitoring: testMonitoring.sendMonitoring, - }} + smClient.sendMessageChannel <- &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_InstantMonitoring{ + InstantMonitoring: testMonitoring.sendMonitoring, + }, + } if err := waitMessage( monitoringSender.messageChannel, testMonitoring.expectedMonitoring, messageTimeout); err != nil { @@ -655,18 +631,10 @@ func TestSMMonitoringNotifications(t *testing.T) { func TestLogMessages(t *testing.T) { var ( nodeID = "mainSM" + nodeType = "mainSMType" messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - currentTime = time.Now().UTC() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + currentTime = time.Now().UTC() ) controller, err := smcontroller.New(&config, messageSender, nil, nil, nil, nil, true) @@ -675,28 +643,26 @@ func TestLogMessages(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, Instances: make([]cloudprotocol.InstanceStatus, 0), + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) - } - type testLogRequest struct { sendLogRequest cloudprotocol.RequestLog - expectedLogRequest *pb.SMIncomingMessages + expectedLogRequest *pbsm.SMIncomingMessages } testRequests := []testLogRequest{ @@ -708,8 +674,8 @@ func TestLogMessages(t *testing.T) { From: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_SystemLogRequest{ - SystemLogRequest: &pb.SystemLogRequest{LogId: "sysLogID1", From: timestamppb.New(currentTime)}, + expectedLogRequest: &pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_SystemLogRequest{ + SystemLogRequest: &pbsm.SystemLogRequest{LogId: "sysLogID1", From: timestamppb.New(currentTime)}, }}, }, { @@ -720,8 +686,8 @@ func TestLogMessages(t *testing.T) { Till: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_SystemLogRequest{ - SystemLogRequest: &pb.SystemLogRequest{LogId: "sysLogID2", Till: timestamppb.New(currentTime)}, + expectedLogRequest: &pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_SystemLogRequest{ + SystemLogRequest: &pbsm.SystemLogRequest{LogId: "sysLogID2", Till: timestamppb.New(currentTime)}, }}, }, { @@ -733,12 +699,14 @@ func TestLogMessages(t *testing.T) { From: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceLogRequest{ - InstanceLogRequest: &pb.InstanceLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "ser1", SubjectId: "s1", Instance: -1}, - LogId: "serviceLogID1", From: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceLogRequest{ + InstanceLogRequest: &pbsm.InstanceLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "ser1", SubjectId: "s1", Instance: -1}, + LogId: "serviceLogID1", From: timestamppb.New(currentTime), + }, }, - }}, + }, }, { sendLogRequest: cloudprotocol.RequestLog{ @@ -749,12 +717,14 @@ func TestLogMessages(t *testing.T) { Till: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceLogRequest{ - InstanceLogRequest: &pb.InstanceLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "ser2", SubjectId: "", Instance: -1}, - LogId: "serviceLogID1", Till: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceLogRequest{ + InstanceLogRequest: &pbsm.InstanceLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "ser2", SubjectId: "", Instance: -1}, + LogId: "serviceLogID1", Till: timestamppb.New(currentTime), + }, }, - }}, + }, }, { sendLogRequest: cloudprotocol.RequestLog{ @@ -765,12 +735,14 @@ func TestLogMessages(t *testing.T) { Till: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceLogRequest{ - InstanceLogRequest: &pb.InstanceLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "", SubjectId: "", Instance: -1}, - LogId: "serviceLogID2", Till: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceLogRequest{ + InstanceLogRequest: &pbsm.InstanceLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "", SubjectId: "", Instance: -1}, + LogId: "serviceLogID2", Till: timestamppb.New(currentTime), + }, }, - }}, + }, }, { sendLogRequest: cloudprotocol.RequestLog{ @@ -781,12 +753,14 @@ func TestLogMessages(t *testing.T) { From: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceCrashLogRequest{ - InstanceCrashLogRequest: &pb.InstanceCrashLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "ser1", SubjectId: "s1", Instance: -1}, - LogId: "serviceLogID1", From: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceCrashLogRequest{ + InstanceCrashLogRequest: &pbsm.InstanceCrashLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "ser1", SubjectId: "s1", Instance: -1}, + LogId: "serviceLogID1", From: timestamppb.New(currentTime), + }, }, - }}, + }, }, { sendLogRequest: cloudprotocol.RequestLog{ @@ -797,12 +771,14 @@ func TestLogMessages(t *testing.T) { Till: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceCrashLogRequest{ - InstanceCrashLogRequest: &pb.InstanceCrashLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "ser2", SubjectId: "", Instance: -1}, - LogId: "serviceLogID1", Till: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceCrashLogRequest{ + InstanceCrashLogRequest: &pbsm.InstanceCrashLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "ser2", SubjectId: "", Instance: -1}, + LogId: "serviceLogID1", Till: timestamppb.New(currentTime), + }, }, - }}, + }, }, { sendLogRequest: cloudprotocol.RequestLog{ @@ -813,12 +789,14 @@ func TestLogMessages(t *testing.T) { Till: ¤tTime, }, }, - expectedLogRequest: &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_InstanceCrashLogRequest{ - InstanceCrashLogRequest: &pb.InstanceCrashLogRequest{ - Instance: &pb.InstanceIdent{ServiceId: "", SubjectId: "", Instance: -1}, - LogId: "serviceLogID2", Till: timestamppb.New(currentTime), + expectedLogRequest: &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_InstanceCrashLogRequest{ + InstanceCrashLogRequest: &pbsm.InstanceCrashLogRequest{ + InstanceFilter: &pbsm.InstanceFilter{ServiceId: "", SubjectId: "", Instance: -1}, + LogId: "serviceLogID2", Till: timestamppb.New(currentTime), + }, }, - }}, + }, }, } @@ -837,11 +815,16 @@ func TestLogMessages(t *testing.T) { ErrorInfo: &cloudprotocol.ErrorInfo{ Message: "this is error", }, + Status: cloudprotocol.LogStatusError, } - smClient.sendMessageChannel <- &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_Log{ - Log: &pb.LogData{LogId: "log0", PartCount: 2, Part: 1, Data: []byte("this is log"), Error: "this is error"}, + smClient.sendMessageChannel <- &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_Log{ + Log: &pbsm.LogData{ + LogId: "log0", PartCount: 2, Part: 1, Data: []byte("this is log"), + Error: &pbcommon.ErrorInfo{Message: "this is error"}, + Status: cloudprotocol.LogStatusError, + }, }, } @@ -853,49 +836,48 @@ func TestLogMessages(t *testing.T) { func TestOverrideEnvVars(t *testing.T) { var ( nodeID = "mainSM" + nodeType = "mainSMType" messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - currentTime = time.Now().UTC() - envVars = cloudprotocol.OverrideEnvVars{ - OverrideEnvVars: []cloudprotocol.EnvVarsInstanceInfo{ + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + currentTime = time.Now().UTC() + envVars = cloudprotocol.OverrideEnvVars{ + Items: []cloudprotocol.EnvVarsInstanceInfo{ { InstanceFilter: cloudprotocol.NewInstanceFilter("service0", "subject0", -1), - EnvVars: []cloudprotocol.EnvVarInfo{ - {ID: "id0", Variable: "var0", TTL: ¤tTime}, + Variables: []cloudprotocol.EnvVarInfo{ + {Name: "var0", Value: "val0", TTL: ¤tTime}, }, }, }, } - expectedPbEnvVarRequest = &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_OverrideEnvVars{ - OverrideEnvVars: &pb.OverrideEnvVars{ - EnvVars: []*pb.OverrideInstanceEnvVar{{Instance: &pb.InstanceIdent{ - ServiceId: "service0", - SubjectId: "subject0", Instance: -1, - }, Vars: []*pb.EnvVarInfo{{VarId: "id0", Variable: "var0", Ttl: timestamppb.New(currentTime)}}}}, + expectedPbEnvVarRequest = &pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_OverrideEnvVars{ + OverrideEnvVars: &pbsm.OverrideEnvVars{ + EnvVars: []*pbsm.OverrideInstanceEnvVar{{InstanceFilter: &pbsm.InstanceFilter{ + ServiceId: "service0", + SubjectId: "subject0", Instance: -1, + }, Variables: []*pbsm.EnvVarInfo{{Name: "var0", Value: "val0", Ttl: timestamppb.New(currentTime)}}}}, + }, }, - }} - pbEnvVarStatus = &pb.SMOutgoingMessages{SMOutgoingMessage: &pb.SMOutgoingMessages_OverrideEnvVarStatus{ - OverrideEnvVarStatus: &pb.OverrideEnvVarStatus{EnvVarsStatus: []*pb.EnvVarInstanceStatus{ - {Instance: &pb.InstanceIdent{ + } + pbEnvVarStatus = &pbsm.SMOutgoingMessages{SMOutgoingMessage: &pbsm.SMOutgoingMessages_OverrideEnvVarStatus{ + OverrideEnvVarStatus: &pbsm.OverrideEnvVarStatus{EnvVarsStatus: []*pbsm.EnvVarInstanceStatus{ + {InstanceFilter: &pbsm.InstanceFilter{ ServiceId: "service0", SubjectId: "subject0", Instance: -1, - }, VarsStatus: []*pb.EnvVarStatus{{VarId: "id0", Error: "someError"}}}, + }, Statuses: []*pbsm.EnvVarStatus{{Name: "var0", Error: &pbcommon.ErrorInfo{ + Message: "someError", + }}}}, }}, }} expectedEnvVarStatus = cloudprotocol.OverrideEnvVarsStatus{ - OverrideEnvVarsStatus: []cloudprotocol.EnvVarsInstanceStatus{ + Statuses: []cloudprotocol.EnvVarsInstanceStatus{ { InstanceFilter: cloudprotocol.NewInstanceFilter("service0", "subject0", -1), - Statuses: []cloudprotocol.EnvVarStatus{{ID: "id0", Error: "someError"}}, + Statuses: []cloudprotocol.EnvVarStatus{{ + Name: "var0", + ErrorInfo: &cloudprotocol.ErrorInfo{Message: "someError"}, + }}, }, }, } @@ -907,25 +889,23 @@ func TestOverrideEnvVars(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, Instances: make([]cloudprotocol.InstanceStatus, 0), + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) - } - if err = controller.OverrideEnvVars(nodeID, envVars); err != nil { t.Fatalf("Error sending override env vars: %v", err) } @@ -943,50 +923,46 @@ func TestOverrideEnvVars(t *testing.T) { func TestRunInstances(t *testing.T) { var ( - nodeID = "mainSM" - messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } - expectedRunInstances = &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_RunInstances{ - RunInstances: &pb.RunInstances{ - Services: []*pb.ServiceInfo{{ - VersionInfo: &pb.VersionInfo{AosVersion: 1, VendorVersion: "1", Description: "desc"}, - Url: "url1", ServiceId: "s1", ProviderId: "p1", Gid: 600, - Sha256: []byte{0, 0, 0, byte(100)}, Sha512: []byte{byte(200), 0, 0, 0}, Size: uint64(500), + nodeID = "mainSM" + nodeType = "mainSMType" + messageSender = newTestMessageSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + expectedRunInstances = &pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_RunInstances{ + RunInstances: &pbsm.RunInstances{ + Services: []*pbsm.ServiceInfo{{ + Version: "1.1.0", + Url: "url1", ServiceId: "s1", ProviderId: "p1", Gid: 600, + Sha256: []byte{0, 0, 0, byte(100)}, Size: uint64(500), }}, - Layers: []*pb.LayerInfo{ + Layers: []*pbsm.LayerInfo{ { - VersionInfo: &pb.VersionInfo{AosVersion: 2, VendorVersion: "3", Description: "desc2"}, - Url: "url2", LayerId: "l1", Digest: "digest1", Sha256: []byte{0, 0, 0, byte(100)}, - Sha512: []byte{byte(200), 0, 0, 0}, Size: uint64(500), + Version: "3.0.0", + Url: "url2", LayerId: "l1", Digest: "digest1", Sha256: []byte{0, 0, 0, byte(100)}, + Size: uint64(500), }, }, - Instances: []*pb.InstanceInfo{ + Instances: []*pbsm.InstanceInfo{ { - Instance: &pb.InstanceIdent{ServiceId: "s1", SubjectId: "subj1", Instance: 1}, - NetworkParameters: &pb.NetworkParameters{Ip: "172.17.0.3", Subnet: "172.17.0.0/16", VlanId: 1}, - Uid: 500, Priority: 1, StoragePath: "storage1", StatePath: "state1", + Instance: &pbcommon.InstanceIdent{ + ServiceId: "s1", SubjectId: "subj1", Instance: 1, + }, + NetworkParameters: &pbsm.NetworkParameters{ + Ip: "172.17.0.3", Subnet: "172.17.0.0/16", VlanId: 1, + }, + Uid: 500, Priority: 1, StoragePath: "storage1", StatePath: "state1", }, }, }, }} sendServices = []aostypes.ServiceInfo{{ - VersionInfo: aostypes.VersionInfo{AosVersion: 1, VendorVersion: "1", Description: "desc"}, - ID: "s1", ProviderID: "p1", URL: "url1", GID: 600, - Sha256: []byte{0, 0, 0, byte(100)}, Sha512: []byte{byte(200), 0, 0, 0}, Size: uint64(500), + Version: "1.1.0", + ServiceID: "s1", ProviderID: "p1", URL: "url1", GID: 600, + Sha256: []byte{0, 0, 0, byte(100)}, Size: uint64(500), }} sendLayers = []aostypes.LayerInfo{{ - VersionInfo: aostypes.VersionInfo{AosVersion: 2, VendorVersion: "3", Description: "desc2"}, - URL: "url2", ID: "l1", Digest: "digest1", Sha256: []byte{0, 0, 0, byte(100)}, - Sha512: []byte{byte(200), 0, 0, 0}, Size: uint64(500), + Version: "3.0.0", + URL: "url2", LayerID: "l1", Digest: "digest1", Sha256: []byte{0, 0, 0, byte(100)}, + Size: uint64(500), }} sendInstances = []aostypes.InstanceInfo{{ InstanceIdent: aostypes.InstanceIdent{ServiceID: "s1", SubjectID: "subj1", Instance: 1}, @@ -1001,7 +977,9 @@ func TestRunInstances(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, &pbsm.RunInstancesStatus{}) if err != nil { t.Fatalf("Can't create test SM: %v", err) } @@ -1009,14 +987,16 @@ func TestRunInstances(t *testing.T) { defer smClient.close() if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, Instances: make([]cloudprotocol.InstanceStatus, 0), + NodeID: nodeID, NodeType: nodeType, Instances: make([]cloudprotocol.InstanceStatus, 0), }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, + }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } @@ -1032,17 +1012,9 @@ func TestRunInstances(t *testing.T) { func TestUpdateNetwork(t *testing.T) { var ( nodeID = "mainSM" + nodeType = "mainSMType" messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} ) networkParameters := []aostypes.NetworkParameters{ @@ -1060,9 +1032,9 @@ func TestUpdateNetwork(t *testing.T) { }, } - expectedUpdatesNetwork := &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_UpdateNetworks{ - UpdateNetworks: &pb.UpdateNetworks{ - Networks: []*pb.NetworkParameters{ + expectedUpdatesNetwork := &pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_UpdateNetworks{ + UpdateNetworks: &pbsm.UpdateNetworks{ + Networks: []*pbsm.NetworkParameters{ { Subnet: "172.17.0.0/16", Ip: "172.17.0.1", @@ -1085,25 +1057,23 @@ func TestUpdateNetwork(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, Instances: make([]cloudprotocol.InstanceStatus, 0), + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) - } - if err := controller.UpdateNetwork(nodeID, networkParameters); err != nil { t.Fatalf("Can't send run instances: %v", err) } @@ -1116,18 +1086,9 @@ func TestUpdateNetwork(t *testing.T) { func TestSyncClock(t *testing.T) { var ( nodeID = "mainSM" + nodeType = "mainSMType" messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} ) controller, err := smcontroller.New(&config, messageSender, nil, nil, nil, nil, true) @@ -1136,21 +1097,25 @@ func TestSyncClock(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, + }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - smClient.sendMessageChannel <- &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_ClockSyncRequest{}, + smClient.sendMessageChannel <- &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_ClockSyncRequest{}, } select { @@ -1158,7 +1123,7 @@ func TestSyncClock(t *testing.T) { t.Fatalf("Wait message error: %v", err) case message := <-smClient.receivedMessagesChannel: - clockSync, ok := message.GetSMIncomingMessage().(*pb.SMIncomingMessages_ClockSync) + clockSync, ok := message.GetSMIncomingMessage().(*pbsm.SMIncomingMessages_ClockSync) if !ok { t.Fatalf("Incorrect message type: %v", message) } @@ -1169,66 +1134,62 @@ func TestSyncClock(t *testing.T) { } } -func TestGetNodeMonitoringData(t *testing.T) { +func TestGetAverageMonitoring(t *testing.T) { var ( - nodeID = "mainSM" - messageSender = newTestMessageSender() - nodeConfig = &pb.NodeConfiguration{ - NodeId: nodeID, RemoteNode: true, RunnerFeatures: []string{"runc"}, NumCpus: 1, - TotalRam: 100, Partitions: []*pb.Partition{{Name: "services", Types: []string{"t1"}, TotalSize: 50}}, - } - config = config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } + nodeID = "mainSM" + nodeType = "mainSMType" + messageSender = newTestMessageSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} testWaitChan = make(chan struct{}) currentTime = time.Now().UTC() - expectedMonitoring = cloudprotocol.NodeMonitoringData{ - NodeID: nodeID, - Timestamp: currentTime, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 10, CPU: 20, InTraffic: 40, OutTraffic: 50, - Disk: []cloudprotocol.PartitionUsage{{Name: "p1", UsedSize: 100}}, + expectedMonitoring = aostypes.NodeMonitoring{ + NodeID: nodeID, + NodeData: aostypes.MonitoringData{ + RAM: 10, CPU: 20, Download: 40, Upload: 50, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: currentTime, }, - ServiceInstances: []cloudprotocol.InstanceMonitoringData{ + InstancesData: []aostypes.InstanceMonitoring{ { InstanceIdent: aostypes.InstanceIdent{ServiceID: "service1", SubjectID: "s1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 10, CPU: 20, InTraffic: 40, OutTraffic: 0, - Disk: []cloudprotocol.PartitionUsage{{Name: "p1", UsedSize: 100}}, + MonitoringData: aostypes.MonitoringData{ + RAM: 10, CPU: 20, Download: 40, Upload: 0, + Disk: []aostypes.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: currentTime, }, }, { InstanceIdent: aostypes.InstanceIdent{ServiceID: "service2", SubjectID: "s1", Instance: 1}, - MonitoringData: cloudprotocol.MonitoringData{ - RAM: 20, CPU: 30, InTraffic: 50, OutTraffic: 10, - Disk: []cloudprotocol.PartitionUsage{{Name: "p2", UsedSize: 50}}, + MonitoringData: aostypes.MonitoringData{ + RAM: 20, CPU: 30, Download: 50, Upload: 10, + Disk: []aostypes.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Timestamp: currentTime, }, }, }, } - sendMonitoring = &pb.SMOutgoingMessages{SMOutgoingMessage: &pb.SMOutgoingMessages_NodeMonitoring{ - NodeMonitoring: &pb.NodeMonitoring{ - Timestamp: timestamppb.New(currentTime), - MonitoringData: &pb.MonitoringData{ - Ram: 10, Cpu: 20, InTraffic: 40, OutTraffic: 50, - Disk: []*pb.PartitionUsage{{Name: "p1", UsedSize: 100}}, + sendMonitoring = &pbsm.SMOutgoingMessages{SMOutgoingMessage: &pbsm.SMOutgoingMessages_AverageMonitoring{ + AverageMonitoring: &pbsm.AverageMonitoring{ + NodeMonitoring: &pbsm.MonitoringData{ + Ram: 10, Cpu: 20, Download: 40, Upload: 50, + Disk: []*pbsm.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: timestamppb.New(currentTime), }, - InstanceMonitoring: []*pb.InstanceMonitoring{ + InstancesMonitoring: []*pbsm.InstanceMonitoring{ { - Instance: &pb.InstanceIdent{ServiceId: "service1", SubjectId: "s1", Instance: 1}, - MonitoringData: &pb.MonitoringData{ - Ram: 10, Cpu: 20, InTraffic: 40, OutTraffic: 0, - Disk: []*pb.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Instance: &pbcommon.InstanceIdent{ServiceId: "service1", SubjectId: "s1", Instance: 1}, + MonitoringData: &pbsm.MonitoringData{ + Ram: 10, Cpu: 20, Download: 40, Upload: 0, + Disk: []*pbsm.PartitionUsage{{Name: "p1", UsedSize: 100}}, + Timestamp: timestamppb.New(currentTime), }, }, { - Instance: &pb.InstanceIdent{ServiceId: "service2", SubjectId: "s1", Instance: 1}, - MonitoringData: &pb.MonitoringData{ - Ram: 20, Cpu: 30, InTraffic: 50, OutTraffic: 10, - Disk: []*pb.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Instance: &pbcommon.InstanceIdent{ServiceId: "service2", SubjectId: "s1", Instance: 1}, + MonitoringData: &pbsm.MonitoringData{ + Ram: 20, Cpu: 30, Download: 50, Upload: 10, + Disk: []*pbsm.PartitionUsage{{Name: "p2", UsedSize: 50}}, + Timestamp: timestamppb.New(currentTime), }, }, }, @@ -1242,42 +1203,38 @@ func TestGetNodeMonitoringData(t *testing.T) { } defer controller.Close() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, &pb.RunInstancesStatus{}) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } defer smClient.close() - if err := waitMessage(controller.GetRunInstancesStatusChannel(), launcher.NodeRunInstanceStatus{ - NodeID: nodeID, Instances: make([]cloudprotocol.InstanceStatus, 0), + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{}, + }, }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{}, - }}, messageTimeout); err != nil { - t.Fatalf("Wait message error: %v", err) - } - go func() { - data, err := controller.GetNodeMonitoringData(nodeID) + data, err := controller.GetAverageMonitoring(nodeID) if err != nil { - t.Errorf("Can't get node monitoring data: %v", err) + t.Errorf("Can't get average node monitoring: %v", err) } if !reflect.DeepEqual(data, expectedMonitoring) { - log.Debug("Exp: ", expectedMonitoring) - log.Debug("Rec: ", data) t.Errorf("Incorrect monitoring data") } testWaitChan <- struct{}{} }() - if err := smClient.waitMessage(&pb.SMIncomingMessages{ - SMIncomingMessage: &pb.SMIncomingMessages_GetNodeMonitoring{}, + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{ + SMIncomingMessage: &pbsm.SMIncomingMessages_GetAverageMonitoring{}, }, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } @@ -1290,15 +1247,12 @@ func TestGetNodeMonitoringData(t *testing.T) { } func TestConnectionStatus(t *testing.T) { - nodeID := "mainSM" - messageSender := newTestMessageSender() - nodeConfig := &pb.NodeConfiguration{NodeId: nodeID} - config := config.Config{ - SMController: config.SMController{ - CMServerURL: cmServerURL, - NodeIDs: []string{nodeID}, - }, - } + var ( + nodeID = "mainSM" + nodeType = "mainSMType" + messageSender = newTestMessageSender() + config = config.Config{SMController: config.SMController{CMServerURL: cmServerURL}} + ) controller, err := smcontroller.New(&config, messageSender, nil, nil, nil, nil, true) if err != nil { @@ -1308,7 +1262,9 @@ func TestConnectionStatus(t *testing.T) { controller.CloudConnected() - smClient, err := newTestSMClient(cmServerURL, nodeConfig, nil) + smClient, err := newTestSMClient(cmServerURL, unitconfig.NodeConfigStatus{ + NodeID: nodeID, NodeType: nodeType, + }, nil) if err != nil { t.Fatalf("Can't create test SM: %v", err) } @@ -1317,8 +1273,8 @@ func TestConnectionStatus(t *testing.T) { // check receive correct connection status on registration - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{CloudStatus: pb.ConnectionEnum_CONNECTED}, + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{CloudStatus: pbsm.ConnectionEnum_CONNECTED}, }}, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } @@ -1327,8 +1283,8 @@ func TestConnectionStatus(t *testing.T) { controller.CloudDisconnected() - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{CloudStatus: pb.ConnectionEnum_DISCONNECTED}, + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{CloudStatus: pbsm.ConnectionEnum_DISCONNECTED}, }}, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } @@ -1337,8 +1293,8 @@ func TestConnectionStatus(t *testing.T) { controller.CloudConnected() - if err := smClient.waitMessage(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_ConnectionStatus{ - ConnectionStatus: &pb.ConnectionStatus{CloudStatus: pb.ConnectionEnum_CONNECTED}, + if err := smClient.waitMessage(&pbsm.SMIncomingMessages{SMIncomingMessage: &pbsm.SMIncomingMessages_ConnectionStatus{ + ConnectionStatus: &pbsm.ConnectionStatus{CloudStatus: pbsm.ConnectionEnum_CONNECTED}, }}, messageTimeout); err != nil { t.Fatalf("Wait message error: %v", err) } @@ -1349,19 +1305,19 @@ func TestConnectionStatus(t *testing.T) { **********************************************************************************************************************/ func newTestAlertSender() *testAlertSender { - return &testAlertSender{messageChannel: make(chan cloudprotocol.AlertItem, 1)} + return &testAlertSender{messageChannel: make(chan interface{}, 1)} } -func (sender *testAlertSender) SendAlert(alert cloudprotocol.AlertItem) { +func (sender *testAlertSender) SendAlert(alert interface{}) { sender.messageChannel <- alert } func newTestMonitoringSender() *testMonitoringSender { - return &testMonitoringSender{messageChannel: make(chan cloudprotocol.NodeMonitoringData, 1)} + return &testMonitoringSender{messageChannel: make(chan aostypes.NodeMonitoring, 1)} } -func (sender *testMonitoringSender) SendMonitoringData(monitoringData cloudprotocol.NodeMonitoringData) { - sender.messageChannel <- monitoringData +func (sender *testMonitoringSender) SendNodeMonitoring(monitoring aostypes.NodeMonitoring) { + sender.messageChannel <- monitoring } func newTestMessageSender() *testMessageSender { @@ -1392,6 +1348,23 @@ func (sender *testMessageSender) UnsubscribeFromConnectionEvents(consumer amqpha * Private **********************************************************************************************************************/ +func waitAlerts[T any](messageChannel <-chan T, expectedMsg interface{}, timeout time.Duration) error { + select { + case <-time.After(timeout): + return aoserrors.New("wait message timeout") + + case message := <-messageChannel: + if !alertutils.AlertsPayloadEqual(message, expectedMsg) { + log.Debugf("%v", message) + log.Debugf("%v", expectedMsg) + + return aoserrors.New("incorrect received message") + } + } + + return nil +} + func waitMessage[T any](messageChannel <-chan T, expectedMsg interface{}, timeout time.Duration) error { select { case <-time.After(timeout): @@ -1399,6 +1372,9 @@ func waitMessage[T any](messageChannel <-chan T, expectedMsg interface{}, timeou case message := <-messageChannel: if !reflect.DeepEqual(message, expectedMsg) { + log.Debugf("%v", message) + log.Debugf("%v", expectedMsg) + return aoserrors.New("incorrect received message") } } @@ -1407,11 +1383,11 @@ func waitMessage[T any](messageChannel <-chan T, expectedMsg interface{}, timeou } func newTestSMClient( - url string, config *pb.NodeConfiguration, runStatus *pb.RunInstancesStatus, + url string, nodeConfigStatus unitconfig.NodeConfigStatus, runStatus *pbsm.RunInstancesStatus, ) (client *testSMClient, err error) { client = &testSMClient{ - sendMessageChannel: make(chan *pb.SMOutgoingMessages, 10), - receivedMessagesChannel: make(chan *pb.SMIncomingMessages, 10), + sendMessageChannel: make(chan *pbsm.SMOutgoingMessages, 10), + receivedMessagesChannel: make(chan *pbsm.SMIncomingMessages, 10), } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) @@ -1422,23 +1398,26 @@ func newTestSMClient( return nil, aoserrors.Wrap(err) } - client.pbClient = pb.NewSMServiceClient(client.connection) + client.pbClient = pbsm.NewSMServiceClient(client.connection) - if client.stream, err = pb.NewSMServiceClient(client.connection).RegisterSM(context.Background()); err != nil { + if client.stream, err = pbsm.NewSMServiceClient(client.connection).RegisterSM(context.Background()); err != nil { return nil, aoserrors.Wrap(err) } if err := client.stream.Send( - &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_NodeConfiguration{NodeConfiguration: config}, + &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_NodeConfigStatus{NodeConfigStatus: &pbsm.NodeConfigStatus{ + NodeId: nodeConfigStatus.NodeID, NodeType: nodeConfigStatus.NodeType, Version: nodeConfigStatus.Version, + Error: pbconvert.ErrorInfoToPB(nodeConfigStatus.Error), + }}, }); err != nil { return nil, aoserrors.Wrap(err) } if runStatus != nil { if err := client.stream.Send( - &pb.SMOutgoingMessages{ - SMOutgoingMessage: &pb.SMOutgoingMessages_RunInstancesStatus{RunInstancesStatus: runStatus}, + &pbsm.SMOutgoingMessages{ + SMOutgoingMessage: &pbsm.SMOutgoingMessages_RunInstancesStatus{RunInstancesStatus: runStatus}, }); err != nil { return nil, aoserrors.Wrap(err) } @@ -1493,14 +1472,14 @@ func (client *testSMClient) processSendMessages(ctx context.Context) { } } -func (client *testSMClient) waitMessage(expectedMsg *pb.SMIncomingMessages, timeout time.Duration) error { +func (client *testSMClient) waitMessage(expectedMsg *pbsm.SMIncomingMessages, timeout time.Duration) error { select { case <-time.After(timeout): return aoserrors.New("wait message timeout") case message := <-client.receivedMessagesChannel: if !proto.Equal(message, expectedMsg) { - return aoserrors.New("incorrect received client message") + return aoserrors.Errorf("incorrect client message received: %v", message) } } diff --git a/smcontroller/smhandler.go b/smcontroller/smhandler.go index 0697ac1b..d80a51e6 100644 --- a/smcontroller/smhandler.go +++ b/smcontroller/smhandler.go @@ -20,23 +20,22 @@ package smcontroller import ( "context" "encoding/json" - "errors" - "io" "reflect" "time" "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/servicemanager/v3" + "github.com/aosedge/aos_common/api/common" + pb "github.com/aosedge/aos_common/api/servicemanager" + "github.com/aosedge/aos_common/resourcemonitor" "github.com/aosedge/aos_common/utils/pbconvert" "github.com/aosedge/aos_common/utils/syncstream" log "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" "github.com/aosedge/aos_communicationmanager/launcher" + "github.com/aosedge/aos_communicationmanager/unitconfig" ) /*********************************************************************************************************************** @@ -50,15 +49,17 @@ const waitMessageTimeout = 5 * time.Second **********************************************************************************************************************/ type smHandler struct { + nodeID string + nodeType string stream pb.SMService_RegisterSMServer messageSender MessageSender alertSender AlertSender monitoringSender MonitoringSender syncstream *syncstream.SyncStream - config launcher.NodeInfo + nodeConfigStatus unitconfig.NodeConfigStatus runStatusCh chan<- launcher.NodeRunInstanceStatus updateInstanceStatusCh chan<- []cloudprotocol.InstanceStatus - systemLimitAlertCh chan<- cloudprotocol.SystemQuotaAlert + systemQuotasAlertCh chan<- cloudprotocol.SystemQuotaAlert } /*********************************************************************************************************************** @@ -66,89 +67,96 @@ type smHandler struct { **********************************************************************************************************************/ func newSMHandler( + nodeID, nodeType string, stream pb.SMService_RegisterSMServer, messageSender MessageSender, alertSender AlertSender, - monitoringSender MonitoringSender, config launcher.NodeInfo, - runStatusCh chan<- launcher.NodeRunInstanceStatus, updateInstanceStatusCh chan<- []cloudprotocol.InstanceStatus, - systemLimitAlertCh chan<- cloudprotocol.SystemQuotaAlert, + monitoringSender MonitoringSender, runStatusCh chan<- launcher.NodeRunInstanceStatus, + updateInstanceStatusCh chan<- []cloudprotocol.InstanceStatus, + systemQuotasAlertCh chan<- cloudprotocol.SystemQuotaAlert, ) (*smHandler, error) { handler := smHandler{ + nodeID: nodeID, + nodeType: nodeType, stream: stream, messageSender: messageSender, alertSender: alertSender, monitoringSender: monitoringSender, syncstream: syncstream.New(), - config: config, runStatusCh: runStatusCh, updateInstanceStatusCh: updateInstanceStatusCh, - systemLimitAlertCh: systemLimitAlertCh, + systemQuotasAlertCh: systemQuotasAlertCh, } return &handler, nil } -func (handler *smHandler) getUnitConfigState() (vendorVersion string, err error) { +func (handler *smHandler) getNodeConfigStatus() (unitconfig.NodeConfigStatus, error) { ctx, cancelFunc := context.WithTimeout(context.Background(), waitMessageTimeout) defer cancelFunc() status, err := handler.syncstream.Send( - ctx, handler.sendGetUnitConfigStatus, reflect.TypeOf(&pb.SMOutgoingMessages_UnitConfigStatus{})) + ctx, handler.sendGetNodeConfigStatus, reflect.TypeOf(&pb.SMOutgoingMessages_NodeConfigStatus{})) if err != nil { - return vendorVersion, aoserrors.Wrap(err) + return unitconfig.NodeConfigStatus{}, aoserrors.Wrap(err) } - pbStatus, ok := status.(*pb.SMOutgoingMessages_UnitConfigStatus) + pbStatus, ok := status.(*pb.SMOutgoingMessages_NodeConfigStatus) if !ok { - return "", aoserrors.New("incorrect type") + return unitconfig.NodeConfigStatus{}, aoserrors.New("incorrect type") } - if pbStatus.UnitConfigStatus.GetError() != "" { - return vendorVersion, aoserrors.New(pbStatus.UnitConfigStatus.GetError()) + if pbStatus.NodeConfigStatus.GetError().GetMessage() != "" { + return unitconfig.NodeConfigStatus{}, aoserrors.New(pbStatus.NodeConfigStatus.GetError().GetMessage()) } - return pbStatus.UnitConfigStatus.GetVendorVersion(), nil + nodeConfigStatus := nodeConfigStatusFromPB(pbStatus.NodeConfigStatus) + + nodeConfigStatus.NodeID = handler.nodeID + nodeConfigStatus.NodeType = handler.nodeType + + return nodeConfigStatus, nil } -func (handler *smHandler) checkUnitConfigState(cfg aostypes.NodeUnitConfig, vendorVersion string) error { +func (handler *smHandler) checkNodeConfig(version string, unitConfig cloudprotocol.NodeConfig) error { ctx, cancelFunc := context.WithTimeout(context.Background(), waitMessageTimeout) defer cancelFunc() status, err := handler.syncstream.Send(ctx, func() error { - return handler.sendCheckUnitConfig(cfg, vendorVersion) - }, reflect.TypeOf(&pb.SMOutgoingMessages_UnitConfigStatus{})) + return handler.sendCheckNodeConfig(unitConfig, version) + }, reflect.TypeOf(&pb.SMOutgoingMessages_NodeConfigStatus{})) if err != nil { return aoserrors.Wrap(err) } - pbStatus, ok := status.(*pb.SMOutgoingMessages_UnitConfigStatus) + pbStatus, ok := status.(*pb.SMOutgoingMessages_NodeConfigStatus) if !ok { return aoserrors.New("incorrect type") } - if pbStatus.UnitConfigStatus.GetError() != "" { - return aoserrors.New(pbStatus.UnitConfigStatus.GetError()) + if pbStatus.NodeConfigStatus.GetError() != nil { + return aoserrors.New(pbStatus.NodeConfigStatus.GetError().GetMessage()) } return nil } -func (handler *smHandler) setUnitConfig(cfg aostypes.NodeUnitConfig, vendorVersion string) error { +func (handler *smHandler) setNodeConfig(version string, cfg cloudprotocol.NodeConfig) error { ctx, cancelFunc := context.WithTimeout(context.Background(), waitMessageTimeout) defer cancelFunc() status, err := handler.syncstream.Send(ctx, func() error { - return handler.sendSetUnitConfig(cfg, vendorVersion) - }, reflect.TypeOf(&pb.SMOutgoingMessages_UnitConfigStatus{})) + return handler.sendSetNodeConfig(cfg, version) + }, reflect.TypeOf(&pb.SMOutgoingMessages_NodeConfigStatus{})) if err != nil { return aoserrors.Wrap(err) } - pbStatus, ok := status.(*pb.SMOutgoingMessages_UnitConfigStatus) + pbStatus, ok := status.(*pb.SMOutgoingMessages_NodeConfigStatus) if !ok { return aoserrors.New("incorrect type") } - if pbStatus.UnitConfigStatus.GetError() != "" { - return aoserrors.New(pbStatus.UnitConfigStatus.GetError()) + if pbStatus.NodeConfigStatus.GetError() != nil { + return aoserrors.New(pbStatus.NodeConfigStatus.GetError().GetMessage()) } return nil @@ -156,7 +164,8 @@ func (handler *smHandler) setUnitConfig(cfg aostypes.NodeUnitConfig, vendorVersi func (handler *smHandler) updateNetworks(networkParameters []aostypes.NetworkParameters) error { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, }).Debug("CM update networks") pbNetworkParameters := make([]*pb.NetworkParameters, len(networkParameters)) @@ -185,7 +194,8 @@ func (handler *smHandler) runInstances( services []aostypes.ServiceInfo, layers []aostypes.LayerInfo, instances []aostypes.InstanceInfo, forceRestart bool, ) error { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, }).Debug("SM run instances") pbRunInstances := &pb.RunInstances{ @@ -197,33 +207,23 @@ func (handler *smHandler) runInstances( for i, serviceInfo := range services { pbRunInstances.Services[i] = &pb.ServiceInfo{ - VersionInfo: &pb.VersionInfo{ - AosVersion: serviceInfo.AosVersion, - VendorVersion: serviceInfo.VendorVersion, - Description: serviceInfo.Description, - }, + Version: serviceInfo.Version, Url: serviceInfo.URL, - ServiceId: serviceInfo.ID, + ServiceId: serviceInfo.ServiceID, ProviderId: serviceInfo.ProviderID, Gid: serviceInfo.GID, Sha256: serviceInfo.Sha256, - Sha512: serviceInfo.Sha512, Size: serviceInfo.Size, } } for i, layerInfo := range layers { pbRunInstances.Layers[i] = &pb.LayerInfo{ - VersionInfo: &pb.VersionInfo{ - AosVersion: layerInfo.AosVersion, - VendorVersion: layerInfo.VendorVersion, - Description: layerInfo.Description, - }, + Version: layerInfo.Version, Url: layerInfo.URL, - LayerId: layerInfo.ID, + LayerId: layerInfo.LayerID, Digest: layerInfo.Digest, Sha256: layerInfo.Sha256, - Sha512: layerInfo.Sha512, Size: layerInfo.Size, } } @@ -250,10 +250,11 @@ func (handler *smHandler) runInstances( func (handler *smHandler) getSystemLog(logRequest cloudprotocol.RequestLog) (err error) { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, - "logID": logRequest.LogID, - "from": logRequest.Filter.From, - "till": logRequest.Filter.Till, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, + "logID": logRequest.LogID, + "from": logRequest.Filter.From, + "till": logRequest.Filter.Till, }).Debug("Get SM system log") request := &pb.SystemLogRequest{LogId: logRequest.LogID} @@ -278,7 +279,8 @@ func (handler *smHandler) getSystemLog(logRequest cloudprotocol.RequestLog) (err //nolint:dupl func (handler *smHandler) getInstanceLog(logRequest cloudprotocol.RequestLog) (err error) { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, "logID": logRequest.LogID, "serviceID": logRequest.Filter.ServiceID, "from": logRequest.Filter.From, @@ -286,7 +288,7 @@ func (handler *smHandler) getInstanceLog(logRequest cloudprotocol.RequestLog) (e }).Debug("Get instance log") request := &pb.InstanceLogRequest{ - LogId: logRequest.LogID, Instance: pbconvert.InstanceFilterToPB(logRequest.Filter.InstanceFilter), + LogId: logRequest.LogID, InstanceFilter: pbconvert.InstanceFilterToPB(logRequest.Filter.InstanceFilter), } if logRequest.Filter.From != nil { @@ -309,7 +311,8 @@ func (handler *smHandler) getInstanceLog(logRequest cloudprotocol.RequestLog) (e //nolint:dupl func (handler *smHandler) getInstanceCrashLog(logRequest cloudprotocol.RequestLog) (err error) { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, "logID": logRequest.LogID, "serviceID": logRequest.Filter.ServiceID, "from": logRequest.Filter.From, @@ -317,7 +320,7 @@ func (handler *smHandler) getInstanceCrashLog(logRequest cloudprotocol.RequestLo }).Debug("Get instance crash log") request := &pb.InstanceCrashLogRequest{ - LogId: logRequest.LogID, Instance: pbconvert.InstanceFilterToPB(logRequest.Filter.InstanceFilter), + LogId: logRequest.LogID, InstanceFilter: pbconvert.InstanceFilterToPB(logRequest.Filter.InstanceFilter), } if logRequest.Filter.From != nil { @@ -340,24 +343,27 @@ func (handler *smHandler) getInstanceCrashLog(logRequest cloudprotocol.RequestLo } func (handler *smHandler) overrideEnvVars(envVars cloudprotocol.OverrideEnvVars) (err error) { - log.WithFields(log.Fields{"nodeID": handler.config.NodeID}).Debug("Override env vars SM ") + log.WithFields(log.Fields{ + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, + }).Debug("Override env vars SM ") - request := &pb.OverrideEnvVars{EnvVars: make([]*pb.OverrideInstanceEnvVar, len(envVars.OverrideEnvVars))} + request := &pb.OverrideEnvVars{EnvVars: make([]*pb.OverrideInstanceEnvVar, len(envVars.Items))} - for i, item := range envVars.OverrideEnvVars { + for i, item := range envVars.Items { requestItem := &pb.OverrideInstanceEnvVar{ - Instance: pbconvert.InstanceFilterToPB(item.InstanceFilter), - Vars: make([]*pb.EnvVarInfo, len(item.EnvVars)), + InstanceFilter: pbconvert.InstanceFilterToPB(item.InstanceFilter), + Variables: make([]*pb.EnvVarInfo, len(item.Variables)), } - for j, envVar := range item.EnvVars { - requestVar := &pb.EnvVarInfo{VarId: envVar.ID, Variable: envVar.Variable} + for j, envVar := range item.Variables { + requestVar := &pb.EnvVarInfo{Name: envVar.Name, Value: envVar.Value} if envVar.TTL != nil { requestVar.Ttl = timestamppb.New(*envVar.TTL) } - requestItem.Vars[j] = requestVar + requestItem.Variables[j] = requestVar } request.EnvVars[i] = requestItem @@ -372,165 +378,171 @@ func (handler *smHandler) overrideEnvVars(envVars cloudprotocol.OverrideEnvVars) return nil } -func (handler *smHandler) getNodeMonitoring() (data cloudprotocol.NodeMonitoringData, err error) { +func (handler *smHandler) getAverageMonitoring() (monitoring aostypes.NodeMonitoring, err error) { ctx, cancelFunc := context.WithTimeout(context.Background(), waitMessageTimeout) defer cancelFunc() status, err := handler.syncstream.Send( - ctx, handler.sendGetNodeMonitoring, reflect.TypeOf(&pb.SMOutgoingMessages_NodeMonitoring{})) + ctx, handler.sendGetAverageMonitoring, reflect.TypeOf(&pb.SMOutgoingMessages_AverageMonitoring{})) if err != nil { - return data, aoserrors.Wrap(err) + return monitoring, aoserrors.Wrap(err) } - pbMonitoring, ok := status.(*pb.SMOutgoingMessages_NodeMonitoring) + pbMonitoring, ok := status.(*pb.SMOutgoingMessages_AverageMonitoring) if !ok { - return data, aoserrors.New("incorrect type") + return monitoring, aoserrors.New("incorrect type") } - data = nodeMonitoringFromPb(pbMonitoring.NodeMonitoring) - data.NodeID = handler.config.NodeID + monitoring = averageMonitoringFromPB(pbMonitoring.AverageMonitoring) + monitoring.NodeID = handler.nodeID - return data, nil + return monitoring, nil } /*********************************************************************************************************************** * Private **********************************************************************************************************************/ -func (handler *smHandler) processSMMessages() { - for { - message, err := handler.stream.Recv() - if err != nil { - if !errors.Is(err, io.EOF) && codes.Canceled != status.Code(err) { - log.Errorf("Close SM client connection error: %v", err) - } - - return - } - - if handler.syncstream.ProcessMessages(message.GetSMOutgoingMessage()) { - continue - } - - switch data := message.GetSMOutgoingMessage().(type) { - case *pb.SMOutgoingMessages_NodeMonitoring: - handler.processMonitoring(data.NodeMonitoring) +func (handler *smHandler) processSMMessages(message *pb.SMOutgoingMessages) { + if handler.syncstream.ProcessMessages(message.GetSMOutgoingMessage()) { + return + } - case *pb.SMOutgoingMessages_Alert: - handler.processAlert(data.Alert) + switch data := message.GetSMOutgoingMessage().(type) { + case *pb.SMOutgoingMessages_InstantMonitoring: + handler.processInstantMonitoring(data.InstantMonitoring) - case *pb.SMOutgoingMessages_NodeConfiguration: - log.Errorf("Unexpected node configuration msg from %s", data.NodeConfiguration.GetNodeId()) + case *pb.SMOutgoingMessages_Alert: + handler.processAlert(data.Alert) - case *pb.SMOutgoingMessages_RunInstancesStatus: - handler.processRunInstanceStatus(data.RunInstancesStatus) + case *pb.SMOutgoingMessages_RunInstancesStatus: + handler.processRunInstanceStatus(data.RunInstancesStatus) - case *pb.SMOutgoingMessages_UpdateInstancesStatus: - handler.processUpdateInstancesStatus(data.UpdateInstancesStatus) + case *pb.SMOutgoingMessages_UpdateInstancesStatus: + handler.processUpdateInstancesStatus(data.UpdateInstancesStatus) - case *pb.SMOutgoingMessages_Log: - handler.processLogMessage(data.Log) + case *pb.SMOutgoingMessages_Log: + handler.processLogMessage(data.Log) - case *pb.SMOutgoingMessages_OverrideEnvVarStatus: - handler.processOverrideEnvVarsStatus(data.OverrideEnvVarStatus) + case *pb.SMOutgoingMessages_OverrideEnvVarStatus: + handler.processOverrideEnvVarsStatus(data.OverrideEnvVarStatus) - case *pb.SMOutgoingMessages_ClockSyncRequest: - handler.sendClockSyncResponse() + case *pb.SMOutgoingMessages_ClockSyncRequest: + handler.sendClockSyncResponse() - default: - log.Warn("Received unprocessed message") - } + default: + log.Warnf("Received unprocessed message: %v", data) } } func (handler *smHandler) processRunInstanceStatus(status *pb.RunInstancesStatus) { runStatus := launcher.NodeRunInstanceStatus{ - NodeID: handler.config.NodeID, NodeType: handler.config.NodeType, - Instances: instancesStatusFromPB(status.GetInstances(), handler.config.NodeID), + NodeID: handler.nodeID, + NodeType: handler.nodeType, + Instances: instancesStatusFromPB(status.GetInstances(), handler.nodeID), } handler.runStatusCh <- runStatus } func (handler *smHandler) processUpdateInstancesStatus(data *pb.UpdateInstancesStatus) { - log.WithFields(log.Fields{"nodeID": handler.config.NodeID}).Debug("Receive SM update instances status") + log.WithFields(log.Fields{ + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, + }).Debug("Receive SM update instances status") - handler.updateInstanceStatusCh <- instancesStatusFromPB(data.GetInstances(), handler.config.NodeID) + handler.updateInstanceStatusCh <- instancesStatusFromPB(data.GetInstances(), handler.nodeID) } func (handler *smHandler) processAlert(alert *pb.Alert) { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, - "tag": alert.GetTag(), + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, + "tag": alert.GetTag(), }).Debug("Receive SM alert") - alertItem := cloudprotocol.AlertItem{ - Timestamp: alert.GetTimestamp().AsTime(), - Tag: alert.GetTag(), - } + timestamp := alert.GetTimestamp().AsTime() + tag := alert.GetTag() + + var alertItem interface{} - switch data := alert.GetPayload().(type) { + switch data := alert.GetAlertItem().(type) { case *pb.Alert_SystemAlert: - alertItem.Payload = cloudprotocol.SystemAlert{ - Message: data.SystemAlert.GetMessage(), - NodeID: handler.config.NodeID, + alertItem = cloudprotocol.SystemAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, + Message: data.SystemAlert.GetMessage(), + NodeID: handler.nodeID, } case *pb.Alert_CoreAlert: - alertItem.Payload = cloudprotocol.CoreAlert{ + alertItem = cloudprotocol.CoreAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, CoreComponent: data.CoreAlert.GetCoreComponent(), Message: data.CoreAlert.GetMessage(), - NodeID: handler.config.NodeID, + NodeID: handler.nodeID, } case *pb.Alert_ResourceValidateAlert: - resourceValidate := cloudprotocol.ResourceValidateAlert{ - ResourcesErrors: make([]cloudprotocol.ResourceValidateError, len(data.ResourceValidateAlert.GetErrors())), - NodeID: handler.config.NodeID, + concreteAlert := cloudprotocol.ResourceValidateAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, + Errors: make([]cloudprotocol.ErrorInfo, len(data.ResourceValidateAlert.GetErrors())), + NodeID: handler.nodeID, + Name: data.ResourceValidateAlert.GetName(), } - for i, resourceError := range data.ResourceValidateAlert.GetErrors() { - resourceValidate.ResourcesErrors[i] = cloudprotocol.ResourceValidateError{ - Name: resourceError.GetName(), - Errors: resourceError.GetErrorMsg(), - } + for i, error := range data.ResourceValidateAlert.GetErrors() { + concreteAlert.Errors[i] = *pbconvert.ErrorInfoFromPB(error) } - alertItem.Payload = resourceValidate + alertItem = concreteAlert case *pb.Alert_DeviceAllocateAlert: - alertItem.Payload = cloudprotocol.DeviceAllocateAlert{ - InstanceIdent: pbconvert.NewInstanceIdentFromPB(data.DeviceAllocateAlert.GetInstance()), + alertItem = cloudprotocol.DeviceAllocateAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, + InstanceIdent: pbconvert.InstanceIdentFromPB(data.DeviceAllocateAlert.GetInstance()), Device: data.DeviceAllocateAlert.GetDevice(), Message: data.DeviceAllocateAlert.GetMessage(), - NodeID: handler.config.NodeID, + NodeID: handler.nodeID, } case *pb.Alert_SystemQuotaAlert: - alertPayload := cloudprotocol.SystemQuotaAlert{ + concreteAlert := cloudprotocol.SystemQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, Parameter: data.SystemQuotaAlert.GetParameter(), Value: data.SystemQuotaAlert.GetValue(), - NodeID: handler.config.NodeID, + NodeID: handler.nodeID, + Status: data.SystemQuotaAlert.GetStatus(), } - if alertPayload.Parameter == "cpu" || alertPayload.Parameter == "ram" { - handler.systemLimitAlertCh <- alertPayload + handler.systemQuotasAlertCh <- concreteAlert + + if concreteAlert.Status != resourcemonitor.AlertStatusRaise { + return } - alertItem.Payload = alertPayload + alertItem = concreteAlert case *pb.Alert_InstanceQuotaAlert: - alertItem.Payload = cloudprotocol.InstanceQuotaAlert{ - InstanceIdent: pbconvert.NewInstanceIdentFromPB(data.InstanceQuotaAlert.GetInstance()), + concreteAlert := cloudprotocol.InstanceQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, + InstanceIdent: pbconvert.InstanceIdentFromPB(data.InstanceQuotaAlert.GetInstance()), Parameter: data.InstanceQuotaAlert.GetParameter(), Value: data.InstanceQuotaAlert.GetValue(), + Status: data.InstanceQuotaAlert.GetStatus(), } + if concreteAlert.Status != resourcemonitor.AlertStatusRaise { + return + } + + alertItem = concreteAlert + case *pb.Alert_InstanceAlert: - alertItem.Payload = cloudprotocol.ServiceInstanceAlert{ - InstanceIdent: pbconvert.NewInstanceIdentFromPB(data.InstanceAlert.GetInstance()), - AosVersion: data.InstanceAlert.GetAosVersion(), - Message: data.InstanceAlert.GetMessage(), + alertItem = cloudprotocol.ServiceInstanceAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: tag}, + InstanceIdent: pbconvert.InstanceIdentFromPB(data.InstanceAlert.GetInstance()), + ServiceVersion: data.InstanceAlert.GetServiceVersion(), + Message: data.InstanceAlert.GetMessage(), } default: @@ -542,55 +554,65 @@ func (handler *smHandler) processAlert(alert *pb.Alert) { func (handler *smHandler) processLogMessage(data *pb.LogData) { log.WithFields(log.Fields{ - "nodeID": handler.config.NodeID, + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, "logID": data.GetLogId(), "part": data.GetPart(), "partCount": data.GetPartCount(), }).Debug("Receive SM push log") if err := handler.messageSender.SendLog(cloudprotocol.PushLog{ - NodeID: handler.config.NodeID, + NodeID: handler.nodeID, LogID: data.GetLogId(), PartsCount: data.GetPartCount(), Part: data.GetPart(), Content: data.GetData(), ErrorInfo: &cloudprotocol.ErrorInfo{ - Message: data.GetError(), + AosCode: int(data.GetError().GetAosCode()), + ExitCode: int(data.GetError().GetExitCode()), + Message: data.GetError().GetMessage(), }, + Status: data.GetStatus(), }); err != nil { log.Errorf("Can't send log: %v", err) } } -func (handler *smHandler) processMonitoring(data *pb.NodeMonitoring) { - log.WithFields(log.Fields{"nodeID": handler.config.NodeID}).Debug("Receive SM monitoring") +func (handler *smHandler) processInstantMonitoring(instantMonitoring *pb.InstantMonitoring) { + log.WithFields(log.Fields{ + "nodeID": handler.nodeID, + "nodeType": handler.nodeType, + }).Debug("Receive SM monitoring") - nodeMonitoring := nodeMonitoringFromPb(data) + nodeMonitoring := instantMonitoringFromPB(instantMonitoring) - nodeMonitoring.NodeID = handler.config.NodeID + nodeMonitoring.NodeID = handler.nodeID - handler.monitoringSender.SendMonitoringData(nodeMonitoring) + handler.monitoringSender.SendNodeMonitoring(nodeMonitoring) } func (handler *smHandler) processOverrideEnvVarsStatus(envVarStatus *pb.OverrideEnvVarStatus) { - response := make([]cloudprotocol.EnvVarsInstanceStatus, len(envVarStatus.GetEnvVarsStatus())) + statuses := make([]cloudprotocol.EnvVarsInstanceStatus, len(envVarStatus.GetEnvVarsStatus())) for i, item := range envVarStatus.GetEnvVarsStatus() { - responseItem := cloudprotocol.EnvVarsInstanceStatus{ - InstanceFilter: cloudprotocol.NewInstanceFilter(item.GetInstance().GetServiceId(), - item.GetInstance().GetSubjectId(), item.GetInstance().GetInstance()), - Statuses: make([]cloudprotocol.EnvVarStatus, len(item.GetVarsStatus())), + statusItem := cloudprotocol.EnvVarsInstanceStatus{ + InstanceFilter: cloudprotocol.NewInstanceFilter(item.GetInstanceFilter().GetServiceId(), + item.GetInstanceFilter().GetSubjectId(), item.GetInstanceFilter().GetInstance()), + Statuses: make([]cloudprotocol.EnvVarStatus, len(item.GetStatuses())), } - for j, varStatus := range item.GetVarsStatus() { - responseItem.Statuses[j] = cloudprotocol.EnvVarStatus{ID: varStatus.GetVarId(), Error: varStatus.GetError()} + for j, varStatus := range item.GetStatuses() { + statusItem.Statuses[j] = cloudprotocol.EnvVarStatus{ + Name: varStatus.GetName(), + ErrorInfo: pbconvert.ErrorInfoFromPB(varStatus.GetError()), + } } - response[i] = responseItem + statuses[i] = statusItem } if err := handler.messageSender.SendOverrideEnvVarsStatus( - cloudprotocol.OverrideEnvVarsStatus{OverrideEnvVarsStatus: response}); err != nil { + cloudprotocol.OverrideEnvVarsStatus{Statuses: statuses}); err != nil { log.Errorf("Can't send override env ears status: %v", err.Error()) } } @@ -608,23 +630,23 @@ func (handler *smHandler) sendClockSyncResponse() { } } -func (handler *smHandler) sendGetUnitConfigStatus() error { +func (handler *smHandler) sendGetNodeConfigStatus() error { if err := handler.stream.Send( - &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_GetUnitConfigStatus{}}); err != nil { + &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_GetNodeConfigStatus{}}); err != nil { return aoserrors.Wrap(err) } return nil } -func (handler *smHandler) sendCheckUnitConfig(cfg aostypes.NodeUnitConfig, vendorVersion string) error { - configJSON, err := json.Marshal(cfg) +func (handler *smHandler) sendCheckNodeConfig(nodeConfig cloudprotocol.NodeConfig, version string) error { + configJSON, err := json.Marshal(nodeConfig) if err != nil { return aoserrors.Wrap(err) } - if err := handler.stream.Send(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_CheckUnitConfig{ - CheckUnitConfig: &pb.CheckUnitConfig{UnitConfig: string(configJSON), VendorVersion: vendorVersion}, + if err := handler.stream.Send(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_CheckNodeConfig{ + CheckNodeConfig: &pb.CheckNodeConfig{NodeConfig: string(configJSON), Version: version}, }}); err != nil { return aoserrors.Wrap(err) } @@ -632,14 +654,14 @@ func (handler *smHandler) sendCheckUnitConfig(cfg aostypes.NodeUnitConfig, vendo return nil } -func (handler *smHandler) sendSetUnitConfig(cfg aostypes.NodeUnitConfig, vendorVersion string) error { - configJSON, err := json.Marshal(cfg) +func (handler *smHandler) sendSetNodeConfig(nodeConfig cloudprotocol.NodeConfig, version string) error { + configJSON, err := json.Marshal(nodeConfig) if err != nil { return aoserrors.Wrap(err) } - if err := handler.stream.Send(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_SetUnitConfig{ - SetUnitConfig: &pb.SetUnitConfig{UnitConfig: string(configJSON), VendorVersion: vendorVersion}, + if err := handler.stream.Send(&pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_SetNodeConfig{ + SetNodeConfig: &pb.SetNodeConfig{NodeConfig: string(configJSON), Version: version}, }}); err != nil { return aoserrors.Wrap(err) } @@ -647,9 +669,9 @@ func (handler *smHandler) sendSetUnitConfig(cfg aostypes.NodeUnitConfig, vendorV return nil } -func (handler *smHandler) sendGetNodeMonitoring() error { +func (handler *smHandler) sendGetAverageMonitoring() error { if err := handler.stream.Send( - &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_GetNodeMonitoring{}}); err != nil { + &pb.SMIncomingMessages{SMIncomingMessage: &pb.SMIncomingMessages_GetAverageMonitoring{}}); err != nil { return aoserrors.Wrap(err) } @@ -678,57 +700,81 @@ func instancesStatusFromPB(pbStatuses []*pb.InstanceStatus, nodeID string) []clo for i, status := range pbStatuses { instancesStatus[i] = cloudprotocol.InstanceStatus{ - InstanceIdent: pbconvert.NewInstanceIdentFromPB(status.GetInstance()), - NodeID: nodeID, - AosVersion: status.GetAosVersion(), - RunState: status.GetRunState(), - ErrorInfo: errorInfoFromPB(status.GetErrorInfo()), + InstanceIdent: pbconvert.InstanceIdentFromPB(status.GetInstance()), + NodeID: nodeID, + ServiceVersion: status.GetServiceVersion(), + Status: status.GetRunState(), + ErrorInfo: errorInfoFromPB(status.GetErrorInfo()), } } return instancesStatus } -func errorInfoFromPB(pbError *pb.ErrorInfo) *cloudprotocol.ErrorInfo { +func errorInfoFromPB(pbError *common.ErrorInfo) *cloudprotocol.ErrorInfo { if pbError == nil { return nil } return &cloudprotocol.ErrorInfo{ - AosCode: int(pbError.GetAosCode()), - ExitCode: int(pbError.GetExitCode()), Message: pbError.GetMessage(), + AosCode: int(pbError.GetAosCode()), ExitCode: int(pbError.GetExitCode()), Message: pbError.GetMessage(), + } +} + +func averageMonitoringFromPB(averageMonitoring *pb.AverageMonitoring) aostypes.NodeMonitoring { + nodeMonitoringData := aostypes.NodeMonitoring{ + NodeData: monitoringDataFromPB(averageMonitoring.GetNodeMonitoring()), + InstancesData: make([]aostypes.InstanceMonitoring, len(averageMonitoring.GetInstancesMonitoring())), } + + for i, pbInstanceMonitoring := range averageMonitoring.GetInstancesMonitoring() { + nodeMonitoringData.InstancesData[i] = aostypes.InstanceMonitoring{ + InstanceIdent: pbconvert.InstanceIdentFromPB(pbInstanceMonitoring.GetInstance()), + MonitoringData: monitoringDataFromPB(pbInstanceMonitoring.GetMonitoringData()), + } + } + + return nodeMonitoringData } -func nodeMonitoringFromPb(pbNodeMonitoring *pb.NodeMonitoring) cloudprotocol.NodeMonitoringData { - nodeMonitoringData := cloudprotocol.NodeMonitoringData{ - Timestamp: pbNodeMonitoring.GetTimestamp().AsTime(), - MonitoringData: monitoringDataFromPb(pbNodeMonitoring.GetMonitoringData()), - ServiceInstances: make([]cloudprotocol.InstanceMonitoringData, len(pbNodeMonitoring.GetInstanceMonitoring())), +func instantMonitoringFromPB(instantMonitoring *pb.InstantMonitoring) aostypes.NodeMonitoring { + nodeMonitoringData := aostypes.NodeMonitoring{ + NodeData: monitoringDataFromPB(instantMonitoring.GetNodeMonitoring()), + InstancesData: make([]aostypes.InstanceMonitoring, len(instantMonitoring.GetInstancesMonitoring())), } - for i, pbInstanceMonitoring := range pbNodeMonitoring.GetInstanceMonitoring() { - nodeMonitoringData.ServiceInstances[i] = cloudprotocol.InstanceMonitoringData{ - InstanceIdent: pbconvert.NewInstanceIdentFromPB(pbInstanceMonitoring.GetInstance()), - MonitoringData: monitoringDataFromPb(pbInstanceMonitoring.GetMonitoringData()), + for i, pbInstanceMonitoring := range instantMonitoring.GetInstancesMonitoring() { + nodeMonitoringData.InstancesData[i] = aostypes.InstanceMonitoring{ + InstanceIdent: pbconvert.InstanceIdentFromPB(pbInstanceMonitoring.GetInstance()), + MonitoringData: monitoringDataFromPB(pbInstanceMonitoring.GetMonitoringData()), } } return nodeMonitoringData } -func monitoringDataFromPb(pbMonitoring *pb.MonitoringData) cloudprotocol.MonitoringData { - monitoringData := cloudprotocol.MonitoringData{ - RAM: pbMonitoring.GetRam(), - CPU: pbMonitoring.GetCpu(), - InTraffic: pbMonitoring.GetInTraffic(), - OutTraffic: pbMonitoring.GetOutTraffic(), - Disk: make([]cloudprotocol.PartitionUsage, len(pbMonitoring.GetDisk())), +func monitoringDataFromPB(pbMonitoring *pb.MonitoringData) aostypes.MonitoringData { + monitoringData := aostypes.MonitoringData{ + Timestamp: pbMonitoring.GetTimestamp().AsTime(), + RAM: pbMonitoring.GetRam(), + CPU: pbMonitoring.GetCpu(), + Download: pbMonitoring.GetDownload(), + Upload: pbMonitoring.GetUpload(), + Disk: make([]aostypes.PartitionUsage, len(pbMonitoring.GetDisk())), } for i, pbData := range pbMonitoring.GetDisk() { - monitoringData.Disk[i] = cloudprotocol.PartitionUsage{Name: pbData.GetName(), UsedSize: pbData.GetUsedSize()} + monitoringData.Disk[i] = aostypes.PartitionUsage{Name: pbData.GetName(), UsedSize: pbData.GetUsedSize()} } return monitoringData } + +func nodeConfigStatusFromPB(pbStatus *pb.NodeConfigStatus) unitconfig.NodeConfigStatus { + return unitconfig.NodeConfigStatus{ + NodeID: pbStatus.GetNodeId(), + NodeType: pbStatus.GetNodeType(), + Version: pbStatus.GetVersion(), + Error: pbconvert.ErrorInfoFromPB(pbStatus.GetError()), + } +} diff --git a/storagestate/storagestate.go b/storagestate/storagestate.go index c9f9de63..65ed3c60 100644 --- a/storagestate/storagestate.go +++ b/storagestate/storagestate.go @@ -128,7 +128,6 @@ type StorageState struct { } type stateParams struct { - instanceID string stateFilePath string quota uint64 checksum []byte @@ -178,6 +177,10 @@ func New(cfg *config.Config, messageSender MessageSender, storage Storage) (stor storageState.isSamePartition = storageMountPoint == stateMountPoint + if err = storageState.initStateWatching(); err != nil { + log.Errorf("Can't init state watching: %v", err) + } + go storageState.processWatcher() return storageState, nil @@ -398,6 +401,26 @@ func (storageState *StorageState) GetInstanceCheckSum(instanceIdent aostypes.Ins * Private **********************************************************************************************************************/ +func (storageState *StorageState) initStateWatching() error { + infos, err := storageState.storage.GetAllStorageStateInfo() + if err != nil { + return aoserrors.Wrap(err) + } + + for _, info := range infos { + if info.StateQuota == 0 { + continue + } + + if err = storageState.startStateWatching(info.InstanceIdent, + storageState.getStatePath(info.InstanceID), info.StateQuota); err != nil { + log.WithField("instanceID", info.InstanceID).Errorf("Can't setup state watching: %v", err) + } + } + + return nil +} + func (storageState *StorageState) prepareState( instanceID string, params SetupParams, checksum []byte, ) (stateFilePath string, err error) { @@ -411,7 +434,7 @@ func (storageState *StorageState) prepareState( stateFilePath = storageState.getStatePath(instanceID) - if err = storageState.setupStateWatching(instanceID, stateFilePath, params); err != nil { + if err = storageState.setupStateWatching(stateFilePath, params); err != nil { return "", aoserrors.Wrap(err) } @@ -479,12 +502,13 @@ func (storageState *StorageState) checkChecksumAndSendUpdateRequest( return nil } -func (storageState *StorageState) setupStateWatching(instanceID, stateFilePath string, params SetupParams) error { +func (storageState *StorageState) setupStateWatching(stateFilePath string, params SetupParams) error { if err := createStateFileIfNotExist(stateFilePath, params.UID, params.GID); err != nil { return aoserrors.Wrap(err) } - if err := storageState.startStateWatching(instanceID, stateFilePath, params); err != nil { + if err := storageState.startStateWatching( + params.InstanceIdent, stateFilePath, params.StateQuota); err != nil { return aoserrors.Wrap(err) } @@ -492,16 +516,15 @@ func (storageState *StorageState) setupStateWatching(instanceID, stateFilePath s } func (storageState *StorageState) startStateWatching( - instanceID string, stateFilePath string, params SetupParams, + instanceIdent aostypes.InstanceIdent, stateFilePath string, quota uint64, ) (err error) { if err = storageState.watcher.Add(stateFilePath); err != nil { return aoserrors.Wrap(err) } - storageState.statesMap[params.InstanceIdent] = &stateParams{ - instanceID: instanceID, + storageState.statesMap[instanceIdent] = &stateParams{ stateFilePath: stateFilePath, - quota: params.StateQuota, + quota: quota, changeTimerChannel: make(chan bool, 1), } diff --git a/storagestate/storagestate_test.go b/storagestate/storagestate_test.go index dc6506df..8dc5a806 100644 --- a/storagestate/storagestate_test.go +++ b/storagestate/storagestate_test.go @@ -20,7 +20,6 @@ package storagestate_test import ( "bytes" "encoding/hex" - "fmt" "os" "path" "testing" @@ -487,7 +486,7 @@ func TestUpdateState(t *testing.T) { } checkSumFromFile, err := getStateFileChecksum(path.Join( - stateDir, fmt.Sprintf("%s_state.dat", stateStorageInfo.InstanceID))) + stateDir, stateStorageInfo.InstanceID+"_state.dat")) if err != nil { t.Fatalf("Can't get checksum from state file: %v", err) } @@ -924,7 +923,7 @@ func TestStateAcceptance(t *testing.T) { t.Error("Can't found state storage info by instance ident") } - pathToStateFile := path.Join(stateDir, fmt.Sprintf("%s_state.dat", stateStorageInfo.InstanceID)) + pathToStateFile := path.Join(stateDir, stateStorageInfo.InstanceID+"_state.dat") if err := os.WriteFile(pathToStateFile, []byte(testData.stateData), 0o600); err != nil { t.Fatalf("Can't write state file: %v", err) diff --git a/umcontroller/umcontroller.go b/umcontroller/umcontroller.go index 02244ffd..6f554a7a 100644 --- a/umcontroller/umcontroller.go +++ b/umcontroller/umcontroller.go @@ -48,37 +48,43 @@ import ( // Controller update managers controller. type Controller struct { - storage storage - server *umCtrlServer - eventChannel chan umCtrlInternalMsg - stopChannel chan bool - componentDir string + sync.Mutex + storage storage + server *umCtrlServer + + eventChannel chan umCtrlInternalMsg + nodeInfoProvider NodeInfoProvider + nodeInfoChannel <-chan cloudprotocol.NodeInfo + stopChannel chan bool + componentDir string decrypter Decrypter allocator spaceallocator.Allocator - connections []umConnection - currentComponents []cloudprotocol.ComponentStatus + connections []umConnection + currentComponents []cloudprotocol.ComponentStatus + newComponentsChannel chan []cloudprotocol.ComponentStatus + fsm *fsm.FSM connectionMonitor allConnectionMonitor operable bool updateFinishCond *sync.Cond - updateError error + updateError error + currentNodeID string fileServer *fileserver.FileServer } -// SystemComponent information about system component update. -type SystemComponent struct { - ID string `json:"id"` - VendorVersion string `json:"vendorVersion"` - AosVersion uint64 `json:"aosVersion"` +// ComponentStatus information about system component update. +type ComponentStatus struct { + ComponentID string `json:"componentId"` + ComponentType string `json:"componentType"` + Version string `json:"version"` Annotations string `json:"annotations,omitempty"` URL string `json:"url"` Sha256 []byte `json:"sha256"` - Sha512 []byte `json:"sha512"` Size uint64 `json:"size"` } @@ -89,7 +95,7 @@ type umConnection struct { updatePriority uint32 state string components []string - updatePackages []SystemComponent + updatePackages []ComponentStatus } type umCtrlInternalMsg struct { @@ -97,17 +103,19 @@ type umCtrlInternalMsg struct { handler *umHandler requestType int status umStatus + close closeReason } type umStatus struct { - umState string + updateStatus string + nodePriority uint32 componsStatus []systemComponentStatus } type systemComponentStatus struct { - id string - vendorVersion string - aosVersion uint64 + componentID string + componentType string + version string status string err string } @@ -121,8 +129,8 @@ type allConnectionMonitor struct { } type storage interface { - GetComponentsUpdateInfo() (updateInfo []SystemComponent, err error) - SetComponentsUpdateInfo(updateInfo []SystemComponent) (err error) + GetComponentsUpdateInfo() (updateInfo []ComponentStatus, err error) + SetComponentsUpdateInfo(updateInfo []ComponentStatus) (err error) } // CertificateProvider certificate and key provider interface. @@ -135,6 +143,14 @@ type Decrypter interface { DecryptAndValidate(encryptedFile, decryptedFile string, params fcrypt.DecryptParams) error } +// NodeInfoProvider provides information about the nodes. +type NodeInfoProvider interface { + GetNodeID() string + GetAllNodeIDs() (nodeIds []string, err error) + GetNodeInfo(nodeID string) (nodeInfo cloudprotocol.NodeInfo, err error) + SubscribeNodeInfoChange() <-chan cloudprotocol.NodeInfo +} + /*********************************************************************************************************************** * Consts **********************************************************************************************************************/ @@ -167,7 +183,7 @@ const ( evUpdateRequest = "updateRequest" evContinue = "continue" evUpdatePrepared = "updatePrepared" - evUmStateUpdated = "umStateUpdated" + evUpdateStatusUpdated = "updateStatusUpdated" evSystemUpdated = "systemUpdated" evApplyComplete = "applyComplete" @@ -195,6 +211,8 @@ const ( const connectionTimeout = 600 * time.Second +const lowestUpdatePriority = 1000 + const fileScheme = "file" /*********************************************************************************************************************** @@ -202,19 +220,22 @@ const fileScheme = "file" **********************************************************************************************************************/ // New creates new update managers controller. -func New(config *config.Config, storage storage, certProvider CertificateProvider, +func New(config *config.Config, storage storage, certProvider CertificateProvider, nodeInfoProvider NodeInfoProvider, cryptocontext *cryptutils.CryptoContext, decrypter Decrypter, insecure bool) ( umCtrl *Controller, err error, ) { umCtrl = &Controller{ - storage: storage, - eventChannel: make(chan umCtrlInternalMsg), - stopChannel: make(chan bool), - componentDir: config.ComponentsDir, - connectionMonitor: allConnectionMonitor{stopTimerChan: make(chan bool, 1), timeoutChan: make(chan bool, 1)}, - operable: true, - updateFinishCond: sync.NewCond(&sync.Mutex{}), - decrypter: decrypter, + storage: storage, + eventChannel: make(chan umCtrlInternalMsg), + nodeInfoProvider: nodeInfoProvider, + nodeInfoChannel: nodeInfoProvider.SubscribeNodeInfoChange(), + stopChannel: make(chan bool), + componentDir: config.ComponentsDir, + connectionMonitor: allConnectionMonitor{stopTimerChan: make(chan bool, 1), timeoutChan: make(chan bool, 1)}, + operable: true, + updateFinishCond: sync.NewCond(&sync.Mutex{}), + newComponentsChannel: make(chan []cloudprotocol.ComponentStatus, 1), + decrypter: decrypter, } if err := os.MkdirAll(umCtrl.componentDir, 0o755); err != nil { @@ -226,11 +247,10 @@ func New(config *config.Config, storage storage, certProvider CertificateProvide return nil, aoserrors.Wrap(err) } - for _, client := range config.UMController.UMClients { - umCtrl.connections = append(umCtrl.connections, umConnection{ - umID: client.UMID, - isLocalClient: client.IsLocal, updatePriority: client.Priority, handler: nil, - }) + umCtrl.currentNodeID = nodeInfoProvider.GetNodeID() + + if err := umCtrl.createConnections(nodeInfoProvider); err != nil { + return nil, aoserrors.Wrap(err) } sort.Slice(umCtrl.connections, func(i, j int) bool { @@ -270,6 +290,7 @@ func (umCtrl *Controller) Close() { } } + close(umCtrl.newComponentsChannel) umCtrl.operable = false umCtrl.stopChannel <- true } @@ -287,6 +308,8 @@ func (umCtrl *Controller) GetStatus() ([]cloudprotocol.ComponentStatus, error) { } // UpdateComponents updates components. +// +//nolint:funlen func (umCtrl *Controller) UpdateComponents( components []cloudprotocol.ComponentInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate, @@ -300,12 +323,18 @@ func (umCtrl *Controller) UpdateComponents( return umCtrl.currentComponents, nil } - componentsUpdateInfo := []SystemComponent{} + componentsUpdateInfo := []ComponentStatus{} for _, component := range components { + if component.ComponentID == nil { + continue + } + componentStatus := systemComponentStatus{ - id: component.ID, vendorVersion: component.VendorVersion, - aosVersion: component.AosVersion, status: cloudprotocol.DownloadedStatus, + componentID: *component.ComponentID, + componentType: component.ComponentType, + version: component.Version, + status: cloudprotocol.DownloadedStatus, } encryptedFile, err := getFilePath(component.URLs[0]) @@ -352,10 +381,12 @@ func (umCtrl *Controller) UpdateComponents( Path: decryptedFile, } - componentInfo := SystemComponent{ - ID: component.ID, VendorVersion: component.VendorVersion, - AosVersion: component.AosVersion, Annotations: string(component.Annotations), - Sha256: fileInfo.Sha256, Sha512: fileInfo.Sha512, Size: fileInfo.Size, + componentInfo := ComponentStatus{ + ComponentID: *component.ComponentID, + ComponentType: component.ComponentType, + Version: component.Version, + Annotations: string(component.Annotations), + Sha256: fileInfo.Sha256, Size: fileInfo.Size, URL: url.String(), } @@ -385,6 +416,10 @@ func (umCtrl *Controller) UpdateComponents( return umCtrl.currentComponents, umCtrl.updateError } +func (umCtrl *Controller) NewComponentsChannel() <-chan []cloudprotocol.ComponentStatus { + return umCtrl.newComponentsChannel +} + /*********************************************************************************************************************** * Private **********************************************************************************************************************/ @@ -408,15 +443,18 @@ func (umCtrl *Controller) processInternalMessages() { umCtrl.handleNewConnection(internalMsg.umID, internalMsg.handler, internalMsg.status) case closeConnection: - umCtrl.handleCloseConnection(internalMsg.umID) + umCtrl.handleCloseConnection(internalMsg.umID, internalMsg.close) case umStatusUpdate: - umCtrl.generateFSMEvent(evUmStateUpdated, internalMsg.umID, internalMsg.status) + umCtrl.generateFSMEvent(evUpdateStatusUpdated, internalMsg.umID, internalMsg.status) default: log.Error("Unsupported internal message ", internalMsg.requestType) } + case nodeInfo := <-umCtrl.nodeInfoChannel: + umCtrl.handleNodeInfoChange(nodeInfo) + case <-umCtrl.stopChannel: log.Debug("Close all connections") @@ -443,22 +481,27 @@ func (umCtrl *Controller) handleNewConnection(umID string, handler *umHandler, s umCtrl.updateCurrentComponentsStatus(status.componsStatus) + if umCtrl.fsm.Current() != stateInit { + umCtrl.notifyNewComponents(umID, status.componsStatus) + } + umIDfound = true if value.handler != nil { log.Warn("Connection already available umID = ", umID) - value.handler.Close() + value.handler.Close(Reconnect) } umCtrl.connections[i].handler = handler umCtrl.connections[i].state = handler.GetInitialState() + umCtrl.connections[i].updatePriority = status.nodePriority umCtrl.connections[i].components = []string{} for _, newComponent := range status.componsStatus { idExist := false for _, value := range umCtrl.connections[i].components { - if value == newComponent.id { + if value == newComponent.componentID { idExist = true break } @@ -468,7 +511,7 @@ func (umCtrl *Controller) handleNewConnection(umID string, handler *umHandler, s continue } - umCtrl.connections[i].components = append(umCtrl.connections[i].components, newComponent.id) + umCtrl.connections[i].components = append(umCtrl.connections[i].components, newComponent.componentID) } break @@ -476,7 +519,7 @@ func (umCtrl *Controller) handleNewConnection(umID string, handler *umHandler, s if !umIDfound { log.Error("Unexpected new UM connection with ID = ", umID) - handler.Close() + handler.Close(ConnectionClose) return } @@ -487,28 +530,39 @@ func (umCtrl *Controller) handleNewConnection(umID string, handler *umHandler, s } } - log.Debug("All connection to Ums established") + if umCtrl.fsm.Current() == stateInit { + log.Debug("All connection to Ums established") - umCtrl.connectionMonitor.stopConnectionTimer() + umCtrl.connectionMonitor.stopConnectionTimer() - if err := umCtrl.getUpdateComponentsFromStorage(); err != nil { - log.Error("Can't read update components from storage: ", err) - } + if err := umCtrl.getUpdateComponentsFromStorage(); err != nil { + log.Error("Can't read update components from storage: ", err) + } - umCtrl.generateFSMEvent(evAllClientsConnected) + umCtrl.generateFSMEvent(evAllClientsConnected) + } } -func (umCtrl *Controller) handleCloseConnection(umID string) { +func (umCtrl *Controller) handleCloseConnection(umID string, reason closeReason) { log.Debug("Close UM connection umid = ", umID) for i, value := range umCtrl.connections { if value.umID == umID { - umCtrl.connections[i].handler = nil + if reason == ConnectionClose { + nodeInfo, err := umCtrl.nodeInfoProvider.GetNodeInfo(umID) + provisionedNode := err == nil && nodeInfo.Status != cloudprotocol.NodeStatusUnprovisioned - umCtrl.fsm.SetState(stateInit) - umCtrl.connectionMonitor.wg.Add(1) + if provisionedNode { + umCtrl.connections[i].handler = nil - go umCtrl.connectionMonitor.startConnectionTimer(len(umCtrl.connections)) + umCtrl.fsm.SetState(stateInit) + umCtrl.connectionMonitor.wg.Add(1) + + go umCtrl.connectionMonitor.startConnectionTimer(len(umCtrl.connections)) + } else { + umCtrl.connections = append(umCtrl.connections[:i], umCtrl.connections[i+1:]...) + } + } return } @@ -523,12 +577,12 @@ func (umCtrl *Controller) updateCurrentComponentsStatus(componsStatus []systemCo toRemove := []int{} for i, curStatus := range umCtrl.currentComponents { - if value.id == curStatus.ID { + if value.componentID == curStatus.ComponentID && value.componentType == curStatus.ComponentType { if curStatus.Status != cloudprotocol.InstalledStatus { continue } - if value.vendorVersion != curStatus.VendorVersion { + if value.version != curStatus.Version { toRemove = append(toRemove, i) continue } @@ -549,7 +603,8 @@ func (umCtrl *Controller) updateCurrentComponentsStatus(componsStatus []systemCo func (umCtrl *Controller) updateComponentElement(component systemComponentStatus) { for i, curElement := range umCtrl.currentComponents { - if curElement.ID == component.id && curElement.VendorVersion == component.vendorVersion { + if curElement.ComponentID == component.componentID && curElement.ComponentType == component.componentType && + curElement.Version == component.version { if curElement.Status == cloudprotocol.InstalledStatus && component.status != cloudprotocol.InstalledStatus { break } @@ -567,9 +622,9 @@ func (umCtrl *Controller) updateComponentElement(component systemComponentStatus } newComponentStatus := cloudprotocol.ComponentStatus{ - ID: component.id, - VendorVersion: component.vendorVersion, - AosVersion: component.aosVersion, + ComponentID: component.componentID, + ComponentType: component.componentType, + Version: component.version, Status: component.status, } @@ -625,7 +680,7 @@ func (umCtrl *Controller) getCurrentUpdateState() (state string) { func (umCtrl *Controller) getUpdateComponentsFromStorage() (err error) { for i := range umCtrl.connections { - umCtrl.connections[i].updatePackages = []SystemComponent{} + umCtrl.connections[i].updatePackages = []ComponentStatus{} } updateComponents, err := umCtrl.storage.GetComponentsUpdateInfo() @@ -644,10 +699,10 @@ func (umCtrl *Controller) getUpdateComponentsFromStorage() (err error) { return aoserrors.Wrap(err) } -func (umCtrl *Controller) addComponentForUpdateToUm(componentInfo SystemComponent) (err error) { +func (umCtrl *Controller) addComponentForUpdateToUm(componentInfo ComponentStatus) (err error) { for i := range umCtrl.connections { for _, id := range umCtrl.connections[i].components { - if id == componentInfo.ID { + if id == componentInfo.ComponentID { newURL, err := umCtrl.fileServer.TranslateURL(umCtrl.connections[i].isLocalClient, componentInfo.URL) if err != nil { return aoserrors.Wrap(err) @@ -662,7 +717,7 @@ func (umCtrl *Controller) addComponentForUpdateToUm(componentInfo SystemComponen } } - return aoserrors.Errorf("component id %s not found", componentInfo.ID) + return aoserrors.Errorf("component id %s not found", componentInfo.ComponentID) } func (umCtrl *Controller) cleanupUpdateData() { @@ -671,7 +726,7 @@ func (umCtrl *Controller) cleanupUpdateData() { umCtrl.allocator.FreeSpace(updatePackage.Size) } - umCtrl.connections[i].updatePackages = []SystemComponent{} + umCtrl.connections[i].updatePackages = []ComponentStatus{} } entries, err := os.ReadDir(umCtrl.componentDir) @@ -706,7 +761,7 @@ func (umCtrl *Controller) cleanupUpdateData() { return } - if err := umCtrl.storage.SetComponentsUpdateInfo([]SystemComponent{}); err != nil { + if err := umCtrl.storage.SetComponentsUpdateInfo([]ComponentStatus{}); err != nil { log.Error("Can't clean components update info ", err) } } @@ -733,22 +788,22 @@ func (umCtrl *Controller) createStateMachine() (string, []fsm.EventDesc, map[str {Name: evContinueApply, Src: []string{stateIdle}, Dst: stateStartApply}, {Name: evContinueRevert, Src: []string{stateIdle}, Dst: stateStartRevert}, // process prepare - {Name: evUmStateUpdated, Src: []string{statePrepareUpdate}, Dst: stateUpdateUmStatusOnPrepareUpdate}, + {Name: evUpdateStatusUpdated, Src: []string{statePrepareUpdate}, Dst: stateUpdateUmStatusOnPrepareUpdate}, {Name: evContinue, Src: []string{stateUpdateUmStatusOnPrepareUpdate}, Dst: statePrepareUpdate}, // process start update {Name: evUpdatePrepared, Src: []string{statePrepareUpdate}, Dst: stateStartUpdate}, - {Name: evUmStateUpdated, Src: []string{stateStartUpdate}, Dst: stateUpdateUmStatusOnStartUpdate}, + {Name: evUpdateStatusUpdated, Src: []string{stateStartUpdate}, Dst: stateUpdateUmStatusOnStartUpdate}, {Name: evContinue, Src: []string{stateUpdateUmStatusOnStartUpdate}, Dst: stateStartUpdate}, // process start apply {Name: evSystemUpdated, Src: []string{stateStartUpdate}, Dst: stateStartApply}, - {Name: evUmStateUpdated, Src: []string{stateStartApply}, Dst: stateUpdateUmStatusOnStartApply}, + {Name: evUpdateStatusUpdated, Src: []string{stateStartApply}, Dst: stateUpdateUmStatusOnStartApply}, {Name: evContinue, Src: []string{stateUpdateUmStatusOnStartApply}, Dst: stateStartApply}, {Name: evApplyComplete, Src: []string{stateStartApply}, Dst: stateIdle}, // process revert {Name: evUpdateFailed, Src: []string{statePrepareUpdate}, Dst: stateStartRevert}, {Name: evUpdateFailed, Src: []string{stateStartUpdate}, Dst: stateStartRevert}, {Name: evUpdateFailed, Src: []string{stateStartApply}, Dst: stateStartRevert}, - {Name: evUmStateUpdated, Src: []string{stateStartRevert}, Dst: stateUpdateUmStatusOnRevert}, + {Name: evUpdateStatusUpdated, Src: []string{stateStartRevert}, Dst: stateUpdateUmStatusOnRevert}, {Name: evContinue, Src: []string{stateUpdateUmStatusOnRevert}, Dst: stateStartRevert}, {Name: evSystemReverted, Src: []string{stateStartRevert}, Dst: stateIdle}, @@ -757,13 +812,13 @@ func (umCtrl *Controller) createStateMachine() (string, []fsm.EventDesc, map[str fsm.Callbacks{ enterPrefix + stateIdle: umCtrl.processIdleState, enterPrefix + statePrepareUpdate: umCtrl.processPrepareState, - enterPrefix + stateUpdateUmStatusOnPrepareUpdate: umCtrl.processUpdateUmState, + enterPrefix + stateUpdateUmStatusOnPrepareUpdate: umCtrl.processUpdateUpdateStatus, enterPrefix + stateStartUpdate: umCtrl.processStartUpdateState, - enterPrefix + stateUpdateUmStatusOnStartUpdate: umCtrl.processUpdateUmState, + enterPrefix + stateUpdateUmStatusOnStartUpdate: umCtrl.processUpdateUpdateStatus, enterPrefix + stateStartApply: umCtrl.processStartApplyState, - enterPrefix + stateUpdateUmStatusOnStartApply: umCtrl.processUpdateUmState, + enterPrefix + stateUpdateUmStatusOnStartApply: umCtrl.processUpdateUpdateStatus, enterPrefix + stateStartRevert: umCtrl.processStartRevertState, - enterPrefix + stateUpdateUmStatusOnRevert: umCtrl.processUpdateUmState, + enterPrefix + stateUpdateUmStatusOnRevert: umCtrl.processUpdateUpdateStatus, enterPrefix + stateFaultState: umCtrl.processFaultState, beforePrefix + "event": umCtrl.onEvent, @@ -842,9 +897,9 @@ func (umCtrl *Controller) onEvent(ctx context.Context, e *fsm.Event) { } func (umCtrl *Controller) processIdleState(ctx context.Context, e *fsm.Event) { - umState := umCtrl.getCurrentUpdateState() + updateStatus := umCtrl.getCurrentUpdateState() - switch umState { + switch updateStatus { case stateFaultState: go umCtrl.generateFSMEvent(evContinueRevert) return @@ -968,8 +1023,8 @@ func (umCtrl *Controller) processStartApplyState(ctx context.Context, e *fsm.Eve go umCtrl.generateFSMEvent(evApplyComplete) } -func (umCtrl *Controller) processUpdateUmState(ctx context.Context, e *fsm.Event) { - log.Debug("processUpdateUmState") +func (umCtrl *Controller) processUpdateUpdateStatus(ctx context.Context, e *fsm.Event) { + log.Debug("processUpdateUpdateStatus") umID, ok := e.Args[0].(string) if !ok { @@ -985,8 +1040,8 @@ func (umCtrl *Controller) processUpdateUmState(ctx context.Context, e *fsm.Event for i, v := range umCtrl.connections { if v.umID == umID { - umCtrl.connections[i].state = status.umState - log.Debugf("UMid = %s state= %s", umID, status.umState) + umCtrl.connections[i].state = status.updateStatus + log.Debugf("umID = %s state = %s", umID, status.updateStatus) break } @@ -1021,7 +1076,109 @@ func (umCtrl *Controller) updateComplete(ctx context.Context, e *fsm.Event) { umCtrl.cleanupCurrentComponentStatus() } +func (umCtrl *Controller) createConnections(nodeInfoProvider NodeInfoProvider) error { + ids, err := nodeInfoProvider.GetAllNodeIDs() + if err != nil { + return aoserrors.Wrap(err) + } + + for _, id := range ids { + nodeInfo, err := nodeInfoProvider.GetNodeInfo(id) + if err != nil { + return aoserrors.Wrap(err) + } + + if nodeInfo.Status == "unprovisioned" { + continue + } + + nodeHasUM, err := umCtrl.nodeHasUMComponent(nodeInfo) + if err != nil { + log.WithField("nodeID", nodeInfo.NodeID).Errorf("Failed to check UM component: %v", err) + } + + if nodeHasUM { + umCtrl.connections = append(umCtrl.connections, umConnection{ + umID: nodeInfo.NodeID, + isLocalClient: nodeInfo.NodeID == umCtrl.currentNodeID, + updatePriority: lowestUpdatePriority, + handler: nil, + }) + } + } + + return nil +} + +func (umCtrl *Controller) handleNodeInfoChange(nodeInfo cloudprotocol.NodeInfo) { + if nodeInfo.Status == "unprovisioned" { + return + } + + nodeHasUM, err := umCtrl.nodeHasUMComponent(nodeInfo) + if err != nil { + log.WithField("nodeID", nodeInfo.NodeID).Errorf("Failed to check UM component: %v", err) + } + + if !nodeHasUM { + return + } + + for _, connection := range umCtrl.connections { + if connection.umID == nodeInfo.NodeID { + return + } + } + + umCtrl.connections = append(umCtrl.connections, umConnection{ + umID: nodeInfo.NodeID, + isLocalClient: nodeInfo.NodeID == umCtrl.currentNodeID, updatePriority: lowestUpdatePriority, handler: nil, + }) +} + func (status systemComponentStatus) String() string { - return fmt.Sprintf("{id: %s, status: %s, vendorVersion: %s aosVersion: %d }", - status.id, status.status, status.vendorVersion, status.aosVersion) + return fmt.Sprintf("{id: %s, status: %s, version: %s }", status.componentID, status.status, status.version) +} + +func (umCtrl *Controller) notifyNewComponents(umID string, componsStatus []systemComponentStatus) { + newComponents := make([]cloudprotocol.ComponentStatus, 0, len(componsStatus)) + + for _, status := range componsStatus { + newComponent := cloudprotocol.ComponentStatus{ + ComponentID: status.componentID, + ComponentType: status.componentType, + Version: status.version, + NodeID: umID, + Status: status.status, + } + + if status.err != "" { + newComponent.ErrorInfo = &cloudprotocol.ErrorInfo{Message: status.err} + } + + newComponents = append(newComponents, newComponent) + } + + if len(newComponents) == 0 { + return + } + + umCtrl.newComponentsChannel <- newComponents +} + +func (umCtrl *Controller) nodeHasUMComponent( + nodeInfo cloudprotocol.NodeInfo, +) (bool, error) { + components, err := nodeInfo.GetAosComponents() + if err != nil { + return false, aoserrors.Wrap(err) + } + + for _, component := range components { + if component == cloudprotocol.AosComponentUM { + return true, nil + } + } + + return false, nil } diff --git a/umcontroller/umcontroller_internal_test.go b/umcontroller/umcontroller_internal_test.go index daa2c582..04cec9be 100644 --- a/umcontroller/umcontroller_internal_test.go +++ b/umcontroller/umcontroller_internal_test.go @@ -26,7 +26,7 @@ import ( "google.golang.org/grpc" "github.com/aosedge/aos_common/aoserrors" - pb "github.com/aosedge/aos_common/api/updatemanager/v1" + pb "github.com/aosedge/aos_common/api/updatemanager" ) /*********************************************************************************************************************** @@ -89,14 +89,14 @@ func TestNormalUpdate(t *testing.T) { stream := normalUpdateStream{test: t, continueCh: make(chan bool)} - handler, stopCh, err := newUmHandler("testUM", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err := newUmHandler("testUM", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("erro create handler %s", err) } stream.step = StepPrepare - components := []SystemComponent{{URL: "file:///path/to/update", VendorVersion: "vendorversion1", AosVersion: 1}} + components := []ComponentStatus{{URL: "file:///path/to/update", Version: "1.1.0"}} if err := handler.PrepareUpdate(components); err != nil { t.Errorf("Can't prepare components: %s", err) } @@ -111,9 +111,9 @@ func TestNormalUpdate(t *testing.T) { break } - if internalEvent.status.umState != pb.UmState_PREPARED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_PREPARED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_PREPARED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_PREPARED.String()) break } @@ -129,9 +129,9 @@ func TestNormalUpdate(t *testing.T) { break } - if internalEvent.status.umState != pb.UmState_UPDATED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_UPDATED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_UPDATED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_UPDATED.String()) break } @@ -147,9 +147,9 @@ func TestNormalUpdate(t *testing.T) { break } - if internalEvent.status.umState != pb.UmState_IDLE.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_IDLE.String()) + if internalEvent.status.updateStatus != pb.UpdateState_IDLE.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_IDLE.String()) break } @@ -171,14 +171,14 @@ func TestNormalUpdateWithReboot(t *testing.T) { stream := normalUpdateStream{test: t, continueCh: make(chan bool)} - handler, stopCh, err := newUmHandler("testUM2", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err := newUmHandler("testUM2", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("error create handler %s", err) } stream.step = StepPrepare - components := []SystemComponent{{URL: "file:///path/to/update", VendorVersion: "vendorversion2", AosVersion: 1}} + components := []ComponentStatus{{URL: "file:///path/to/update", Version: "2.1.0"}} if err := handler.PrepareUpdate(components); err != nil { t.Errorf("Can't prepare components: %s", err) } @@ -188,9 +188,9 @@ func TestNormalUpdateWithReboot(t *testing.T) { case internalEvent := <-eventChannel: switch stream.step { case StepPrepare: - if internalEvent.status.umState != pb.UmState_PREPARED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_PREPARED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_PREPARED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_PREPARED.String()) break } @@ -201,12 +201,12 @@ func TestNormalUpdateWithReboot(t *testing.T) { } default: - log.Warn("Receive ", internalEvent.status.umState) + log.Warn("Receive ", internalEvent.status.updateStatus) } case <-stopCh: if stream.step == StepRebootOnUpdate { - handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UmState_UPDATED) + handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UpdateState_UPDATED) if err != nil { t.Errorf("Can't create UM handler: %s", err) } @@ -221,7 +221,7 @@ func TestNormalUpdateWithReboot(t *testing.T) { } if stream.step == StepRebootOnApply { - handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("Can't create UM handler: %s", err) } @@ -246,14 +246,14 @@ func TestRevert(t *testing.T) { stream := failureUpdateStream{test: t, continueCh: make(chan bool)} - handler, stopCh, err := newUmHandler("testUM3", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err := newUmHandler("testUM3", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("error create handler %s", err) } stream.step = StepPrepare - components := []SystemComponent{{URL: "file:///path/to/update", VendorVersion: "vendorversion3", AosVersion: 1}} + components := []ComponentStatus{{URL: "file:///path/to/update", Version: "2.1.0"}} if err := handler.PrepareUpdate(components); err != nil { t.Errorf("Can't prepare components: %s", err) } @@ -263,9 +263,9 @@ func TestRevert(t *testing.T) { case internalEvent := <-eventChannel: switch stream.step { case StepPrepare: - if internalEvent.status.umState != pb.UmState_PREPARED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_PREPARED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_PREPARED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_PREPARED.String()) break } @@ -276,9 +276,9 @@ func TestRevert(t *testing.T) { } case StepUpdate: - if internalEvent.status.umState != pb.UmState_FAILED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_FAILED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_FAILED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_FAILED.String()) break } @@ -289,9 +289,9 @@ func TestRevert(t *testing.T) { } case StepRevertUpdate: - if internalEvent.status.umState != pb.UmState_IDLE.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_IDLE.String()) + if internalEvent.status.updateStatus != pb.UpdateState_IDLE.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_IDLE.String()) break } @@ -313,14 +313,14 @@ func TestRevertWithReboot(t *testing.T) { stream := failureUpdateStream{test: t, continueCh: make(chan bool)} - handler, stopCh, err := newUmHandler("testUM4", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err := newUmHandler("testUM4", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("error create handler %s", err) } stream.step = StepPrepare - components := []SystemComponent{{URL: "file:///path/to/update", VendorVersion: "vendorversion4", AosVersion: 1}} + components := []ComponentStatus{{URL: "file:///path/to/update", Version: "2.1.0"}} if err := handler.PrepareUpdate(components); err != nil { t.Errorf("Can't prepare components: %s", err) } @@ -330,9 +330,9 @@ func TestRevertWithReboot(t *testing.T) { case internalEvent := <-eventChannel: switch stream.step { case StepPrepare: - if internalEvent.status.umState != pb.UmState_PREPARED.String() { - t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.umState, - pb.UmState_PREPARED.String()) + if internalEvent.status.updateStatus != pb.UpdateState_PREPARED.String() { + t.Errorf("Unexpected UM update State %s != %s", internalEvent.status.updateStatus, + pb.UpdateState_PREPARED.String()) break } @@ -343,12 +343,12 @@ func TestRevertWithReboot(t *testing.T) { } default: - log.Warn("Receive ", internalEvent.status.umState) + log.Warn("Receive ", internalEvent.status.updateStatus) } case <-stopCh: if stream.step == StepRebootOnUpdate { - handler, stopCh, err = newUmHandler("testUM4", &stream, eventChannel, pb.UmState_FAILED) + handler, stopCh, err = newUmHandler("testUM4", &stream, eventChannel, pb.UpdateState_FAILED) if err != nil { t.Errorf("Can't create um handler: %s", err) } @@ -363,7 +363,7 @@ func TestRevertWithReboot(t *testing.T) { } if stream.step == StepRebootOnRevert { - handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UmState_IDLE) + handler, stopCh, err = newUmHandler("testUM2", &stream, eventChannel, pb.UpdateState_IDLE) if err != nil { t.Errorf("Can't create um handler: %s", err) } @@ -422,7 +422,7 @@ func (stream *normalUpdateStream) Recv() (*pb.UpdateStatus, error) { switch stream.step { case StepPrepare: - messageToSend = &pb.UpdateStatus{UmState: pb.UmState_PREPARED} + messageToSend = &pb.UpdateStatus{UpdateState: pb.UpdateState_PREPARED} case StepRebootOnUpdate: return nil, io.EOF @@ -431,10 +431,10 @@ func (stream *normalUpdateStream) Recv() (*pb.UpdateStatus, error) { return nil, io.EOF case StepUpdate: - messageToSend = &pb.UpdateStatus{UmState: pb.UmState_UPDATED} + messageToSend = &pb.UpdateStatus{UpdateState: pb.UpdateState_UPDATED} case StepApplyUpdate: - messageToSend = &pb.UpdateStatus{UmState: pb.UmState_IDLE} + messageToSend = &pb.UpdateStatus{UpdateState: pb.UpdateState_IDLE} case StepFinish: return nil, io.EOF @@ -478,13 +478,13 @@ func (stream *failureUpdateStream) Recv() (*pb.UpdateStatus, error) { switch stream.step { case StepPrepare: - messageToSend = &pb.UpdateStatus{UmState: pb.UmState_PREPARED} + messageToSend = &pb.UpdateStatus{UpdateState: pb.UpdateState_PREPARED} case StepRebootOnUpdate: return nil, io.EOF case StepUpdate: - messageToSend = &pb.UpdateStatus{UmState: pb.UmState_FAILED} + messageToSend = &pb.UpdateStatus{UpdateState: pb.UpdateState_FAILED} case StepRebootOnRevert: return nil, io.EOF diff --git a/umcontroller/umcontroller_test.go b/umcontroller/umcontroller_test.go index 8c2c683f..faf2b918 100644 --- a/umcontroller/umcontroller_test.go +++ b/umcontroller/umcontroller_test.go @@ -35,8 +35,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "github.com/aosedge/aos_common/aoserrors" - "github.com/aosedge/aos_common/aostypes" - pb "github.com/aosedge/aos_common/api/updatemanager/v1" + pb "github.com/aosedge/aos_common/api/updatemanager" "github.com/aosedge/aos_common/image" "github.com/aosedge/aos_common/api/cloudprotocol" @@ -65,7 +64,7 @@ const ( ) type testStorage struct { - updateInfo []umcontroller.SystemComponent + updateInfo []umcontroller.ComponentStatus } type testUmConnection struct { @@ -75,12 +74,18 @@ type testUmConnection struct { step string test *testing.T umID string - components []*pb.SystemComponent + components []*pb.ComponentStatus conn *grpc.ClientConn } type testCryptoContext struct{} +type testNodeInfoProvider struct { + umcontroller.NodeInfoProvider + nodeInfo []cloudprotocol.NodeInfo + nodeInfoListeners []chan cloudprotocol.NodeInfo +} + /*********************************************************************************************************************** * Vars **********************************************************************************************************************/ @@ -101,6 +106,76 @@ func init() { log.SetOutput(os.Stdout) } +/*********************************************************************************************************************** + * testNodeInfoProvider implementation + **********************************************************************************************************************/ + +func NewTestNodeInfoProvider(nodeIds []string) *testNodeInfoProvider { + provider := &testNodeInfoProvider{ + nodeInfo: make([]cloudprotocol.NodeInfo, 0), + nodeInfoListeners: make([]chan cloudprotocol.NodeInfo, 0), + } + + for _, nodeID := range nodeIds { + nodeInfo := cloudprotocol.NodeInfo{ + NodeID: nodeID, + Status: "provisioned", + Attrs: map[string]interface{}{ + cloudprotocol.NodeAttrAosComponents: interface{}(cloudprotocol.AosComponentUM), + }, + } + provider.nodeInfo = append(provider.nodeInfo, nodeInfo) + } + + return provider +} + +func (provider *testNodeInfoProvider) GetNodeID() string { + return "test" +} + +func (provider *testNodeInfoProvider) GetAllNodeIDs() (nodesIds []string, err error) { + result := make([]string, 0) + + for _, nodeInfo := range provider.nodeInfo { + result = append(result, nodeInfo.NodeID) + } + + return result, nil +} + +func (provider *testNodeInfoProvider) GetNodeInfo(nodeID string) (cloudprotocol.NodeInfo, error) { + for _, nodeInfo := range provider.nodeInfo { + if nodeInfo.NodeID == nodeID { + return nodeInfo, nil + } + } + + return cloudprotocol.NodeInfo{}, aoserrors.Errorf("not found") +} + +func (provider *testNodeInfoProvider) SubscribeNodeInfoChange() <-chan cloudprotocol.NodeInfo { + listener := make(chan cloudprotocol.NodeInfo) + provider.nodeInfoListeners = append(provider.nodeInfoListeners, listener) + + return listener +} + +func (provider *testNodeInfoProvider) addNode(nodeID string) { + nodeInfo := cloudprotocol.NodeInfo{ + NodeID: nodeID, + Status: "provisioned", + Attrs: map[string]interface{}{ + cloudprotocol.NodeAttrAosComponents: interface{}(cloudprotocol.AosComponentUM), + }, + } + provider.nodeInfo = append(provider.nodeInfo, nodeInfo) + + for _, listener := range provider.nodeInfoListeners { + listener <- nodeInfo + } +} + /*********************************************************************************************************************** * Tests **********************************************************************************************************************/ @@ -142,40 +217,49 @@ func TestConnection(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8092", - UMClients: []config.UMClientConfig{ - {UMID: "umID1", Priority: 10}, - {UMID: "umID2", Priority: 0}, - }, } + + nodeInfoProvider := NewTestNodeInfoProvider([]string{"umID1"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} umCtrl, err := umcontroller.New( - &smConfig, &testStorage{}, nil, nil, &testCryptoContext{}, true) + &smConfig, &testStorage{}, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Fatalf("Can't create: UM controller %s", err) } - components := []*pb.SystemComponent{ - {Id: "component1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "component2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + go func() { + for { + _, ok := <-umCtrl.NewComponentsChannel() + if !ok { + return + } + } + }() + + components := []*pb.ComponentStatus{ + {ComponentId: "component1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "component2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - streamUM1, connUM1, err := createClientConnection("umID1", pb.UmState_IDLE, components) + streamUM1, connUM1, err := createClientConnection("umID1", pb.UpdateState_IDLE, components) if err != nil { t.Errorf("Error connect %s", err) } - components2 := []*pb.SystemComponent{ - {Id: "component3", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "component4", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + nodeInfoProvider.addNode("umID2") + + components2 := []*pb.ComponentStatus{ + {ComponentId: "component3", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "component4", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - streamUM2, connUM2, err := createClientConnection("umID2", pb.UmState_IDLE, components2) + streamUM2, connUM2, err := createClientConnection("umID2", pb.UpdateState_IDLE, components2) if err != nil { t.Errorf("Error connect %s", err) } - streamUM1Copy, connUM1Copy, err := createClientConnection("umID1", pb.UmState_IDLE, components) + streamUM1Copy, connUM1Copy, err := createClientConnection("umID1", pb.UpdateState_IDLE, components) if err != nil { t.Errorf("Error connect %s", err) } @@ -206,12 +290,86 @@ func TestConnection(t *testing.T) { time.Sleep(1 * time.Second) } +func TestNewComponentsUpdate(t *testing.T) { + umCtrlConfig := config.UMController{ + CMServerURL: "localhost:8091", + FileServerURL: "localhost:8092", + } + + // add components for node with ID=umID1 + nodeInfoProvider := NewTestNodeInfoProvider([]string{"umID1"}) + smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} + + umCtrl, err := umcontroller.New( + &smConfig, &testStorage{}, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) + if err != nil { + t.Fatalf("Can't create: UM controller %s", err) + } + + components := []*pb.ComponentStatus{ + {ComponentId: "component1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "component2", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + } + + streamUM1, connUM1, err := createClientConnection("umID1", pb.UpdateState_IDLE, components) + if err != nil { + t.Errorf("Error connect %s", err) + } + + newComponents, err := umCtrl.GetStatus() + if err != nil { + t.Errorf("Can't get system components %s", err) + } + + if len(newComponents) != 2 { + t.Errorf("Incorrect count of components %d", len(newComponents)) + } + + // add new components for node with ID=umID2 + nodeInfoProvider.addNode("umID2") + + components2 := []*pb.ComponentStatus{ + {ComponentId: "component3", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "component4", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + } + + streamUM2, connUM2, err := createClientConnection("umID2", pb.UpdateState_IDLE, components2) + if err != nil { + t.Errorf("Error connect %s", err) + } + + select { + case newComponents := <-umCtrl.NewComponentsChannel(): + if !reflect.DeepEqual(newComponents, []cloudprotocol.ComponentStatus{ + {ComponentID: "component3", Version: "1.0.0", Status: "installed", NodeID: "umID2"}, + {ComponentID: "component4", Version: "1.0.0", Status: "installed", NodeID: "umID2"}, + }) { + t.Errorf("Incorrect new components: %v", newComponents) + } + + case <-time.After(5 * time.Second): + t.Error("Waiting for new components timeout") + } + + umCtrl.Close() + + _ = streamUM1.CloseSend() + + connUM1.Close() + + _ = streamUM2.CloseSend() + + connUM2.Close() + + time.Sleep(1 * time.Second) +} + /*********************************************************************************************************************** * Private **********************************************************************************************************************/ func createClientConnection( - clientID string, state pb.UmState, components []*pb.SystemComponent, + clientID string, state pb.UpdateState, components []*pb.ComponentStatus, ) (stream pb.UMService_RegisterUMClient, conn *grpc.ClientConn, err error) { var opts []grpc.DialOption opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) @@ -230,7 +388,7 @@ func createClientConnection( return stream, nil, aoserrors.Wrap(err) } - umMsg := &pb.UpdateStatus{UmId: clientID, UmState: state, Components: components} + umMsg := &pb.UpdateStatus{NodeId: clientID, UpdateState: state, Components: components} if err = stream.Send(umMsg); err != nil { log.Errorf("Fail send update status message %s", err) @@ -245,36 +403,33 @@ func TestFullUpdate(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM1", Priority: 1}, - {UMID: "testUM2", Priority: 10}, - }, } + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM1", "testUM2"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um1Components := []*pb.SystemComponent{ - {Id: "um1C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um1C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um1Components := []*pb.ComponentStatus{ + {ComponentId: "um1C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um1C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um1 := newTestUM(t, "testUM1", pb.UmState_IDLE, "init", um1Components) + um1 := newTestUM(t, "testUM1", pb.UpdateState_IDLE, "init", um1Components) go um1.processMessages() - um2Components := []*pb.SystemComponent{ - {Id: "um2C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um2C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um2Components := []*pb.ComponentStatus{ + {ComponentId: "um2C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um2C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um2 := newTestUM(t, "testUM2", pb.UmState_IDLE, "init", um2Components) + um2 := newTestUM(t, "testUM2", pb.UpdateState_IDLE, "init", um2Components) go um2.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -286,16 +441,25 @@ func TestFullUpdate(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um1C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um1C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um2C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um2C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um2C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um2C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -308,58 +472,68 @@ func TestFullUpdate(t *testing.T) { finChan <- true }(finishChannel) - um1Components = append(um1Components, &pb.SystemComponent{ - Id: "um1C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING, + um1Components = append(um1Components, &pb.ComponentStatus{ + ComponentId: "um1C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLING, }) um1.setComponents(um1Components) um1.step = prepareStep um1.continueChan <- true <-um1.notifyTestChan // receive prepare - um1.sendState(pb.UmState_PREPARED) + um1.sendState(pb.UpdateState_PREPARED) um2Components = append(um2Components, - &pb.SystemComponent{Id: "um2C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um2C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um2Components = append(um2Components, - &pb.SystemComponent{Id: "um2C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um2C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um2.setComponents(um2Components) um2.step = prepareStep um2.continueChan <- true <-um2.notifyTestChan - um2.sendState(pb.UmState_PREPARED) + um2.sendState(pb.UpdateState_PREPARED) um1.step = updateStep um1.continueChan <- true <-um1.notifyTestChan // um1 updated - um1.sendState(pb.UmState_UPDATED) + um1.sendState(pb.UpdateState_UPDATED) um2.step = updateStep um2.continueChan <- true <-um2.notifyTestChan // um2 updated - um2.sendState(pb.UmState_UPDATED) + um2.sendState(pb.UpdateState_UPDATED) - um1Components = []*pb.SystemComponent{ - {Id: "um1C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um1C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um1Components = []*pb.ComponentStatus{ + {ComponentId: "um1C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um1C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } um1.setComponents(um1Components) um1.step = applyStep um1.continueChan <- true <-um1.notifyTestChan // um1 apply - um1.sendState(pb.UmState_IDLE) + um1.sendState(pb.UpdateState_IDLE) - um2Components = []*pb.SystemComponent{ - {Id: "um2C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um2C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um2Components = []*pb.ComponentStatus{ + {ComponentId: "um2C1", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um2C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } um2.setComponents(um2Components) um2.step = applyStep um2.continueChan <- true <-um2.notifyTestChan // um1 apply - um2.sendState(pb.UmState_IDLE) + um2.sendState(pb.UpdateState_IDLE) time.Sleep(1 * time.Second) @@ -369,10 +543,10 @@ func TestFullUpdate(t *testing.T) { <-finishChannel etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um1C1", VendorVersion: "1", Status: "installed"}, - {ID: "um1C2", VendorVersion: "2", Status: "installed"}, - {ID: "um2C1", VendorVersion: "2", Status: "installed"}, - {ID: "um2C2", VendorVersion: "2", Status: "installed"}, + {ComponentID: "um1C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um1C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um2C1", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um2C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, } currentComponents, err := umCtrl.GetStatus() @@ -405,36 +579,32 @@ func TestFullUpdateWithDisconnect(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM3", Priority: 1}, - {UMID: "testUM4", Priority: 10}, - }, } - + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM3", "testUM4"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um3Components := []*pb.SystemComponent{ - {Id: "um3C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um3C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um3Components := []*pb.ComponentStatus{ + {ComponentId: "um3C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um3C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um3 := newTestUM(t, "testUM3", pb.UmState_IDLE, "init", um3Components) + um3 := newTestUM(t, "testUM3", pb.UpdateState_IDLE, "init", um3Components) go um3.processMessages() - um4Components := []*pb.SystemComponent{ - {Id: "um4C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um4C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um4Components := []*pb.ComponentStatus{ + {ComponentId: "um4C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um4C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um4 := newTestUM(t, "testUM4", pb.UmState_IDLE, "init", um4Components) + um4 := newTestUM(t, "testUM4", pb.UpdateState_IDLE, "init", um4Components) go um4.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -446,16 +616,25 @@ func TestFullUpdateWithDisconnect(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um3C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um3C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um4C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um4C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um4C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um4C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -471,25 +650,40 @@ func TestFullUpdateWithDisconnect(t *testing.T) { // prepare UM3 um3Components = append(um3Components, - &pb.SystemComponent{Id: "um3C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um3C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um3.setComponents(um3Components) um3.step = prepareStep um3.continueChan <- true <-um3.notifyTestChan // receive prepare - um3.sendState(pb.UmState_PREPARED) + um3.sendState(pb.UpdateState_PREPARED) // prepare UM4 um4Components = append(um4Components, - &pb.SystemComponent{Id: "um4C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um4C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um4Components = append(um4Components, - &pb.SystemComponent{Id: "um4C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um4C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um4.setComponents(um4Components) um4.step = prepareStep um4.continueChan <- true <-um4.notifyTestChan - um4.sendState(pb.UmState_PREPARED) + um4.sendState(pb.UpdateState_PREPARED) um3.step = updateStep um3.continueChan <- true @@ -500,7 +694,7 @@ func TestFullUpdateWithDisconnect(t *testing.T) { um3.closeConnection() <-um3.notifyTestChan - um3 = newTestUM(t, "testUM3", pb.UmState_UPDATED, applyStep, um3Components) + um3 = newTestUM(t, "testUM3", pb.UpdateState_UPDATED, applyStep, um3Components) go um3.processMessages() um4.step = updateStep @@ -512,7 +706,7 @@ func TestFullUpdateWithDisconnect(t *testing.T) { <-um4.notifyTestChan - um4 = newTestUM(t, "testUM4", pb.UmState_UPDATED, applyStep, um4Components) + um4 = newTestUM(t, "testUM4", pb.UpdateState_UPDATED, applyStep, um4Components) go um4.processMessages() um3.step = applyStep @@ -524,12 +718,12 @@ func TestFullUpdateWithDisconnect(t *testing.T) { um3.closeConnection() <-um3.notifyTestChan - um3Components = []*pb.SystemComponent{ - {Id: "um3C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um3C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um3Components = []*pb.ComponentStatus{ + {ComponentId: "um3C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um3C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } - um3 = newTestUM(t, "testUM3", pb.UmState_IDLE, "init", um3Components) + um3 = newTestUM(t, "testUM3", pb.UpdateState_IDLE, "init", um3Components) go um3.processMessages() // um4 reboot @@ -537,12 +731,12 @@ func TestFullUpdateWithDisconnect(t *testing.T) { um4.closeConnection() <-um4.notifyTestChan - um4Components = []*pb.SystemComponent{ - {Id: "um4C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um4C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um4Components = []*pb.ComponentStatus{ + {ComponentId: "um4C1", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um4C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } - um4 = newTestUM(t, "testUM4", pb.UmState_IDLE, "init", um4Components) + um4 = newTestUM(t, "testUM4", pb.UpdateState_IDLE, "init", um4Components) go um4.processMessages() um3.step = finishStep @@ -551,10 +745,10 @@ func TestFullUpdateWithDisconnect(t *testing.T) { <-finishChannel etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um3C1", VendorVersion: "1", Status: "installed"}, - {ID: "um3C2", VendorVersion: "2", Status: "installed"}, - {ID: "um4C1", VendorVersion: "2", Status: "installed"}, - {ID: "um4C2", VendorVersion: "2", Status: "installed"}, + {ComponentID: "um3C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um3C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um4C1", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um4C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, } currentComponents, err := umCtrl.GetStatus() @@ -582,36 +776,32 @@ func TestFullUpdateWithReboot(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM5", Priority: 1}, - {UMID: "testUM6", Priority: 10}, - }, } - + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM5", "testUM6"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um5Components := []*pb.SystemComponent{ - {Id: "um5C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um5C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um5Components := []*pb.ComponentStatus{ + {ComponentId: "um5C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um5C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um5 := newTestUM(t, "testUM5", pb.UmState_IDLE, "init", um5Components) + um5 := newTestUM(t, "testUM5", pb.UpdateState_IDLE, "init", um5Components) go um5.processMessages() - um6Components := []*pb.SystemComponent{ - {Id: "um6C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um6C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um6Components := []*pb.ComponentStatus{ + {ComponentId: "um6C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um6C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um6 := newTestUM(t, "testUM6", pb.UmState_IDLE, "init", um6Components) + um6 := newTestUM(t, "testUM6", pb.UpdateState_IDLE, "init", um6Components) go um6.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -623,16 +813,25 @@ func TestFullUpdateWithReboot(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um5C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um5C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um6C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um6C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um6C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um6C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -648,25 +847,40 @@ func TestFullUpdateWithReboot(t *testing.T) { // prepare UM5 um5Components = append(um5Components, - &pb.SystemComponent{Id: "um5C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um5C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um5.setComponents(um5Components) um5.step = prepareStep um5.continueChan <- true <-um5.notifyTestChan // receive prepare - um5.sendState(pb.UmState_PREPARED) + um5.sendState(pb.UpdateState_PREPARED) // prepare UM6 um6Components = append(um6Components, - &pb.SystemComponent{Id: "um6C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um6C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um6Components = append(um6Components, - &pb.SystemComponent{Id: "um6C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um6C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um6.setComponents(um6Components) um6.step = prepareStep um6.continueChan <- true <-um6.notifyTestChan - um6.sendState(pb.UmState_PREPARED) + um6.sendState(pb.UpdateState_PREPARED) um5.step = updateStep um5.continueChan <- true @@ -685,15 +899,15 @@ func TestFullUpdateWithReboot(t *testing.T) { <-finishChannel umCtrl, err = umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um5 = newTestUM(t, "testUM5", pb.UmState_UPDATED, applyStep, um5Components) + um5 = newTestUM(t, "testUM5", pb.UpdateState_UPDATED, applyStep, um5Components) go um5.processMessages() - um6 = newTestUM(t, "testUM6", pb.UmState_PREPARED, updateStep, um6Components) + um6 = newTestUM(t, "testUM6", pb.UpdateState_PREPARED, updateStep, um6Components) go um6.processMessages() um6.continueChan <- true @@ -702,7 +916,7 @@ func TestFullUpdateWithReboot(t *testing.T) { um6.step = rebootStep um6.closeConnection() - um6 = newTestUM(t, "testUM6", pb.UmState_UPDATED, applyStep, um6Components) + um6 = newTestUM(t, "testUM6", pb.UpdateState_UPDATED, applyStep, um6Components) go um6.processMessages() // um5 apply and full reboot @@ -721,42 +935,42 @@ func TestFullUpdateWithReboot(t *testing.T) { <-um6.notifyTestChan umCtrl, err = umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um5Components = []*pb.SystemComponent{ - {Id: "um5C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um5C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um5Components = []*pb.ComponentStatus{ + {ComponentId: "um5C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um5C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } - um5 = newTestUM(t, "testUM5", pb.UmState_IDLE, "init", um5Components) + um5 = newTestUM(t, "testUM5", pb.UpdateState_IDLE, "init", um5Components) go um5.processMessages() - um6 = newTestUM(t, "testUM6", pb.UmState_UPDATED, applyStep, um6Components) + um6 = newTestUM(t, "testUM6", pb.UpdateState_UPDATED, applyStep, um6Components) go um6.processMessages() um6.step = rebootStep um6.closeConnection() <-um6.notifyTestChan - um6Components = []*pb.SystemComponent{ - {Id: "um6C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um6C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLED}, + um6Components = []*pb.ComponentStatus{ + {ComponentId: "um6C1", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um6C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLED}, } - um6 = newTestUM(t, "testUM6", pb.UmState_IDLE, "init", um6Components) + um6 = newTestUM(t, "testUM6", pb.UpdateState_IDLE, "init", um6Components) go um6.processMessages() um5.step = finishStep um6.step = finishStep etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um5C1", VendorVersion: "1", Status: "installed"}, - {ID: "um5C2", VendorVersion: "2", Status: "installed"}, - {ID: "um6C1", VendorVersion: "2", Status: "installed"}, - {ID: "um6C2", VendorVersion: "2", Status: "installed"}, + {ComponentID: "um5C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um5C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um6C1", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, + {ComponentID: "um6C2", ComponentType: "type-1", Version: "2.0.0", Status: "installed"}, } currentComponents, err := umCtrl.GetStatus() @@ -784,36 +998,32 @@ func TestRevertOnPrepare(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM7", Priority: 1}, - {UMID: "testUM8", Priority: 10}, - }, } - + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM7", "testUM8"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um7Components := []*pb.SystemComponent{ - {Id: "um7C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um7C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um7Components := []*pb.ComponentStatus{ + {ComponentId: "um7C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um7C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um7 := newTestUM(t, "testUM7", pb.UmState_IDLE, "init", um7Components) + um7 := newTestUM(t, "testUM7", pb.UpdateState_IDLE, "init", um7Components) go um7.processMessages() - um8Components := []*pb.SystemComponent{ - {Id: "um8C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um8C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um8Components := []*pb.ComponentStatus{ + {ComponentId: "um8C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um8C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um8 := newTestUM(t, "testUM8", pb.UmState_IDLE, "init", um8Components) + um8 := newTestUM(t, "testUM8", pb.UpdateState_IDLE, "init", um8Components) go um8.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -825,16 +1035,25 @@ func TestRevertOnPrepare(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um7C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um7C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um8C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um8C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um8C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um8C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -849,34 +1068,49 @@ func TestRevertOnPrepare(t *testing.T) { }() um7Components = append(um7Components, - &pb.SystemComponent{Id: "um7C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um7C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um7.setComponents(um7Components) um7.step = prepareStep um7.continueChan <- true <-um7.notifyTestChan // receive prepare - um7.sendState(pb.UmState_PREPARED) + um7.sendState(pb.UpdateState_PREPARED) um8Components = append(um8Components, - &pb.SystemComponent{Id: "um8C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um8C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um8Components = append(um8Components, - &pb.SystemComponent{Id: "um8C2", VendorVersion: "2", Status: pb.ComponentStatus_ERROR}) + &pb.ComponentStatus{ + ComponentId: "um8C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_ERROR, + }) um8.setComponents(um8Components) um8.step = prepareStep um8.continueChan <- true <-um8.notifyTestChan - um8.sendState(pb.UmState_FAILED) + um8.sendState(pb.UpdateState_FAILED) um7.step = revertStep um7.continueChan <- true <-um7.notifyTestChan // um7 revert received - um7.sendState(pb.UmState_IDLE) + um7.sendState(pb.UpdateState_IDLE) um8.step = revertStep um8.continueChan <- true <-um8.notifyTestChan // um8 revert received - um8.sendState(pb.UmState_IDLE) + um8.sendState(pb.UpdateState_IDLE) um7.step = finishStep um8.step = finishStep @@ -884,11 +1118,11 @@ func TestRevertOnPrepare(t *testing.T) { <-finishChannel etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um7C1", VendorVersion: "1", Status: "installed"}, - {ID: "um7C2", VendorVersion: "1", Status: "installed"}, - {ID: "um8C1", VendorVersion: "1", Status: "installed"}, - {ID: "um8C2", VendorVersion: "1", Status: "installed"}, - {ID: "um8C2", VendorVersion: "2", Status: "error"}, + {ComponentID: "um7C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um7C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um8C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um8C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um8C2", ComponentType: "type-1", Version: "2.0.0", Status: "error"}, } currentComponents, err := umCtrl.GetStatus() @@ -917,36 +1151,32 @@ func TestRevertOnUpdate(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM9", Priority: 1}, - {UMID: "testUM10", Priority: 10}, - }, } - + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM9", "testUM10"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um9Components := []*pb.SystemComponent{ - {Id: "um9C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um9C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um9Components := []*pb.ComponentStatus{ + {ComponentId: "um9C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um9C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um9 := newTestUM(t, "testUM9", pb.UmState_IDLE, "init", um9Components) + um9 := newTestUM(t, "testUM9", pb.UpdateState_IDLE, "init", um9Components) go um9.processMessages() - um10Components := []*pb.SystemComponent{ - {Id: "um10C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um10C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um10Components := []*pb.ComponentStatus{ + {ComponentId: "um10C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um10C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um10 := newTestUM(t, "testUM10", pb.UmState_IDLE, "init", um10Components) + um10 := newTestUM(t, "testUM10", pb.UpdateState_IDLE, "init", um10Components) go um10.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -958,16 +1188,25 @@ func TestRevertOnUpdate(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um9C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um9C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um10C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um10C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um10C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um10C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -982,58 +1221,73 @@ func TestRevertOnUpdate(t *testing.T) { }() um9Components = append(um9Components, - &pb.SystemComponent{Id: "um9C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um9C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um9.setComponents(um9Components) um9.step = prepareStep um9.continueChan <- true <-um9.notifyTestChan // receive prepare - um9.sendState(pb.UmState_PREPARED) + um9.sendState(pb.UpdateState_PREPARED) um10Components = append(um10Components, - &pb.SystemComponent{Id: "um10C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um10C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um10Components = append(um10Components, - &pb.SystemComponent{Id: "um10C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um10C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um10.setComponents(um10Components) um10.step = prepareStep um10.continueChan <- true <-um10.notifyTestChan - um10.sendState(pb.UmState_PREPARED) + um10.sendState(pb.UpdateState_PREPARED) um9.step = updateStep um9.continueChan <- true <-um9.notifyTestChan // um9 updated - um9.sendState(pb.UmState_UPDATED) + um9.sendState(pb.UpdateState_UPDATED) - um10Components = []*pb.SystemComponent{ - {Id: "um10C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um10C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um10C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}, - {Id: "um10C2", VendorVersion: "2", Status: pb.ComponentStatus_ERROR}, + um10Components = []*pb.ComponentStatus{ + {ComponentId: "um10C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um10C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um10C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_INSTALLING}, + {ComponentId: "um10C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_ERROR}, } um10.setComponents(um10Components) um10.step = updateStep um10.continueChan <- true <-um10.notifyTestChan // um10 updated - um10.sendState(pb.UmState_FAILED) + um10.sendState(pb.UpdateState_FAILED) - um9Components = []*pb.SystemComponent{ - {Id: "um9C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um9C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um9Components = []*pb.ComponentStatus{ + {ComponentId: "um9C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um9C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } um9.setComponents(um9Components) um9.step = revertStep um9.continueChan <- true <-um9.notifyTestChan // um9 revert received - um9.sendState(pb.UmState_IDLE) + um9.sendState(pb.UpdateState_IDLE) um10.step = revertStep um10.continueChan <- true <-um10.notifyTestChan // um10 revert received - um10.sendState(pb.UmState_IDLE) + um10.sendState(pb.UpdateState_IDLE) um9.step = finishStep um10.step = finishStep @@ -1041,11 +1295,11 @@ func TestRevertOnUpdate(t *testing.T) { <-finishChannel etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um9C1", VendorVersion: "1", Status: "installed"}, - {ID: "um9C2", VendorVersion: "1", Status: "installed"}, - {ID: "um10C1", VendorVersion: "1", Status: "installed"}, - {ID: "um10C2", VendorVersion: "1", Status: "installed"}, - {ID: "um10C2", VendorVersion: "2", Status: "error"}, + {ComponentID: "um9C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um9C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um10C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um10C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um10C2", ComponentType: "type-1", Version: "2.0.0", Status: "error"}, } currentComponents, err := umCtrl.GetStatus() @@ -1074,36 +1328,32 @@ func TestRevertOnUpdateWithDisconnect(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM11", Priority: 1}, - {UMID: "testUM12", Priority: 10}, - }, } - + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM11", "testUM12"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um11Components := []*pb.SystemComponent{ - {Id: "um11C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um11C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um11Components := []*pb.ComponentStatus{ + {ComponentId: "um11C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um11C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um11 := newTestUM(t, "testUM11", pb.UmState_IDLE, "init", um11Components) + um11 := newTestUM(t, "testUM11", pb.UpdateState_IDLE, "init", um11Components) go um11.processMessages() - um12Components := []*pb.SystemComponent{ - {Id: "um12C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um12C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um12Components := []*pb.ComponentStatus{ + {ComponentId: "um12C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um12C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um12 := newTestUM(t, "testUM12", pb.UmState_IDLE, "init", um12Components) + um12 := newTestUM(t, "testUM12", pb.UpdateState_IDLE, "init", um12Components) go um12.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -1115,16 +1365,25 @@ func TestRevertOnUpdateWithDisconnect(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um11C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um11C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um12C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um12C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um12C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um12C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -1139,34 +1398,49 @@ func TestRevertOnUpdateWithDisconnect(t *testing.T) { }() um11Components = append(um11Components, - &pb.SystemComponent{Id: "um11C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um11C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um11.setComponents(um11Components) um11.step = prepareStep um11.continueChan <- true <-um11.notifyTestChan // receive prepare - um11.sendState(pb.UmState_PREPARED) + um11.sendState(pb.UpdateState_PREPARED) um12Components = append(um12Components, - &pb.SystemComponent{Id: "um12C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um12C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um12Components = append(um12Components, - &pb.SystemComponent{Id: "um12C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um12C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um12.setComponents(um12Components) um12.step = prepareStep um12.continueChan <- true <-um12.notifyTestChan - um12.sendState(pb.UmState_PREPARED) + um12.sendState(pb.UpdateState_PREPARED) um11.step = updateStep um11.continueChan <- true <-um11.notifyTestChan // um11 updated - um11.sendState(pb.UmState_UPDATED) + um11.sendState(pb.UpdateState_UPDATED) - um12Components = []*pb.SystemComponent{ - {Id: "um12C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um12C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um12C2", VendorVersion: "2", Status: pb.ComponentStatus_ERROR}, + um12Components = []*pb.ComponentStatus{ + {ComponentId: "um12C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um12C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um12C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_ERROR}, } um12.setComponents(um12Components) @@ -1178,24 +1452,24 @@ func TestRevertOnUpdateWithDisconnect(t *testing.T) { um12.closeConnection() <-um12.notifyTestChan - um12 = newTestUM(t, "testUM12", pb.UmState_FAILED, revertStep, um12Components) + um12 = newTestUM(t, "testUM12", pb.UpdateState_FAILED, revertStep, um12Components) go um12.processMessages() - um11Components = []*pb.SystemComponent{ - {Id: "um11C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um11C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um11Components = []*pb.ComponentStatus{ + {ComponentId: "um11C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um11C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } um11.setComponents(um11Components) um11.step = revertStep um11.continueChan <- true <-um11.notifyTestChan // um11 revert received - um11.sendState(pb.UmState_IDLE) + um11.sendState(pb.UpdateState_IDLE) um12.step = revertStep um12.continueChan <- true <-um12.notifyTestChan // um12 revert received - um12.sendState(pb.UmState_IDLE) + um12.sendState(pb.UpdateState_IDLE) um11.step = finishStep um12.step = finishStep @@ -1203,11 +1477,11 @@ func TestRevertOnUpdateWithDisconnect(t *testing.T) { <-finishChannel etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um11C1", VendorVersion: "1", Status: "installed"}, - {ID: "um11C2", VendorVersion: "1", Status: "installed"}, - {ID: "um12C1", VendorVersion: "1", Status: "installed"}, - {ID: "um12C2", VendorVersion: "1", Status: "installed"}, - {ID: "um12C2", VendorVersion: "2", Status: "error"}, + {ComponentID: "um11C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um11C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um12C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um12C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um12C2", ComponentType: "type-1", Version: "2.0.0", Status: "error"}, } currentComponents, err := umCtrl.GetStatus() @@ -1236,36 +1510,33 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { umCtrlConfig := config.UMController{ CMServerURL: "localhost:8091", FileServerURL: "localhost:8093", - UMClients: []config.UMClientConfig{ - {UMID: "testUM13", Priority: 1, IsLocal: true}, - {UMID: "testUM14", Priority: 10}, - }, } + nodeInfoProvider := NewTestNodeInfoProvider([]string{"testUM13", "testUM14"}) smConfig := config.Config{UMController: umCtrlConfig, ComponentsDir: tmpDir} var updateStorage testStorage umCtrl, err := umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um13Components := []*pb.SystemComponent{ - {Id: "um13C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um13C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um13Components := []*pb.ComponentStatus{ + {ComponentId: "um13C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um13C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um13 := newTestUM(t, "testUM13", pb.UmState_IDLE, "init", um13Components) + um13 := newTestUM(t, "testUM13", pb.UpdateState_IDLE, "init", um13Components) go um13.processMessages() - um14Components := []*pb.SystemComponent{ - {Id: "um14C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um14C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um14Components := []*pb.ComponentStatus{ + {ComponentId: "um14C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um14C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } - um14 := newTestUM(t, "testUM14", pb.UmState_IDLE, "init", um14Components) + um14 := newTestUM(t, "testUM14", pb.UpdateState_IDLE, "init", um14Components) go um14.processMessages() componentDir, err := os.MkdirTemp("", "aosComponent_") @@ -1277,16 +1548,25 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "um13C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile1"), kilobyte*2), + ComponentID: convertToComponentID("um13C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile1"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um14C1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile2"), kilobyte*2), + ComponentID: convertToComponentID("um14C1"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile2"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, { - ID: "um14C2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2"}, - DecryptDataStruct: prepareDecryptDataStruct(path.Join(componentDir, "someFile3"), kilobyte*2), + ComponentID: convertToComponentID("um14C2"), + ComponentType: "type-1", + Version: "2.0.0", + DownloadInfo: prepareDownloadInfo(path.Join(componentDir, "someFile3"), kilobyte*2), + DecryptionInfo: prepareDecryptionInfo(), }, } @@ -1301,34 +1581,49 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { }() um13Components = append(um13Components, - &pb.SystemComponent{Id: "um13C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um13C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um13.setComponents(um13Components) um13.step = prepareStep um13.continueChan <- true <-um13.notifyTestChan // receive prepare - um13.sendState(pb.UmState_PREPARED) + um13.sendState(pb.UpdateState_PREPARED) um14Components = append(um14Components, - &pb.SystemComponent{Id: "um14C1", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um14C1", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um14Components = append(um14Components, - &pb.SystemComponent{Id: "um14C2", VendorVersion: "2", Status: pb.ComponentStatus_INSTALLING}) + &pb.ComponentStatus{ + ComponentId: "um14C2", + ComponentType: "type-1", + Version: "2.0.0", + State: pb.ComponentState_INSTALLING, + }) um14.setComponents(um14Components) um14.step = prepareStep um14.continueChan <- true <-um14.notifyTestChan - um14.sendState(pb.UmState_PREPARED) + um14.sendState(pb.UpdateState_PREPARED) um13.step = updateStep um13.continueChan <- true <-um13.notifyTestChan // um13 updated - um13.sendState(pb.UmState_UPDATED) + um13.sendState(pb.UpdateState_UPDATED) - um14Components = []*pb.SystemComponent{ - {Id: "um14C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um14C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um14C2", VendorVersion: "2", Status: pb.ComponentStatus_ERROR}, + um14Components = []*pb.ComponentStatus{ + {ComponentId: "um14C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um14C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um14C2", ComponentType: "type-1", Version: "2.0.0", State: pb.ComponentState_ERROR}, } um14.setComponents(um14Components) @@ -1350,32 +1645,32 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { // um14 reboot umCtrl, err = umcontroller.New( - &smConfig, &updateStorage, nil, nil, &testCryptoContext{}, true) + &smConfig, &updateStorage, nil, nodeInfoProvider, nil, &testCryptoContext{}, true) if err != nil { t.Errorf("Can't create: UM controller %s", err) } - um13 = newTestUM(t, "testUM13", pb.UmState_UPDATED, revertStep, um13Components) + um13 = newTestUM(t, "testUM13", pb.UpdateState_UPDATED, revertStep, um13Components) go um13.processMessages() - um14 = newTestUM(t, "testUM14", pb.UmState_FAILED, revertStep, um14Components) + um14 = newTestUM(t, "testUM14", pb.UpdateState_FAILED, revertStep, um14Components) go um14.processMessages() - um13Components = []*pb.SystemComponent{ - {Id: "um13C1", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, - {Id: "um13C2", VendorVersion: "1", Status: pb.ComponentStatus_INSTALLED}, + um13Components = []*pb.ComponentStatus{ + {ComponentId: "um13C1", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, + {ComponentId: "um13C2", ComponentType: "type-1", Version: "1.0.0", State: pb.ComponentState_INSTALLED}, } um13.setComponents(um13Components) um13.step = revertStep um13.continueChan <- true <-um13.notifyTestChan // um13 revert received - um13.sendState(pb.UmState_IDLE) + um13.sendState(pb.UpdateState_IDLE) um14.step = revertStep um14.continueChan <- true <-um14.notifyTestChan // um14 revert received - um14.sendState(pb.UmState_IDLE) + um14.sendState(pb.UpdateState_IDLE) um13.step = finishStep um14.step = finishStep @@ -1383,11 +1678,11 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { time.Sleep(time.Second) etalonComponents := []cloudprotocol.ComponentStatus{ - {ID: "um13C1", VendorVersion: "1", Status: "installed"}, - {ID: "um13C2", VendorVersion: "1", Status: "installed"}, - {ID: "um14C1", VendorVersion: "1", Status: "installed"}, - {ID: "um14C2", VendorVersion: "1", Status: "installed"}, - {ID: "um14C2", VendorVersion: "2", Status: "error"}, + {ComponentID: "um13C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um13C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um14C1", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um14C2", ComponentType: "type-1", Version: "1.0.0", Status: "installed"}, + {ComponentID: "um14C2", ComponentType: "type-1", Version: "2.0.0", Status: "error"}, } currentComponents, err := umCtrl.GetStatus() @@ -1396,9 +1691,12 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { } if !reflect.DeepEqual(etalonComponents, currentComponents) { - log.Debug(currentComponents) + log.WithFields(log.Fields{ + "etalon": etalonComponents, + "current": currentComponents, + }).Error("incorrect result component list") + t.Error("incorrect result component list") - log.Debug(etalonComponents) } um13.closeConnection() @@ -1416,11 +1714,11 @@ func TestRevertOnUpdateWithReboot(t *testing.T) { * Interfaces **********************************************************************************************************************/ -func (storage *testStorage) GetComponentsUpdateInfo() (updateInfo []umcontroller.SystemComponent, err error) { +func (storage *testStorage) GetComponentsUpdateInfo() (updateInfo []umcontroller.ComponentStatus, err error) { return storage.updateInfo, err } -func (storage *testStorage) SetComponentsUpdateInfo(updateInfo []umcontroller.SystemComponent) (err error) { +func (storage *testStorage) SetComponentsUpdateInfo(updateInfo []umcontroller.ComponentStatus) (err error) { storage.updateInfo = updateInfo return aoserrors.Wrap(err) } @@ -1504,12 +1802,12 @@ func (context *testCryptoContext) DecryptAndValidate( * Private **********************************************************************************************************************/ -func newTestUM(t *testing.T, id string, umState pb.UmState, testState string, components []*pb.SystemComponent) ( - umTest *testUmConnection, -) { +func newTestUM(t *testing.T, id string, updateStatus pb.UpdateState, + testState string, components []*pb.ComponentStatus, +) (umTest *testUmConnection) { t.Helper() - stream, conn, err := createClientConnection(id, umState, components) + stream, conn, err := createClientConnection(id, updateStatus, components) if err != nil { t.Errorf("Error connect %s", err) return umTest @@ -1529,12 +1827,12 @@ func newTestUM(t *testing.T, id string, umState pb.UmState, testState string, co return umTest } -func (um *testUmConnection) setComponents(components []*pb.SystemComponent) { +func (um *testUmConnection) setComponents(components []*pb.ComponentStatus) { um.components = components } -func (um *testUmConnection) sendState(state pb.UmState) { - umMsg := &pb.UpdateStatus{UmId: um.umID, UmState: state, Components: um.components} +func (um *testUmConnection) sendState(state pb.UpdateState) { + umMsg := &pb.UpdateStatus{NodeId: um.umID, UpdateState: state, Components: um.components} if err := um.stream.Send(umMsg); err != nil { um.test.Errorf("Fail send update status message %s", err) @@ -1547,14 +1845,14 @@ func (um *testUmConnection) closeConnection() { _ = um.stream.CloseSend() } -func prepareDecryptDataStruct(filePath string, size uint64) cloudprotocol.DecryptDataStruct { +func prepareDownloadInfo(filePath string, size uint64) cloudprotocol.DownloadInfo { if err := generateFile(filePath, size); err != nil { - return cloudprotocol.DecryptDataStruct{} + return cloudprotocol.DownloadInfo{} } imageFileInfo, err := image.CreateFileInfo(context.Background(), filePath) if err != nil { - return cloudprotocol.DecryptDataStruct{} + return cloudprotocol.DownloadInfo{} } url := url.URL{ @@ -1562,6 +1860,14 @@ func prepareDecryptDataStruct(filePath string, size uint64) cloudprotocol.Decryp Path: filePath, } + return cloudprotocol.DownloadInfo{ + URLs: []string{url.String()}, + Sha256: imageFileInfo.Sha256, + Size: imageFileInfo.Size, + } +} + +func prepareDecryptionInfo() cloudprotocol.DecryptionInfo { recInfo := struct { Serial string `json:"serial"` Issuer []byte `json:"issuer"` @@ -1570,19 +1876,12 @@ func prepareDecryptDataStruct(filePath string, size uint64) cloudprotocol.Decryp Issuer: []byte("issuer"), } - return cloudprotocol.DecryptDataStruct{ - URLs: []string{url.String()}, - Sha256: imageFileInfo.Sha256, - Sha512: imageFileInfo.Sha512, - Size: imageFileInfo.Size, - DecryptionInfo: &cloudprotocol.DecryptionInfo{ - BlockAlg: "AES256/CBC/pkcs7", - BlockIv: []byte{}, - BlockKey: []byte{}, - AsymAlg: "RSA/PKCS1v1_5", - ReceiverInfo: &recInfo, - }, - Signs: &cloudprotocol.Signs{}, + return cloudprotocol.DecryptionInfo{ + BlockAlg: "AES256/CBC/pkcs7", + BlockIv: []byte{}, + BlockKey: []byte{}, + AsymAlg: "RSA/PKCS1v1_5", + ReceiverInfo: &recInfo, } } @@ -1594,3 +1893,7 @@ func generateFile(fileName string, size uint64) (err error) { return nil } + +func convertToComponentID(id string) *string { + return &id +} diff --git a/umcontroller/umctrlserver.go b/umcontroller/umctrlserver.go index 1ebb24bf..9da731e2 100644 --- a/umcontroller/umctrlserver.go +++ b/umcontroller/umctrlserver.go @@ -28,7 +28,7 @@ import ( "google.golang.org/grpc/credentials" "github.com/aosedge/aos_common/aoserrors" - pb "github.com/aosedge/aos_common/api/updatemanager/v1" + pb "github.com/aosedge/aos_common/api/updatemanager" "github.com/aosedge/aos_common/utils/cryptutils" "github.com/aosedge/aos_communicationmanager/config" @@ -126,15 +126,15 @@ func (server *umCtrlServer) RegisterUM(stream pb.UMService_RegisterUMServer) (er return aoserrors.Wrap(err) } - log.Debugf("Register UM id %s status %s", statusMsg.GetUmId(), statusMsg.GetUmState().String()) + log.Debugf("Register UM id %s status %s", statusMsg.GetNodeId(), statusMsg.GetUpdateState().String()) - handler, ch, err := newUmHandler(statusMsg.GetUmId(), stream, server.controllerCh, statusMsg.GetUmState()) + handler, ch, err := newUmHandler(statusMsg.GetNodeId(), stream, server.controllerCh, statusMsg.GetUpdateState()) if err != nil { return aoserrors.Wrap(err) } openConnectionMsg := umCtrlInternalMsg{ - umID: statusMsg.GetUmId(), + umID: statusMsg.GetNodeId(), handler: handler, requestType: openConnection, status: getUmStatusFromUmMessage(statusMsg), @@ -143,11 +143,12 @@ func (server *umCtrlServer) RegisterUM(stream pb.UMService_RegisterUMServer) (er server.controllerCh <- openConnectionMsg // wait for close - <-ch + reason := <-ch closeConnectionMsg := umCtrlInternalMsg{ - umID: statusMsg.GetUmId(), + umID: statusMsg.GetNodeId(), requestType: closeConnection, + close: reason, } server.controllerCh <- closeConnectionMsg @@ -155,19 +156,20 @@ func (server *umCtrlServer) RegisterUM(stream pb.UMService_RegisterUMServer) (er } func getUmStatusFromUmMessage(msg *pb.UpdateStatus) (status umStatus) { - status.umState = msg.GetUmState().String() + status.updateStatus = msg.GetUpdateState().String() + status.nodePriority = msg.GetPriority() for _, component := range msg.GetComponents() { - if component.GetId() == "" { + if component.GetComponentId() == "" { continue } status.componsStatus = append(status.componsStatus, systemComponentStatus{ - id: component.GetId(), - vendorVersion: component.GetVendorVersion(), - aosVersion: component.GetAosVersion(), - status: strings.ToLower(component.GetStatus().String()), - err: component.GetError(), + componentID: component.GetComponentId(), + componentType: component.GetComponentType(), + version: component.GetVersion(), + status: strings.ToLower(component.GetState().String()), + err: component.GetError().GetMessage(), }) } diff --git a/umcontroller/umhandler.go b/umcontroller/umhandler.go index c2341b87..03241880 100644 --- a/umcontroller/umhandler.go +++ b/umcontroller/umhandler.go @@ -26,30 +26,37 @@ import ( log "github.com/sirupsen/logrus" "github.com/aosedge/aos_common/aoserrors" - pb "github.com/aosedge/aos_common/api/updatemanager/v1" + pb "github.com/aosedge/aos_common/api/updatemanager" ) /*********************************************************************************************************************** * Types **********************************************************************************************************************/ +type closeReason int + type umHandler struct { - umID string - stream pb.UMService_RegisterUMServer - messageChannel chan umCtrlInternalMsg - closeChannel chan bool - FSM *fsm.FSM - initialUmState string + umID string + stream pb.UMService_RegisterUMServer + messageChannel chan umCtrlInternalMsg + closeChannel chan closeReason + FSM *fsm.FSM + initialUpdateStatus string } type prepareRequest struct { - components []SystemComponent + components []ComponentStatus } /*********************************************************************************************************************** * Consts **********************************************************************************************************************/ +const ( + Reconnect closeReason = iota + ConnectionClose +) + const ( hStateIdle = "Idle" hStateWaitForPrepareResp = "WaitForPrepareResp" @@ -78,22 +85,22 @@ const ( // NewUmHandler create update manager connection handler. func newUmHandler(id string, umStream pb.UMService_RegisterUMServer, - messageChannel chan umCtrlInternalMsg, state pb.UmState) (handler *umHandler, closeChannel chan bool, err error, -) { + messageChannel chan umCtrlInternalMsg, state pb.UpdateState, +) (handler *umHandler, closeChannel chan closeReason, err error) { handler = &umHandler{umID: id, stream: umStream, messageChannel: messageChannel} - handler.closeChannel = make(chan bool) - handler.initialUmState = state.String() + handler.closeChannel = make(chan closeReason) + handler.initialUpdateStatus = state.String() initFsmState := hStateIdle switch state { - case pb.UmState_IDLE: + case pb.UpdateState_IDLE: initFsmState = hStateIdle - case pb.UmState_PREPARED: + case pb.UpdateState_PREPARED: initFsmState = hStateWaitForStartUpdate - case pb.UmState_UPDATED: + case pb.UpdateState_UPDATED: initFsmState = hStateWaitForApply - case pb.UmState_FAILED: + case pb.UpdateState_FAILED: log.Error("UM in failure state") initFsmState = hStateWaitForRevert @@ -141,17 +148,17 @@ func newUmHandler(id string, umStream pb.UMService_RegisterUMServer, } // Close close connection. -func (handler *umHandler) Close() { +func (handler *umHandler) Close(reason closeReason) { log.Debug("Close umhandler with UMID = ", handler.umID) - handler.closeChannel <- true + handler.closeChannel <- reason } func (handler *umHandler) GetInitialState() (state string) { - return handler.initialUmState + return handler.initialUpdateStatus } // Close close connection. -func (handler *umHandler) PrepareUpdate(prepareComponents []SystemComponent) (err error) { +func (handler *umHandler) PrepareUpdate(prepareComponents []ComponentStatus) (err error) { log.Debug("PrepareUpdate for UMID ", handler.umID) request := prepareRequest{components: prepareComponents} @@ -181,7 +188,7 @@ func (handler *umHandler) StartRevert() (err error) { **********************************************************************************************************************/ func (handler *umHandler) receiveData() { - defer func() { handler.closeChannel <- true }() + defer func() { handler.closeChannel <- ConnectionClose }() for { statusMsg, err := handler.stream.Recv() @@ -197,15 +204,15 @@ func (handler *umHandler) receiveData() { var evt string - state := statusMsg.GetUmState() + state := statusMsg.GetUpdateState() switch state { - case pb.UmState_IDLE: + case pb.UpdateState_IDLE: evt = eventIdleState - case pb.UmState_PREPARED: + case pb.UpdateState_PREPARED: evt = eventPrepareSuccess - case pb.UmState_UPDATED: + case pb.UpdateState_UPDATED: evt = eventUpdateSuccess - case pb.UmState_FAILED: + case pb.UpdateState_FAILED: log.Error("Update failure status: ", statusMsg.GetError()) evt = eventUpdateError @@ -233,13 +240,12 @@ func (handler *umHandler) sendPrepareUpdateRequest(ctx context.Context, e *fsm.E for _, value := range request.components { componetInfo := pb.PrepareComponentInfo{ - Id: value.ID, - VendorVersion: value.VendorVersion, - AosVersion: value.AosVersion, + ComponentId: value.ComponentID, + ComponentType: value.ComponentType, + Version: value.Version, Annotations: value.Annotations, Url: value.URL, Sha256: value.Sha256, - Sha512: value.Sha512, Size: value.Size, } diff --git a/unitconfig/unitconfig.go b/unitconfig/unitconfig.go index 746e85cc..786ab9be 100644 --- a/unitconfig/unitconfig.go +++ b/unitconfig/unitconfig.go @@ -24,12 +24,20 @@ import ( "sync" "github.com/aosedge/aos_common/aoserrors" - "github.com/aosedge/aos_common/aostypes" + semver "github.com/hashicorp/go-version" + log "github.com/sirupsen/logrus" "github.com/aosedge/aos_common/api/cloudprotocol" "github.com/aosedge/aos_communicationmanager/config" ) +/********************************************************************************************************************** +* Consts +**********************************************************************************************************************/ + +// ErrNotFound error to detect that item not found. +var ErrNotFound = errors.New("not found") + /*********************************************************************************************************************** * Types **********************************************************************************************************************/ @@ -38,16 +46,34 @@ import ( type Instance struct { sync.Mutex - client Client - unitConfigFile string - unitConfig aostypes.UnitConfig - unitConfigError error + client Client + curNodeID string + curNodeType string + unitConfigFile string + unitConfig cloudprotocol.UnitConfig + currentNodeConfigListeners []chan cloudprotocol.NodeConfig + unitConfigError error +} + +// NodeInfoProvider node info provider interface. +type NodeInfoProvider interface { + GetCurrentNodeInfo() (cloudprotocol.NodeInfo, error) } // Client client unit config interface. type Client interface { - CheckUnitConfig(unitConfig aostypes.UnitConfig) (err error) - SetUnitConfig(unitConfig aostypes.UnitConfig) (err error) + CheckNodeConfig(nodeID, version string, nodeConfig cloudprotocol.NodeConfig) error + SetNodeConfig(nodeID, version string, nodeConfig cloudprotocol.NodeConfig) error + GetNodeConfigStatuses() ([]NodeConfigStatus, error) + NodeConfigStatusChannel() <-chan NodeConfigStatus +} + +// NodeConfigStatus node config status. +type NodeConfigStatus struct { + NodeID string + NodeType string + Version string + Error *cloudprotocol.ErrorInfo } // ErrAlreadyInstalled error to detect that unit config with the same version already installed. @@ -58,13 +84,27 @@ var ErrAlreadyInstalled = errors.New("already installed") **********************************************************************************************************************/ // New creates new unit config instance. -func New(cfg *config.Config, client Client) (instance *Instance, err error) { +func New(cfg *config.Config, nodeInfoProvider NodeInfoProvider, client Client) (instance *Instance, err error) { instance = &Instance{ - client: client, - unitConfigFile: cfg.UnitConfigFile, + client: client, + unitConfigFile: cfg.UnitConfigFile, + currentNodeConfigListeners: make([]chan cloudprotocol.NodeConfig, 0), + } + + var nodeInfo cloudprotocol.NodeInfo + + if nodeInfo, err = nodeInfoProvider.GetCurrentNodeInfo(); err != nil { + return nil, aoserrors.Wrap(err) + } + + instance.curNodeID = nodeInfo.NodeID + instance.curNodeType = nodeInfo.NodeType + + if err := instance.load(); err != nil { + instance.unitConfigError = err } - _ = instance.load() + go instance.handleNodeConfigStatus() return instance, nil } @@ -74,7 +114,7 @@ func (instance *Instance) GetStatus() (unitConfigInfo cloudprotocol.UnitConfigSt instance.Lock() defer instance.Unlock() - unitConfigInfo.VendorVersion = instance.unitConfig.VendorVersion + unitConfigInfo.Version = instance.unitConfig.Version unitConfigInfo.Status = cloudprotocol.InstalledStatus if instance.unitConfigError != nil { @@ -85,71 +125,116 @@ func (instance *Instance) GetStatus() (unitConfigInfo cloudprotocol.UnitConfigSt return unitConfigInfo, nil } -// GetUnitConfigVersion returns unit config version. -func (instance *Instance) GetUnitConfigVersion(configJSON json.RawMessage) (vendorVersion string, err error) { - unitConfig := aostypes.UnitConfig{VendorVersion: "unknown"} - - if err = json.Unmarshal(configJSON, &unitConfig); err != nil { - return unitConfig.VendorVersion, aoserrors.Wrap(err) - } - - return unitConfig.VendorVersion, nil -} - // CheckUnitConfig checks unit config. -func (instance *Instance) CheckUnitConfig(configJSON json.RawMessage) (vendorVersion string, err error) { +func (instance *Instance) CheckUnitConfig(unitConfig cloudprotocol.UnitConfig) error { instance.Lock() defer instance.Unlock() - unitConfig := aostypes.UnitConfig{VendorVersion: "unknown"} + if instance.unitConfigError != nil && instance.unitConfig.Version == "" { + log.Warnf("Skip unit config version check due to error: %v", instance.unitConfigError) + } else if err := instance.checkVersion(unitConfig.Version); err != nil { + return aoserrors.Wrap(err) + } - if err = json.Unmarshal(configJSON, &unitConfig); err != nil { - return unitConfig.VendorVersion, aoserrors.Wrap(err) + nodeConfigStatuses, err := instance.client.GetNodeConfigStatuses() + if err != nil { + log.Errorf("Error getting node config statuses: %v", err) } - if vendorVersion, err = instance.checkUnitConfig(unitConfig); err != nil { - return vendorVersion, aoserrors.Wrap(err) + for i, nodeConfigStatus := range nodeConfigStatuses { + if nodeConfigStatus.Version != unitConfig.Version || nodeConfigStatus.Error != nil { + nodeConfig := findNodeConfig(nodeConfigStatus.NodeID, nodeConfigStatus.NodeType, unitConfig) + + nodeConfig.NodeID = &nodeConfigStatuses[i].NodeID + + if err := instance.client.CheckNodeConfig( + nodeConfigStatus.NodeID, unitConfig.Version, nodeConfig); err != nil { + return aoserrors.Wrap(err) + } + } } - return vendorVersion, nil + return nil } -func (instance *Instance) GetUnitConfiguration(nodeType string) aostypes.NodeUnitConfig { +// GetNodeConfig returns node config for node or node type. +func (instance *Instance) GetNodeConfig(nodeID, nodeType string) (cloudprotocol.NodeConfig, error) { + for _, node := range instance.unitConfig.Nodes { + if node.NodeID != nil && *node.NodeID == nodeID { + return node, nil + } + } + for _, node := range instance.unitConfig.Nodes { if node.NodeType == nodeType { - return node + return node, nil } } - return aostypes.NodeUnitConfig{} + return cloudprotocol.NodeConfig{}, ErrNotFound +} + +// GetNodeConfig returns node config of the node with given id and type. +func (instance *Instance) GetCurrentNodeConfig() (cloudprotocol.NodeConfig, error) { + return instance.GetNodeConfig(instance.curNodeID, instance.curNodeType) +} + +// SubscribeCurrentNodeConfigChange subscribes new current node config listener. +func (instance *Instance) SubscribeCurrentNodeConfigChange() <-chan cloudprotocol.NodeConfig { + instance.Lock() + defer instance.Unlock() + + log.Debug("Subscribe to current node config change event") + + ch := make(chan cloudprotocol.NodeConfig, 1) + instance.currentNodeConfigListeners = append(instance.currentNodeConfigListeners, ch) + + return ch } // UpdateUnitConfig updates unit config. -func (instance *Instance) UpdateUnitConfig(configJSON json.RawMessage) (err error) { +func (instance *Instance) UpdateUnitConfig(unitConfig cloudprotocol.UnitConfig) (err error) { instance.Lock() defer instance.Unlock() - unitConfig := aostypes.UnitConfig{VendorVersion: "unknown"} + defer func() { + instance.unitConfigError = err + }() - if err = json.Unmarshal(configJSON, &unitConfig); err != nil { + if instance.unitConfigError != nil && instance.unitConfig.Version == "" { + log.Warnf("Skip unit config version check due to error: %v", instance.unitConfigError) + } else if err := instance.checkVersion(unitConfig.Version); err != nil { return aoserrors.Wrap(err) } - if unitConfig.VendorVersion == instance.unitConfig.VendorVersion { - return aoserrors.New("invalid vendor version") + instance.unitConfig = unitConfig + + nodeConfigStatuses, err := instance.client.GetNodeConfigStatuses() + if err != nil { + log.Errorf("Error getting node config statuses: %v", err) } - instance.unitConfig = unitConfig + for _, nodeConfigStatus := range nodeConfigStatuses { + if nodeConfigStatus.Version != unitConfig.Version || nodeConfigStatus.Error != nil { + nodeConfig := findNodeConfig(nodeConfigStatus.NodeID, nodeConfigStatus.NodeType, unitConfig) - if err = instance.client.SetUnitConfig(instance.unitConfig); err != nil { - return aoserrors.Wrap(err) + if err := instance.client.SetNodeConfig( + nodeConfigStatus.NodeID, unitConfig.Version, nodeConfig); err != nil { + return aoserrors.Wrap(err) + } + + if nodeConfigStatus.NodeID == instance.curNodeID { + instance.updateCurrentNodeConfigListeners(nodeConfig) + } + } } - if err = os.WriteFile(instance.unitConfigFile, configJSON, 0o600); err != nil { + configJSON, err := json.Marshal(instance.unitConfig) + if err != nil { return aoserrors.Wrap(err) } - if err = instance.load(); err != nil { + if err = os.WriteFile(instance.unitConfigFile, configJSON, 0o600); err != nil { return aoserrors.Wrap(err) } @@ -167,6 +252,13 @@ func (instance *Instance) load() (err error) { byteValue, err := os.ReadFile(instance.unitConfigFile) if err != nil { + if os.IsNotExist(err) { + // Don't treat absent config as an error. + instance.unitConfig = cloudprotocol.UnitConfig{Version: "0.0.0"} + + return nil + } + return aoserrors.Wrap(err) } @@ -177,14 +269,75 @@ func (instance *Instance) load() (err error) { return nil } -func (instance *Instance) checkUnitConfig(unitConfig aostypes.UnitConfig) (vendorVersion string, err error) { - if unitConfig.VendorVersion == instance.unitConfig.VendorVersion { - return unitConfig.VendorVersion, ErrAlreadyInstalled +func (instance *Instance) checkVersion(version string) error { + curVer, err := semver.NewVersion(instance.unitConfig.Version) + if err != nil { + return aoserrors.Wrap(err) + } + + newVer, err := semver.NewVersion(version) + if err != nil { + return aoserrors.Wrap(err) + } + + if newVer.Equal(curVer) { + return ErrAlreadyInstalled + } + + if newVer.LessThan(curVer) { + return aoserrors.New("wrong version") + } + + return nil +} + +func (instance *Instance) handleNodeConfigStatus() { + for { + nodeConfigStatus, ok := <-instance.client.NodeConfigStatusChannel() + if !ok { + return + } + + if instance.unitConfigError != nil { + log.WithField("NodeID", nodeConfigStatus.NodeID).Warnf( + "Can't update node config due to: %v", instance.unitConfigError) + } + + if nodeConfigStatus.Version == instance.unitConfig.Version && nodeConfigStatus.Error == nil { + continue + } + + nodeConfig := findNodeConfig(nodeConfigStatus.NodeID, nodeConfigStatus.NodeType, instance.unitConfig) + + if err := instance.client.SetNodeConfig( + nodeConfigStatus.NodeID, instance.unitConfig.Version, nodeConfig); err != nil { + log.WithField("NodeID", nodeConfigStatus.NodeID).Errorf("Can't update node config: %v", err) + } + + if nodeConfigStatus.NodeID == instance.curNodeID { + instance.updateCurrentNodeConfigListeners(nodeConfig) + } + } +} + +func findNodeConfig(nodeID, nodeType string, unitConfig cloudprotocol.UnitConfig) cloudprotocol.NodeConfig { + for i, nodeConfig := range unitConfig.Nodes { + if nodeConfig.NodeID != nil && *nodeConfig.NodeID == nodeID { + return unitConfig.Nodes[i] + } } - if err = instance.client.CheckUnitConfig(unitConfig); err != nil { - return unitConfig.VendorVersion, aoserrors.Wrap(err) + for i, nodeConfig := range unitConfig.Nodes { + if nodeConfig.NodeType == nodeType { + return unitConfig.Nodes[i] + } } - return unitConfig.VendorVersion, nil + return cloudprotocol.NodeConfig{} +} + +func (instance *Instance) updateCurrentNodeConfigListeners(curNodeConfig cloudprotocol.NodeConfig) { + for _, listener := range instance.currentNodeConfigListeners { + listener <- curNodeConfig + } } diff --git a/unitconfig/unitconfig_test.go b/unitconfig/unitconfig_test.go index ea93de8d..fe07cad2 100644 --- a/unitconfig/unitconfig_test.go +++ b/unitconfig/unitconfig_test.go @@ -21,9 +21,10 @@ import ( "encoding/json" "os" "path" + "reflect" "testing" + "time" - "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" "github.com/aosedge/aos_communicationmanager/config" "github.com/aosedge/aos_communicationmanager/unitconfig" @@ -37,8 +38,8 @@ import ( const validTestUnitConfig = ` { - "formatVersion": 1, - "vendorVersion": "1.0.0", + "formatVersion": "1", + "version": "1.0.0", "nodes": [ { "nodeType" : "type1" @@ -46,11 +47,38 @@ const validTestUnitConfig = ` ] }` +const node0TestUnitConfig = ` + { + "formatVersion": "1", + "version": "1.0.0", + "nodes": [ + { + "nodeId" : "node0", + "nodeType" : "type1" + } + ] + }` + /*********************************************************************************************************************** * Types **********************************************************************************************************************/ -type testClient struct{} +type testNodeConfig struct { + NodeID string + NodeType string + Version string +} + +type testClient struct { + nodeConfigStatuses []unitconfig.NodeConfigStatus + nodeConfigStatusChannel chan unitconfig.NodeConfigStatus + nodeConfigSetCheckChannel chan testNodeConfig +} + +type testNodeInfoProvider struct { + nodeID string + nodeType string +} /*********************************************************************************************************************** * Vars @@ -101,7 +129,10 @@ func TestValidGetStatus(t *testing.T) { t.Fatalf("Can't create unit config file: %s", err) } - unitConfig, err := unitconfig.New(&config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, &testClient{}) + nodeInfoProvider := newTestInfoProvider("node0", "type1") + + unitConfig, err := unitconfig.New( + &config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, newTestClient()) if err != nil { t.Fatalf("Can't create unit config instance: %s", err) } @@ -115,11 +146,14 @@ func TestValidGetStatus(t *testing.T) { t.Errorf("Wrong unit config status: %s", info.Status) } - if info.VendorVersion != "1.0.0" { - t.Errorf("Wrong unit config version: %s", info.VendorVersion) + if info.Version != "1.0.0" { + t.Errorf("Wrong unit config version: %s", info.Version) } - nodeUnitConfig := unitConfig.GetUnitConfiguration("type1") + nodeUnitConfig, err := unitConfig.GetNodeConfig("id1", "type1") + if err != nil { + t.Errorf("Unexpected error: %v", err) + } if nodeUnitConfig.NodeType != "type1" { t.Error("Unexpected node type") @@ -138,7 +172,10 @@ func TestInvalidGetStatus(t *testing.T) { t.Fatalf("Can't create unit config file: %s", err) } - unitConfig, err := unitconfig.New(&config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, &testClient{}) + nodeInfoProvider := newTestInfoProvider("node0", "type1") + + unitConfig, err := unitconfig.New( + &config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, newTestClient()) if err != nil { t.Fatalf("Can't create unit config instance: %s", err) } @@ -158,68 +195,110 @@ func TestCheckUnitConfig(t *testing.T) { t.Fatalf("Can't create unit config file: %s", err) } - unitConfig, err := unitconfig.New(&config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, &testClient{}) + client := newTestClient() + nodeInfoProvider := newTestInfoProvider("node0", "type1") + + unitConfig, err := unitconfig.New( + &config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, client) if err != nil { t.Fatalf("Can't create unit config instance: %s", err) } - validUnitConfig := ` - { - "formatVersion": 1, - "vendorVersion": "2.0.0" - }` + validUnitConfig := cloudprotocol.UnitConfig{ + FormatVersion: "1", + Version: "2.0.0", + Nodes: []cloudprotocol.NodeConfig{{NodeType: "type1"}}, + } - vendorVersion, err := unitConfig.CheckUnitConfig(json.RawMessage(validUnitConfig)) - if err != nil { - t.Errorf("Check unit config error: %s", err) + client.nodeConfigStatuses = []unitconfig.NodeConfigStatus{ + {NodeID: "id1", NodeType: "type1", Version: "1.0.0"}, + {NodeID: "id2", NodeType: "type1", Version: "1.0.0"}, + {NodeID: "id3", NodeType: "type1", Version: "1.0.0"}, } - if vendorVersion != "2.0.0" { - t.Errorf("Wrong unit config version: %s", vendorVersion) + if err := unitConfig.CheckUnitConfig(validUnitConfig); err != nil { + t.Errorf("Check unit config error: %v", err) } - invalidUnitConfig := ` - { - "formatVersion": 1, - "vendorVersion": "1.0.0" - }` + for i := 0; i < len(client.nodeConfigStatuses); i++ { + select { + case nodeConfig := <-client.nodeConfigSetCheckChannel: + if !reflect.DeepEqual(nodeConfig, testNodeConfig{ + NodeID: client.nodeConfigStatuses[i].NodeID, + NodeType: "type1", + Version: "2.0.0", + }) { + t.Errorf("Wrong node config: %v", nodeConfig) + } + + case <-time.After(1 * time.Second): + t.Fatalf("Set node config timeout") + } + } - if vendorVersion, err = unitConfig.CheckUnitConfig(json.RawMessage(invalidUnitConfig)); err == nil { - t.Error("Error expected") + invalidUnitConfig := cloudprotocol.UnitConfig{ + FormatVersion: "1", + Version: "1.0.0", } - if vendorVersion != "1.0.0" { - t.Errorf("Wrong unit config version: %s", vendorVersion) + if err := unitConfig.CheckUnitConfig(invalidUnitConfig); err == nil { + t.Error("Error expected") } } func TestUpdateUnitConfig(t *testing.T) { if err := os.WriteFile(path.Join(tmpDir, "aos_unit.cfg"), []byte(validTestUnitConfig), 0o600); err != nil { - t.Fatalf("Can't create unit config file: %s", err) + t.Fatalf("Can't create unit config file: %v", err) } - unitConfig, err := unitconfig.New(&config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, &testClient{}) + client := newTestClient() + nodeInfoProvider := newTestInfoProvider("node0", "type1") + + unitConfig, err := unitconfig.New( + &config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, client) if err != nil { - t.Fatalf("Can't create unit config instance: %s", err) + t.Fatalf("Can't create unit config instance: %v", err) } - newUnitConfig := ` - { - "formatVersion": 1, - "vendorVersion": "2.0.0" - }` + newUnitConfig := cloudprotocol.UnitConfig{ + FormatVersion: "1", + Version: "2.0.0", + Nodes: []cloudprotocol.NodeConfig{{NodeType: "type1"}}, + } + + client.nodeConfigStatuses = []unitconfig.NodeConfigStatus{ + {NodeID: "id1", NodeType: "type1", Version: "1.0.0"}, + {NodeID: "id2", NodeType: "type1", Version: "1.0.0"}, + {NodeID: "id3", NodeType: "type1", Version: "1.0.0"}, + } - if err = unitConfig.UpdateUnitConfig(json.RawMessage(newUnitConfig)); err != nil { - t.Fatalf("Can't update unit config: %s", err) + if err = unitConfig.UpdateUnitConfig(newUnitConfig); err != nil { + t.Fatalf("Can't update unit config: %v", err) } - vendorVersion, err := unitConfig.GetUnitConfigVersion(json.RawMessage(newUnitConfig)) + for i := 0; i < len(client.nodeConfigStatuses); i++ { + select { + case nodeConfig := <-client.nodeConfigSetCheckChannel: + if !reflect.DeepEqual(nodeConfig, testNodeConfig{ + NodeID: client.nodeConfigStatuses[i].NodeID, + NodeType: "type1", + Version: "2.0.0", + }) { + t.Errorf("Wrong node config: %v", nodeConfig) + } + + case <-time.After(1 * time.Second): + t.Fatalf("Set node config timeout") + } + } + + status, err := unitConfig.GetStatus() if err != nil { - t.Errorf("Get unit config version error: %s", err) + t.Errorf("Get unit config status error: %v", err) } - if vendorVersion != "2.0.0" { - t.Errorf("Wrong unit config version: %s", vendorVersion) + if status.Version != "2.0.0" { + t.Errorf("Wrong unit config version: %s", status.Version) } readUnitConfig, err := os.ReadFile(path.Join(tmpDir, "aos_unit.cfg")) @@ -227,19 +306,135 @@ func TestUpdateUnitConfig(t *testing.T) { t.Fatalf("Can't read unit config file: %s", err) } - if string(readUnitConfig) != newUnitConfig { + newUnitConfigJSON, err := json.Marshal(newUnitConfig) + if err != nil { + t.Fatalf("Can't marshal new unit config: %s", err) + } + + if string(readUnitConfig) != string(newUnitConfigJSON) { t.Errorf("Read wrong unit config: %s", readUnitConfig) } } +func TestNodeConfigStatus(t *testing.T) { + if err := os.WriteFile(path.Join(tmpDir, "aos_unit.cfg"), []byte(validTestUnitConfig), 0o600); err != nil { + t.Fatalf("Can't create unit config file: %v", err) + } + + client := newTestClient() + nodeInfoProvider := newTestInfoProvider("node0", "type1") + + _, err := unitconfig.New(&config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, client) + if err != nil { + t.Fatalf("Can't create unit config instance: %v", err) + } + + client.nodeConfigStatusChannel <- unitconfig.NodeConfigStatus{ + NodeID: "id1", + NodeType: "type1", + } + + select { + case nodeConfig := <-client.nodeConfigSetCheckChannel: + if !reflect.DeepEqual(nodeConfig, testNodeConfig{NodeID: "id1", NodeType: "type1", Version: "1.0.0"}) { + t.Errorf("Wrong node config: %v", nodeConfig) + } + + case <-time.After(1 * time.Second): + t.Fatalf("Set node config timeout") + } +} + +func TestCurrentNodeConfigUpdate(t *testing.T) { + if err := os.WriteFile(path.Join(tmpDir, "aos_unit.cfg"), []byte(node0TestUnitConfig), 0o600); err != nil { + t.Fatalf("Can't create unit config file: %v", err) + } + + var ( + client = newTestClient() + nodeInfoProvider = newTestInfoProvider("node0", "type1") + ) + + instance, err := unitconfig.New( + &config.Config{UnitConfigFile: path.Join(tmpDir, "aos_unit.cfg")}, nodeInfoProvider, client) + if err != nil { + t.Fatalf("Can't create unit config instance: %v", err) + } + + curNodeConfigListener := instance.SubscribeCurrentNodeConfigChange() + + client.nodeConfigStatusChannel <- unitconfig.NodeConfigStatus{ + NodeID: "node0", + NodeType: "type1", + } + + node0 := "node0" + + for i := 0; i < 2; i++ { + select { + case nodeConfig := <-client.nodeConfigSetCheckChannel: + if !reflect.DeepEqual(nodeConfig, testNodeConfig{NodeID: "node0", NodeType: "type1", Version: "1.0.0"}) { + t.Errorf("Wrong node config: %v", nodeConfig) + } + + case curNodeConfig := <-curNodeConfigListener: + if !reflect.DeepEqual(curNodeConfig, cloudprotocol.NodeConfig{NodeID: &node0, NodeType: "type1"}) { + t.Errorf("Wrong node config: %v", curNodeConfig) + } + + case <-time.After(1 * time.Second): + t.Fatalf("Set node config timeout") + } + } +} + /*********************************************************************************************************************** * testClient **********************************************************************************************************************/ -func (client *testClient) CheckUnitConfig(unitConfig aostypes.UnitConfig) (err error) { +func newTestClient() *testClient { + return &testClient{ + nodeConfigStatusChannel: make(chan unitconfig.NodeConfigStatus, 1), + nodeConfigSetCheckChannel: make(chan testNodeConfig, 10), + } +} + +func (client *testClient) CheckNodeConfig(nodeID string, version string, nodeConfig cloudprotocol.NodeConfig) error { + client.nodeConfigSetCheckChannel <- testNodeConfig{ + NodeID: nodeID, + NodeType: nodeConfig.NodeType, + Version: version, + } + return nil } -func (client *testClient) SetUnitConfig(unitConfig aostypes.UnitConfig) (err error) { +func (client *testClient) SetNodeConfig(nodeID string, version string, nodeConfig cloudprotocol.NodeConfig) error { + client.nodeConfigSetCheckChannel <- testNodeConfig{ + NodeID: nodeID, + NodeType: nodeConfig.NodeType, + Version: version, + } + return nil } + +func (client *testClient) GetNodeConfigStatuses() ([]unitconfig.NodeConfigStatus, error) { + return client.nodeConfigStatuses, nil +} + +func (client *testClient) NodeConfigStatusChannel() <-chan unitconfig.NodeConfigStatus { + return client.nodeConfigStatusChannel +} + +/*********************************************************************************************************************** + * testNodeInfoProvider + **********************************************************************************************************************/ + +func newTestInfoProvider(nodeID, nodeType string) *testNodeInfoProvider { + return &testNodeInfoProvider{nodeID: nodeID, nodeType: nodeType} +} + +func (provider *testNodeInfoProvider) GetCurrentNodeInfo() (cloudprotocol.NodeInfo, error) { + return cloudprotocol.NodeInfo{NodeID: provider.nodeID, NodeType: provider.nodeType}, nil +} diff --git a/unitstatushandler/firmwaremanager.go b/unitstatushandler/firmwaremanager.go index 3fed525c..9590fc6f 100644 --- a/unitstatushandler/firmwaremanager.go +++ b/unitstatushandler/firmwaremanager.go @@ -21,21 +21,20 @@ import ( "context" "encoding/json" "errors" - "fmt" "net/url" "reflect" - "strings" "sync" "time" "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" + semver "github.com/hashicorp/go-version" "github.com/looplab/fsm" log "github.com/sirupsen/logrus" + "github.com/aosedge/aos_common/utils/semverutils" "github.com/aosedge/aos_communicationmanager/cmserver" "github.com/aosedge/aos_communicationmanager/downloader" - "github.com/aosedge/aos_communicationmanager/unitconfig" ) /*********************************************************************************************************************** @@ -54,12 +53,10 @@ type firmwareDownloader interface { type firmwareStatusHandler interface { updateComponentStatus(componentInfo cloudprotocol.ComponentStatus) - updateUnitConfigStatus(unitConfigInfo cloudprotocol.UnitConfigStatus) } type firmwareUpdate struct { Schedule cloudprotocol.ScheduleRule `json:"schedule,omitempty"` - UnitConfig json.RawMessage `json:"unitConfig,omitempty"` Components []cloudprotocol.ComponentInfo `json:"components,omitempty"` CertChains []cloudprotocol.CertificateChain `json:"certChains,omitempty"` Certs []cloudprotocol.Certificate `json:"certs,omitempty"` @@ -70,23 +67,20 @@ type firmwareManager struct { statusChannel chan cmserver.UpdateFOTAStatus - downloader firmwareDownloader - statusHandler firmwareStatusHandler - firmwareUpdater FirmwareUpdater - unitConfigUpdater UnitConfigUpdater - storage Storage - runner InstanceRunner + downloader firmwareDownloader + statusHandler firmwareStatusHandler + firmwareUpdater FirmwareUpdater + storage Storage stateMachine *updateStateMachine statusMutex sync.RWMutex pendingUpdate *firmwareUpdate ComponentStatuses map[string]*cloudprotocol.ComponentStatus `json:"componentStatuses,omitempty"` - UnitConfigStatus cloudprotocol.UnitConfigStatus `json:"unitConfigStatus,omitempty"` CurrentUpdate *firmwareUpdate `json:"currentUpdate,omitempty"` DownloadResult map[string]*downloadResult `json:"downloadResult,omitempty"` CurrentState string `json:"currentState,omitempty"` - UpdateErr string `json:"updateErr,omitempty"` + UpdateErr *cloudprotocol.ErrorInfo `json:"updateErr,omitempty"` TTLDate time.Time `json:"ttlDate,omitempty"` } @@ -95,18 +89,15 @@ type firmwareManager struct { **********************************************************************************************************************/ func newFirmwareManager(statusHandler firmwareStatusHandler, downloader firmwareDownloader, - firmwareUpdater FirmwareUpdater, unitConfigUpdater UnitConfigUpdater, - storage Storage, runner InstanceRunner, defaultTTL time.Duration, + firmwareUpdater FirmwareUpdater, storage Storage, defaultTTL time.Duration, ) (manager *firmwareManager, err error) { manager = &firmwareManager{ - statusChannel: make(chan cmserver.UpdateFOTAStatus, 1), - downloader: downloader, - statusHandler: statusHandler, - firmwareUpdater: firmwareUpdater, - unitConfigUpdater: unitConfigUpdater, - storage: storage, - runner: runner, - CurrentState: stateNoUpdate, + statusChannel: make(chan cmserver.UpdateFOTAStatus, 1), + downloader: downloader, + statusHandler: statusHandler, + firmwareUpdater: firmwareUpdater, + storage: storage, + CurrentState: stateNoUpdate, } if err = manager.loadState(); err != nil { @@ -159,14 +150,13 @@ func (manager *firmwareManager) getCurrentStatus() (status cmserver.UpdateFOTASt } for _, component := range manager.CurrentUpdate.Components { - status.Components = append(status.Components, cloudprotocol.ComponentStatus{ - ID: component.ID, AosVersion: component.AosVersion, VendorVersion: component.VendorVersion, - }) - } - - if len(manager.CurrentUpdate.UnitConfig) != 0 { - version, _ := manager.unitConfigUpdater.GetUnitConfigVersion(manager.CurrentUpdate.UnitConfig) - status.UnitConfig = &cloudprotocol.UnitConfigStatus{VendorVersion: version} + if component.ComponentID != nil { + status.Components = append(status.Components, cloudprotocol.ComponentStatus{ + ComponentID: *component.ComponentID, + ComponentType: component.ComponentType, + Version: component.Version, + }) + } } return status @@ -176,9 +166,10 @@ func (manager *firmwareManager) processDesiredStatus(desiredStatus cloudprotocol manager.Lock() defer manager.Unlock() + log.Debug("Process desired FOTA") + update := &firmwareUpdate{ Schedule: desiredStatus.FOTASchedule, - UnitConfig: desiredStatus.UnitConfig, Components: make([]cloudprotocol.ComponentInfo, 0), CertChains: desiredStatus.CertificateChains, Certs: desiredStatus.Certificates, @@ -189,11 +180,28 @@ func (manager *firmwareManager) processDesiredStatus(desiredStatus cloudprotocol return aoserrors.Wrap(err) } + var desiredComponentsWithNoID []cloudprotocol.ComponentInfo + desiredLoop: for _, desiredComponent := range desiredStatus.Components { + if err := validateComponent(desiredComponent); err != nil { + log.WithFields(log.Fields{ + "id": desiredComponent.ComponentID, + "type": desiredComponent.ComponentType, + "version": desiredComponent.Version, + }).Warnf("Skip invalid component: %v", err) + continue + } + + if desiredComponent.ComponentID == nil { + desiredComponentsWithNoID = append(desiredComponentsWithNoID, desiredComponent) + continue + } + for _, installedComponent := range installedComponents { - if desiredComponent.ID == installedComponent.ID { - if desiredComponent.VendorVersion == installedComponent.VendorVersion && + if *desiredComponent.ComponentID == installedComponent.ComponentID && + desiredComponent.ComponentType == installedComponent.ComponentType { + if desiredComponent.Version == installedComponent.Version && installedComponent.Status == cloudprotocol.InstalledStatus { continue desiredLoop } else { @@ -204,15 +212,22 @@ desiredLoop: } log.WithFields(log.Fields{ - "id": desiredComponent.ID, - "vendorVersion": desiredComponent.VendorVersion, + "id": *desiredComponent.ComponentID, + "type": desiredComponent.ComponentType, + "version": desiredComponent.Version, }).Error("Desired component not found") } - if len(update.UnitConfig) != 0 || len(update.Components) != 0 { + handleDesiredComponentsWithNoID(desiredComponentsWithNoID, installedComponents, update) + + if len(update.Components) != 0 { + log.WithField("components", update.Components).Debug("FOTA update required") + if err = manager.newUpdate(update); err != nil { return aoserrors.Wrap(err) } + } else { + log.Debug("No FOTA update required") } return nil @@ -224,7 +239,7 @@ func (manager *firmwareManager) startUpdate() (err error) { log.Debug("Start firmware update") - if err = manager.stateMachine.sendEvent(eventStartUpdate, ""); err != nil { + if err = manager.stateMachine.sendEvent(eventStartUpdate, nil); err != nil { return aoserrors.Wrap(err) } @@ -264,66 +279,41 @@ func (manager *firmwareManager) getComponentStatuses() (status []cloudprotocol.C return status, nil } -func (manager *firmwareManager) getUnitConfigStatuses() (status []cloudprotocol.UnitConfigStatus, err error) { - manager.Lock() - defer manager.Unlock() - - manager.statusMutex.RLock() - defer manager.statusMutex.RUnlock() - - info, err := manager.unitConfigUpdater.GetStatus() - if err != nil { - return nil, aoserrors.Wrap(err) - } - - status = append(status, info) - - // Append currently processing info - - if manager.CurrentState == stateNoUpdate || len(manager.CurrentUpdate.UnitConfig) == 0 { - return status, nil - } - - status = append(status, manager.UnitConfigStatus) - - return status, nil -} - /*********************************************************************************************************************** * Implementer **********************************************************************************************************************/ -func (manager *firmwareManager) stateChanged(event, state string, updateErr string) { +func (manager *firmwareManager) stateChanged(event, state string, updateErr error) { + var errorInfo *cloudprotocol.ErrorInfo + + if updateErr != nil { + errorInfo = &cloudprotocol.ErrorInfo{Message: updateErr.Error()} + } + if event == eventCancel { for id, status := range manager.ComponentStatuses { if status.Status != cloudprotocol.ErrorStatus { - manager.updateComponentStatusByID(id, cloudprotocol.ErrorStatus, updateErr) - } - } - - if len(manager.CurrentUpdate.UnitConfig) != 0 { - if manager.UnitConfigStatus.Status != cloudprotocol.ErrorStatus { - manager.updateUnitConfigStatus(cloudprotocol.ErrorStatus, updateErr) + manager.updateComponentStatusByID(id, cloudprotocol.ErrorStatus, errorInfo) } } } manager.CurrentState = state - manager.UpdateErr = updateErr + manager.UpdateErr = errorInfo log.WithFields(log.Fields{ "state": state, "event": event, }).Debug("Firmware manager state changed") - if updateErr != "" { - log.Errorf("Firmware update error: %s", updateErr) + if updateErr != nil { + log.Errorf("Firmware update error: %v", updateErr) } manager.sendCurrentStatus() if err := manager.saveState(); err != nil { - log.Errorf("Can't save current firmware manager state: %s", err) + log.Errorf("Can't save current firmware manager state: %v", err) } } @@ -347,78 +337,85 @@ func (manager *firmwareManager) noUpdate() { var err error if manager.TTLDate, err = manager.stateMachine.startNewUpdate( - time.Duration(manager.CurrentUpdate.Schedule.TTL) * time.Second); err != nil { - log.Errorf("Can't start new firmware update: %s", err) + time.Duration(manager.CurrentUpdate.Schedule.TTL)*time.Second, true); err != nil { + log.Errorf("Can't start new firmware update: %v", err) } }() } } +func createDownloadRequest(components []cloudprotocol.ComponentInfo) map[string]downloader.PackageInfo { + request := make(map[string]downloader.PackageInfo) + + for _, component := range components { + if component.ComponentID == nil { + continue + } + + downloadID := getDownloadID(component) + + if _, ok := request[downloadID]; ok { + log.WithFields(log.Fields{ + "id": downloadID, + "version": component.Version, + }).Debug("Skip duplicate download component") + + continue + } + + log.WithFields(log.Fields{ + "id": downloadID, + "version": component.Version, + }).Debug("Download component") + + request[downloadID] = downloader.PackageInfo{ + URLs: component.URLs, + Sha256: component.Sha256, + Size: component.Size, + TargetType: cloudprotocol.DownloadTargetComponent, + TargetID: downloadID, + TargetVersion: component.Version, + } + } + + return request +} + func (manager *firmwareManager) download(ctx context.Context) { - var downloadErr string + var downloadErr error defer func() { go func() { manager.Lock() defer manager.Unlock() - if downloadErr != "" { + if downloadErr != nil { manager.stateMachine.finishOperation(ctx, eventCancel, downloadErr) } else { - manager.stateMachine.finishOperation(ctx, eventFinishDownload, "") + manager.stateMachine.finishOperation(ctx, eventFinishDownload, nil) } }() }() manager.DownloadResult = nil - if len(manager.CurrentUpdate.UnitConfig) != 0 { - manager.UnitConfigStatus.VendorVersion = "" - - version, err := manager.unitConfigUpdater.GetUnitConfigVersion(manager.CurrentUpdate.UnitConfig) - - manager.UnitConfigStatus.VendorVersion = version - - if err != nil { - log.Errorf("Error getting unit config version: %s", err) - - downloadErr = aoserrors.Wrap(err).Error() - manager.updateUnitConfigStatus(cloudprotocol.ErrorStatus, downloadErr) - - return - } - - log.WithFields(log.Fields{"version": version}).Debug("Get unit config version") - - manager.updateUnitConfigStatus(cloudprotocol.PendingStatus, "") - } - manager.statusMutex.Lock() manager.ComponentStatuses = make(map[string]*cloudprotocol.ComponentStatus) - request := make(map[string]downloader.PackageInfo) + request := createDownloadRequest(manager.CurrentUpdate.Components) for _, component := range manager.CurrentUpdate.Components { - log.WithFields(log.Fields{ - "id": component.ID, - "version": component.VendorVersion, - }).Debug("Download component") - - request[component.ID] = downloader.PackageInfo{ - URLs: component.URLs, - Sha256: component.Sha256, - Sha512: component.Sha512, - Size: component.Size, - TargetType: cloudprotocol.DownloadTargetComponent, - TargetID: component.ID, - TargetAosVersion: component.AosVersion, - TargetVendorVersion: component.VendorVersion, + if component.ComponentID == nil { + continue } - manager.ComponentStatuses[component.ID] = &cloudprotocol.ComponentStatus{ - ID: component.ID, - AosVersion: component.AosVersion, - VendorVersion: component.VendorVersion, - Status: cloudprotocol.DownloadingStatus, + + if _, ok := request[getDownloadID(component)]; ok { + manager.ComponentStatuses[*component.ComponentID] = &cloudprotocol.ComponentStatus{ + ComponentID: *component.ComponentID, + ComponentType: component.ComponentType, + Version: component.Version, + Status: cloudprotocol.DownloadingStatus, + } } } @@ -429,26 +426,35 @@ func (manager *firmwareManager) download(ctx context.Context) { return } - manager.DownloadResult = manager.downloader.download(ctx, request, false, manager.updateComponentStatusByID) + manager.DownloadResult = manager.downloader.download(ctx, request, false, manager.updateComponentStatusByDownloadID) downloadErr = getDownloadError(manager.DownloadResult) - for id, item := range manager.ComponentStatuses { + for _, item := range manager.ComponentStatuses { if item.ErrorInfo != nil { log.WithFields(log.Fields{ - "id": item.ID, - "version": item.VendorVersion, + "id": item.ComponentID, + "type": item.ComponentType, + "version": item.Version, }).Errorf("Error downloading component: %s", item.ErrorInfo.Message) continue } + downloadID := getDownloadID(cloudprotocol.ComponentInfo{ + ComponentID: &item.ComponentID, + ComponentType: item.ComponentType, + Version: item.Version, + }) + log.WithFields(log.Fields{ - "id": item.ID, - "version": item.VendorVersion, + "downloadID": downloadID, + "componentID": item.ComponentID, + "type": item.ComponentType, + "version": item.Version, }).Debug("Component successfully downloaded") - manager.updateComponentStatusByID(id, cloudprotocol.PendingStatus, "") + manager.updateComponentStatusByDownloadID(downloadID, cloudprotocol.PendingStatus, nil) } } @@ -457,7 +463,7 @@ func (manager *firmwareManager) readyToUpdate() { } func (manager *firmwareManager) update(ctx context.Context) { - var updateErr string + var updateErr error defer func() { go func() { @@ -469,21 +475,8 @@ func (manager *firmwareManager) update(ctx context.Context) { }() if len(manager.CurrentUpdate.Components) != 0 { - if err := manager.updateComponents(ctx); err != "" { + if err := manager.updateComponents(ctx); err != nil { updateErr = err - return - } - } - - if len(manager.CurrentUpdate.UnitConfig) != 0 { - if err := manager.updateUnitConfig(ctx); err != "" { - updateErr = err - return - } - - if err := manager.runner.RestartInstances(); err != nil { - updateErr = err.Error() - return } } } @@ -493,8 +486,8 @@ func (manager *firmwareManager) updateTimeout() { defer manager.Unlock() if manager.stateMachine.canTransit(eventCancel) { - if err := manager.stateMachine.sendEvent(eventCancel, aoserrors.New("update timeout").Error()); err != nil { - log.Errorf("Can't cancel update: %s", err) + if err := manager.stateMachine.sendEvent(eventCancel, aoserrors.New("update timeout")); err != nil { + log.Errorf("Can't cancel update: %v", err) } } } @@ -527,13 +520,12 @@ func (manager *firmwareManager) newUpdate(update *firmwareUpdate) (err error) { manager.CurrentUpdate = update if manager.TTLDate, err = manager.stateMachine.startNewUpdate( - time.Duration(manager.CurrentUpdate.Schedule.TTL) * time.Second); err != nil { + time.Duration(manager.CurrentUpdate.Schedule.TTL)*time.Second, true); err != nil { return aoserrors.Wrap(err) } default: - if reflect.DeepEqual(update.Components, manager.CurrentUpdate.Components) && - unitConfigsEqual(update.UnitConfig, manager.CurrentUpdate.UnitConfig) { + if reflect.DeepEqual(update.Components, manager.CurrentUpdate.Components) { if reflect.DeepEqual(update.Schedule, manager.CurrentUpdate.Schedule) { return nil } @@ -556,7 +548,7 @@ func (manager *firmwareManager) newUpdate(update *firmwareUpdate) (err error) { return nil } - if err = manager.stateMachine.sendEvent(eventCancel, aoserrors.Wrap(context.Canceled).Error()); err != nil { + if err = manager.stateMachine.sendEvent(eventCancel, aoserrors.Wrap(context.Canceled)); err != nil { return aoserrors.Wrap(err) } } @@ -564,30 +556,33 @@ func (manager *firmwareManager) newUpdate(update *firmwareUpdate) (err error) { return nil } -func (manager *firmwareManager) updateComponents(ctx context.Context) (componentsErr string) { +func (manager *firmwareManager) updateComponents(ctx context.Context) (componentsErr error) { defer func() { switch { - case strings.Contains(componentsErr, context.Canceled.Error()): + case errors.Is(ctx.Err(), context.Canceled): - case componentsErr == "": + case componentsErr == nil: for _, status := range manager.ComponentStatuses { log.WithFields(log.Fields{ - "id": status.ID, - "version": status.VendorVersion, + "id": status.ComponentID, + "type": status.ComponentType, + "version": status.Version, }).Info("Component successfully updated") } default: for id, status := range manager.ComponentStatuses { if status.Status != cloudprotocol.ErrorStatus { - manager.updateComponentStatusByID(id, cloudprotocol.ErrorStatus, - fmt.Sprintf("update aborted due to error: %s", componentsErr)) + manager.updateComponentStatusByID(id, cloudprotocol.ErrorStatus, &cloudprotocol.ErrorInfo{ + Message: "update aborted due to error: " + componentsErr.Error(), + }) } log.WithFields(log.Fields{ - "id": status.ID, - "version": status.VendorVersion, - }).Errorf("Error updating component: %v", status.ErrorInfo) + "id": status.ComponentID, + "type": status.ComponentType, + "version": status.Version, + }).Errorf("Error updating component: %s", status.ErrorInfo.Message) } } }() @@ -595,15 +590,24 @@ func (manager *firmwareManager) updateComponents(ctx context.Context) (component updateComponents := make([]cloudprotocol.ComponentInfo, 0, len(manager.CurrentUpdate.Components)) for _, component := range manager.CurrentUpdate.Components { - log.WithFields(log.Fields{"id": component.ID, "version": component.VendorVersion}).Debug("Update component") + if component.ComponentID == nil { + continue + } - manager.updateComponentStatusByID(component.ID, cloudprotocol.InstallingStatus, "") + log.WithFields(log.Fields{ + "id": component.ComponentID, + "type": component.ComponentType, + "version": component.Version, + }).Debug("Update component") - downloadInfo, ok := manager.DownloadResult[component.ID] + manager.updateComponentStatusByID(*component.ComponentID, cloudprotocol.InstallingStatus, nil) + + downloadInfo, ok := manager.DownloadResult[getDownloadID(component)] if !ok { - err := aoserrors.New("update ID not found").Error() + err := aoserrors.New("update ID not found") - manager.updateComponentStatusByID(component.ID, cloudprotocol.ErrorStatus, err) + manager.updateComponentStatusByID(*component.ComponentID, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: err.Error()}) return err } @@ -619,17 +623,15 @@ func (manager *firmwareManager) updateComponents(ctx context.Context) (component } select { - case errStr := <-manager.asyncUpdate(updateComponents): - return errStr + case err := <-manager.asyncUpdate(updateComponents): + return err case <-ctx.Done(): - errStr := "" - if err := ctx.Err(); err != nil { - errStr = err.Error() + return aoserrors.Wrap(err) } - return errStr + return nil } } @@ -637,7 +639,41 @@ func (manager *firmwareManager) sendCurrentStatus() { manager.statusChannel <- manager.getCurrentStatus() } -func (manager *firmwareManager) updateComponentStatusByID(id, status, componentErr string) { +func (manager *firmwareManager) updateComponentStatusByDownloadID(id, status string, + componentErr *cloudprotocol.ErrorInfo, +) { + manager.statusMutex.Lock() + defer manager.statusMutex.Unlock() + + found := false + + for _, info := range manager.ComponentStatuses { + downloadID := getDownloadID(cloudprotocol.ComponentInfo{ + ComponentID: &info.ComponentID, + ComponentType: info.ComponentType, + Version: info.Version, + }) + + if downloadID != id { + continue + } + + info.Status = status + info.ErrorInfo = componentErr + + manager.statusHandler.updateComponentStatus(*info) + + found = true + } + + if !found { + log.Errorf("Can't update firmware component status: id %s not found", id) + + return + } +} + +func (manager *firmwareManager) updateComponentStatusByID(id, status string, componentErr *cloudprotocol.ErrorInfo) { manager.statusMutex.Lock() defer manager.statusMutex.Unlock() @@ -648,10 +684,7 @@ func (manager *firmwareManager) updateComponentStatusByID(id, status, componentE } info.Status = status - - if componentErr != "" { - info.ErrorInfo = &cloudprotocol.ErrorInfo{Message: componentErr} - } + info.ErrorInfo = componentErr manager.statusHandler.updateComponentStatus(*info) } @@ -686,103 +719,115 @@ func (manager *firmwareManager) saveState() (err error) { return nil } -func (manager *firmwareManager) updateUnitConfig(ctx context.Context) (unitConfigErr string) { - log.Debug("Update unit config") - - defer func() { - if unitConfigErr != "" { - manager.updateUnitConfigStatus(cloudprotocol.ErrorStatus, unitConfigErr) - } - }() - - if _, err := manager.unitConfigUpdater.CheckUnitConfig(manager.CurrentUpdate.UnitConfig); err != nil { - if errors.Is(err, unitconfig.ErrAlreadyInstalled) { - log.Error("Unit config already installed") +func (manager *firmwareManager) asyncUpdate(updateComponents []cloudprotocol.ComponentInfo) (channel <-chan error) { + finishChannel := make(chan error, 1) - manager.updateUnitConfigStatus(cloudprotocol.InstalledStatus, "") - - return "" - } + go func() { + var err error - return aoserrors.Wrap(err).Error() - } - - manager.updateUnitConfigStatus(cloudprotocol.InstallingStatus, "") - - if err := manager.unitConfigUpdater.UpdateUnitConfig(manager.CurrentUpdate.UnitConfig); err != nil { - return aoserrors.Wrap(err).Error() - } - - manager.updateUnitConfigStatus(cloudprotocol.InstalledStatus, "") - - return "" -} - -func (manager *firmwareManager) asyncUpdate( - updateComponents []cloudprotocol.ComponentInfo, -) (channel <-chan string) { - finishChannel := make(chan string, 1) - - go func() (errorStr string) { - defer func() { finishChannel <- errorStr }() - - updateResult, err := manager.firmwareUpdater.UpdateComponents( + updateResult, updateErr := manager.firmwareUpdater.UpdateComponents( updateComponents, manager.CurrentUpdate.CertChains, manager.CurrentUpdate.Certs) - if err != nil { - errorStr = aoserrors.Wrap(err).Error() + if updateErr != nil { + err = aoserrors.Wrap(updateErr) } for id, status := range manager.ComponentStatuses { for _, item := range updateResult { - if item.ID == status.ID && item.VendorVersion == status.VendorVersion { - if errorStr == "" { + if item.ComponentID == status.ComponentID && item.Version == status.Version { + if err == nil { if item.ErrorInfo != nil { - errorStr = item.ErrorInfo.Message + err = aoserrors.New(item.ErrorInfo.Message) } } - manager.updateComponentStatusByID(id, item.Status, errorStr) + manager.updateComponentStatusByID(id, item.Status, item.ErrorInfo) } } } - return errorStr + finishChannel <- err }() return finishChannel } -func (manager *firmwareManager) updateUnitConfigStatus(status, errorStr string) { - manager.statusMutex.Lock() - defer manager.statusMutex.Unlock() +func getDownloadID(component cloudprotocol.ComponentInfo) string { + return component.ComponentType + ":" + component.Version +} - manager.UnitConfigStatus.Status = status +func validateComponent(component cloudprotocol.ComponentInfo) error { + if component.ComponentType == "" { + return aoserrors.New("component type is empty") + } - if errorStr != "" { - manager.UnitConfigStatus.ErrorInfo = &cloudprotocol.ErrorInfo{Message: errorStr} + if err := validateSemver(component.Version); err != nil { + return aoserrors.Wrap(err) } - manager.statusHandler.updateUnitConfigStatus(manager.UnitConfigStatus) + return nil } -func unitConfigsEqual(config1, config2 json.RawMessage) (equal bool) { - var configData1, configData2 interface{} +func validateSemver(version string) error { + _, err := semver.NewSemver(version) - if config1 == nil && config2 == nil { - return true - } + return aoserrors.Wrap(err) +} - if (config1 == nil && config2 != nil) || (config1 != nil && config2 == nil) { - return false - } +func handleDesiredComponentsWithNoID(componentsWithNoID []cloudprotocol.ComponentInfo, + installedComponents []cloudprotocol.ComponentStatus, update *firmwareUpdate, +) { + log.Debug("Handle desired components with no ID") - if err := json.Unmarshal(config1, &configData1); err != nil { - log.Errorf("Can't marshal unit config: %s", err) - } + newComponents := make(map[string]cloudprotocol.ComponentInfo) - if err := json.Unmarshal(config2, &configData2); err != nil { - log.Errorf("Can't marshal unit config: %s", err) +installedLoop: + for _, installedComponent := range installedComponents { + componentID := installedComponent.ComponentID + + for _, updateComponent := range update.Components { + if updateComponent.ComponentID != nil && *updateComponent.ComponentID == componentID { + continue installedLoop + } + } + + for _, component := range componentsWithNoID { + if component.ComponentType != installedComponent.ComponentType { + continue + } + + component.ComponentID = &componentID + + newComponent, ok := newComponents[*component.ComponentID] + if !ok { + if err := validateSemver(component.Version); err != nil { + log.Errorf("Error validating version: %v", err) + continue + } + + newComponents[*component.ComponentID] = component + + continue + } + + greater, err := semverutils.GreaterThan(component.Version, newComponent.Version) + if err != nil { + log.Errorf("Error comparing versions: %v", err) + continue + } + + if greater { + newComponents[*component.ComponentID] = component + } + } } - return reflect.DeepEqual(configData1, configData2) + for _, component := range newComponents { + log.WithFields(log.Fields{ + "id": *component.ComponentID, + "type": component.ComponentType, + "version": component.Version, + }).Debug("Deducted component ID from installed components") + + update.Components = append(update.Components, component) + } } diff --git a/unitstatushandler/groupdownloader.go b/unitstatushandler/groupdownloader.go index fd824041..2694d28f 100644 --- a/unitstatushandler/groupdownloader.go +++ b/unitstatushandler/groupdownloader.go @@ -37,7 +37,7 @@ type downloadResult struct { Error string `json:"error"` } -type statusNotifier func(id string, status string, componentErr string) +type statusNotifier func(id string, status string, componentErr *cloudprotocol.ErrorInfo) type groupDownloader struct { Downloader @@ -59,7 +59,7 @@ func (downloader *groupDownloader) download(ctx context.Context, request map[str for id := range request { result[id] = &downloadResult{} - updateStatus(id, cloudprotocol.DownloadingStatus, "") + updateStatus(id, cloudprotocol.DownloadingStatus, nil) } downloadCtx, cancelFunc := context.WithCancel(ctx) @@ -70,7 +70,7 @@ func (downloader *groupDownloader) download(ctx context.Context, request map[str handleError := func(id string, err error) { if errorStr := aoserrors.Wrap(err).Error(); !isCancelError(errorStr) { result[id].Error = errorStr - updateStatus(id, cloudprotocol.ErrorStatus, errorStr) + updateStatus(id, cloudprotocol.ErrorStatus, &cloudprotocol.ErrorInfo{Message: errorStr}) } if !continueOnError { @@ -102,7 +102,7 @@ func (downloader *groupDownloader) download(ctx context.Context, request map[str return } - updateStatus(id, cloudprotocol.DownloadedStatus, "") + updateStatus(id, cloudprotocol.DownloadedStatus, nil) }(id) } @@ -115,7 +115,7 @@ func (downloader *groupDownloader) download(ctx context.Context, request map[str for id, item := range result { if item.Error == "" { item.Error = aoserrors.Wrap(downloadCtx.Err()).Error() - updateStatus(id, cloudprotocol.ErrorStatus, item.Error) + updateStatus(id, cloudprotocol.ErrorStatus, &cloudprotocol.ErrorInfo{Message: item.Error}) } } } @@ -143,14 +143,14 @@ func (downloader *groupDownloader) releaseDownloadedSoftware() error { return nil } -func getDownloadError(result map[string]*downloadResult) (downloadErr string) { +func getDownloadError(result map[string]*downloadResult) error { for _, item := range result { if item.Error != "" && !isCancelError(item.Error) { - return item.Error + return aoserrors.New(item.Error) } } - return "" + return nil } func isCancelError(errString string) (result bool) { diff --git a/unitstatushandler/softwaremanager.go b/unitstatushandler/softwaremanager.go index 1c20d5cd..aeefa93e 100644 --- a/unitstatushandler/softwaremanager.go +++ b/unitstatushandler/softwaremanager.go @@ -20,6 +20,7 @@ package unitstatushandler import ( "context" "encoding/json" + "errors" "net/url" "reflect" "sync" @@ -34,6 +35,7 @@ import ( "github.com/aosedge/aos_communicationmanager/cmserver" "github.com/aosedge/aos_communicationmanager/downloader" + "github.com/aosedge/aos_communicationmanager/unitconfig" ) /*********************************************************************************************************************** @@ -52,48 +54,59 @@ type softwareDownloader interface { releaseDownloadedSoftware() error } type softwareStatusHandler interface { - updateLayerStatus(layerInfo cloudprotocol.LayerStatus) - updateServiceStatus(serviceInfo cloudprotocol.ServiceStatus) - setInstanceStatus(status []cloudprotocol.InstanceStatus) + updateLayerStatus(status cloudprotocol.LayerStatus) + updateServiceStatus(status cloudprotocol.ServiceStatus) + updateUnitConfigStatus(status cloudprotocol.UnitConfigStatus) + updateInstanceStatus(status cloudprotocol.InstanceStatus) + getNodesStatus() ([]cloudprotocol.NodeStatus, error) } type softwareUpdate struct { - Schedule cloudprotocol.ScheduleRule `json:"schedule,omitempty"` - InstallServices []cloudprotocol.ServiceInfo `json:"installServices,omitempty"` - RemoveServices []cloudprotocol.ServiceStatus `json:"removeServices,omitempty"` - RestoreServices []cloudprotocol.ServiceInfo `json:"restoreServices,omitempty"` - InstallLayers []cloudprotocol.LayerInfo `json:"installLayers,omitempty"` - RemoveLayers []cloudprotocol.LayerStatus `json:"removeLayers,omitempty"` - RestoreLayers []cloudprotocol.LayerStatus `json:"restoreLayers,omitempty"` - RunInstances []cloudprotocol.InstanceInfo `json:"runInstances,omitempty"` - CertChains []cloudprotocol.CertificateChain `json:"certChains,omitempty"` - Certs []cloudprotocol.Certificate `json:"certs,omitempty"` + Schedule cloudprotocol.ScheduleRule `json:"schedule,omitempty"` + UnitConfig *cloudprotocol.UnitConfig `json:"unitConfig,omitempty"` + InstallServices []cloudprotocol.ServiceInfo `json:"installServices,omitempty"` + RemoveServices []cloudprotocol.ServiceStatus `json:"removeServices,omitempty"` + RestoreServices []cloudprotocol.ServiceInfo `json:"restoreServices,omitempty"` + InstallLayers []cloudprotocol.LayerInfo `json:"installLayers,omitempty"` + RemoveLayers []cloudprotocol.LayerStatus `json:"removeLayers,omitempty"` + RestoreLayers []cloudprotocol.LayerStatus `json:"restoreLayers,omitempty"` + RunInstances []cloudprotocol.InstanceInfo `json:"runInstances,omitempty"` + CertChains []cloudprotocol.CertificateChain `json:"certChains,omitempty"` + Certs []cloudprotocol.Certificate `json:"certs,omitempty"` + NodesStatus []cloudprotocol.NodeStatus `json:"nodesStatus,omitempty"` + RebalanceRequest bool `json:"rebalanceRequest,omitempty"` } type softwareManager struct { sync.Mutex - runCond *sync.Cond + runStatusCV *sync.Cond statusChannel chan cmserver.UpdateSOTAStatus - downloader softwareDownloader - statusHandler softwareStatusHandler - softwareUpdater SoftwareUpdater - instanceRunner InstanceRunner - storage Storage + nodeManager NodeManager + unitConfigUpdater UnitConfigUpdater + downloader softwareDownloader + statusHandler softwareStatusHandler + softwareUpdater SoftwareUpdater + instanceRunner InstanceRunner + storage Storage stateMachine *updateStateMachine actionHandler *action.Handler statusMutex sync.RWMutex pendingUpdate *softwareUpdate + newServices []string + revertServices []string + LayerStatuses map[string]*cloudprotocol.LayerStatus `json:"layerStatuses,omitempty"` ServiceStatuses map[string]*cloudprotocol.ServiceStatus `json:"serviceStatuses,omitempty"` InstanceStatuses []cloudprotocol.InstanceStatus `json:"instanceStatuses,omitempty"` + UnitConfigStatus cloudprotocol.UnitConfigStatus `json:"unitConfigStatus,omitempty"` CurrentUpdate *softwareUpdate `json:"currentUpdate,omitempty"` DownloadResult map[string]*downloadResult `json:"downloadResult,omitempty"` CurrentState string `json:"currentState,omitempty"` - UpdateErr string `json:"updateErr,omitempty"` + UpdateErr *cloudprotocol.ErrorInfo `json:"updateErr,omitempty"` TTLDate time.Time `json:"ttlDate,omitempty"` } @@ -101,21 +114,24 @@ type softwareManager struct { * Interface **********************************************************************************************************************/ -func newSoftwareManager(statusHandler softwareStatusHandler, downloader softwareDownloader, - softwareUpdater SoftwareUpdater, instanceRunner InstanceRunner, storage Storage, defaultTTL time.Duration, +func newSoftwareManager(statusHandler softwareStatusHandler, downloader softwareDownloader, nodeManager NodeManager, + unitConfigUpdater UnitConfigUpdater, softwareUpdater SoftwareUpdater, instanceRunner InstanceRunner, + storage Storage, defaultTTL time.Duration, ) (manager *softwareManager, err error) { manager = &softwareManager{ - statusChannel: make(chan cmserver.UpdateSOTAStatus, 1), - downloader: downloader, - statusHandler: statusHandler, - softwareUpdater: softwareUpdater, - instanceRunner: instanceRunner, - actionHandler: action.New(maxConcurrentActions), - storage: storage, - CurrentState: stateNoUpdate, + statusChannel: make(chan cmserver.UpdateSOTAStatus, 1), + downloader: downloader, + statusHandler: statusHandler, + nodeManager: nodeManager, + unitConfigUpdater: unitConfigUpdater, + softwareUpdater: softwareUpdater, + instanceRunner: instanceRunner, + actionHandler: action.New(maxConcurrentActions), + storage: storage, + CurrentState: stateNoUpdate, } - manager.runCond = sync.NewCond(&manager.Mutex) + manager.runStatusCV = sync.NewCond(&manager.Mutex) if err = manager.loadState(); err != nil { return nil, aoserrors.Wrap(err) @@ -126,6 +142,7 @@ func newSoftwareManager(statusHandler softwareStatusHandler, downloader software manager.stateMachine = newUpdateStateMachine(manager.CurrentState, fsm.Events{ // no update state {Name: eventStartDownload, Src: []string{stateNoUpdate}, Dst: stateDownloading}, + {Name: eventReadyToUpdate, Src: []string{stateNoUpdate}, Dst: stateReadyToUpdate}, // downloading state {Name: eventFinishDownload, Src: []string{stateDownloading}, Dst: stateReadyToUpdate}, {Name: eventCancel, Src: []string{stateDownloading}, Dst: stateNoUpdate}, @@ -145,9 +162,13 @@ func newSoftwareManager(statusHandler softwareStatusHandler, downloader software func (manager *softwareManager) close() (err error) { manager.Lock() + log.Debug("Close software manager") - manager.runCond.Broadcast() + + manager.runStatusCV.Signal() + close(manager.statusChannel) + manager.Unlock() if err = manager.stateMachine.close(); err != nil { @@ -165,69 +186,71 @@ func (manager *softwareManager) getCurrentStatus() (status cmserver.UpdateSOTASt return status } + status.RebalanceRequest = manager.CurrentUpdate.RebalanceRequest + for _, layer := range manager.CurrentUpdate.InstallLayers { status.InstallLayers = append(status.InstallLayers, cloudprotocol.LayerStatus{ - ID: layer.ID, Digest: layer.Digest, AosVersion: layer.AosVersion, + LayerID: layer.LayerID, Digest: layer.Digest, Version: layer.Version, }) } for _, layer := range manager.CurrentUpdate.RemoveLayers { status.RemoveLayers = append(status.RemoveLayers, cloudprotocol.LayerStatus{ - ID: layer.ID, Digest: layer.Digest, AosVersion: layer.AosVersion, + LayerID: layer.LayerID, Digest: layer.Digest, Version: layer.Version, }) } for _, service := range manager.CurrentUpdate.InstallServices { status.InstallServices = append(status.InstallServices, cloudprotocol.ServiceStatus{ - ID: service.ID, AosVersion: service.AosVersion, + ServiceID: service.ServiceID, Version: service.Version, }) } for _, service := range manager.CurrentUpdate.RemoveServices { status.RemoveServices = append(status.RemoveServices, cloudprotocol.ServiceStatus{ - ID: service.ID, AosVersion: service.AosVersion, + ServiceID: service.ServiceID, Version: service.Version, }) } + if manager.CurrentUpdate.UnitConfig != nil { + status.UnitConfig = &cloudprotocol.UnitConfigStatus{Version: manager.CurrentUpdate.UnitConfig.Version} + } + return status } -func (manager *softwareManager) processRunStatus(status RunInstancesStatus) { +func (manager *softwareManager) processRunStatus(instances []cloudprotocol.InstanceStatus) bool { manager.Lock() defer manager.Unlock() - manager.InstanceStatuses = status.Instances - - for _, errStatus := range status.ErrorServices { - var errMsg string - - if errStatus.ErrorInfo != nil { - errMsg = errStatus.ErrorInfo.Message - } - - if _, ok := manager.ServiceStatuses[errStatus.ID]; !ok { - status := errStatus - manager.ServiceStatuses[errStatus.ID] = &status - } + manager.InstanceStatuses = instances - manager.updateServiceStatusByID(errStatus.ID, errStatus.Status, errMsg) + if len(manager.newServices) != 0 && len(manager.CurrentUpdate.RunInstances) != 0 { + manager.checkNewServices() + manager.newServices = nil } - manager.runCond.Broadcast() + manager.runStatusCV.Signal() + + return len(manager.revertServices) == 0 } func (manager *softwareManager) processDesiredStatus(desiredStatus cloudprotocol.DesiredStatus) error { manager.Lock() defer manager.Unlock() + log.Debug("Process desired SOTA") + update := &softwareUpdate{ Schedule: desiredStatus.SOTASchedule, + UnitConfig: desiredStatus.UnitConfig, InstallServices: make([]cloudprotocol.ServiceInfo, 0), RemoveServices: make([]cloudprotocol.ServiceStatus, 0), InstallLayers: make([]cloudprotocol.LayerInfo, 0), RemoveLayers: make([]cloudprotocol.LayerStatus, 0), RunInstances: desiredStatus.Instances, CertChains: desiredStatus.CertificateChains, Certs: desiredStatus.Certificates, + NodesStatus: make([]cloudprotocol.NodeStatus, 0), } allServices, err := manager.softwareUpdater.GetServicesStatus() @@ -242,15 +265,45 @@ func (manager *softwareManager) processDesiredStatus(desiredStatus cloudprotocol manager.processDesiredServices(update, allServices, desiredStatus.Services) manager.processDesiredLayers(update, allLayers, desiredStatus.Layers) + manager.processNodesStatus(update, desiredStatus.Nodes) if len(update.InstallServices) != 0 || len(update.RemoveServices) != 0 || len(update.InstallLayers) != 0 || len(update.RemoveLayers) != 0 || len(update.RestoreServices) != 0 || - len(update.RestoreLayers) != 0 || manager.needRunInstances(desiredStatus.Instances) { + len(update.RestoreLayers) != 0 || manager.needRunInstances(desiredStatus.Instances) || + update.UnitConfig != nil || len(update.NodesStatus) != 0 { if err := manager.newUpdate(update); err != nil { return aoserrors.Wrap(err) } } else { - log.Debug("No software update needed") + log.Debug("No SOTA update required") + } + + return nil +} + +func (manager *softwareManager) requestRebalancing() error { + manager.Lock() + defer manager.Unlock() + + log.Debug("Request rebalancing") + + if manager.CurrentUpdate == nil || len(manager.CurrentUpdate.RunInstances) == 0 { + return nil + } + + update := &softwareUpdate{ + Schedule: manager.CurrentUpdate.Schedule, + InstallServices: make([]cloudprotocol.ServiceInfo, 0), + RemoveServices: make([]cloudprotocol.ServiceStatus, 0), + InstallLayers: make([]cloudprotocol.LayerInfo, 0), + RemoveLayers: make([]cloudprotocol.LayerStatus, 0), + RunInstances: manager.CurrentUpdate.RunInstances, + NodesStatus: make([]cloudprotocol.NodeStatus, 0), + RebalanceRequest: true, + } + + if err := manager.newUpdate(update); err != nil { + return err } return nil @@ -262,7 +315,7 @@ func (manager *softwareManager) processDesiredServices( downloadServiceLoop: for _, desiredService := range desiredServices { for _, service := range allServices { - if desiredService.ID == service.ID && desiredService.AosVersion == service.AosVersion && + if desiredService.ServiceID == service.ServiceID && desiredService.Version == service.Version && service.Status != cloudprotocol.ErrorStatus { if service.Cached { update.RestoreServices = append(update.RestoreServices, desiredService) @@ -286,7 +339,7 @@ removeServiceLoop: } for _, desiredService := range desiredServices { - if service.ID == desiredService.ID { + if service.ServiceID == desiredService.ServiceID { continue removeServiceLoop } } @@ -333,6 +386,31 @@ removeLayersLoop: } } +func (manager *softwareManager) processNodesStatus( + update *softwareUpdate, desiredNodesStatus []cloudprotocol.NodeStatus, +) { + curNodesStatus, err := manager.statusHandler.getNodesStatus() + if err != nil { + log.Errorf("Can't get nodes status: %v", err) + return + } + +desiredNodesLoop: + for _, desiredNodeStatus := range desiredNodesStatus { + for _, curNodeStatus := range curNodesStatus { + if desiredNodeStatus.NodeID == curNodeStatus.NodeID { + if desiredNodeStatus.Status != curNodeStatus.Status { + update.NodesStatus = append(update.NodesStatus, desiredNodeStatus) + } + + continue desiredNodesLoop + } + } + + update.NodesStatus = append(update.NodesStatus, desiredNodeStatus) + } +} + func (manager *softwareManager) needRunInstances(desiredInstances []cloudprotocol.InstanceInfo) bool { currentIdents := make([]aostypes.InstanceIdent, len(manager.InstanceStatuses)) desiredIdents := []aostypes.InstanceIdent{} @@ -377,7 +455,7 @@ func (manager *softwareManager) startUpdate() (err error) { log.Debug("Start software update") - if err = manager.stateMachine.sendEvent(eventStartUpdate, ""); err != nil { + if err = manager.stateMachine.sendEvent(eventStartUpdate, nil); err != nil { return aoserrors.Wrap(err) } @@ -407,13 +485,21 @@ func (manager *softwareManager) getServiceStatus() (serviceStatuses []cloudproto // Append currently processing info for _, service := range manager.ServiceStatuses { - serviceStatuses = append(serviceStatuses, *service) + if service.Status != cloudprotocol.InstalledStatus { + serviceStatuses = append(serviceStatuses, *service) + } } return serviceStatuses, nil } func (manager *softwareManager) getLayersStatus() (layerStatuses []cloudprotocol.LayerStatus, err error) { + manager.Lock() + defer manager.Unlock() + + manager.statusMutex.RLock() + defer manager.statusMutex.RUnlock() + layersStatus, err := manager.softwareUpdater.GetLayersStatus() if err != nil { return nil, aoserrors.Wrap(err) @@ -430,47 +516,105 @@ func (manager *softwareManager) getLayersStatus() (layerStatuses []cloudprotocol } for _, layer := range manager.LayerStatuses { - layerStatuses = append(layerStatuses, *layer) + if layer.Status != cloudprotocol.InstalledStatus { + layerStatuses = append(layerStatuses, *layer) + } } return layerStatuses, nil } +func (manager *softwareManager) getUnitConfigStatuses() (status []cloudprotocol.UnitConfigStatus, err error) { + manager.Lock() + defer manager.Unlock() + + manager.statusMutex.RLock() + defer manager.statusMutex.RUnlock() + + info, err := manager.unitConfigUpdater.GetStatus() + if err != nil { + return nil, aoserrors.Wrap(err) + } + + status = append(status, info) + + // Append currently processing info + + if manager.CurrentState == stateNoUpdate || manager.CurrentUpdate.UnitConfig == nil { + return status, nil + } + + if manager.UnitConfigStatus.Status != cloudprotocol.InstalledStatus { + status = append(status, manager.UnitConfigStatus) + } + + return status, nil +} + +func (manager *softwareManager) getInstancesStatus() ([]cloudprotocol.InstanceStatus, error) { + manager.Lock() + defer manager.Unlock() + + manager.statusMutex.RLock() + defer manager.statusMutex.RUnlock() + + return manager.InstanceStatuses, nil +} + /*********************************************************************************************************************** * Implementer **********************************************************************************************************************/ -func (manager *softwareManager) stateChanged(event, state string, updateErr string) { +func (manager *softwareManager) stateChanged(event, state string, updateErr error) { + var errorInfo *cloudprotocol.ErrorInfo + + if updateErr != nil { + errorInfo = &cloudprotocol.ErrorInfo{Message: updateErr.Error()} + } + if event == eventCancel { for id, status := range manager.LayerStatuses { if status.Status != cloudprotocol.ErrorStatus { - manager.updateLayerStatusByID(id, cloudprotocol.ErrorStatus, updateErr) + manager.updateLayerStatusByID(id, cloudprotocol.ErrorStatus, errorInfo) } } for id, status := range manager.ServiceStatuses { if status.Status != cloudprotocol.ErrorStatus { - manager.updateServiceStatusByID(id, cloudprotocol.ErrorStatus, updateErr) + manager.updateServiceStatusByID(id, cloudprotocol.ErrorStatus, errorInfo) } } + + if manager.CurrentUpdate.UnitConfig != nil { + if manager.UnitConfigStatus.Status != cloudprotocol.ErrorStatus { + manager.updateUnitConfigStatus(cloudprotocol.ErrorStatus, errorInfo) + } + } + } + + if state == stateDownloading || state == stateReadyToUpdate { + if manager.CurrentUpdate.UnitConfig != nil { + manager.UnitConfigStatus.Version = manager.CurrentUpdate.UnitConfig.Version + manager.updateUnitConfigStatus(cloudprotocol.PendingStatus, nil) + } } manager.CurrentState = state - manager.UpdateErr = updateErr + manager.UpdateErr = errorInfo log.WithFields(log.Fields{ "state": state, "event": event, }).Debug("Software manager state changed") - if updateErr != "" { - log.Errorf("Software update error: %s", updateErr) + if updateErr != nil { + log.Errorf("Software update error: %v", updateErr) } manager.sendCurrentStatus() if err := manager.saveState(); err != nil { - log.Errorf("Can't save current software manager state: %s", err) + log.Errorf("Can't save current software manager state: %v", err) } } @@ -494,8 +638,9 @@ func (manager *softwareManager) noUpdate() { var err error if manager.TTLDate, err = manager.stateMachine.startNewUpdate( - time.Duration(manager.CurrentUpdate.Schedule.TTL) * time.Second); err != nil { - log.Errorf("Can't start new software update: %s", err) + time.Duration(manager.CurrentUpdate.Schedule.TTL)*time.Second, + manager.isDownloadRequired()); err != nil { + log.Errorf("Can't start new software update: %v", err) } }() } @@ -503,7 +648,7 @@ func (manager *softwareManager) noUpdate() { func (manager *softwareManager) download(ctx context.Context) { var ( - downloadErr string + downloadErr error finishEvent = eventFinishDownload ) @@ -533,36 +678,37 @@ func (manager *softwareManager) download(ctx context.Context) { if layerStatus, ok := manager.LayerStatuses[id]; ok { if layerStatus.Status == cloudprotocol.ErrorStatus { log.WithFields(log.Fields{ - "id": layerStatus.ID, + "id": layerStatus.LayerID, "digest": layerStatus.Digest, - "version": layerStatus.AosVersion, - }).Errorf("Error downloading layer: %v", layerStatus.ErrorInfo) + "version": layerStatus.Version, + }).Errorf("Error downloading layer: %s", layerStatus.ErrorInfo.Message) continue } log.WithFields(log.Fields{ - "id": layerStatus.ID, + "id": layerStatus.LayerID, "digest": layerStatus.Digest, - "version": layerStatus.AosVersion, + "version": layerStatus.Version, }).Debug("Layer successfully downloaded") - manager.updateLayerStatusByID(id, cloudprotocol.PendingStatus, "") + manager.updateLayerStatusByID(id, cloudprotocol.PendingStatus, nil) } else if serviceStatus, ok := manager.ServiceStatuses[id]; ok { if serviceStatus.Status == cloudprotocol.ErrorStatus { log.WithFields(log.Fields{ - "id": serviceStatus.ID, - "version": serviceStatus.AosVersion, - }).Errorf("Error downloading service: %v", serviceStatus.ErrorInfo) + "id": serviceStatus.ServiceID, + "version": serviceStatus.Version, + }).Errorf("Error downloading service: %s", serviceStatus.ErrorInfo.Message) + continue } log.WithFields(log.Fields{ - "id": serviceStatus.ID, - "version": serviceStatus.AosVersion, + "id": serviceStatus.ServiceID, + "version": serviceStatus.Version, }).Debug("Service successfully downloaded") - manager.updateServiceStatusByID(id, cloudprotocol.PendingStatus, "") + manager.updateServiceStatusByID(id, cloudprotocol.PendingStatus, nil) } } @@ -592,49 +738,45 @@ func (manager *softwareManager) prepareDownloadRequest() (request map[string]dow for _, service := range manager.CurrentUpdate.InstallServices { log.WithFields(log.Fields{ - "id": service.ID, - "version": service.AosVersion, + "id": service.ServiceID, + "version": service.Version, }).Debug("Download service") - request[service.ID] = downloader.PackageInfo{ - URLs: service.URLs, - Sha256: service.Sha256, - Sha512: service.Sha512, - Size: service.Size, - TargetType: cloudprotocol.DownloadTargetService, - TargetID: service.ID, - TargetAosVersion: service.AosVersion, - TargetVendorVersion: service.VendorVersion, + request[service.ServiceID] = downloader.PackageInfo{ + URLs: service.URLs, + Sha256: service.Sha256, + Size: service.Size, + TargetType: cloudprotocol.DownloadTargetService, + TargetID: service.ServiceID, + TargetVersion: service.Version, } - manager.ServiceStatuses[service.ID] = &cloudprotocol.ServiceStatus{ - ID: service.ID, - AosVersion: service.AosVersion, - Status: cloudprotocol.DownloadingStatus, + manager.ServiceStatuses[service.ServiceID] = &cloudprotocol.ServiceStatus{ + ServiceID: service.ServiceID, + Version: service.Version, + Status: cloudprotocol.DownloadingStatus, } } for _, layer := range manager.CurrentUpdate.InstallLayers { log.WithFields(log.Fields{ - "id": layer.ID, + "id": layer.LayerID, "digest": layer.Digest, - "version": layer.AosVersion, + "version": layer.Version, }).Debug("Download layer") request[layer.Digest] = downloader.PackageInfo{ - URLs: layer.URLs, - Sha256: layer.Sha256, - Sha512: layer.Sha512, - Size: layer.Size, - TargetType: cloudprotocol.DownloadTargetLayer, - TargetID: layer.Digest, - TargetAosVersion: layer.AosVersion, - TargetVendorVersion: layer.VendorVersion, + URLs: layer.URLs, + Sha256: layer.Sha256, + Size: layer.Size, + TargetType: cloudprotocol.DownloadTargetLayer, + TargetID: layer.Digest, + TargetVersion: layer.Version, } manager.LayerStatuses[layer.Digest] = &cloudprotocol.LayerStatus{ - ID: layer.ID, - AosVersion: layer.AosVersion, - Digest: layer.Digest, - Status: cloudprotocol.DownloadingStatus, + LayerID: layer.LayerID, + Version: layer.Version, + Digest: layer.Digest, + Status: cloudprotocol.DownloadingStatus, } } @@ -651,7 +793,7 @@ func (manager *softwareManager) update(ctx context.Context) { manager.Lock() defer manager.Unlock() - var updateErr string + var updateErr error if manager.LayerStatuses == nil { manager.LayerStatuses = make(map[string]*cloudprotocol.LayerStatus) @@ -670,40 +812,110 @@ func (manager *softwareManager) update(ctx context.Context) { }() }() - if errorStr := manager.removeServices(); errorStr != "" && updateErr == "" { - updateErr = errorStr + if err := manager.updateNodes(); err != nil { + updateErr = err + } + + if manager.CurrentUpdate.UnitConfig != nil { + if err := manager.updateUnitConfig(); err != nil { + updateErr = err + } } - if errorStr := manager.installLayers(); errorStr != "" && updateErr == "" { - updateErr = errorStr + if err := manager.removeServices(); err != nil && updateErr == nil { + updateErr = err } - if errorStr := manager.restoreServices(); errorStr != "" && updateErr == "" { - updateErr = errorStr + if err := manager.installLayers(); err != nil && updateErr == nil { + updateErr = err } - newServices, errorStr := manager.installServices() - if errorStr != "" && updateErr == "" { - updateErr = errorStr + if err := manager.restoreServices(); err != nil && updateErr == nil { + updateErr = err } - if errorStr := manager.removeLayers(); errorStr != "" && updateErr == "" { - updateErr = errorStr + newServices, err := manager.installServices() + if err != nil && updateErr == nil { + updateErr = err } - if errorStr := manager.restoreLayers(); errorStr != "" && updateErr == "" { - updateErr = errorStr + manager.newServices = newServices + manager.revertServices = nil + + if err := manager.removeLayers(); err != nil && updateErr == nil { + updateErr = err } - if errorStr := manager.runInstances(newServices); errorStr != "" && updateErr == "" { - updateErr = errorStr + if err := manager.restoreLayers(); err != nil && updateErr == nil { + updateErr = err } - if updateErr != "" { - return + if err := manager.runInstances(); err != nil && updateErr == nil { + updateErr = err } - manager.runCond.Wait() + manager.runStatusCV.Wait() + + if len(manager.revertServices) != 0 { + manager.doRevertServices() + manager.revertServices = nil + + if err := manager.runInstances(); err != nil && updateErr == nil { + updateErr = err + } + + manager.runStatusCV.Wait() + } +} + +func (manager *softwareManager) doRevertServices() { + for _, serviceID := range manager.revertServices { + log.WithField("id", serviceID).Debug("Revert service") + + manager.actionHandler.Execute(serviceID, func(serviceID string) error { + err := manager.softwareUpdater.RevertService(serviceID) + if err != nil { + log.WithField("id", serviceID).Errorf("Can't revert service: %v", err) + + return aoserrors.Wrap(err) + } + + log.WithField("id", serviceID).Debug("Service reverted") + + return nil + }) + } + + manager.actionHandler.Wait() +} + +func (manager *softwareManager) checkNewServices() { +serviceLoop: + for _, serviceID := range manager.newServices { + for _, instanceStatus := range manager.InstanceStatuses { + if instanceStatus.ServiceID == serviceID && instanceStatus.Status != cloudprotocol.InstanceStateFailed { + continue serviceLoop + } + } + + log.WithField("serviceID", serviceID).Error("Can't run any instances of service") + + updateErr := aoserrors.New("can't run any instances of service") + + if _, ok := manager.ServiceStatuses[serviceID]; !ok { + log.Errorf("Service status not found: %s", serviceID) + + manager.ServiceStatuses[serviceID] = &cloudprotocol.ServiceStatus{ + ServiceID: serviceID, + } + } + + manager.ServiceStatuses[serviceID].Status = cloudprotocol.ErrorStatus + manager.updateServiceStatusByID(serviceID, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: updateErr.Error()}) + + manager.revertServices = append(manager.revertServices, serviceID) + } } func (manager *softwareManager) updateTimeout() { @@ -711,12 +923,12 @@ func (manager *softwareManager) updateTimeout() { defer manager.Unlock() if manager.stateMachine.canTransit(eventCancel) { - if err := manager.stateMachine.sendEvent(eventCancel, aoserrors.New("update timeout").Error()); err != nil { + if err := manager.stateMachine.sendEvent(eventCancel, aoserrors.New("update timeout")); err != nil { log.Errorf("Can't cancel update: %s", err) } } - manager.runCond.Broadcast() + manager.runStatusCV.Signal() } /*********************************************************************************************************************** @@ -747,19 +959,21 @@ func (manager *softwareManager) newUpdate(update *softwareUpdate) (err error) { manager.CurrentUpdate = update if manager.TTLDate, err = manager.stateMachine.startNewUpdate( - time.Duration(manager.CurrentUpdate.Schedule.TTL) * time.Second); err != nil { + time.Duration(manager.CurrentUpdate.Schedule.TTL)*time.Second, manager.isDownloadRequired()); err != nil { return aoserrors.Wrap(err) } default: - if reflect.DeepEqual(update.InstallLayers, manager.CurrentUpdate.InstallLayers) && - reflect.DeepEqual(update.RemoveLayers, manager.CurrentUpdate.RemoveLayers) && - reflect.DeepEqual(update.InstallServices, manager.CurrentUpdate.InstallServices) && - reflect.DeepEqual(update.RemoveServices, manager.CurrentUpdate.RemoveServices) && - reflect.DeepEqual(update.RunInstances, manager.CurrentUpdate.RunInstances) && - reflect.DeepEqual(update.RestoreServices, manager.CurrentUpdate.RestoreServices) && - reflect.DeepEqual(update.RestoreLayers, manager.CurrentUpdate.RestoreLayers) { + if update.RebalanceRequest { + log.Debug("Skip rebalancing during update") + + return nil + } + + if manager.isUpdateEquals(update) { if reflect.DeepEqual(update.Schedule, manager.CurrentUpdate.Schedule) { + log.Debug("Skip update without changes") + return nil } @@ -783,7 +997,7 @@ func (manager *softwareManager) newUpdate(update *softwareUpdate) (err error) { return nil } - if err = manager.stateMachine.sendEvent(eventCancel, ""); err != nil { + if err = manager.stateMachine.sendEvent(eventCancel, nil); err != nil { return aoserrors.Wrap(err) } } @@ -795,17 +1009,17 @@ func (manager *softwareManager) sendCurrentStatus() { manager.statusChannel <- manager.getCurrentStatus() } -func (manager *softwareManager) updateStatusByID(id string, status string, errorStr string) { +func (manager *softwareManager) updateStatusByID(id string, status string, errorInfo *cloudprotocol.ErrorInfo) { if _, ok := manager.LayerStatuses[id]; ok { - manager.updateLayerStatusByID(id, status, errorStr) + manager.updateLayerStatusByID(id, status, errorInfo) } else if _, ok := manager.ServiceStatuses[id]; ok { - manager.updateServiceStatusByID(id, status, errorStr) + manager.updateServiceStatusByID(id, status, errorInfo) } else { log.Errorf("Software update ID not found: %s", id) } } -func (manager *softwareManager) updateLayerStatusByID(id, status, layerErr string) { +func (manager *softwareManager) updateLayerStatusByID(id, status string, layerErr *cloudprotocol.ErrorInfo) { manager.statusMutex.Lock() defer manager.statusMutex.Unlock() @@ -816,15 +1030,12 @@ func (manager *softwareManager) updateLayerStatusByID(id, status, layerErr strin } info.Status = status - - if layerErr != "" { - info.ErrorInfo = &cloudprotocol.ErrorInfo{Message: layerErr} - } + info.ErrorInfo = layerErr manager.statusHandler.updateLayerStatus(*info) } -func (manager *softwareManager) updateServiceStatusByID(id, status, serviceErr string) { +func (manager *softwareManager) updateServiceStatusByID(id, status string, serviceErr *cloudprotocol.ErrorInfo) { manager.statusMutex.Lock() defer manager.statusMutex.Unlock() @@ -835,10 +1046,7 @@ func (manager *softwareManager) updateServiceStatusByID(id, status, serviceErr s } info.Status = status - - if serviceErr != "" { - info.ErrorInfo = &cloudprotocol.ErrorInfo{Message: serviceErr} - } + info.ErrorInfo = serviceErr manager.statusHandler.updateServiceStatus(*info) } @@ -873,26 +1081,27 @@ func (manager *softwareManager) saveState() (err error) { return nil } -func (manager *softwareManager) installLayers() (installErr string) { +func (manager *softwareManager) installLayers() (installErr error) { var mutex sync.Mutex - handleError := func(layer cloudprotocol.LayerInfo, layerErr string) { + handleError := func(layer cloudprotocol.LayerInfo, layerErr error) { log.WithFields(log.Fields{ - "digest": layer.Digest, - "id": layer.ID, - "aosVersion": layer.AosVersion, + "digest": layer.Digest, + "id": layer.LayerID, + "version": layer.Version, }).Errorf("Can't install layer: %s", layerErr) - if isCancelError(layerErr) { + if errors.Is(layerErr, context.Canceled) { return } - manager.updateLayerStatusByID(layer.Digest, cloudprotocol.ErrorStatus, layerErr) + manager.updateLayerStatusByID(layer.Digest, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: layerErr.Error()}) mutex.Lock() defer mutex.Unlock() - if installErr == "" { + if installErr == nil { installErr = layerErr } } @@ -902,7 +1111,7 @@ func (manager *softwareManager) installLayers() (installErr string) { for _, layer := range manager.CurrentUpdate.InstallLayers { downloadInfo, ok := manager.DownloadResult[layer.Digest] if !ok { - handleError(layer, aoserrors.New("can't get download result").Error()) + handleError(layer, aoserrors.New("can't get download result")) continue } @@ -916,19 +1125,19 @@ func (manager *softwareManager) installLayers() (installErr string) { Path: downloadInfo.FileName, } - layer.DecryptDataStruct.URLs = []string{url.String()} + layer.DownloadInfo.URLs = []string{url.String()} installLayers = append(installLayers, layer) } for _, layer := range installLayers { log.WithFields(log.Fields{ - "id": layer.ID, - "aosVersion": layer.AosVersion, + "id": layer.LayerID, + "aosVersion": layer.Version, "digest": layer.Digest, }).Debug("Install layer") - manager.updateLayerStatusByID(layer.Digest, cloudprotocol.InstallingStatus, "") + manager.updateLayerStatusByID(layer.Digest, cloudprotocol.InstallingStatus, nil) // Create new variable to be captured by action function layerInfo := layer @@ -936,17 +1145,17 @@ func (manager *softwareManager) installLayers() (installErr string) { manager.actionHandler.Execute(layerInfo.Digest, func(digest string) error { if err := manager.softwareUpdater.InstallLayer(layerInfo, manager.CurrentUpdate.CertChains, manager.CurrentUpdate.Certs); err != nil { - handleError(layerInfo, aoserrors.Wrap(err).Error()) + handleError(layerInfo, aoserrors.Wrap(err)) return aoserrors.Wrap(err) } log.WithFields(log.Fields{ - "id": layerInfo.ID, - "aosVersion": layerInfo.AosVersion, + "id": layerInfo.LayerID, + "aosVersion": layerInfo.Version, "digest": layerInfo.Digest, }).Info("Layer successfully installed") - manager.updateLayerStatusByID(layerInfo.Digest, cloudprotocol.InstalledStatus, "") + manager.updateLayerStatusByID(layerInfo.Digest, cloudprotocol.InstalledStatus, nil) return nil }) @@ -957,54 +1166,55 @@ func (manager *softwareManager) installLayers() (installErr string) { return installErr } -func (manager *softwareManager) removeLayers() (removeErr string) { - return manager.processRemoveRestorLayers( - manager.CurrentUpdate.RemoveLayers, "remove", cloudprotocol.RemovedStatus, manager.softwareUpdater.RemoveLayer) +func (manager *softwareManager) removeLayers() (removeErr error) { + return manager.processRemoveRestoreLayers( + manager.CurrentUpdate.RemoveLayers, "Remove", cloudprotocol.RemovedStatus, manager.softwareUpdater.RemoveLayer) } -func (manager *softwareManager) restoreLayers() (restoreErr string) { - return manager.processRemoveRestorLayers( - manager.CurrentUpdate.RestoreLayers, "restore", cloudprotocol.InstalledStatus, manager.softwareUpdater.RestoreLayer) +func (manager *softwareManager) restoreLayers() (restoreErr error) { + return manager.processRemoveRestoreLayers( + manager.CurrentUpdate.RestoreLayers, "Restore", cloudprotocol.InstalledStatus, manager.softwareUpdater.RestoreLayer) } -func (manager *softwareManager) processRemoveRestorLayers( +func (manager *softwareManager) processRemoveRestoreLayers( layers []cloudprotocol.LayerStatus, operationStr, successStatus string, operation func(digest string) error, -) (processError string) { +) (processError error) { var mutex sync.Mutex - handleError := func(layer cloudprotocol.LayerStatus, layerErr string) { + handleError := func(layer cloudprotocol.LayerStatus, layerErr error) { log.WithFields(log.Fields{ "digest": layer.Digest, - "id": layer.ID, - "aosVersion": layer.AosVersion, + "id": layer.LayerID, + "aosVersion": layer.Version, }).Errorf("Can't %s layer: %s", operationStr, layerErr) - if isCancelError(layerErr) { + if errors.Is(layerErr, context.Canceled) { return } - manager.updateLayerStatusByID(layer.Digest, cloudprotocol.ErrorStatus, layerErr) + manager.updateLayerStatusByID(layer.Digest, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: layerErr.Error()}) mutex.Lock() defer mutex.Unlock() - if processError == "" { + if processError == nil { processError = layerErr } } for _, layer := range layers { log.WithFields(log.Fields{ - "id": layer.ID, - "aosVersion": layer.AosVersion, + "id": layer.LayerID, + "aosVersion": layer.Version, "digest": layer.Digest, }).Debugf("%s layer", operationStr) manager.statusMutex.Lock() manager.LayerStatuses[layer.Digest] = &cloudprotocol.LayerStatus{ - ID: layer.ID, - AosVersion: layer.AosVersion, - Digest: layer.Digest, + LayerID: layer.LayerID, + Version: layer.Version, + Digest: layer.Digest, } manager.statusMutex.Unlock() @@ -1013,17 +1223,17 @@ func (manager *softwareManager) processRemoveRestorLayers( manager.actionHandler.Execute(layerInfo.Digest, func(digest string) error { if err := operation(layerInfo.Digest); err != nil { - handleError(layerInfo, aoserrors.Wrap(err).Error()) + handleError(layerInfo, aoserrors.Wrap(err)) return aoserrors.Wrap(err) } log.WithFields(log.Fields{ - "id": layerInfo.ID, - "aosVersion": layerInfo.AosVersion, + "id": layerInfo.LayerID, + "aosVersion": layerInfo.Version, "digest": layerInfo.Digest, }).Infof("Layer successfully %sd", operationStr) - manager.updateLayerStatusByID(layerInfo.Digest, successStatus, "") + manager.updateLayerStatusByID(layerInfo.Digest, successStatus, nil) return nil }) @@ -1031,28 +1241,29 @@ func (manager *softwareManager) processRemoveRestorLayers( manager.actionHandler.Wait() - return "" + return nil } -func (manager *softwareManager) installServices() (newServices []string, installErr string) { +func (manager *softwareManager) installServices() (newServices []string, installErr error) { var mutex sync.Mutex - handleError := func(service cloudprotocol.ServiceInfo, serviceErr string) { + handleError := func(service cloudprotocol.ServiceInfo, serviceErr error) { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, + "id": service.ServiceID, + "version": service.Version, }).Errorf("Can't install service: %s", serviceErr) - if isCancelError(serviceErr) { + if errors.Is(serviceErr, context.Canceled) { return } - manager.updateStatusByID(service.ID, cloudprotocol.ErrorStatus, serviceErr) + manager.updateStatusByID(service.ServiceID, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: serviceErr.Error()}) mutex.Lock() defer mutex.Unlock() - if installErr == "" { + if installErr == nil { installErr = serviceErr } } @@ -1060,9 +1271,9 @@ func (manager *softwareManager) installServices() (newServices []string, install installServices := []cloudprotocol.ServiceInfo{} for _, service := range manager.CurrentUpdate.InstallServices { - downloadInfo, ok := manager.DownloadResult[service.ID] + downloadInfo, ok := manager.DownloadResult[service.ServiceID] if !ok { - handleError(service, aoserrors.New("can't get download result").Error()) + handleError(service, aoserrors.New("can't get download result")) continue } @@ -1076,38 +1287,38 @@ func (manager *softwareManager) installServices() (newServices []string, install Path: downloadInfo.FileName, } - service.DecryptDataStruct.URLs = []string{url.String()} + service.DownloadInfo.URLs = []string{url.String()} installServices = append(installServices, service) } for _, service := range installServices { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, + "id": service.ServiceID, + "version": service.Version, }).Debug("Install service") - manager.updateServiceStatusByID(service.ID, cloudprotocol.InstallingStatus, "") + manager.updateServiceStatusByID(service.ServiceID, cloudprotocol.InstallingStatus, nil) // Create new variable to be captured by action function serviceInfo := service - manager.actionHandler.Execute(serviceInfo.ID, func(serviceID string) error { + manager.actionHandler.Execute(serviceInfo.ServiceID, func(serviceID string) error { err := manager.softwareUpdater.InstallService(serviceInfo, manager.CurrentUpdate.CertChains, manager.CurrentUpdate.Certs) if err != nil { - handleError(serviceInfo, aoserrors.Wrap(err).Error()) + handleError(serviceInfo, aoserrors.Wrap(err)) return aoserrors.Wrap(err) } log.WithFields(log.Fields{ - "id": serviceInfo.ID, - "aosVersion": serviceInfo.AosVersion, + "id": serviceInfo.ServiceID, + "aosVersion": serviceInfo.Version, }).Info("Service successfully installed") - newServices = append(newServices, serviceInfo.ID) + newServices = append(newServices, serviceInfo.ServiceID) - manager.updateServiceStatusByID(serviceInfo.ID, cloudprotocol.InstalledStatus, "") + manager.updateServiceStatusByID(serviceInfo.ServiceID, cloudprotocol.InstalledStatus, nil) return nil }) @@ -1118,57 +1329,57 @@ func (manager *softwareManager) installServices() (newServices []string, install return newServices, installErr } -func (manager *softwareManager) restoreServices() (restoreErr string) { +func (manager *softwareManager) restoreServices() (restoreErr error) { var mutex sync.Mutex - handleError := func(service cloudprotocol.ServiceInfo, serviceErr string) { + handleError := func(service cloudprotocol.ServiceInfo, serviceErr error) { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, - }).Errorf("Can't restore service: %s", serviceErr) + "id": service.ServiceID, + "aosVersion": service.Version, + }).Errorf("Can't restore service: %v", serviceErr) - if isCancelError(serviceErr) { + if errors.Is(serviceErr, context.Canceled) { return } - manager.updateStatusByID(service.ID, cloudprotocol.ErrorStatus, serviceErr) + manager.updateStatusByID(service.ServiceID, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: serviceErr.Error()}) mutex.Lock() defer mutex.Unlock() - if restoreErr == "" { + if restoreErr == nil { restoreErr = serviceErr } } for _, service := range manager.CurrentUpdate.RestoreServices { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, + "id": service.ServiceID, + "aosVersion": service.Version, }).Debug("Restore service") - manager.ServiceStatuses[service.ID] = &cloudprotocol.ServiceStatus{ - ID: service.ID, - AosVersion: service.AosVersion, - Status: cloudprotocol.InstallingStatus, + manager.ServiceStatuses[service.ServiceID] = &cloudprotocol.ServiceStatus{ + ServiceID: service.ServiceID, + Version: service.Version, + Status: cloudprotocol.InstallingStatus, } // Create new variable to be captured by action function serviceInfo := service - manager.actionHandler.Execute(serviceInfo.ID, func(serviceID string) error { - if err := manager.softwareUpdater.RestoreService(serviceInfo.ID); err != nil { - handleError(serviceInfo, aoserrors.Wrap(err).Error()) - + manager.actionHandler.Execute(serviceInfo.ServiceID, func(serviceID string) error { + if err := manager.softwareUpdater.RestoreService(serviceInfo.ServiceID); err != nil { + handleError(serviceInfo, aoserrors.Wrap(err)) return aoserrors.Wrap(err) } log.WithFields(log.Fields{ - "id": serviceInfo.ID, - "aosVersion": serviceInfo.AosVersion, + "id": serviceInfo.ServiceID, + "version": serviceInfo.Version, }).Info("Service successfully restored") - manager.updateServiceStatusByID(serviceInfo.ID, cloudprotocol.InstalledStatus, "") + manager.updateServiceStatusByID(serviceInfo.ServiceID, cloudprotocol.InstalledStatus, nil) return nil }) @@ -1179,61 +1390,64 @@ func (manager *softwareManager) restoreServices() (restoreErr string) { return restoreErr } -func (manager *softwareManager) removeServices() (removeErr string) { +func (manager *softwareManager) removeServices() (removeErr error) { var mutex sync.Mutex - handleError := func(service cloudprotocol.ServiceStatus, serviceErr string) { + handleError := func(service cloudprotocol.ServiceStatus, serviceErr error) { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, - }).Errorf("Can't install service: %s", serviceErr) + "id": service.ServiceID, + "version": service.Version, + }).Errorf("Can't remove service: %v", serviceErr) - if isCancelError(serviceErr) { + if errors.Is(serviceErr, context.Canceled) { return } - manager.updateStatusByID(service.ID, cloudprotocol.ErrorStatus, serviceErr) + manager.updateStatusByID(service.ServiceID, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: serviceErr.Error()}) mutex.Lock() defer mutex.Unlock() - if removeErr == "" { + if removeErr == nil { removeErr = serviceErr } } for _, service := range manager.CurrentUpdate.RemoveServices { log.WithFields(log.Fields{ - "id": service.ID, - "aosVersion": service.AosVersion, + "id": service.ServiceID, + "aosVersion": service.Version, }).Debug("Remove service") // Create status for remove layers. For install layer it is created in download function. manager.statusMutex.Lock() - manager.ServiceStatuses[service.ID] = &cloudprotocol.ServiceStatus{ - ID: service.ID, - AosVersion: service.AosVersion, - Status: cloudprotocol.RemovingStatus, + manager.ServiceStatuses[service.ServiceID] = &cloudprotocol.ServiceStatus{ + ServiceID: service.ServiceID, + Version: service.Version, + Status: cloudprotocol.RemovingStatus, } manager.statusMutex.Unlock() - manager.updateServiceStatusByID(service.ID, cloudprotocol.RemovingStatus, "") + manager.updateServiceStatusByID(service.ServiceID, cloudprotocol.RemovingStatus, nil) // Create new variable to be captured by action function serviceStatus := service - manager.actionHandler.Execute(serviceStatus.ID, func(serviceID string) error { - if err := manager.softwareUpdater.RemoveService(serviceStatus.ID); err != nil { - handleError(serviceStatus, err.Error()) - return aoserrors.Wrap(err) + manager.actionHandler.Execute(serviceStatus.ServiceID, func(serviceID string) error { + if err := manager.softwareUpdater.RemoveService(serviceStatus.ServiceID); err != nil { + err = aoserrors.Wrap(err) + handleError(serviceStatus, err) + + return err } log.WithFields(log.Fields{ - "id": serviceStatus.ID, - "aosVersion": serviceStatus.AosVersion, + "id": serviceStatus.ServiceID, + "aosVersion": serviceStatus.Version, }).Info("Service successfully removed") - manager.updateServiceStatusByID(serviceStatus.ID, cloudprotocol.RemovedStatus, "") + manager.updateServiceStatusByID(serviceStatus.ServiceID, cloudprotocol.RemovedStatus, nil) return nil }) @@ -1244,18 +1458,14 @@ func (manager *softwareManager) removeServices() (removeErr string) { return removeErr } -func (manager *softwareManager) runInstances(newServices []string) (runErr string) { +func (manager *softwareManager) runInstances() (runErr error) { manager.InstanceStatuses = []cloudprotocol.InstanceStatus{} for _, instance := range manager.CurrentUpdate.RunInstances { - var aosVersion uint64 - - for _, serviceInfo := range manager.CurrentUpdate.InstallServices { - if serviceInfo.ID == instance.ServiceID { - aosVersion = serviceInfo.AosVersion + var version string - break - } + if serviceInfo, ok := manager.ServiceStatuses[instance.ServiceID]; ok { + version = serviceInfo.Version } ident := aostypes.InstanceIdent{ @@ -1265,19 +1475,116 @@ func (manager *softwareManager) runInstances(newServices []string) (runErr strin for i := uint64(0); i < instance.NumInstances; i++ { ident.Instance = i - manager.InstanceStatuses = append(manager.InstanceStatuses, cloudprotocol.InstanceStatus{ - InstanceIdent: ident, - AosVersion: aosVersion, - RunState: cloudprotocol.InstanceStateActivating, - }) + instanceStatus := cloudprotocol.InstanceStatus{ + InstanceIdent: ident, + ServiceVersion: version, + Status: cloudprotocol.InstanceStateActivating, + } + + manager.InstanceStatuses = append(manager.InstanceStatuses, instanceStatus) + manager.statusHandler.updateInstanceStatus(instanceStatus) } } - manager.statusHandler.setInstanceStatus(manager.InstanceStatuses) + if err := manager.instanceRunner.RunInstances( + manager.CurrentUpdate.RunInstances, manager.CurrentUpdate.RebalanceRequest); err != nil { + return aoserrors.Wrap(err) + } - if err := manager.instanceRunner.RunInstances(manager.CurrentUpdate.RunInstances, newServices); err != nil { - return err.Error() + return nil +} + +func (manager *softwareManager) updateNodes() (nodesErr error) { + for _, nodeStatus := range manager.CurrentUpdate.NodesStatus { + if nodeStatus.Status == cloudprotocol.NodeStatusPaused { + log.WithField("nodeID", nodeStatus.NodeID).Debug("Pause node") + + if err := manager.nodeManager.PauseNode(nodeStatus.NodeID); err != nil && nodesErr == nil { + log.WithField("nodeID", nodeStatus.NodeID).Errorf("Can't pause node: %v", err) + + nodesErr = aoserrors.Wrap(err) + } + } + + if nodeStatus.Status == cloudprotocol.NodeStatusProvisioned { + log.WithField("nodeID", nodeStatus.NodeID).Debug("Resume node") + + if err := manager.nodeManager.ResumeNode(nodeStatus.NodeID); err != nil && nodesErr == nil { + log.WithField("nodeID", nodeStatus.NodeID).Errorf("Can't resume node: %v", err) + + nodesErr = aoserrors.Wrap(err) + } + } + } + + return nodesErr +} + +func (manager *softwareManager) updateUnitConfig() (unitConfigErr error) { + log.Debug("Update unit config") + + defer func() { + if unitConfigErr != nil { + manager.updateUnitConfigStatus(cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: unitConfigErr.Error()}) + } + }() + + if err := manager.unitConfigUpdater.CheckUnitConfig(*manager.CurrentUpdate.UnitConfig); err != nil { + if errors.Is(err, unitconfig.ErrAlreadyInstalled) { + log.Error("Unit config already installed") + + manager.updateUnitConfigStatus(cloudprotocol.InstalledStatus, nil) + + return nil + } + + return aoserrors.Wrap(err) } - return "" + manager.updateUnitConfigStatus(cloudprotocol.InstallingStatus, nil) + + if err := manager.unitConfigUpdater.UpdateUnitConfig(*manager.CurrentUpdate.UnitConfig); err != nil { + return aoserrors.Wrap(err) + } + + manager.updateUnitConfigStatus(cloudprotocol.InstalledStatus, nil) + + return nil +} + +func (manager *softwareManager) updateUnitConfigStatus(status string, errorInfo *cloudprotocol.ErrorInfo) { + manager.statusMutex.Lock() + defer manager.statusMutex.Unlock() + + manager.UnitConfigStatus.Status = status + manager.UnitConfigStatus.ErrorInfo = errorInfo + + manager.statusHandler.updateUnitConfigStatus(manager.UnitConfigStatus) +} + +func (manager *softwareManager) isDownloadRequired() bool { + if manager.CurrentUpdate != nil && + (len(manager.CurrentUpdate.InstallLayers) > 0 || + len(manager.CurrentUpdate.InstallServices) > 0) { + return true + } + + return false +} + +func (manager *softwareManager) isUpdateEquals(update *softwareUpdate) bool { + if reflect.DeepEqual(update.NodesStatus, manager.CurrentUpdate.NodesStatus) && + reflect.DeepEqual(update.UnitConfig, manager.CurrentUpdate.UnitConfig) && + reflect.DeepEqual(update.InstallLayers, manager.CurrentUpdate.InstallLayers) && + reflect.DeepEqual(update.RemoveLayers, manager.CurrentUpdate.RemoveLayers) && + reflect.DeepEqual(update.InstallServices, manager.CurrentUpdate.InstallServices) && + reflect.DeepEqual(update.RemoveServices, manager.CurrentUpdate.RemoveServices) && + reflect.DeepEqual(update.RunInstances, manager.CurrentUpdate.RunInstances) && + reflect.DeepEqual(update.RestoreServices, manager.CurrentUpdate.RestoreServices) && + reflect.DeepEqual(update.RestoreLayers, manager.CurrentUpdate.RestoreLayers) { + return true + } + + return false } diff --git a/unitstatushandler/timetable.go b/unitstatushandler/timetable.go index e7d12738..9eefe273 100644 --- a/unitstatushandler/timetable.go +++ b/unitstatushandler/timetable.go @@ -29,7 +29,10 @@ import ( * Consts **********************************************************************************************************************/ -const maxAvailableTime = 1<<63 - 1 +const ( + maxAvailableTime = 1<<63 - 1 + daysInWeek = 7 +) /*********************************************************************************************************************** * Types @@ -54,12 +57,12 @@ func validateTimetable(timetable []cloudprotocol.TimetableEntry) (err error) { return aoserrors.New("start value should contain only time") } - if year, month, day := slot.Finish.Date(); year != 0 || month != 1 || day != 1 { - return aoserrors.New("finish value should contain only time") + if year, month, day := slot.End.Date(); year != 0 || month != 1 || day != 1 { + return aoserrors.New("end value should contain only time") } - if slot.Start.After(slot.Finish.Time) { - return aoserrors.New("start value should be before finish value") + if slot.Start.After(slot.End.Time) { + return aoserrors.New("start value should be before end value") } } } @@ -85,7 +88,7 @@ func getAvailableTimetableTime( for _, entry := range timetable { // Convert to time.Weekday - entryWeekday := time.Weekday((entry.DayOfWeek) % 7) //nolint:gomnd + entryWeekday := time.Weekday((entry.DayOfWeek) % daysInWeek) fromWeekday := fromDate.Weekday() // Get num of days from weekday to entry weekday @@ -103,7 +106,7 @@ func getAvailableTimetableTime( //nolint:gosmopolitan finishDate := time.Date(startEntry.Year(), startEntry.Month(), startEntry.Day(), - slot.Finish.Hour(), slot.Finish.Minute(), slot.Finish.Second(), slot.Finish.Nanosecond(), time.Local) + slot.End.Hour(), slot.End.Minute(), slot.End.Second(), slot.End.Nanosecond(), time.Local) duration := startDate.Sub(fromDate) diff --git a/unitstatushandler/unitstatushandler.go b/unitstatushandler/unitstatushandler.go index 011f7179..f753d8aa 100644 --- a/unitstatushandler/unitstatushandler.go +++ b/unitstatushandler/unitstatushandler.go @@ -21,13 +21,14 @@ import ( "context" "encoding/json" "errors" - "strconv" "sync" - "sync/atomic" "time" + "golang.org/x/exp/slices" + "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/api/cloudprotocol" + "github.com/aosedge/aos_common/resourcemonitor" log "github.com/sirupsen/logrus" "github.com/aosedge/aos_communicationmanager/amqphandler" @@ -40,6 +41,15 @@ import ( * Types **********************************************************************************************************************/ +// NodeManager manages nodes. +type NodeManager interface { + GetAllNodeIDs() ([]string, error) + GetNodeInfo(nodeID string) (cloudprotocol.NodeInfo, error) + SubscribeNodeInfoChange() <-chan cloudprotocol.NodeInfo + PauseNode(nodeID string) error + ResumeNode(nodeID string) error +} + // Downloader downloads packages. type Downloader interface { Download(ctx context.Context, packageInfo downloader.PackageInfo) (result downloader.Result, err error) @@ -55,10 +65,9 @@ type StatusSender interface { // UnitConfigUpdater updates unit configuration. type UnitConfigUpdater interface { - GetStatus() (unitConfigInfo cloudprotocol.UnitConfigStatus, err error) - GetUnitConfigVersion(configJSON json.RawMessage) (vendorVersion string, err error) - CheckUnitConfig(configJSON json.RawMessage) (vendorVersion string, err error) - UpdateUnitConfig(configJSON json.RawMessage) (err error) + GetStatus() (cloudprotocol.UnitConfigStatus, error) + CheckUnitConfig(unitConfig cloudprotocol.UnitConfig) error + UpdateUnitConfig(unitConfig cloudprotocol.UnitConfig) error } // FirmwareUpdater updates system components. @@ -66,13 +75,17 @@ type FirmwareUpdater interface { GetStatus() (componentsInfo []cloudprotocol.ComponentStatus, err error) UpdateComponents(components []cloudprotocol.ComponentInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate) (status []cloudprotocol.ComponentStatus, err error) + NewComponentsChannel() <-chan []cloudprotocol.ComponentStatus } // InstanceRunner instances runner. type InstanceRunner interface { - RunInstances(instances []cloudprotocol.InstanceInfo, newServices []string) error - RestartInstances() error - GetNodesConfiguration() []cloudprotocol.NodeInfo + RunInstances(instances []cloudprotocol.InstanceInfo, rebalancing bool) error +} + +// SystemQuotaAlertProvider provides system quota alerts. +type SystemQuotaAlertProvider interface { + GetSystemQuoteAlertChannel() <-chan cloudprotocol.SystemQuotaAlert } // SoftwareUpdater updates services, layers. @@ -82,6 +95,7 @@ type SoftwareUpdater interface { InstallService(serviceInfo cloudprotocol.ServiceInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate) error RestoreService(serviceID string) error + RevertService(serviceID string) error RemoveService(serviceID string) error InstallLayer(layerInfo cloudprotocol.LayerInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate) error @@ -109,44 +123,30 @@ type LayerStatus struct { Cached bool } -// RunInstancesStatus run instances status. -type RunInstancesStatus struct { - UnitSubjects []string - Instances []cloudprotocol.InstanceStatus - ErrorServices []cloudprotocol.ServiceStatus -} - // Instance instance of unit status handler. type Instance struct { sync.Mutex + nodeManager NodeManager statusSender StatusSender statusMutex sync.Mutex - statusTimer *time.Timer - unitSubjects []string - unitConfigStatus itemStatus - componentStatuses map[string]*itemStatus - layerStatuses map[string]*itemStatus - serviceStatuses map[string]*itemStatus - instanceStatuses []cloudprotocol.InstanceStatus - + unitStatus cloudprotocol.UnitStatus + statusTimer *time.Timer sendStatusPeriod time.Duration firmwareManager *firmwareManager softwareManager *softwareManager - initDone bool - isConnected int32 -} + newComponentsChannel <-chan []cloudprotocol.ComponentStatus + nodeChangedChannel <-chan cloudprotocol.NodeInfo + systemQuotaAlertChannel <-chan cloudprotocol.SystemQuotaAlert -type statusDescriptor struct { - amqpStatus interface{} + initDone bool + isConnected bool } -type itemStatus []statusDescriptor - /*********************************************************************************************************************** * Public **********************************************************************************************************************/ @@ -154,6 +154,7 @@ type itemStatus []statusDescriptor // New creates new unit status handler instance. func New( cfg *config.Config, + nodeManager NodeManager, unitConfigUpdater UnitConfigUpdater, firmwareUpdater FirmwareUpdater, softwareUpdater SoftwareUpdater, @@ -161,28 +162,30 @@ func New( downloader Downloader, storage Storage, statusSender StatusSender, + systemQuotaAlertProvider SystemQuotaAlertProvider, ) (instance *Instance, err error) { log.Debug("Create unit status handler") instance = &Instance{ - statusSender: statusSender, - sendStatusPeriod: cfg.UnitStatusSendTimeout.Duration, + nodeManager: nodeManager, + statusSender: statusSender, + sendStatusPeriod: cfg.UnitStatusSendTimeout.Duration, + newComponentsChannel: firmwareUpdater.NewComponentsChannel(), + nodeChangedChannel: nodeManager.SubscribeNodeInfoChange(), + systemQuotaAlertChannel: systemQuotaAlertProvider.GetSystemQuoteAlertChannel(), } - // Initialize maps of statuses for avoiding situation of adding values to uninitialized map on go routine - instance.componentStatuses = make(map[string]*itemStatus) - instance.layerStatuses = make(map[string]*itemStatus) - instance.serviceStatuses = make(map[string]*itemStatus) + instance.resetUnitStatus() groupDownloader := newGroupDownloader(downloader) - if instance.firmwareManager, err = newFirmwareManager(instance, groupDownloader, firmwareUpdater, unitConfigUpdater, - storage, instanceRunner, cfg.UMController.UpdateTTL.Duration); err != nil { + if instance.firmwareManager, err = newFirmwareManager(instance, groupDownloader, firmwareUpdater, + storage, cfg.UMController.UpdateTTL.Duration); err != nil { return nil, aoserrors.Wrap(err) } - if instance.softwareManager, err = newSoftwareManager(instance, groupDownloader, softwareUpdater, instanceRunner, - storage, cfg.SMController.UpdateTTL.Duration); err != nil { + if instance.softwareManager, err = newSoftwareManager(instance, groupDownloader, nodeManager, unitConfigUpdater, + softwareUpdater, instanceRunner, storage, cfg.SMController.UpdateTTL.Duration); err != nil { return nil, aoserrors.Wrap(err) } @@ -190,6 +193,8 @@ func New( return nil, aoserrors.Wrap(err) } + go instance.handleChannels() + return instance, nil } @@ -228,35 +233,45 @@ func (instance *Instance) SendUnitStatus() error { instance.Lock() defer instance.Unlock() - instance.sendCurrentStatus() + if err := instance.initCurrentStatus(); err != nil { + return aoserrors.Wrap(err) + } + + instance.sendCurrentStatus(false) return nil } // ProcessRunStatus process current run instances status. -func (instance *Instance) ProcessRunStatus(status RunInstancesStatus) error { +func (instance *Instance) ProcessRunStatus(instances []cloudprotocol.InstanceStatus) error { instance.Lock() defer instance.Unlock() + log.Debug("Process run status") + + if !instance.softwareManager.processRunStatus(instances) { + return nil + } + if err := instance.initCurrentStatus(); err != nil { return aoserrors.Wrap(err) } - instance.unitSubjects = status.UnitSubjects - instance.instanceStatuses = status.Instances + instance.initDone = true - instance.softwareManager.processRunStatus(status) - instance.sendCurrentStatus() + instance.sendCurrentStatus(false) return nil } // ProcessUpdateInstanceStatus process update instances status. -func (instance *Instance) ProcessUpdateInstanceStatus(status []cloudprotocol.InstanceStatus) { +func (instance *Instance) ProcessUpdateInstanceStatus(statuses []cloudprotocol.InstanceStatus) { instance.Lock() defer instance.Unlock() - instance.updateInstanceStatus(status) + for _, status := range statuses { + instance.updateInstanceStatus(status) + } } // ProcessDesiredStatus processes desired status. @@ -323,284 +338,301 @@ func (instance *Instance) StartSOTAUpdate() (err error) { // CloudConnected indicates unit connected to cloud. func (instance *Instance) CloudConnected() { - atomic.StoreInt32(&instance.isConnected, 1) + instance.statusMutex.Lock() + defer instance.statusMutex.Unlock() + + instance.isConnected = true } // CloudDisconnected indicates unit disconnected from cloud. func (instance *Instance) CloudDisconnected() { - atomic.StoreInt32(&instance.isConnected, 0) + instance.statusMutex.Lock() + defer instance.statusMutex.Unlock() + + instance.isConnected = false } /*********************************************************************************************************************** * Private **********************************************************************************************************************/ -func (instance *Instance) initCurrentStatus() error { - instance.unitConfigStatus = nil - instance.componentStatuses = make(map[string]*itemStatus) - instance.serviceStatuses = make(map[string]*itemStatus) - instance.layerStatuses = make(map[string]*itemStatus) - - // Get initial unit config info +func (instance *Instance) resetUnitStatus() { + instance.unitStatus = cloudprotocol.UnitStatus{ + MessageType: cloudprotocol.UnitStatusMessageType, + UnitConfig: make([]cloudprotocol.UnitConfigStatus, 0), + Nodes: make([]cloudprotocol.NodeInfo, 0), + Services: make([]cloudprotocol.ServiceStatus, 0), + Instances: make([]cloudprotocol.InstanceStatus, 0), + Layers: make([]cloudprotocol.LayerStatus, 0), + Components: make([]cloudprotocol.ComponentStatus, 0), + UnitSubjects: make([]string, 0), + } +} - unitConfigStatuses, err := instance.firmwareManager.getUnitConfigStatuses() +func (instance *Instance) initUnitConfigStatus() error { + unitConfigStatuses, err := instance.softwareManager.getUnitConfigStatuses() if err != nil { return aoserrors.Wrap(err) } for _, status := range unitConfigStatuses { - log.WithFields(log.Fields{ - "status": status.Status, - "vendorVersion": status.VendorVersion, - "error": status.ErrorInfo, - }).Debug("Initial unit config status") - - instance.processUnitConfigStatus(status) + instance.updateUnitConfigStatus(status) } - // Get initial components info + return nil +} +func (instance *Instance) initComponentsStatus() error { componentStatuses, err := instance.firmwareManager.getComponentStatuses() if err != nil { return aoserrors.Wrap(err) } for _, status := range componentStatuses { - log.WithFields(log.Fields{ - "id": status.ID, - "status": status.Status, - "vendorVersion": status.VendorVersion, - "error": status.ErrorInfo, - }).Debug("Initial component status") - - instance.processComponentStatus(status) + instance.setComponentStatus(status) } - // Get initial services and layers info + return nil +} +func (instance *Instance) initServicesStatus() error { serviceStatuses, err := instance.softwareManager.getServiceStatus() if err != nil { return aoserrors.Wrap(err) } for _, status := range serviceStatuses { - if _, ok := instance.serviceStatuses[status.ID]; !ok { - instance.serviceStatuses[status.ID] = &itemStatus{} - } - - log.WithFields(log.Fields{ - "id": status.ID, - "status": status.Status, - "aosVersion": status.AosVersion, - "error": status.ErrorInfo, - }).Debug("Initial service status") - - instance.processServiceStatus(status) + instance.setServiceStatus(status) } + return nil +} + +func (instance *Instance) initLayersStatus() error { layerStatuses, err := instance.softwareManager.getLayersStatus() if err != nil { return aoserrors.Wrap(err) } for _, status := range layerStatuses { - if _, ok := instance.layerStatuses[status.Digest]; !ok { - instance.layerStatuses[status.Digest] = &itemStatus{} - } + instance.setLayerStatus(status) + } - log.WithFields(log.Fields{ - "id": status.ID, - "digest": status.Digest, - "status": status.Status, - "aosVersion": status.AosVersion, - "error": status.ErrorInfo, - }).Debug("Initial layer status") + return nil +} - instance.processLayerStatus(status) +func (instance *Instance) initInstancesStatus() error { + instances, err := instance.softwareManager.getInstancesStatus() + if err != nil { + return aoserrors.Wrap(err) } - instance.initDone = true + for _, status := range instances { + instance.setInstanceStatus(status) + } return nil } -func (descriptor *statusDescriptor) getStatus() (status string) { - switch amqpStatus := descriptor.amqpStatus.(type) { - case *cloudprotocol.UnitConfigStatus: - return amqpStatus.Status - - case *cloudprotocol.ComponentStatus: - return amqpStatus.Status +func (instance *Instance) initNodesStatus() error { + nodesInfo, err := instance.getAllNodesInfo() + if err != nil { + log.Errorf("Can't get nodes info: %v", err) + } - case *cloudprotocol.LayerStatus: - return amqpStatus.Status + for _, info := range nodesInfo { + instance.setNodeInfo(info) + } - case *cloudprotocol.ServiceStatus: - return amqpStatus.Status + return nil +} - default: - return cloudprotocol.UnknownStatus +func (instance *Instance) initCurrentStatus() error { + if err := instance.initUnitConfigStatus(); err != nil { + return err } -} -func (descriptor *statusDescriptor) getVersion() (version string) { - switch amqpStatus := descriptor.amqpStatus.(type) { - case *cloudprotocol.UnitConfigStatus: - return amqpStatus.VendorVersion + if err := instance.initComponentsStatus(); err != nil { + return err + } - case *cloudprotocol.ComponentStatus: - return amqpStatus.VendorVersion + if err := instance.initServicesStatus(); err != nil { + return err + } - case *cloudprotocol.LayerStatus: - return strconv.FormatUint(amqpStatus.AosVersion, 10) + if err := instance.initLayersStatus(); err != nil { + return err + } - case *cloudprotocol.ServiceStatus: - return strconv.FormatUint(amqpStatus.AosVersion, 10) + if err := instance.initInstancesStatus(); err != nil { + return err + } - default: - return "" + if err := instance.initNodesStatus(); err != nil { + return err } + + return nil } -func (instance *Instance) updateUnitConfigStatus(unitConfigInfo cloudprotocol.UnitConfigStatus) { +func (instance *Instance) setUnitConfigStatus(status cloudprotocol.UnitConfigStatus) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() log.WithFields(log.Fields{ - "status": unitConfigInfo.Status, - "vendorVersion": unitConfigInfo.VendorVersion, - "error": unitConfigInfo.ErrorInfo, - }).Debug("Update unit config status") + "status": status.Status, + "version": status.Version, + "error": status.ErrorInfo, + }).Debug("Set unit config status") + + index := slices.IndexFunc(instance.unitStatus.UnitConfig, func(unitConfigStatus cloudprotocol.UnitConfigStatus) bool { + return unitConfigStatus.Version == status.Version + }) + if index < 0 { + instance.unitStatus.UnitConfig = append(instance.unitStatus.UnitConfig, status) + } else { + instance.unitStatus.UnitConfig[index] = status + } - instance.processUnitConfigStatus(unitConfigInfo) instance.statusChanged() } -func (instance *Instance) processUnitConfigStatus(unitConfigInfo cloudprotocol.UnitConfigStatus) { - instance.updateStatus(&instance.unitConfigStatus, statusDescriptor{&unitConfigInfo}) +func (instance *Instance) updateUnitConfigStatus(status cloudprotocol.UnitConfigStatus) { + instance.setUnitConfigStatus(status) + instance.statusChanged() } -func (instance *Instance) updateComponentStatus(componentInfo cloudprotocol.ComponentStatus) { +func (instance *Instance) setComponentStatus(status cloudprotocol.ComponentStatus) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() log.WithFields(log.Fields{ - "id": componentInfo.ID, - "status": componentInfo.Status, - "vendorVersion": componentInfo.VendorVersion, - "error": componentInfo.ErrorInfo, - }).Debug("Update component status") - - instance.processComponentStatus(componentInfo) - instance.statusChanged() -} - -func (instance *Instance) processComponentStatus(componentInfo cloudprotocol.ComponentStatus) { - componentStatus, ok := instance.componentStatuses[componentInfo.ID] - if !ok { - componentStatus = &itemStatus{} - instance.componentStatuses[componentInfo.ID] = componentStatus + "id": status.ComponentID, + "type": status.ComponentType, + "status": status.Status, + "version": status.Version, + "error": status.ErrorInfo, + }).Debug("Set component status") + + index := slices.IndexFunc(instance.unitStatus.Components, func(componentStatus cloudprotocol.ComponentStatus) bool { + return componentStatus.ComponentID == status.ComponentID && componentStatus.Version == status.Version + }) + if index < 0 { + instance.unitStatus.Components = append(instance.unitStatus.Components, status) + } else { + instance.unitStatus.Components[index] = status } +} - instance.updateStatus(componentStatus, statusDescriptor{&componentInfo}) +func (instance *Instance) updateComponentStatus(status cloudprotocol.ComponentStatus) { + instance.setComponentStatus(status) + instance.statusChanged() } -func (instance *Instance) updateLayerStatus(layerInfo cloudprotocol.LayerStatus) { +func (instance *Instance) setLayerStatus(status cloudprotocol.LayerStatus) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() log.WithFields(log.Fields{ - "id": layerInfo.ID, - "digest": layerInfo.Digest, - "status": layerInfo.Status, - "aosVersion": layerInfo.AosVersion, - "error": layerInfo.ErrorInfo, - }).Debug("Update layer status") - - if _, ok := instance.layerStatuses[layerInfo.Digest]; !ok { - instance.layerStatuses[layerInfo.Digest] = &itemStatus{} + "id": status.LayerID, + "digest": status.Digest, + "status": status.Status, + "version": status.Version, + "error": status.ErrorInfo, + }).Debug("Set layer status") + + index := slices.IndexFunc(instance.unitStatus.Layers, func(layerStatus cloudprotocol.LayerStatus) bool { + return layerStatus.LayerID == status.LayerID && layerStatus.Version == status.Version + }) + if index < 0 { + instance.unitStatus.Layers = append(instance.unitStatus.Layers, status) + } else { + instance.unitStatus.Layers[index] = status } - - instance.processLayerStatus(layerInfo) - instance.statusChanged() } -func (instance *Instance) processLayerStatus(layerInfo cloudprotocol.LayerStatus) { - layerStatus, ok := instance.layerStatuses[layerInfo.Digest] - if !ok { - layerStatus = &itemStatus{} - instance.layerStatuses[layerInfo.Digest] = layerStatus - } - - instance.updateStatus(layerStatus, statusDescriptor{&layerInfo}) +func (instance *Instance) updateLayerStatus(status cloudprotocol.LayerStatus) { + instance.setLayerStatus(status) + instance.statusChanged() } -func (instance *Instance) updateServiceStatus(serviceInfo cloudprotocol.ServiceStatus) { +func (instance *Instance) setServiceStatus(status cloudprotocol.ServiceStatus) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() log.WithFields(log.Fields{ - "id": serviceInfo.ID, - "status": serviceInfo.Status, - "aosVersion": serviceInfo.AosVersion, - "error": serviceInfo.ErrorInfo, - }).Debug("Update service status") - - instance.processServiceStatus(serviceInfo) - instance.statusChanged() -} - -func (instance *Instance) processServiceStatus(serviceInfo cloudprotocol.ServiceStatus) { - serviceStatus, ok := instance.serviceStatuses[serviceInfo.ID] - if !ok { - serviceStatus = &itemStatus{} - instance.serviceStatuses[serviceInfo.ID] = serviceStatus + "id": status.ServiceID, + "status": status.Status, + "version": status.Version, + "error": status.ErrorInfo, + }).Debug("Set service status") + + index := slices.IndexFunc(instance.unitStatus.Services, func(serviceStatus cloudprotocol.ServiceStatus) bool { + return serviceStatus.ServiceID == status.ServiceID && serviceStatus.Version == status.Version + }) + if index < 0 { + instance.unitStatus.Services = append(instance.unitStatus.Services, status) + } else { + instance.unitStatus.Services[index] = status } +} - instance.updateStatus(serviceStatus, statusDescriptor{&serviceInfo}) +func (instance *Instance) updateServiceStatus(status cloudprotocol.ServiceStatus) { + instance.setServiceStatus(status) + instance.statusChanged() } -func (instance *Instance) updateInstanceStatus(status []cloudprotocol.InstanceStatus) { +func (instance *Instance) setInstanceStatus(status cloudprotocol.InstanceStatus) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() - newStatuses := []cloudprotocol.InstanceStatus{} - -foundloop: - for _, instanceStatus := range status { - for i := range instance.instanceStatuses { - if instanceStatus.InstanceIdent == instance.instanceStatuses[i].InstanceIdent && - instanceStatus.AosVersion == instance.instanceStatuses[i].AosVersion { - log.WithFields(log.Fields{ - "serviceID": instanceStatus.InstanceIdent.ServiceID, - "subjectID": instanceStatus.InstanceIdent.SubjectID, - "instance": instanceStatus.InstanceIdent.Instance, - "aosVersion": instanceStatus.AosVersion, - "runState": instanceStatus.RunState, - "error": instanceStatus.ErrorInfo, - }).Debug("Update instance status") - - instance.instanceStatuses[i].StateChecksum = instanceStatus.StateChecksum - instance.instanceStatuses[i].RunState = instanceStatus.RunState - instance.instanceStatuses[i].ErrorInfo = instanceStatus.ErrorInfo - - continue foundloop - } - } - - newStatuses = append(newStatuses, instanceStatus) + log.WithFields(log.Fields{ + "serviceID": status.InstanceIdent.ServiceID, + "subjectID": status.InstanceIdent.SubjectID, + "instance": status.InstanceIdent.Instance, + "version": status.ServiceVersion, + "status": status.Status, + "error": status.ErrorInfo, + }).Debug("Set instance status") + + index := slices.IndexFunc(instance.unitStatus.Instances, func(instanceStatus cloudprotocol.InstanceStatus) bool { + return instanceStatus.InstanceIdent == status.InstanceIdent + }) + if index < 0 { + instance.unitStatus.Instances = append(instance.unitStatus.Instances, status) + } else { + instance.unitStatus.Instances[index] = status } +} - instance.instanceStatuses = append(instance.instanceStatuses, newStatuses...) - +func (instance *Instance) updateInstanceStatus(status cloudprotocol.InstanceStatus) { + instance.setInstanceStatus(status) instance.statusChanged() } -func (instance *Instance) setInstanceStatus(status []cloudprotocol.InstanceStatus) { +func (instance *Instance) setNodeInfo(nodeInfo cloudprotocol.NodeInfo) { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() - instance.instanceStatuses = status + log.WithFields(log.Fields{ + "nodeID": nodeInfo.NodeID, + "nodeType": nodeInfo.NodeType, + "status": nodeInfo.Status, + }).Debug("Set node info") + + index := slices.IndexFunc(instance.unitStatus.Nodes, func(node cloudprotocol.NodeInfo) bool { + return node.NodeID == nodeInfo.NodeID + }) + if index < 0 { + instance.unitStatus.Nodes = append(instance.unitStatus.Nodes, nodeInfo) + } else { + instance.unitStatus.Nodes[index] = nodeInfo + } +} + +func (instance *Instance) updateNodeInfo(nodeInfo cloudprotocol.NodeInfo) { + instance.setNodeInfo(nodeInfo) + instance.statusChanged() } func (instance *Instance) statusChanged() { @@ -612,97 +644,108 @@ func (instance *Instance) statusChanged() { instance.statusMutex.Lock() defer instance.statusMutex.Unlock() - instance.sendCurrentStatus() + instance.sendCurrentStatus(true) }) } -func (instance *Instance) updateStatus(status *itemStatus, descriptor statusDescriptor) { - if descriptor.getStatus() == cloudprotocol.InstalledStatus { - *status = itemStatus{descriptor} - return - } - - for i, element := range *status { - if element.getVersion() == descriptor.getVersion() { - (*status)[i] = descriptor - return - } - } - - *status = append(*status, descriptor) -} - -func (instance *Instance) sendCurrentStatus() { +func (instance *Instance) sendCurrentStatus(deltaStatus bool) { if instance.statusTimer != nil { instance.statusTimer.Stop() instance.statusTimer = nil } + defer instance.resetUnitStatus() + + log.WithField("deltaStatus", deltaStatus).Debug("Send current status") + if !instance.initDone { return } - if atomic.LoadInt32(&instance.isConnected) != 1 { + if !instance.isConnected { return } - unitStatus := cloudprotocol.UnitStatus{ - UnitSubjects: instance.unitSubjects, - Components: make([]cloudprotocol.ComponentStatus, 0, len(instance.componentStatuses)), - Layers: make([]cloudprotocol.LayerStatus, 0, len(instance.layerStatuses)), - Services: make([]cloudprotocol.ServiceStatus, 0, len(instance.serviceStatuses)), - Instances: instance.instanceStatuses, - Nodes: instance.softwareManager.instanceRunner.GetNodesConfiguration(), + instance.unitStatus.IsDeltaInfo = deltaStatus + if err := instance.statusSender.SendUnitStatus( + instance.unitStatus); err != nil && !errors.Is(err, amqphandler.ErrNotConnected) { + log.Errorf("Can't send unit status: %s", err) + } +} + +func (instance *Instance) getAllNodesInfo() ([]cloudprotocol.NodeInfo, error) { + nodeIDs, err := instance.nodeManager.GetAllNodeIDs() + if err != nil { + return nil, aoserrors.Wrap(err) } - for _, status := range instance.unitConfigStatus { - unitConfig, ok := status.amqpStatus.(*cloudprotocol.UnitConfigStatus) - if !ok { - log.Error("Incorrect unit config type") + nodesInfo := make([]cloudprotocol.NodeInfo, 0, len(nodeIDs)) + + for _, nodeID := range nodeIDs { + nodeInfo, err := instance.nodeManager.GetNodeInfo(nodeID) + if err != nil { + log.WithField("nodeID", nodeID).Errorf("Can't get node info: %s", err) continue } - unitStatus.UnitConfig = append(unitStatus.UnitConfig, *unitConfig) + nodesInfo = append(nodesInfo, nodeInfo) + } + + return nodesInfo, nil +} + +func (instance *Instance) getNodesStatus() ([]cloudprotocol.NodeStatus, error) { + nodesInfo, err := instance.getAllNodesInfo() + if err != nil { + return nil, err + } + + nodesStatus := make([]cloudprotocol.NodeStatus, 0, len(nodesInfo)) + + for _, nodeInfo := range nodesInfo { + nodesStatus = append(nodesStatus, cloudprotocol.NodeStatus{NodeID: nodeInfo.NodeID, Status: nodeInfo.Status}) } - for _, componentStatus := range instance.componentStatuses { - for _, status := range *componentStatus { - status, ok := status.amqpStatus.(*cloudprotocol.ComponentStatus) + return nodesStatus, nil +} + +func (instance *Instance) handleChannels() { + for { + select { + case newComponents, ok := <-instance.newComponentsChannel: if !ok { - log.Error("Incorrect component status type") - continue + return } - unitStatus.Components = append(unitStatus.Components, *status) - } - } + for _, componentStatus := range newComponents { + instance.updateComponentStatus(componentStatus) + } - for _, layerStatus := range instance.layerStatuses { - for _, status := range *layerStatus { - status, ok := status.amqpStatus.(*cloudprotocol.LayerStatus) + case nodeInfo, ok := <-instance.nodeChangedChannel: if !ok { - log.Error("Incorrect layer status type") - continue + return } - unitStatus.Layers = append(unitStatus.Layers, *status) - } - } + instance.updateNodeInfo(nodeInfo) - for _, serviceStatus := range instance.serviceStatuses { - for _, status := range *serviceStatus { - status, ok := status.amqpStatus.(*cloudprotocol.ServiceStatus) + if err := instance.softwareManager.requestRebalancing(); err != nil { + log.Errorf("Can't perform rebalancing: %v", err) + } + + case systemQuotaAlert, ok := <-instance.systemQuotaAlertChannel: if !ok { - log.Error("Incorrect service status type") - continue + return } - unitStatus.Services = append(unitStatus.Services, *status) - } - } + if systemQuotaAlert.Status == resourcemonitor.AlertStatusFall { + return + } - if err := instance.statusSender.SendUnitStatus( - unitStatus); err != nil && !errors.Is(err, amqphandler.ErrNotConnected) { - log.Errorf("Can't send unit status: %s", err) + if slices.Contains([]string{"cpu", "ram"}, systemQuotaAlert.Parameter) { + if err := instance.softwareManager.requestRebalancing(); err != nil { + log.Errorf("Can't perform rebalancing: %v", err) + } + } + } } } diff --git a/unitstatushandler/unitstatushandler_internal_test.go b/unitstatushandler/unitstatushandler_internal_test.go index 2e346be2..2ee90a65 100644 --- a/unitstatushandler/unitstatushandler_internal_test.go +++ b/unitstatushandler/unitstatushandler_internal_test.go @@ -21,8 +21,6 @@ import ( "context" "encoding/json" "os" - "reflect" - "sort" "strings" "testing" "time" @@ -53,6 +51,11 @@ const waitStatusTimeout = 5 * time.Second * Types **********************************************************************************************************************/ +type TestNodeManager struct { + nodesInfo map[string]*cloudprotocol.NodeInfo + nodeInfoChannel chan cloudprotocol.NodeInfo +} + type TestSender struct { Consumer amqphandler.ConnectionEventsConsumer statusChannel chan cloudprotocol.UnitStatus @@ -60,7 +63,6 @@ type TestSender struct { type TestUnitConfigUpdater struct { UnitConfigStatus cloudprotocol.UnitConfigStatus - UpdateVersion string UpdateError error } @@ -69,17 +71,23 @@ type TestFirmwareUpdater struct { InitComponentsInfo []cloudprotocol.ComponentStatus UpdateComponentsInfo []cloudprotocol.ComponentStatus UpdateError error + + newComponentsChannel chan []cloudprotocol.ComponentStatus } type TestSoftwareUpdater struct { - AllServices []ServiceStatus - AllLayers []LayerStatus - UpdateError error + AllServices []ServiceStatus + AllLayers []LayerStatus + RevertedServices []string + UpdateError error } type TestInstanceRunner struct { runInstanceChan chan []cloudprotocol.InstanceInfo - newServices []string +} + +type TestSystemQuotaAlertProvider struct { + alertsChannel chan cloudprotocol.SystemQuotaAlert } type TestDownloader struct { @@ -224,7 +232,7 @@ func TestGroupDownloader(t *testing.T) { } result := testGroupDownloader.download(ctx, item.request, item.continueOnError, - func(id string, status string, componentErr string) { + func(id string, status string, componentErr *cloudprotocol.ErrorInfo) { log.WithFields(log.Fields{ "id": id, "status": status, "error": componentErr, }).Debug("Component download status") @@ -249,40 +257,43 @@ func TestFirmwareManager(t *testing.T) { downloadResult map[string]*downloadResult updateTime time.Duration updateComponentStatuses []cloudprotocol.ComponentStatus - unitConfigError error triggerUpdate bool updateWaitStatuses []cmserver.UpdateStatus } updateComponents := []cloudprotocol.ComponentInfo{ { - ID: "comp1", - VersionInfo: aostypes.VersionInfo{VendorVersion: "1.0"}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{1}}, + ComponentID: convertToComponentID("comp1"), + ComponentType: "rootfs", + Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, }, { - ID: "comp2", - VersionInfo: aostypes.VersionInfo{VendorVersion: "2.0"}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{2}}, + ComponentID: convertToComponentID("comp2"), + ComponentType: "rootfs", + Version: "2.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, }, } otherUpdateComponents := []cloudprotocol.ComponentInfo{ { - ID: "comp3", - VersionInfo: aostypes.VersionInfo{VendorVersion: "3.0"}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{3}}, + ComponentID: convertToComponentID("comp3"), + ComponentType: "rootfs", + Version: "3.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{3}}, }, { - ID: "comp4", - VersionInfo: aostypes.VersionInfo{VendorVersion: "4.0"}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{4}}, + ComponentID: convertToComponentID("comp4"), + ComponentType: "rootfs", + Version: "4.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{4}}, }, } updateTimeSlots := []cloudprotocol.TimeSlot{{ - Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 23, 59, 59, 999999, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 23, 59, 59, 999999, time.Local)}, }} updateTimetable := []cloudprotocol.TimetableEntry{ @@ -300,17 +311,118 @@ func TestFirmwareManager(t *testing.T) { testID: "success update", initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{Components: updateComponents}, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, + }, + updateComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.Downloading}, + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, + }, + }, + { + testID: "success update components with no ID", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + initComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "bios", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + }, + desiredStatus: &cloudprotocol.DesiredStatus{Components: []cloudprotocol.ComponentInfo{ + { + ComponentID: convertToComponentID("comp1"), + ComponentType: "rootfs", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, + }, + { + ComponentID: nil, + ComponentType: "bios", + Version: "0.0.2", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + { + ComponentID: nil, + ComponentType: "rootfs", + Version: "broken-version", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + { + ComponentID: nil, + ComponentType: "rootfs", + Version: "0.0.2", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + { + ComponentID: nil, + ComponentType: "rootfs", + Version: "0.0.3", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + }}, + downloadResult: map[string]*downloadResult{ + "rootfs:0.0.1": {}, + "bios:0.0.2": {}, + "rootfs:0.0.3": {}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.1", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "bios", Version: "0.0.2", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "0.0.3", Status: cloudprotocol.InstalledStatus}, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.Downloading}, + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, + }, + }, + { + testID: "success update with different component types", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + initComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "bios", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + }, + desiredStatus: &cloudprotocol.DesiredStatus{Components: []cloudprotocol.ComponentInfo{ + { + ComponentID: convertToComponentID("comp1"), + ComponentType: "rootfs", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, + }, + { + ComponentID: convertToComponentID("comp2"), + ComponentType: "rootfs", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + { + ComponentID: convertToComponentID("comp3"), + ComponentType: "bios", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + }}, + downloadResult: map[string]*downloadResult{ + "rootfs:0.0.1": {}, + "bios:0.0.1": {}, + }, + updateComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.1", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "0.0.1", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "bios", Version: "0.0.1", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, @@ -323,38 +435,72 @@ func TestFirmwareManager(t *testing.T) { testID: "download error", initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{Components: updateComponents}, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {Error: "download error"}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {Error: "download error"}, + convertToDownloadID(updateComponents[1]): {}, + }, + updateComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.Downloading}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "download error"}}, + }, + }, + { + testID: "download error on same component type", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + initComponentStatuses: []cloudprotocol.ComponentStatus{ + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + }, + desiredStatus: &cloudprotocol.DesiredStatus{Components: []cloudprotocol.ComponentInfo{ + { + ComponentID: convertToComponentID("comp1"), + ComponentType: "rootfs", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, + }, + { + ComponentID: convertToComponentID("comp2"), + ComponentType: "rootfs", + Version: "0.0.1", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{2}}, + }, + }}, + downloadResult: map[string]*downloadResult{ + "rootfs:0.0.1": {Error: "download error"}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", Version: "0.0.0", ComponentType: "rootfs", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", Version: "0.0.0", ComponentType: "rootfs", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.Downloading}, {State: cmserver.NoUpdate, Error: "download error"}, + {State: cmserver.Downloading}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "download error"}}, }, }, { testID: "update error", initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{Components: updateComponents}, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, { - ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.ErrorStatus, + ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: "update error"}, }, }, @@ -362,7 +508,7 @@ func TestFirmwareManager(t *testing.T) { {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, {State: cmserver.Updating}, - {State: cmserver.NoUpdate, Error: "update error"}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "update error"}}, }, }, { @@ -373,20 +519,22 @@ func TestFirmwareManager(t *testing.T) { }, initStatus: &cmserver.UpdateStatus{State: cmserver.Downloading}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, downloadTime: 1 * time.Second, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.ReadyToUpdate}, {State: cmserver.Updating}, {State: cmserver.NoUpdate}, + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, }, }, { @@ -395,30 +543,35 @@ func TestFirmwareManager(t *testing.T) { CurrentState: stateReadyToUpdate, CurrentUpdate: &firmwareUpdate{Components: updateComponents}, DownloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, ComponentStatuses: map[string]*cloudprotocol.ComponentStatus{ - updateComponents[0].ID: { - ID: updateComponents[0].ID, - VendorVersion: updateComponents[0].VendorVersion, + *updateComponents[0].ComponentID: { + ComponentID: *updateComponents[0].ComponentID, + ComponentType: updateComponents[0].ComponentType, + Version: updateComponents[0].Version, }, - updateComponents[1].ID: { - ID: updateComponents[1].ID, - VendorVersion: updateComponents[1].VendorVersion, + *updateComponents[1].ComponentID: { + ComponentID: *updateComponents[1].ComponentID, + ComponentType: updateComponents[1].ComponentType, + Version: updateComponents[1].Version, }, }, }, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, downloadTime: 1 * time.Second, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, }, - updateWaitStatuses: []cmserver.UpdateStatus{{State: cmserver.Updating}, {State: cmserver.NoUpdate}}, }, { testID: "continue update on updating state", @@ -426,29 +579,33 @@ func TestFirmwareManager(t *testing.T) { CurrentState: stateUpdating, CurrentUpdate: &firmwareUpdate{Components: updateComponents}, DownloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, ComponentStatuses: map[string]*cloudprotocol.ComponentStatus{ - updateComponents[0].ID: { - ID: updateComponents[0].ID, - VendorVersion: updateComponents[0].VendorVersion, + *updateComponents[0].ComponentID: { + ComponentID: *updateComponents[0].ComponentID, + ComponentType: updateComponents[0].ComponentType, + Version: updateComponents[0].Version, }, - updateComponents[1].ID: { - ID: updateComponents[1].ID, - VendorVersion: updateComponents[1].VendorVersion, + *updateComponents[1].ComponentID: { + ComponentID: *updateComponents[1].ComponentID, + ComponentType: updateComponents[1].ComponentType, + Version: updateComponents[1].Version, }, }, }, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.NoUpdate}, }, - updateWaitStatuses: []cmserver.UpdateStatus{{State: cmserver.NoUpdate}}, }, { testID: "same update on ready to update state", @@ -459,35 +616,40 @@ func TestFirmwareManager(t *testing.T) { Components: updateComponents, }, DownloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, ComponentStatuses: map[string]*cloudprotocol.ComponentStatus{ - updateComponents[0].ID: { - ID: updateComponents[0].ID, - VendorVersion: updateComponents[0].VendorVersion, + *updateComponents[0].ComponentID: { + ComponentID: *updateComponents[0].ComponentID, + ComponentType: updateComponents[0].ComponentType, + Version: updateComponents[0].Version, }, - updateComponents[1].ID: { - ID: updateComponents[1].ID, - VendorVersion: updateComponents[1].VendorVersion, + *updateComponents[1].ComponentID: { + ComponentID: *updateComponents[1].ComponentID, + ComponentType: updateComponents[1].ComponentType, + Version: updateComponents[1].Version, }, }, }, initStatus: &cmserver.UpdateStatus{State: cmserver.ReadyToUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{ Components: updateComponents, FOTASchedule: cloudprotocol.ScheduleRule{Type: cloudprotocol.TriggerUpdate}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + }, + triggerUpdate: true, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, }, - triggerUpdate: true, - updateWaitStatuses: []cmserver.UpdateStatus{{State: cmserver.Updating}, {State: cmserver.NoUpdate}}, }, { testID: "new update on downloading state", @@ -495,31 +657,31 @@ func TestFirmwareManager(t *testing.T) { CurrentState: stateDownloading, CurrentUpdate: &firmwareUpdate{Components: updateComponents}, DownloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, }, initStatus: &cmserver.UpdateStatus{State: cmserver.Downloading}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp3", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{Components: otherUpdateComponents}, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, - otherUpdateComponents[0].ID: {}, - otherUpdateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, + convertToDownloadID(otherUpdateComponents[0]): {}, + convertToDownloadID(otherUpdateComponents[1]): {}, }, downloadTime: 1 * time.Second, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp3", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "4.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "4.0.0", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.NoUpdate, Error: context.Canceled.Error()}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: context.Canceled.Error()}}, {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, {State: cmserver.Updating}, @@ -537,25 +699,25 @@ func TestFirmwareManager(t *testing.T) { }, initStatus: &cmserver.UpdateStatus{State: cmserver.ReadyToUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp3", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{ Components: otherUpdateComponents, FOTASchedule: cloudprotocol.ScheduleRule{Type: cloudprotocol.TriggerUpdate}, }, downloadResult: map[string]*downloadResult{ - otherUpdateComponents[0].ID: {}, - otherUpdateComponents[1].ID: {}, + convertToDownloadID(otherUpdateComponents[0]): {}, + convertToDownloadID(otherUpdateComponents[1]): {}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp3", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "4.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "4.0.0", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.NoUpdate, Error: context.Canceled.Error()}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: context.Canceled.Error()}}, {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, }, @@ -568,41 +730,43 @@ func TestFirmwareManager(t *testing.T) { Components: updateComponents, }, DownloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, ComponentStatuses: map[string]*cloudprotocol.ComponentStatus{ - updateComponents[0].ID: { - ID: updateComponents[0].ID, - VendorVersion: updateComponents[0].VendorVersion, + *updateComponents[0].ComponentID: { + ComponentID: *updateComponents[0].ComponentID, + ComponentType: updateComponents[0].ComponentType, + Version: updateComponents[0].Version, Status: cloudprotocol.InstallingStatus, }, - updateComponents[1].ID: { - ID: updateComponents[1].ID, - VendorVersion: updateComponents[1].VendorVersion, + *updateComponents[1].ComponentID: { + ComponentID: *updateComponents[1].ComponentID, + ComponentType: updateComponents[1].ComponentType, + Version: updateComponents[1].Version, Status: cloudprotocol.InstallingStatus, }, }, }, initStatus: &cmserver.UpdateStatus{State: cmserver.Updating}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp3", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{Components: otherUpdateComponents}, downloadResult: map[string]*downloadResult{ - otherUpdateComponents[0].ID: {}, - otherUpdateComponents[1].ID: {}, + convertToDownloadID(otherUpdateComponents[0]): {}, + convertToDownloadID(otherUpdateComponents[1]): {}, }, downloadTime: 1 * time.Second, updateTime: 1 * time.Second, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp3", VendorVersion: "3.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp4", VendorVersion: "4.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp3", ComponentType: "rootfs", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp4", ComponentType: "rootfs", Version: "4.0.0", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.NoUpdate}, @@ -612,32 +776,12 @@ func TestFirmwareManager(t *testing.T) { {State: cmserver.NoUpdate}, }, }, - { - testID: "update unit config", - initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, - desiredStatus: &cloudprotocol.DesiredStatus{UnitConfig: json.RawMessage("{}")}, - updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.Downloading}, - {State: cmserver.ReadyToUpdate}, - {State: cmserver.Updating}, - {State: cmserver.NoUpdate}, - }, - }, - { - testID: "error unit config", - initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, - desiredStatus: &cloudprotocol.DesiredStatus{UnitConfig: json.RawMessage("{}")}, - unitConfigError: aoserrors.New("unit config error"), - updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.Downloading}, {State: cmserver.NoUpdate, Error: "unit config error"}, - }, - }, { testID: "timetable update", initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{ FOTASchedule: cloudprotocol.ScheduleRule{ @@ -647,12 +791,12 @@ func TestFirmwareManager(t *testing.T) { Components: updateComponents, }, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, updateComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, @@ -665,8 +809,8 @@ func TestFirmwareManager(t *testing.T) { testID: "update TTL", initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, initComponentStatuses: []cloudprotocol.ComponentStatus{ - {ID: "comp1", VendorVersion: "0.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "rootfs", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "rootfs", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, desiredStatus: &cloudprotocol.DesiredStatus{ FOTASchedule: cloudprotocol.ScheduleRule{ @@ -676,19 +820,20 @@ func TestFirmwareManager(t *testing.T) { Components: updateComponents, }, downloadResult: map[string]*downloadResult{ - updateComponents[0].ID: {}, - updateComponents[1].ID: {}, + convertToDownloadID(updateComponents[0]): {}, + convertToDownloadID(updateComponents[1]): {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, - {State: cmserver.NoUpdate, Error: "update timeout"}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{ + Message: "update timeout", + }}, }, }, } firmwareUpdater := NewTestFirmwareUpdater(nil) - unitConfigUpdater := NewTestUnitConfigUpdater(cloudprotocol.UnitConfigStatus{}) firmwareDownloader := newTestGroupDownloader() testStorage := NewTestStorage() @@ -701,7 +846,6 @@ func TestFirmwareManager(t *testing.T) { firmwareUpdater.InitComponentsInfo = item.initComponentStatuses firmwareUpdater.UpdateComponentsInfo = item.updateComponentStatuses firmwareUpdater.UpdateTime = item.updateTime - unitConfigUpdater.UpdateError = item.unitConfigError if err := testStorage.saveFirmwareState(item.initState); err != nil { t.Errorf("Can't save init state: %s", err) @@ -710,8 +854,8 @@ func TestFirmwareManager(t *testing.T) { // Create firmware manager - firmwareManager, err := newFirmwareManager(newTestStatusHandler(), firmwareDownloader, - firmwareUpdater, unitConfigUpdater, testStorage, &TestInstanceRunner{}, 30*time.Second) + firmwareManager, err := newFirmwareManager(newTestStatusHandler(), firmwareDownloader, firmwareUpdater, + testStorage, 30*time.Second) if err != nil { t.Errorf("Can't create firmware manager: %s", err) continue @@ -778,36 +922,36 @@ func TestSoftwareManager(t *testing.T) { triggerUpdate bool updateError error updateWaitStatuses []cmserver.UpdateStatus - newServices []string + requestRebalancing bool } updateLayers := []cloudprotocol.LayerInfo{ { - ID: "layer1", - Digest: "digest1", - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, + LayerID: "layer1", + Digest: "digest1", + Version: "1.0.0", }, { - ID: "layer2", - Digest: "digest2", - VersionInfo: aostypes.VersionInfo{AosVersion: 2}, + LayerID: "layer2", + Digest: "digest2", + Version: "2.0.0", }, } updateServices := []cloudprotocol.ServiceInfo{ { - ID: "service1", - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, + ServiceID: "service1", + Version: "1.0.0", }, { - ID: "service2", - VersionInfo: aostypes.VersionInfo{AosVersion: 2}, + ServiceID: "service2", + Version: "2.0.0", }, } updateTimeSlots := []cloudprotocol.TimeSlot{{ - Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 23, 59, 59, 999999, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 23, 59, 59, 999999, time.Local)}, }} updateTimetable := []cloudprotocol.TimetableEntry{ @@ -829,7 +973,7 @@ func TestSoftwareManager(t *testing.T) { }, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, @@ -837,7 +981,6 @@ func TestSoftwareManager(t *testing.T) { {State: cmserver.Updating}, {State: cmserver.NoUpdate}, }, - newServices: []string{"service1", "service2"}, }, { testID: "new services", @@ -845,45 +988,45 @@ func TestSoftwareManager(t *testing.T) { initServices: []ServiceStatus{ { ServiceStatus: cloudprotocol.ServiceStatus{ - ID: updateServices[0].ID, - AosVersion: updateServices[0].AosVersion, - Status: cloudprotocol.InstalledStatus, + ServiceID: updateServices[0].ServiceID, + Version: updateServices[0].Version, + Status: cloudprotocol.InstalledStatus, }, }, { ServiceStatus: cloudprotocol.ServiceStatus{ - ID: updateServices[1].ID, - AosVersion: updateServices[1].AosVersion, - Status: cloudprotocol.InstalledStatus, + ServiceID: updateServices[1].ServiceID, + Version: updateServices[1].Version, + Status: cloudprotocol.InstalledStatus, }, }, }, initLayers: []LayerStatus{ { LayerStatus: cloudprotocol.LayerStatus{ - ID: updateLayers[0].ID, - AosVersion: updateLayers[0].AosVersion, - Digest: updateLayers[0].Digest, - Status: cloudprotocol.InstalledStatus, + LayerID: updateLayers[0].LayerID, + Version: updateLayers[0].Version, + Digest: updateLayers[0].Digest, + Status: cloudprotocol.InstalledStatus, }, }, { LayerStatus: cloudprotocol.LayerStatus{ - ID: updateLayers[1].ID, - AosVersion: updateLayers[1].AosVersion, - Digest: updateLayers[1].Digest, - Status: cloudprotocol.InstalledStatus, + LayerID: updateLayers[1].LayerID, + Version: updateLayers[1].Version, + Digest: updateLayers[1].Digest, + Status: cloudprotocol.InstalledStatus, }, }, }, desiredStatus: &cloudprotocol.DesiredStatus{ Layers: updateLayers, Services: append(updateServices, cloudprotocol.ServiceInfo{ - ID: "service3", - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, + ServiceID: "service3", + Version: "1.0", }, cloudprotocol.ServiceInfo{ - ID: "service4", - VersionInfo: aostypes.VersionInfo{AosVersion: 1}, + ServiceID: "service4", + Version: "1.0", }), }, downloadResult: map[string]*downloadResult{ @@ -895,7 +1038,6 @@ func TestSoftwareManager(t *testing.T) { {State: cmserver.Updating}, {State: cmserver.NoUpdate}, }, - newServices: []string{"service3", "service4"}, }, { testID: "one item download error", @@ -905,11 +1047,11 @@ func TestSoftwareManager(t *testing.T) { }, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {Error: "download error"}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, - {State: cmserver.ReadyToUpdate, Error: "download error"}, + {State: cmserver.ReadyToUpdate, Error: &cloudprotocol.ErrorInfo{Message: "download error"}}, {State: cmserver.Updating}, {State: cmserver.NoUpdate}, }, @@ -921,11 +1063,16 @@ func TestSoftwareManager(t *testing.T) { Layers: updateLayers, Services: updateServices, }, downloadResult: map[string]*downloadResult{ - updateLayers[0].Digest: {Error: "download error"}, updateLayers[1].Digest: {Error: "download error"}, - updateServices[0].ID: {Error: "download error"}, updateServices[1].ID: {Error: "download error"}, + updateLayers[0].Digest: {Error: "download error"}, + updateLayers[1].Digest: {Error: "download error"}, + updateServices[0].ServiceID: {Error: "download error"}, + updateServices[1].ServiceID: {Error: "download error"}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.Downloading}, {State: cmserver.NoUpdate, Error: "download error"}, + {State: cmserver.Downloading}, { + State: cmserver.NoUpdate, + Error: &cloudprotocol.ErrorInfo{Message: "download error"}, + }, }, }, { @@ -936,14 +1083,14 @@ func TestSoftwareManager(t *testing.T) { }, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateError: aoserrors.New("update error"), updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, {State: cmserver.Updating}, - {State: cmserver.NoUpdate, Error: "update error"}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "update error"}}, }, }, { @@ -957,10 +1104,12 @@ func TestSoftwareManager(t *testing.T) { initStatus: &cmserver.UpdateStatus{State: cmserver.Downloading}, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.ReadyToUpdate}, {State: cmserver.Updating}, {State: cmserver.NoUpdate}, + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, }, }, { @@ -972,37 +1121,63 @@ func TestSoftwareManager(t *testing.T) { }, DownloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, LayerStatuses: map[string]*cloudprotocol.LayerStatus{ updateLayers[0].Digest: { - ID: updateLayers[0].ID, - Digest: updateLayers[0].Digest, - AosVersion: updateLayers[0].AosVersion, - Status: cloudprotocol.InstallingStatus, + LayerID: updateLayers[0].LayerID, + Digest: updateLayers[0].Digest, + Version: updateLayers[0].Version, + Status: cloudprotocol.InstallingStatus, }, updateLayers[1].Digest: { - ID: updateLayers[1].ID, - Digest: updateLayers[1].Digest, - AosVersion: updateLayers[1].AosVersion, - Status: cloudprotocol.InstallingStatus, + LayerID: updateLayers[1].LayerID, + Digest: updateLayers[1].Digest, + Version: updateLayers[1].Version, + Status: cloudprotocol.InstallingStatus, }, }, ServiceStatuses: map[string]*cloudprotocol.ServiceStatus{ - updateServices[0].ID: { - ID: updateServices[0].ID, - AosVersion: updateServices[0].AosVersion, - Status: cloudprotocol.InstallingStatus, + updateServices[0].ServiceID: { + ServiceID: updateServices[0].ServiceID, + Version: updateServices[0].Version, + Status: cloudprotocol.InstallingStatus, }, - updateServices[1].ID: { - ID: updateServices[1].ID, - AosVersion: updateServices[1].AosVersion, - Status: cloudprotocol.InstallingStatus, + updateServices[1].ServiceID: { + ServiceID: updateServices[1].ServiceID, + Version: updateServices[1].Version, + Status: cloudprotocol.InstallingStatus, }, }, }, updateWaitStatuses: []cmserver.UpdateStatus{ - {State: cmserver.Updating}, {State: cmserver.NoUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, + }, + }, + { + testID: "update unit config", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + desiredStatus: &cloudprotocol.DesiredStatus{UnitConfig: &cloudprotocol.UnitConfig{ + Version: "1.0.0", + }}, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, + }, + }, + { + testID: "error unit config", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + desiredStatus: &cloudprotocol.DesiredStatus{UnitConfig: &cloudprotocol.UnitConfig{ + Version: "1.0.0", + }}, + updateError: aoserrors.New("unit config error"), + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "unit config error"}}, }, }, { @@ -1017,7 +1192,7 @@ func TestSoftwareManager(t *testing.T) { }, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, @@ -1038,16 +1213,74 @@ func TestSoftwareManager(t *testing.T) { }, downloadResult: map[string]*downloadResult{ updateLayers[0].Digest: {}, updateLayers[1].Digest: {}, - updateServices[0].ID: {}, updateServices[1].ID: {}, + updateServices[0].ServiceID: {}, updateServices[1].ServiceID: {}, }, updateWaitStatuses: []cmserver.UpdateStatus{ {State: cmserver.Downloading}, {State: cmserver.ReadyToUpdate}, - {State: cmserver.NoUpdate, Error: "update timeout"}, + {State: cmserver.NoUpdate, Error: &cloudprotocol.ErrorInfo{Message: "update timeout"}}, + }, + }, + { + testID: "update node status", + initStatus: &cmserver.UpdateStatus{State: cmserver.NoUpdate}, + desiredStatus: &cloudprotocol.DesiredStatus{ + Nodes: []cloudprotocol.NodeStatus{ + {NodeID: "node1", Status: cloudprotocol.NodeStatusPaused}, + {NodeID: "node2", Status: cloudprotocol.NodeStatusPaused}, + }, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, }, }, + { + testID: "rebalancing request", + initState: &softwareManager{ + CurrentState: stateNoUpdate, + CurrentUpdate: &softwareUpdate{ + RunInstances: []cloudprotocol.InstanceInfo{ + {ServiceID: "service1", SubjectID: "subject1", NumInstances: 1}, + {ServiceID: "service2", SubjectID: "subject2", NumInstances: 1}, + }, + }, + ServiceStatuses: map[string]*cloudprotocol.ServiceStatus{ + "service1": {ServiceID: "service1", Version: "1.0.0"}, + "service2": {ServiceID: "service2", Version: "2.0.0"}, + }, + }, + initServices: []ServiceStatus{ + { + ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: updateServices[0].ServiceID, + Version: updateServices[0].Version, + Status: cloudprotocol.InstalledStatus, + }, + }, + { + ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: updateServices[1].ServiceID, + Version: updateServices[1].Version, + Status: cloudprotocol.InstalledStatus, + }, + }, + }, + updateWaitStatuses: []cmserver.UpdateStatus{ + {State: cmserver.ReadyToUpdate}, + {State: cmserver.Updating}, + {State: cmserver.NoUpdate}, + }, + requestRebalancing: true, + }, } + nodeManager := NewTestNodeManager([]cloudprotocol.NodeInfo{ + {NodeID: "node1", NodeType: "type1", Status: cloudprotocol.NodeStatusProvisioned}, + {NodeID: "node2", NodeType: "type2", Status: cloudprotocol.NodeStatusProvisioned}, + }) + unitConfigUpdater := NewTestUnitConfigUpdater(cloudprotocol.UnitConfigStatus{}) softwareUpdater := NewTestSoftwareUpdater(nil, nil) instanceRunner := NewTestInstanceRunner() softwareDownloader := newTestGroupDownloader() @@ -1062,6 +1295,7 @@ func TestSoftwareManager(t *testing.T) { softwareUpdater.AllServices = item.initServices softwareUpdater.AllLayers = item.initLayers softwareUpdater.UpdateError = item.updateError + unitConfigUpdater.UpdateError = item.updateError if err := testStorage.saveSoftwareState(item.initState); err != nil { t.Errorf("Can't save init state: %s", err) @@ -1070,8 +1304,8 @@ func TestSoftwareManager(t *testing.T) { // Create software manager - softwareManager, err := newSoftwareManager(newTestStatusHandler(), softwareDownloader, softwareUpdater, - instanceRunner, testStorage, 30*time.Second) + softwareManager, err := newSoftwareManager(newTestStatusHandler(), softwareDownloader, nodeManager, + unitConfigUpdater, softwareUpdater, instanceRunner, testStorage, 30*time.Second) if err != nil { t.Errorf("Can't create software manager: %s", err) continue @@ -1102,25 +1336,19 @@ func TestSoftwareManager(t *testing.T) { } } + if item.requestRebalancing { + if err = softwareManager.requestRebalancing(); err != nil { + t.Errorf("Rebalancing failed: %s", err) + } + } + for _, expectedStatus := range item.updateWaitStatuses { if expectedStatus.State == cmserver.Updating { if _, err := instanceRunner.WaitForRunInstance(time.Second); err != nil { t.Errorf("Wait run instances error: %v", err) } - if item.newServices != nil { - sort.Slice(instanceRunner.newServices, func(i, j int) bool { - return instanceRunner.newServices[j] > instanceRunner.newServices[i] - }) - - if !reflect.DeepEqual(instanceRunner.newServices, item.newServices) { - t.Errorf("Wrong new services: %v", instanceRunner.newServices) - } - } - - if item.updateError == nil { - softwareManager.processRunStatus(RunInstancesStatus{}) - } + softwareManager.processRunStatus(nil) } if err = waitForSOTAUpdateStatus(softwareManager.statusChannel, expectedStatus); err != nil { @@ -1132,6 +1360,19 @@ func TestSoftwareManager(t *testing.T) { } } + if item.desiredStatus != nil && item.desiredStatus.Nodes != nil { + for _, nodeStatus := range item.desiredStatus.Nodes { + nodeInfo, err := nodeManager.GetNodeInfo(nodeStatus.NodeID) + if err != nil { + t.Errorf("Get node info error: %v", err) + } + + if nodeInfo.Status != nodeStatus.Status { + t.Errorf("Wrong node status: %v", nodeInfo.Status) + } + } + } + closeSM: // Close software manager @@ -1171,8 +1412,8 @@ func TestTimeTable(t *testing.T) { { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 2, 0, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 2, 0, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, }, }, }, @@ -1184,26 +1425,26 @@ func TestTimeTable(t *testing.T) { { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 2, 0, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 2, 0, 0, 0, 0, time.Local)}, }, }, }, }, - err: "finish value should contain only time", + err: "end value should contain only time", }, { timetable: []cloudprotocol.TimetableEntry{ { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 1, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 1, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, }, }, }, }, - err: "start value should be before finish value", + err: "start value should be before end value", }, { fromDate: time.Date(1, 1, 1, 0, 0, 0, 0, time.Local), @@ -1211,8 +1452,8 @@ func TestTimeTable(t *testing.T) { { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 0, 0, 0, 0, time.Local)}, }, }, }, @@ -1225,32 +1466,32 @@ func TestTimeTable(t *testing.T) { { DayOfWeek: 2, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, }, { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 14, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 14, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 3, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 16, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 18, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 16, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 18, 0, 0, 0, time.Local)}, }, { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 20, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 22, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 20, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 22, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, }, }, }, @@ -1263,48 +1504,48 @@ func TestTimeTable(t *testing.T) { { DayOfWeek: 1, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, }, { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 14, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 14, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 2, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 16, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 18, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 16, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 18, 0, 0, 0, time.Local)}, }, { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 20, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 22, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 20, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 22, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 3, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 4, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 12, 0, 0, 0, time.Local)}, }, }, }, { DayOfWeek: 5, TimeSlots: []cloudprotocol.TimeSlot{ { - Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, - Finish: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, + Start: aostypes.Time{Time: time.Date(0, 1, 1, 8, 0, 0, 0, time.Local)}, + End: aostypes.Time{Time: time.Date(0, 1, 1, 10, 0, 0, 0, time.Local)}, }, }, }, @@ -1399,6 +1640,90 @@ func TestSyncExecutor(t *testing.T) { * Interfaces **********************************************************************************************************************/ +/*********************************************************************************************************************** + * TestNodeManager + **********************************************************************************************************************/ + +func NewTestNodeManager(nodesInfo []cloudprotocol.NodeInfo) *TestNodeManager { + nodesInfoMap := make(map[string]*cloudprotocol.NodeInfo) + + for _, nodeInfo := range nodesInfo { + nodesInfoMap[nodeInfo.NodeID] = &cloudprotocol.NodeInfo{} + *nodesInfoMap[nodeInfo.NodeID] = nodeInfo + } + + return &TestNodeManager{ + nodesInfo: nodesInfoMap, + } +} + +func (manager *TestNodeManager) GetAllNodeIDs() ([]string, error) { + nodeIDs := make([]string, 0, len(manager.nodesInfo)) + + for nodeID := range manager.nodesInfo { + nodeIDs = append(nodeIDs, nodeID) + } + + return nodeIDs, nil +} + +func (manager *TestNodeManager) GetNodeInfo(nodeID string) (cloudprotocol.NodeInfo, error) { + nodeInfo, ok := manager.nodesInfo[nodeID] + if !ok { + return cloudprotocol.NodeInfo{}, aoserrors.New("node not found") + } + + return *nodeInfo, nil +} + +func (manager *TestNodeManager) SubscribeNodeInfoChange() <-chan cloudprotocol.NodeInfo { + manager.nodeInfoChannel = make(chan cloudprotocol.NodeInfo, 1) + + return manager.nodeInfoChannel +} + +func (manager *TestNodeManager) NodeInfoChanged(nodeInfo cloudprotocol.NodeInfo) { + if _, ok := manager.nodesInfo[nodeInfo.NodeID]; !ok { + manager.nodesInfo[nodeInfo.NodeID] = &cloudprotocol.NodeInfo{} + } + + *manager.nodesInfo[nodeInfo.NodeID] = nodeInfo + + if manager.nodeInfoChannel != nil { + manager.nodeInfoChannel <- nodeInfo + } +} + +func (manager *TestNodeManager) GetAllNodesInfo() []cloudprotocol.NodeInfo { + nodesInfo := make([]cloudprotocol.NodeInfo, 0, len(manager.nodesInfo)) + + for _, nodeInfo := range manager.nodesInfo { + nodesInfo = append(nodesInfo, *nodeInfo) + } + + return nodesInfo +} + +func (manager *TestNodeManager) PauseNode(nodeID string) error { + if _, ok := manager.nodesInfo[nodeID]; !ok { + return aoserrors.New("node not found") + } + + manager.nodesInfo[nodeID].Status = cloudprotocol.NodeStatusPaused + + return nil +} + +func (manager *TestNodeManager) ResumeNode(nodeID string) error { + if _, ok := manager.nodesInfo[nodeID]; !ok { + return aoserrors.New("node not found") + } + + manager.nodesInfo[nodeID].Status = cloudprotocol.NodeStatusProvisioned + + return nil +} + /*********************************************************************************************************************** * TestSender **********************************************************************************************************************/ @@ -1433,23 +1758,19 @@ func (sender *TestSender) SubscribeForConnectionEvents(consumer amqphandler.Conn * TestUnitConfigUpdater **********************************************************************************************************************/ -func NewTestUnitConfigUpdater(unitConfigInfo cloudprotocol.UnitConfigStatus) (updater *TestUnitConfigUpdater) { - return &TestUnitConfigUpdater{UnitConfigStatus: unitConfigInfo} +func NewTestUnitConfigUpdater(unitConfigsStatus cloudprotocol.UnitConfigStatus) *TestUnitConfigUpdater { + return &TestUnitConfigUpdater{UnitConfigStatus: unitConfigsStatus} } -func (updater *TestUnitConfigUpdater) GetStatus() (info cloudprotocol.UnitConfigStatus, err error) { +func (updater *TestUnitConfigUpdater) GetStatus() (cloudprotocol.UnitConfigStatus, error) { return updater.UnitConfigStatus, nil } -func (updater *TestUnitConfigUpdater) GetUnitConfigVersion(configJSON json.RawMessage) (version string, err error) { - return updater.UpdateVersion, updater.UpdateError -} - -func (updater *TestUnitConfigUpdater) CheckUnitConfig(configJSON json.RawMessage) (version string, err error) { - return updater.UpdateVersion, updater.UpdateError +func (updater *TestUnitConfigUpdater) CheckUnitConfig(unitConfig cloudprotocol.UnitConfig) error { + return updater.UpdateError } -func (updater *TestUnitConfigUpdater) UpdateUnitConfig(configJSON json.RawMessage) (err error) { +func (updater *TestUnitConfigUpdater) UpdateUnitConfig(unitConfig cloudprotocol.UnitConfig) (err error) { return updater.UpdateError } @@ -1458,7 +1779,10 @@ func (updater *TestUnitConfigUpdater) UpdateUnitConfig(configJSON json.RawMessag **********************************************************************************************************************/ func NewTestFirmwareUpdater(componentsInfo []cloudprotocol.ComponentStatus) (updater *TestFirmwareUpdater) { - return &TestFirmwareUpdater{InitComponentsInfo: componentsInfo} + return &TestFirmwareUpdater{ + InitComponentsInfo: componentsInfo, + newComponentsChannel: make(chan []cloudprotocol.ComponentStatus, 1), + } } func (updater *TestFirmwareUpdater) GetStatus() (info []cloudprotocol.ComponentStatus, err error) { @@ -1473,6 +1797,14 @@ func (updater *TestFirmwareUpdater) UpdateComponents( return updater.UpdateComponentsInfo, updater.UpdateError } +func (updater *TestFirmwareUpdater) NewComponentsChannel() <-chan []cloudprotocol.ComponentStatus { + return updater.newComponentsChannel +} + +func (updater *TestFirmwareUpdater) SetNewComponents(newComponents []cloudprotocol.ComponentStatus) { + updater.newComponentsChannel <- newComponents +} + /*********************************************************************************************************************** * TestSoftwareUpdater **********************************************************************************************************************/ @@ -1503,6 +1835,12 @@ func (updater *TestSoftwareUpdater) RemoveService(serviceID string) error { return updater.UpdateError } +func (updater *TestSoftwareUpdater) RevertService(serviceID string) error { + updater.RevertedServices = append(updater.RevertedServices, serviceID) + + return updater.UpdateError +} + func (updater *TestSoftwareUpdater) InstallLayer(layerInfo cloudprotocol.LayerInfo, chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate, ) error { @@ -1525,17 +1863,12 @@ func NewTestInstanceRunner() *TestInstanceRunner { return &TestInstanceRunner{runInstanceChan: make(chan []cloudprotocol.InstanceInfo, 1)} } -func (runner *TestInstanceRunner) RunInstances(instances []cloudprotocol.InstanceInfo, newServices []string) error { - runner.newServices = newServices +func (runner *TestInstanceRunner) RunInstances(instances []cloudprotocol.InstanceInfo, rebalancing bool) error { runner.runInstanceChan <- instances return nil } -func (runner *TestInstanceRunner) RestartInstances() error { - return nil -} - func (runner *TestInstanceRunner) WaitForRunInstance(timeout time.Duration) ([]cloudprotocol.InstanceInfo, error) { select { case receivedRunInstances := <-runner.runInstanceChan: @@ -1546,8 +1879,20 @@ func (runner *TestInstanceRunner) WaitForRunInstance(timeout time.Duration) ([]c } } -func (runner *TestInstanceRunner) GetNodesConfiguration() (nodes []cloudprotocol.NodeInfo) { - return nodes +/*********************************************************************************************************************** + * TestSystemQuotaAlertProvider + **********************************************************************************************************************/ + +func NewTestSystemQuotaAlertProvider() *TestSystemQuotaAlertProvider { + return &TestSystemQuotaAlertProvider{alertsChannel: make(chan cloudprotocol.SystemQuotaAlert, 1)} +} + +func (provider *TestSystemQuotaAlertProvider) GetSystemQuoteAlertChannel() <-chan cloudprotocol.SystemQuotaAlert { + return provider.alertsChannel +} + +func (provider *TestSystemQuotaAlertProvider) SendSystemQuotaAlert(alert cloudprotocol.SystemQuotaAlert) { + provider.alertsChannel <- alert } /*********************************************************************************************************************** @@ -1628,16 +1973,22 @@ func (downloader *testGroupDownloader) download( ctx context.Context, request map[string]downloader.PackageInfo, continueOnError bool, updateStatus statusNotifier, ) (result map[string]*downloadResult) { for id := range request { - updateStatus(id, cloudprotocol.DownloadingStatus, "") + updateStatus(id, cloudprotocol.DownloadingStatus, nil) } select { case <-time.After(downloader.downloadTime): - if getDownloadError(downloader.result) != "" && !continueOnError { + if getDownloadError(downloader.result) != nil && !continueOnError { for id := range request { - if downloader.result[id].Error == "" { - downloader.result[id].Error = aoserrors.Wrap(context.Canceled).Error() + if result, ok := downloader.result[id]; ok { + if result.Error == "" { + result.Error = aoserrors.Wrap(context.Canceled).Error() + } + + continue } + + log.Errorf("Download result for id: %s not found", id) } } @@ -1647,9 +1998,10 @@ func (downloader *testGroupDownloader) download( } if downloader.result[id].Error != "" { - updateStatus(id, cloudprotocol.ErrorStatus, downloader.result[id].Error) + updateStatus(id, cloudprotocol.ErrorStatus, + &cloudprotocol.ErrorInfo{Message: downloader.result[id].Error}) } else { - updateStatus(id, cloudprotocol.DownloadedStatus, "") + updateStatus(id, cloudprotocol.DownloadedStatus, nil) } } @@ -1658,7 +2010,7 @@ func (downloader *testGroupDownloader) download( case <-ctx.Done(): for id := range request { downloader.result[id].Error = aoserrors.Wrap(context.Canceled).Error() - updateStatus(id, cloudprotocol.ErrorStatus, downloader.result[id].Error) + updateStatus(id, cloudprotocol.ErrorStatus, &cloudprotocol.ErrorInfo{Message: downloader.result[id].Error}) } return result @@ -1685,53 +2037,55 @@ func newTestStatusHandler() *testStatusHandler { return &testStatusHandler{} } -func (statusHandler *testStatusHandler) updateComponentStatus(componentInfo cloudprotocol.ComponentStatus) { +func (statusHandler *testStatusHandler) updateComponentStatus(status cloudprotocol.ComponentStatus) { log.WithFields(log.Fields{ - "id": componentInfo.ID, - "version": componentInfo.VendorVersion, - "status": componentInfo.Status, - "error": componentInfo.ErrorInfo, + "id": status.ComponentID, + "version": status.Version, + "status": status.Status, + "error": status.ErrorInfo, }).Debug("Update component status") } -func (statusHandler *testStatusHandler) updateUnitConfigStatus(unitConfigInfo cloudprotocol.UnitConfigStatus) { +func (statusHandler *testStatusHandler) updateUnitConfigStatus(status cloudprotocol.UnitConfigStatus) { log.WithFields(log.Fields{ - "version": unitConfigInfo.VendorVersion, - "status": unitConfigInfo.Status, - "error": unitConfigInfo.ErrorInfo, + "version": status.Version, + "status": status.Status, + "error": status.ErrorInfo, }).Debug("Update unit config status") } -func (statusHandler *testStatusHandler) updateLayerStatus(layerInfo cloudprotocol.LayerStatus) { +func (statusHandler *testStatusHandler) updateLayerStatus(status cloudprotocol.LayerStatus) { log.WithFields(log.Fields{ - "id": layerInfo.ID, - "digest": layerInfo.Digest, - "version": layerInfo.AosVersion, - "status": layerInfo.Status, - "error": layerInfo.ErrorInfo, + "id": status.LayerID, + "digest": status.Digest, + "version": status.Version, + "status": status.Status, + "error": status.ErrorInfo, }).Debug("Update layer status") } -func (statusHandler *testStatusHandler) updateServiceStatus(serviceInfo cloudprotocol.ServiceStatus) { +func (statusHandler *testStatusHandler) updateServiceStatus(status cloudprotocol.ServiceStatus) { log.WithFields(log.Fields{ - "id": serviceInfo.ID, - "version": serviceInfo.AosVersion, - "status": serviceInfo.Status, - "error": serviceInfo.ErrorInfo, + "id": status.ServiceID, + "version": status.Version, + "status": status.Status, + "error": status.ErrorInfo, }).Debug("Update service status") } -func (statusHandler *testStatusHandler) setInstanceStatus(status []cloudprotocol.InstanceStatus) { - for _, instanceStatus := range status { - log.WithFields(log.Fields{ - "serviceID": instanceStatus.ServiceID, - "subjectID": instanceStatus.SubjectID, - "instanceID": instanceStatus.Instance, - "aosVersion": instanceStatus.AosVersion, - "error": instanceStatus.ErrorInfo, - "nodeID": instanceStatus.NodeID, - }).Debug("Update instance status") - } +func (statusHandler *testStatusHandler) updateInstanceStatus(status cloudprotocol.InstanceStatus) { + log.WithFields(log.Fields{ + "serviceID": status.ServiceID, + "subjectID": status.SubjectID, + "instanceID": status.Instance, + "version": status.ServiceVersion, + "error": status.ErrorInfo, + "nodeID": status.NodeID, + }).Debug("Update instance status") +} + +func (statusHandler *testStatusHandler) getNodesStatus() ([]cloudprotocol.NodeStatus, error) { + return []cloudprotocol.NodeStatus{}, nil } /*********************************************************************************************************************** @@ -1830,13 +2184,17 @@ func compareStatuses(expectedStatus, comparedStatus cmserver.UpdateStatus) (err return aoserrors.Errorf("wrong state: %s", comparedStatus.State) } - if comparedStatus.Error == "" && expectedStatus.Error != "" || - comparedStatus.Error != "" && expectedStatus.Error == "" { - return aoserrors.Errorf("wrong error: %s", comparedStatus.Error) + if expectedStatus.Error == nil && comparedStatus.Error == nil { + return nil + } + + if comparedStatus.Error == nil && expectedStatus.Error != nil || + comparedStatus.Error != nil && expectedStatus.Error == nil { + return aoserrors.Errorf("wrong error: %s", comparedStatus.Error.Message) } - if !strings.Contains(comparedStatus.Error, expectedStatus.Error) { - return aoserrors.Errorf("wrong error: %s", comparedStatus.Error) + if !strings.Contains(comparedStatus.Error.Message, expectedStatus.Error.Message) { + return aoserrors.Errorf("wrong error: %s", comparedStatus.Error.Message) } return nil @@ -1873,3 +2231,11 @@ func waitForSOTAUpdateStatus( return aoserrors.Errorf("wait for SOTA %s status timeout", expectedStatus.State) } } + +func convertToComponentID(id string) *string { + return &id +} + +func convertToDownloadID(component cloudprotocol.ComponentInfo) string { + return component.ComponentType + ":" + component.Version +} diff --git a/unitstatushandler/unitstatushandler_test.go b/unitstatushandler/unitstatushandler_test.go index a6484a80..8ee8d1b9 100644 --- a/unitstatushandler/unitstatushandler_test.go +++ b/unitstatushandler/unitstatushandler_test.go @@ -18,7 +18,6 @@ package unitstatushandler_test import ( - "encoding/json" "reflect" "testing" "time" @@ -54,39 +53,39 @@ func TestSendInitialStatus(t *testing.T) { expectedUnitStatus := cloudprotocol.UnitStatus{ UnitSubjects: []string{"subject1"}, UnitConfig: []cloudprotocol.UnitConfigStatus{ - {VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, Components: []cloudprotocol.ComponentStatus{ - {ID: "comp0", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp1", VendorVersion: "1.1", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.2", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp0", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", Version: "1.1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", Version: "1.2.0", Status: cloudprotocol.InstalledStatus}, }, Layers: []cloudprotocol.LayerStatus{ - {ID: "layer0", Digest: "digest0", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "layer1", Digest: "digest1", AosVersion: 2, Status: cloudprotocol.InstalledStatus}, - {ID: "layer2", Digest: "digest2", AosVersion: 3, Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer0", Digest: "digest0", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer1", Digest: "digest1", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer2", Digest: "digest2", Version: "3.0.0", Status: cloudprotocol.InstalledStatus}, }, Services: []cloudprotocol.ServiceStatus{ - {ID: "service0", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "service1", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "service2", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service0", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service2", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, } initialServices := []unitstatushandler.ServiceStatus{ {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service0", AosVersion: 1, Status: cloudprotocol.InstalledStatus, + ServiceID: "service0", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }}, {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service1", AosVersion: 1, Status: cloudprotocol.InstalledStatus, + ServiceID: "service1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }}, {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service2", AosVersion: 1, Status: cloudprotocol.InstalledStatus, + ServiceID: "service2", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }}, { ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service3", AosVersion: 1, Status: cloudprotocol.InstalledStatus, + ServiceID: "service3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }, Cached: true, }, @@ -94,13 +93,13 @@ func TestSendInitialStatus(t *testing.T) { initialLayers := []unitstatushandler.LayerStatus{ {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer0", Digest: "digest0", AosVersion: 1, Status: cloudprotocol.InstalledStatus, + LayerID: "layer0", Digest: "digest0", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer1", Digest: "digest1", AosVersion: 2, Status: cloudprotocol.InstalledStatus, + LayerID: "layer1", Digest: "digest1", Version: "2.0.0", Status: cloudprotocol.InstalledStatus, }}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer2", Digest: "digest2", AosVersion: 3, Status: cloudprotocol.InstalledStatus, + LayerID: "layer2", Digest: "digest2", Version: "3.0.0", Status: cloudprotocol.InstalledStatus, }}, } @@ -111,8 +110,9 @@ func TestSendInitialStatus(t *testing.T) { sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, fotaUpdater, sotaUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, fotaUpdater, sotaUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -124,8 +124,7 @@ func TestSendInitialStatus(t *testing.T) { t.Fatalf("Can't send unit status: %v", err) } - if err := statusHandler.ProcessRunStatus( - unitstatushandler.RunInstancesStatus{UnitSubjects: []string{"subject1"}}); err != nil { + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -140,8 +139,7 @@ func TestSendInitialStatus(t *testing.T) { sender.Consumer.CloudDisconnected() - if err := statusHandler.ProcessRunStatus( - unitstatushandler.RunInstancesStatus{UnitSubjects: []string{"subject10"}}); err != nil { + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -152,15 +150,16 @@ func TestSendInitialStatus(t *testing.T) { func TestUpdateUnitConfig(t *testing.T) { unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) fotaUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) sotaUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, fotaUpdater, sotaUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, fotaUpdater, sotaUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -170,7 +169,7 @@ func TestUpdateUnitConfig(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -181,7 +180,7 @@ func TestUpdateUnitConfig(t *testing.T) { // success update unitConfigUpdater.UnitConfigStatus = cloudprotocol.UnitConfigStatus{ - VendorVersion: "1.1", Status: cloudprotocol.InstalledStatus, + Version: "1.1.0", Status: cloudprotocol.InstalledStatus, } expectedUnitStatus := cloudprotocol.UnitStatus{ UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, @@ -190,9 +189,16 @@ func TestUpdateUnitConfig(t *testing.T) { Services: []cloudprotocol.ServiceStatus{}, } - unitConfigUpdater.UpdateVersion = "1.1" + statusHandler.ProcessDesiredStatus( + cloudprotocol.DesiredStatus{UnitConfig: &cloudprotocol.UnitConfig{Version: "1.1.0"}}) - statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{UnitConfig: json.RawMessage("{}")}) + if _, err := instanceRunner.WaitForRunInstance(waitRunInstanceTimeout); err != nil { + t.Errorf("Wait run instances error: %v", err) + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } receivedUnitStatus, err := sender.WaitForStatus(waitStatusTimeout) if err != nil { @@ -205,16 +211,24 @@ func TestUpdateUnitConfig(t *testing.T) { // failed update - unitConfigUpdater.UpdateVersion = "1.2" unitConfigUpdater.UpdateError = aoserrors.New("some error occurs") - unitConfigUpdater.UnitConfigStatus = cloudprotocol.UnitConfigStatus{ - VendorVersion: "1.2", Status: cloudprotocol.ErrorStatus, + expectedUnitStatus.UnitConfig = append(expectedUnitStatus.UnitConfig, cloudprotocol.UnitConfigStatus{ + Version: "1.2.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: unitConfigUpdater.UpdateError.Error()}, + }) + + statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{UnitConfig: &cloudprotocol.UnitConfig{ + Version: "1.2.0", + }}) + + if _, err := instanceRunner.WaitForRunInstance(waitRunInstanceTimeout); err != nil { + t.Errorf("Wait run instances error: %v", err) } - expectedUnitStatus.UnitConfig = append(expectedUnitStatus.UnitConfig, unitConfigUpdater.UnitConfigStatus) - statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{UnitConfig: json.RawMessage("{}")}) + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } if receivedUnitStatus, err = sender.WaitForStatus(waitStatusTimeout); err != nil { t.Fatalf("Can't receive unit status: %s", err) @@ -227,20 +241,20 @@ func TestUpdateUnitConfig(t *testing.T) { func TestUpdateComponents(t *testing.T) { unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater(cloudprotocol.UnitConfigStatus{ - VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus, + Version: "1.0.0", Status: cloudprotocol.InstalledStatus, }) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater([]cloudprotocol.ComponentStatus{ - {ID: "comp0", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp0", ComponentType: "type-1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp1", ComponentType: "type-1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "type-1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }) softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() - statusHandler, err := unitstatushandler.New(cfg, + statusHandler, err := unitstatushandler.New(cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + unitstatushandler.NewTestStorage(), sender, unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -250,7 +264,7 @@ func TestUpdateComponents(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -261,22 +275,21 @@ func TestUpdateComponents(t *testing.T) { // success update expectedUnitStatus := cloudprotocol.UnitStatus{ - UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Components: []cloudprotocol.ComponentStatus{ - {ID: "comp0", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp0", ComponentType: "type-1", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, + {ComponentID: "comp2", ComponentType: "type-1", Version: "2.0.0", Status: cloudprotocol.InstalledStatus}, }, - Layers: []cloudprotocol.LayerStatus{}, - Services: []cloudprotocol.ServiceStatus{}, + Layers: []cloudprotocol.LayerStatus{}, + Services: []cloudprotocol.ServiceStatus{}, + IsDeltaInfo: true, } firmwareUpdater.UpdateComponentsInfo = expectedUnitStatus.Components statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Components: []cloudprotocol.ComponentInfo{ - {ID: "comp0", VersionInfo: aostypes.VersionInfo{VendorVersion: "2.0"}}, - {ID: "comp2", VersionInfo: aostypes.VersionInfo{VendorVersion: "2.0"}}, + {ComponentID: convertToComponentID("comp0"), ComponentType: "type-1", Version: "2.0.0"}, + {ComponentID: convertToComponentID("comp2"), ComponentType: "type-1", Version: "2.0.0"}, }, }) @@ -294,25 +307,22 @@ func TestUpdateComponents(t *testing.T) { firmwareUpdater.UpdateError = aoserrors.New("some error occurs") expectedUnitStatus = cloudprotocol.UnitStatus{ - UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Components: []cloudprotocol.ComponentStatus{ - {ID: "comp0", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, - {ID: "comp1", VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}, { - ID: "comp1", VendorVersion: "2.0", Status: cloudprotocol.ErrorStatus, + ComponentID: "comp1", ComponentType: "type-1", Version: "2.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: firmwareUpdater.UpdateError.Error()}, }, - {ID: "comp2", VendorVersion: "2.0", Status: cloudprotocol.InstalledStatus}, }, - Layers: []cloudprotocol.LayerStatus{}, - Services: []cloudprotocol.ServiceStatus{}, + Layers: []cloudprotocol.LayerStatus{}, + Services: []cloudprotocol.ServiceStatus{}, + IsDeltaInfo: true, } firmwareUpdater.UpdateComponentsInfo = expectedUnitStatus.Components statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Components: []cloudprotocol.ComponentInfo{ - {ID: "comp1", VersionInfo: aostypes.VersionInfo{VendorVersion: "2.0"}}, + {ComponentID: convertToComponentID("comp1"), ComponentType: "type-1", Version: "2.0.0"}, }, }) @@ -326,27 +336,17 @@ func TestUpdateComponents(t *testing.T) { } func TestUpdateLayers(t *testing.T) { - layerStatuses := []unitstatushandler.LayerStatus{ - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - } unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) - softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, layerStatuses) + softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -356,7 +356,19 @@ func TestUpdateLayers(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + softwareUpdater.AllLayers = []unitstatushandler.LayerStatus{ + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer0", Digest: "digest0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer2", Digest: "digest2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -370,11 +382,11 @@ func TestUpdateLayers(t *testing.T) { UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Components: []cloudprotocol.ComponentStatus{}, Layers: []cloudprotocol.LayerStatus{ - {ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.RemovedStatus}, - {ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.RemovedStatus}, - {ID: "layer3", Digest: "digest3", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "layer4", Digest: "digest4", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer0", Digest: "digest0", Version: "0.0.0", Status: cloudprotocol.RemovedStatus}, + {LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer2", Digest: "digest2", Version: "0.0.0", Status: cloudprotocol.RemovedStatus}, + {LayerID: "layer3", Digest: "digest3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer4", Digest: "digest4", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, Services: []cloudprotocol.ServiceStatus{}, } @@ -382,16 +394,16 @@ func TestUpdateLayers(t *testing.T) { statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Layers: []cloudprotocol.LayerInfo{ { - ID: "layer1", Digest: "digest1", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{1}}, + LayerID: "layer1", Digest: "digest1", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, }, { - ID: "layer3", Digest: "digest3", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{3}}, + LayerID: "layer3", Digest: "digest3", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{3}}, }, { - ID: "layer4", Digest: "digest4", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{4}}, + LayerID: "layer4", Digest: "digest4", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{4}}, }, }, }) @@ -400,7 +412,19 @@ func TestUpdateLayers(t *testing.T) { t.Errorf("Wait run instances error: %v", err) } - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + softwareUpdater.AllLayers = []unitstatushandler.LayerStatus{ + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer3", Digest: "digest3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer4", Digest: "digest4", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -413,24 +437,6 @@ func TestUpdateLayers(t *testing.T) { t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) } - softwareUpdater.AllLayers = []unitstatushandler.LayerStatus{ - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.RemovedStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.RemovedStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer3", Digest: "digest3", AosVersion: 1, Status: cloudprotocol.InstalledStatus, - }}, - {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer4", Digest: "digest4", AosVersion: 1, Status: cloudprotocol.InstalledStatus, - }}, - } - // failed update softwareUpdater.UpdateError = aoserrors.New("some error occurs") @@ -439,13 +445,11 @@ func TestUpdateLayers(t *testing.T) { UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Components: []cloudprotocol.ComponentStatus{}, Layers: []cloudprotocol.LayerStatus{ - {ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.RemovedStatus}, - {ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.RemovedStatus}, - {ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.RemovedStatus}, - {ID: "layer3", Digest: "digest3", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "layer4", Digest: "digest4", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.RemovedStatus}, + {LayerID: "layer3", Digest: "digest3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer4", Digest: "digest4", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, { - ID: "layer5", Digest: "digest5", AosVersion: 1, Status: cloudprotocol.ErrorStatus, + LayerID: "layer5", Digest: "digest5", Version: "1.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: softwareUpdater.UpdateError.Error()}, }, }, @@ -455,16 +459,16 @@ func TestUpdateLayers(t *testing.T) { statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Layers: []cloudprotocol.LayerInfo{ { - ID: "layer3", Digest: "digest3", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{3}}, + LayerID: "layer3", Digest: "digest3", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{3}}, }, { - ID: "layer4", Digest: "digest4", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{4}}, + LayerID: "layer4", Digest: "digest4", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{4}}, }, { - ID: "layer5", Digest: "digest5", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{5}}, + LayerID: "layer5", Digest: "digest5", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{5}}, }, }, }) @@ -473,6 +477,19 @@ func TestUpdateLayers(t *testing.T) { t.Errorf("Wait run instances error: %v", err) } + softwareUpdater.AllLayers = []unitstatushandler.LayerStatus{ + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer3", Digest: "digest3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {LayerStatus: cloudprotocol.LayerStatus{ + LayerID: "layer4", Digest: "digest4", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + if receivedUnitStatus, err = sender.WaitForStatus(waitStatusTimeout); err != nil { t.Fatalf("Can't receive unit status: %s", err) } @@ -483,27 +500,17 @@ func TestUpdateLayers(t *testing.T) { } func TestUpdateServices(t *testing.T) { - serviceStatuses := []unitstatushandler.ServiceStatus{ - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service0", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service1", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service2", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - } unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) - softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(serviceStatuses, nil) + softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -513,7 +520,19 @@ func TestUpdateServices(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + softwareUpdater.AllServices = []unitstatushandler.ServiceStatus{ + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -528,26 +547,26 @@ func TestUpdateServices(t *testing.T) { Components: []cloudprotocol.ComponentStatus{}, Layers: []cloudprotocol.LayerStatus{}, Services: []cloudprotocol.ServiceStatus{ - {ID: "service0", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "service1", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "service2", Status: cloudprotocol.RemovedStatus}, - {ID: "service3", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service2", Version: "0.0.0", Status: cloudprotocol.RemovedStatus}, + {ServiceID: "service3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, }, } statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Services: []cloudprotocol.ServiceInfo{ { - ID: "service0", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{0}}, + ServiceID: "service0", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{0}}, }, { - ID: "service1", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{1}}, + ServiceID: "service1", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, }, { - ID: "service3", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{3}}, + ServiceID: "service3", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{3}}, }, }, }) @@ -556,7 +575,19 @@ func TestUpdateServices(t *testing.T) { t.Errorf("Wait run instances error: %v", err) } - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + softwareUpdater.AllServices = []unitstatushandler.ServiceStatus{ + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + {ServiceStatus: cloudprotocol.ServiceStatus{ + ServiceID: "service3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus, + }}, + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -571,20 +602,6 @@ func TestUpdateServices(t *testing.T) { // failed update - softwareUpdater.AllServices = []unitstatushandler.ServiceStatus{ - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service0", AosVersion: 0, Status: cloudprotocol.InstalledStatus, - }}, - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service1", AosVersion: 1, Status: cloudprotocol.InstalledStatus, - }}, - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service2", AosVersion: 0, Status: cloudprotocol.RemovedStatus, - }}, - {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service3", AosVersion: 1, Status: cloudprotocol.InstalledStatus, - }}, - } softwareUpdater.UpdateError = aoserrors.New("some error occurs") expectedUnitStatus = cloudprotocol.UnitStatus{ @@ -593,18 +610,17 @@ func TestUpdateServices(t *testing.T) { Layers: []cloudprotocol.LayerStatus{}, Services: []cloudprotocol.ServiceStatus{ { - ID: "service0", AosVersion: 0, Status: cloudprotocol.ErrorStatus, + ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: softwareUpdater.UpdateError.Error()}, }, - {ID: "service1", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, - {ID: "service2", Status: cloudprotocol.RemovedStatus}, - {ID: "service3", AosVersion: 1, Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service1", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service3", Version: "1.0.0", Status: cloudprotocol.InstalledStatus}, { - ID: "service3", AosVersion: 2, Status: cloudprotocol.ErrorStatus, + ServiceID: "service3", Version: "2.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: softwareUpdater.UpdateError.Error()}, }, { - ID: "service4", AosVersion: 2, Status: cloudprotocol.ErrorStatus, + ServiceID: "service4", Version: "2.0.0", Status: cloudprotocol.ErrorStatus, ErrorInfo: &cloudprotocol.ErrorInfo{Message: softwareUpdater.UpdateError.Error()}, }, }, @@ -613,16 +629,16 @@ func TestUpdateServices(t *testing.T) { statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Services: []cloudprotocol.ServiceInfo{ { - ID: "service1", VersionInfo: aostypes.VersionInfo{AosVersion: 1}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{1}}, + ServiceID: "service1", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{1}}, }, { - ID: "service3", VersionInfo: aostypes.VersionInfo{AosVersion: 2}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{3}}, + ServiceID: "service3", Version: "2.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{3}}, }, { - ID: "service4", VersionInfo: aostypes.VersionInfo{AosVersion: 2}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{Sha256: []byte{4}}, + ServiceID: "service4", Version: "2.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{4}}, }, }, }) @@ -631,6 +647,10 @@ func TestUpdateServices(t *testing.T) { t.Errorf("Wait run instances error: %v", err) } + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + if receivedUnitStatus, err = sender.WaitForStatus(waitStatusTimeout); err != nil { t.Fatalf("Can't receive unit status: %s", err) } @@ -642,15 +662,16 @@ func TestUpdateServices(t *testing.T) { func TestRunInstances(t *testing.T) { unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %v", err) } @@ -662,15 +683,16 @@ func TestRunInstances(t *testing.T) { initialInstancesStatus := []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, + ServiceVersion: "1.0.0", }, } - if err := statusHandler.ProcessRunStatus( - unitstatushandler.RunInstancesStatus{Instances: initialInstancesStatus}); err != nil { + if err := statusHandler.ProcessRunStatus(initialInstancesStatus); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -711,24 +733,28 @@ func TestRunInstances(t *testing.T) { updatedInstancesStatus := []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, + ServiceVersion: "1.0.0", }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 2}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 2}, + ServiceVersion: "1.0.0", }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj2", Instance: 0}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj2", Instance: 0}, + ServiceVersion: "1.0.0", }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", }, } - if err := statusHandler.ProcessRunStatus( - unitstatushandler.RunInstancesStatus{Instances: updatedInstancesStatus}); err != nil { + if err := statusHandler.ProcessRunStatus(updatedInstancesStatus); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -756,17 +782,18 @@ func TestRunInstances(t *testing.T) { } } -func TestUpdateInstancesStatus(t *testing.T) { +func TestRevertServices(t *testing.T) { unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) instanceRunner := unitstatushandler.NewTestInstanceRunner() sender := unitstatushandler.NewTestSender() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, unitstatushandler.NewTestDownloader(), - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %v", err) } @@ -776,18 +803,134 @@ func TestUpdateInstancesStatus(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus( - unitstatushandler.RunInstancesStatus{Instances: []cloudprotocol.InstanceStatus{ - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, - }, + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + + if _, err = sender.WaitForStatus(waitStatusTimeout); err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + // success run + + expectedRunInstances := []cloudprotocol.InstanceInfo{ + {ServiceID: "service0", SubjectID: "subject0", NumInstances: 3}, + } + + statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ + Instances: expectedRunInstances, + Services: []cloudprotocol.ServiceInfo{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, AosVersion: 1, + ServiceID: "service0", Version: "1.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{Sha256: []byte{0}}, }, + }, + }) + + instancesStatus := []cloudprotocol.InstanceStatus{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subject0", Instance: 0}, + ServiceVersion: "1.0.0", + Status: cloudprotocol.InstanceStateFailed, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subject0", Instance: 1}, + ServiceVersion: "1.0.0", + Status: cloudprotocol.InstanceStateFailed, + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "service0", SubjectID: "subject0", Instance: 2}, + ServiceVersion: "1.0.0", + Status: cloudprotocol.InstanceStateFailed, + }, + } + + receivedRunInstances, err := instanceRunner.WaitForRunInstance(waitRunInstanceTimeout) + if err != nil { + t.Fatalf("Can't receive run instances: %v", err) + } + + if !reflect.DeepEqual(receivedRunInstances, expectedRunInstances) { + t.Error("Incorrect run instances") + } + + if err := statusHandler.ProcessRunStatus(instancesStatus); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + + receivedRunInstances, err = instanceRunner.WaitForRunInstance(waitRunInstanceTimeout) + if err != nil { + t.Fatalf("Can't receive run instances: %v", err) + } + + if !reflect.DeepEqual(receivedRunInstances, expectedRunInstances) { + t.Error("Incorrect run instances") + } + + if err := statusHandler.ProcessRunStatus(instancesStatus); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + + receivedUnitStatus, err := sender.WaitForStatus(waitStatusTimeout) + if err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + expectedUnitStatus := cloudprotocol.UnitStatus{ + UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, + Services: []cloudprotocol.ServiceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, AosVersion: 1, + ServiceID: "service0", Version: "1.0.0", Status: cloudprotocol.ErrorStatus, + ErrorInfo: &cloudprotocol.ErrorInfo{Message: "can't run any instances of service"}, }, - }}); err != nil { + }, + Instances: instancesStatus, + } + + if err = compareUnitStatus(receivedUnitStatus, expectedUnitStatus); err != nil { + t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) + } + + if !reflect.DeepEqual(softwareUpdater.RevertedServices, []string{"service0"}) { + t.Errorf("Incorrect reverted services: %v", softwareUpdater.RevertedServices) + } +} + +func TestUpdateInstancesStatus(t *testing.T) { + unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) + firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) + softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) + instanceRunner := unitstatushandler.NewTestInstanceRunner() + sender := unitstatushandler.NewTestSender() + + statusHandler, err := unitstatushandler.New( + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) + if err != nil { + t.Fatalf("Can't create unit status handler: %v", err) + } + defer statusHandler.Close() + + sender.Consumer.CloudConnected() + + go handleUpdateStatus(statusHandler) + + if err := statusHandler.ProcessRunStatus([]cloudprotocol.InstanceStatus{ + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, + ServiceVersion: "1.0.0", + }, + { + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, + ServiceVersion: "1.0.0", + }, + }); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -796,30 +939,31 @@ func TestUpdateInstancesStatus(t *testing.T) { } expectedUnitStatus := cloudprotocol.UnitStatus{ - UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Instances: []cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, - RunState: "fail", ErrorInfo: &cloudprotocol.ErrorInfo{Message: "someError"}, - }, - { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 1}, AosVersion: 1, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", + Status: "fail", ErrorInfo: &cloudprotocol.ErrorInfo{Message: "someError"}, }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, AosVersion: 1, - StateChecksum: "newState", + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, + ServiceVersion: "1.0.0", + StateChecksum: "newState", }, }, + IsDeltaInfo: true, } statusHandler.ProcessUpdateInstanceStatus([]cloudprotocol.InstanceStatus{ { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, AosVersion: 1, - RunState: "fail", ErrorInfo: &cloudprotocol.ErrorInfo{Message: "someError"}, + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv1", SubjectID: "Subj1", Instance: 0}, + ServiceVersion: "1.0.0", + Status: "fail", ErrorInfo: &cloudprotocol.ErrorInfo{Message: "someError"}, }, { - InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, AosVersion: 1, - StateChecksum: "newState", + InstanceIdent: aostypes.InstanceIdent{ServiceID: "Serv2", SubjectID: "Subj2", Instance: 1}, + ServiceVersion: "1.0.0", + StateChecksum: "newState", }, }) @@ -836,37 +980,37 @@ func TestUpdateInstancesStatus(t *testing.T) { func TestUpdateCachedSOTA(t *testing.T) { serviceStatuses := []unitstatushandler.ServiceStatus{ {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service0", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service1", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + ServiceID: "service1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service2", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + ServiceID: "service2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {ServiceStatus: cloudprotocol.ServiceStatus{ - ID: "service4", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + ServiceID: "service4", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }, Cached: true}, } layerStatuses := []unitstatushandler.LayerStatus{ {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + LayerID: "layer0", Digest: "digest0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + LayerID: "layer2", Digest: "digest2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer4", Digest: "digest4", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + LayerID: "layer4", Digest: "digest4", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }, Cached: true}, {LayerStatus: cloudprotocol.LayerStatus{ - ID: "layer5", Digest: "digest5", AosVersion: 0, Status: cloudprotocol.InstalledStatus, + LayerID: "layer5", Digest: "digest5", Version: "0.0.0", Status: cloudprotocol.InstalledStatus, }, Cached: true}, } unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( - cloudprotocol.UnitConfigStatus{VendorVersion: "1.0", Status: cloudprotocol.InstalledStatus}) + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(serviceStatuses, layerStatuses) instanceRunner := unitstatushandler.NewTestInstanceRunner() @@ -874,8 +1018,9 @@ func TestUpdateCachedSOTA(t *testing.T) { downloader := unitstatushandler.NewTestDownloader() statusHandler, err := unitstatushandler.New( - cfg, unitConfigUpdater, firmwareUpdater, softwareUpdater, instanceRunner, downloader, - unitstatushandler.NewTestStorage(), sender) + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, downloader, unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) if err != nil { t.Fatalf("Can't create unit status handler: %s", err) } @@ -885,7 +1030,7 @@ func TestUpdateCachedSOTA(t *testing.T) { go handleUpdateStatus(statusHandler) - if err := statusHandler.ProcessRunStatus(unitstatushandler.RunInstancesStatus{}); err != nil { + if err := statusHandler.ProcessRunStatus(nil); err != nil { t.Fatalf("Can't process run status: %v", err) } @@ -897,68 +1042,76 @@ func TestUpdateCachedSOTA(t *testing.T) { UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, Components: []cloudprotocol.ComponentStatus{}, Layers: []cloudprotocol.LayerStatus{ - {ID: "layer0", Digest: "digest0", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "layer1", Digest: "digest1", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "layer2", Digest: "digest2", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "layer3", Digest: "digest3", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "layer5", Digest: "digest5", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer0", Digest: "digest0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer1", Digest: "digest1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer2", Digest: "digest2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer3", Digest: "digest3", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {LayerID: "layer5", Digest: "digest5", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, }, Services: []cloudprotocol.ServiceStatus{ - {ID: "service0", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "service1", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "service2", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "service3", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, - {ID: "service4", AosVersion: 0, Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service0", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service1", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service2", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service3", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, + {ServiceID: "service4", Version: "0.0.0", Status: cloudprotocol.InstalledStatus}, }, } statusHandler.ProcessDesiredStatus(cloudprotocol.DesiredStatus{ Services: []cloudprotocol.ServiceInfo{ { - ID: "service0", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"service0"}, Sha256: []byte{0}}, + ServiceID: "service0", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"service0"}, Sha256: []byte{0}}, }, { - ID: "service1", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"service1"}, Sha256: []byte{1}}, + ServiceID: "service1", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"service1"}, Sha256: []byte{1}}, }, { - ID: "service2", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"service2"}, Sha256: []byte{2}}, + ServiceID: "service2", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"service2"}, Sha256: []byte{2}}, }, { - ID: "service3", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"service3"}, Sha256: []byte{3}}, + ServiceID: "service3", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"service3"}, Sha256: []byte{3}}, }, { - ID: "service4", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"service3"}, Sha256: []byte{3}}, + ServiceID: "service4", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"service3"}, Sha256: []byte{3}}, }, }, Layers: []cloudprotocol.LayerInfo{ { - ID: "layer0", Digest: "digest0", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"layer0"}, Sha256: []byte{0}}, + LayerID: "layer0", Digest: "digest0", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"layer0"}, Sha256: []byte{0}}, }, { - ID: "layer1", Digest: "digest1", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"layer1"}, Sha256: []byte{1}}, + LayerID: "layer1", Digest: "digest1", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"layer1"}, Sha256: []byte{1}}, }, { - ID: "layer2", Digest: "digest2", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"layer2"}, Sha256: []byte{2}}, + LayerID: "layer2", Digest: "digest2", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"layer2"}, Sha256: []byte{2}}, }, { - ID: "layer3", Digest: "digest3", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"layer3"}, Sha256: []byte{3}}, + LayerID: "layer3", Digest: "digest3", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"layer3"}, Sha256: []byte{3}}, }, { - ID: "layer5", Digest: "digest5", VersionInfo: aostypes.VersionInfo{AosVersion: 0}, - DecryptDataStruct: cloudprotocol.DecryptDataStruct{URLs: []string{"layer5"}, Sha256: []byte{3}}, + LayerID: "layer5", Digest: "digest5", Version: "0.0.0", + DownloadInfo: cloudprotocol.DownloadInfo{URLs: []string{"layer5"}, Sha256: []byte{3}}, }, }, }) + if _, err := instanceRunner.WaitForRunInstance(waitRunInstanceTimeout); err != nil { + t.Errorf("Wait run instances error: %v", err) + } + + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + receivedUnitStatus, err := sender.WaitForStatus(waitStatusTimeout) if err != nil { t.Fatalf("Can't receive unit status: %s", err) @@ -979,6 +1132,148 @@ func TestUpdateCachedSOTA(t *testing.T) { } } +func TestNewComponents(t *testing.T) { + unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) + firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) + softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) + instanceRunner := unitstatushandler.NewTestInstanceRunner() + sender := unitstatushandler.NewTestSender() + + statusHandler, err := unitstatushandler.New( + cfg, unitstatushandler.NewTestNodeManager(nil), unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) + if err != nil { + t.Fatalf("Can't create unit status handler: %v", err) + } + defer statusHandler.Close() + + sender.Consumer.CloudConnected() + + go handleUpdateStatus(statusHandler) + + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + + receivedUnitStatus, err := sender.WaitForStatus(waitStatusTimeout) + if err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + expectedUnitStatus := cloudprotocol.UnitStatus{ + UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, + } + + if err = compareUnitStatus(receivedUnitStatus, expectedUnitStatus); err != nil { + t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) + } + + // New components + + newComponents := []cloudprotocol.ComponentStatus{ + { + ComponentID: "comp1", ComponentType: "type1", Version: "1.0.0", + Status: cloudprotocol.InstalledStatus, NodeID: "node1", + }, + { + ComponentID: "comp2", ComponentType: "type2", Version: "1.0.0", + Status: cloudprotocol.InstalledStatus, NodeID: "node2", + }, + { + ComponentID: "comp3", ComponentType: "type3", Version: "1.0.0", + Status: cloudprotocol.InstalledStatus, NodeID: "node3", + }, + } + + firmwareUpdater.SetNewComponents(newComponents) + + receivedUnitStatus, err = sender.WaitForStatus(waitStatusTimeout) + if err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + expectedUnitStatus = cloudprotocol.UnitStatus{ + Components: newComponents, + IsDeltaInfo: true, + } + + if err = compareUnitStatus(receivedUnitStatus, expectedUnitStatus); err != nil { + t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) + } +} + +func TestNodeInfoChanged(t *testing.T) { + unitConfigUpdater := unitstatushandler.NewTestUnitConfigUpdater( + cloudprotocol.UnitConfigStatus{Version: "1.0.0", Status: cloudprotocol.InstalledStatus}) + firmwareUpdater := unitstatushandler.NewTestFirmwareUpdater(nil) + softwareUpdater := unitstatushandler.NewTestSoftwareUpdater(nil, nil) + instanceRunner := unitstatushandler.NewTestInstanceRunner() + sender := unitstatushandler.NewTestSender() + nodeInfoProvider := unitstatushandler.NewTestNodeManager([]cloudprotocol.NodeInfo{ + {NodeID: "node1", NodeType: "type1", Status: cloudprotocol.NodeStatusProvisioned}, + {NodeID: "node2", NodeType: "type2", Status: cloudprotocol.NodeStatusProvisioned}, + }) + + statusHandler, err := unitstatushandler.New( + cfg, nodeInfoProvider, unitConfigUpdater, firmwareUpdater, softwareUpdater, + instanceRunner, unitstatushandler.NewTestDownloader(), unitstatushandler.NewTestStorage(), sender, + unitstatushandler.NewTestSystemQuotaAlertProvider()) + if err != nil { + t.Fatalf("Can't create unit status handler: %v", err) + } + defer statusHandler.Close() + + sender.Consumer.CloudConnected() + + go handleUpdateStatus(statusHandler) + + if err := statusHandler.ProcessRunStatus(nil); err != nil { + t.Fatalf("Can't process run status: %v", err) + } + + receivedUnitStatus, err := sender.WaitForStatus(waitStatusTimeout) + if err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + expectedUnitStatus := cloudprotocol.UnitStatus{ + UnitConfig: []cloudprotocol.UnitConfigStatus{unitConfigUpdater.UnitConfigStatus}, + Nodes: nodeInfoProvider.GetAllNodesInfo(), + } + + if err = compareUnitStatus(receivedUnitStatus, expectedUnitStatus); err != nil { + t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) + } + + // New nodes info + + newNodesInfo := []cloudprotocol.NodeInfo{ + {NodeID: "node1", NodeType: "type1", Status: cloudprotocol.NodeStatusPaused}, + {NodeID: "node2", NodeType: "type2", Status: cloudprotocol.NodeStatusProvisioned}, + {NodeID: "node3", NodeType: "type3", Status: cloudprotocol.NodeStatusProvisioned}, + } + + for _, newNodeInfo := range newNodesInfo { + nodeInfoProvider.NodeInfoChanged(newNodeInfo) + } + + receivedUnitStatus, err = sender.WaitForStatus(waitStatusTimeout) + if err != nil { + t.Fatalf("Can't receive unit status: %v", err) + } + + expectedUnitStatus = cloudprotocol.UnitStatus{ + Nodes: newNodesInfo, + IsDeltaInfo: true, + } + + if err = compareUnitStatus(receivedUnitStatus, expectedUnitStatus); err != nil { + t.Errorf("Wrong unit status received: %v, expected: %v", receivedUnitStatus, expectedUnitStatus) + } +} + /*********************************************************************************************************************** * Private **********************************************************************************************************************/ @@ -1045,11 +1340,32 @@ func compareUnitStatus(status1, status2 cloudprotocol.UnitStatus) (err error) { if err = compareStatus(len(status1.Services), len(status2.Services), func(index1, index2 int) (result bool) { + status1.Services[index1].ErrorInfo = nil + status2.Services[index2].ErrorInfo = nil + return reflect.DeepEqual(status1.Services[index1], status2.Services[index2]) }); err != nil { return aoserrors.Wrap(err) } + if err = compareStatus(len(status1.Instances), len(status2.Instances), + func(index1, index2 int) (result bool) { + return reflect.DeepEqual(status1.Instances[index1], status2.Instances[index2]) + }); err != nil { + return aoserrors.Wrap(err) + } + + if err = compareStatus(len(status1.Nodes), len(status2.Nodes), + func(index1, index2 int) (result bool) { + return reflect.DeepEqual(status1.Nodes[index1], status2.Nodes[index2]) + }); err != nil { + return aoserrors.Wrap(err) + } + + if status1.IsDeltaInfo != status2.IsDeltaInfo { + return aoserrors.New("IsDeltaInfo mismatch") + } + return nil } @@ -1068,3 +1384,7 @@ func handleUpdateStatus(handler *unitstatushandler.Instance) { } } } + +func convertToComponentID(id string) *string { + return &id +} diff --git a/unitstatushandler/updatestatemachine.go b/unitstatushandler/updatestatemachine.go index 3f3e27ef..4eeaef2d 100644 --- a/unitstatushandler/updatestatemachine.go +++ b/unitstatushandler/updatestatemachine.go @@ -45,6 +45,7 @@ const ( const ( eventStartDownload = "startDownload" eventFinishDownload = "finishDownload" + eventReadyToUpdate = "readyToUpdate" eventStartUpdate = "startUpdate" eventFinishUpdate = "finishUpdate" eventCancel = "cancel" @@ -68,7 +69,7 @@ type updateStateMachine struct { } type updateManager interface { - stateChanged(event, state, updateErr string) + stateChanged(event, state string, updateErr error) download(ctx context.Context) readyToUpdate() update(ctx context.Context) @@ -145,13 +146,13 @@ func (stateMachine *updateStateMachine) canTransit(event string) (result bool) { return stateMachine.fsm.Can(event) } -func (stateMachine *updateStateMachine) sendEvent(event string, managerErr string) (err error) { +func (stateMachine *updateStateMachine) sendEvent(event string, managerErr error) (err error) { if stateMachine.canTransit(event) { stateMachine.cancel() } if err = stateMachine.fsm.Event(context.Background(), event, managerErr); err != nil { - log.Errorf("Can't send event: %s", err) + log.Errorf("Can't send event: %v", err) return aoserrors.Wrap(err) } @@ -180,23 +181,25 @@ func (stateMachine *updateStateMachine) scheduleUpdate(schedule cloudprotocol.Sc stateMachine.updateTimer = time.AfterFunc(updateTime, func() { if err := stateMachine.manager.startUpdate(); err != nil { - log.Errorf("Can't start update: %s", err) + log.Errorf("Can't start update: %v", err) } }) } -func (stateMachine *updateStateMachine) finishOperation(ctx context.Context, finishEvent string, operationErr string) { +func (stateMachine *updateStateMachine) finishOperation(ctx context.Context, finishEvent string, operationErr error) { // Do nothing if context canceled if ctx.Err() != nil { return } if err := stateMachine.sendEvent(finishEvent, operationErr); err != nil { - log.Errorf("Can't send finish event: %s", err) + log.Errorf("Can't send finish event: %v", err) } } -func (stateMachine *updateStateMachine) startNewUpdate(ttlTime time.Duration) (ttlDate time.Time, err error) { +func (stateMachine *updateStateMachine) startNewUpdate( + ttlTime time.Duration, downloadRequired bool, +) (ttlDate time.Time, err error) { if ttlTime == 0 { ttlTime = stateMachine.defaultTTL } @@ -207,8 +210,14 @@ func (stateMachine *updateStateMachine) startNewUpdate(ttlTime time.Duration) (t stateMachine.setTTLTimer(ttlTime) } - if err = stateMachine.sendEvent(eventStartDownload, ""); err != nil { - return ttlDate, aoserrors.Wrap(err) + if downloadRequired { + if err = stateMachine.sendEvent(eventStartDownload, nil); err != nil { + return ttlDate, aoserrors.Wrap(err) + } + } else { + if err = stateMachine.sendEvent(eventReadyToUpdate, nil); err != nil { + return ttlDate, aoserrors.Wrap(err) + } } return ttlDate, nil @@ -249,11 +258,11 @@ func (stateMachine *updateStateMachine) cancel() { } func (stateMachine *updateStateMachine) onBeforeEvent(ctx context.Context, event *fsm.Event) { - var managerErr string + var managerErr error if len(event.Args) != 0 { - if errorStr, ok := event.Args[0].(string); ok { - managerErr = errorStr + if err, ok := event.Args[0].(error); ok { + managerErr = err } } diff --git a/vendor/github.com/aosedge/aos_common/aostypes/aostypes.go b/vendor/github.com/aosedge/aos_common/aostypes/aostypes.go index f176fa45..3cc2c9b5 100644 --- a/vendor/github.com/aosedge/aos_common/aostypes/aostypes.go +++ b/vendor/github.com/aosedge/aos_common/aostypes/aostypes.go @@ -46,6 +46,21 @@ const ( monthDuration = yearDuration / 12 ) +// Partition types. +const ( + GenericPartition = "generic" + StoragesPartition = "storages" + StatesPartition = "states" + ServicesPartition = "services" + LayersPartition = "layers" +) + +// BalancingPolicy types. +const ( + BalancingEnabled = "enabled" + BalancingDisabled = "disabled" +) + /*********************************************************************************************************************** * Types **********************************************************************************************************************/ @@ -60,103 +75,25 @@ type Time struct { time.Time } -// AlertRuleParam describes alert rule. -type AlertRuleParam struct { - MinTimeout Duration `json:"minTimeout"` - MinThreshold uint64 `json:"minThreshold"` - MaxThreshold uint64 `json:"maxThreshold"` -} - -// PartitionAlertRuleParam describes alert rule. -type PartitionAlertRuleParam struct { - AlertRuleParam - Name string `json:"name"` -} - -// AlertRules define service monitoring alerts rules. -type AlertRules struct { - RAM *AlertRuleParam `json:"ram,omitempty"` - CPU *AlertRuleParam `json:"cpu,omitempty"` - UsedDisks []PartitionAlertRuleParam `json:"usedDisks,omitempty"` - InTraffic *AlertRuleParam `json:"inTraffic,omitempty"` - OutTraffic *AlertRuleParam `json:"outTraffic,omitempty"` -} - -// FileSystemMount specifies a mount instructions. -type FileSystemMount struct { - Destination string `json:"destination"` - Type string `json:"type,omitempty"` - Source string `json:"source,omitempty"` - Options []string `json:"options,omitempty"` -} - -// Host struct represents entry in /etc/hosts. -type Host struct { - IP string `json:"ip"` - Hostname string `json:"hostname"` -} - -// DeviceInfo device information. -type DeviceInfo struct { - Name string `json:"name"` - SharedCount int `json:"sharedCount,omitempty"` - Groups []string `json:"groups,omitempty"` - HostDevices []string `json:"hostDevices"` -} - -// ResourceInfo resource information. -type ResourceInfo struct { - Name string `json:"name"` - Groups []string `json:"groups,omitempty"` - Mounts []FileSystemMount `json:"mounts,omitempty"` - Env []string `json:"env,omitempty"` - Hosts []Host `json:"hosts,omitempty"` -} - -// NodeConfig node configuration. -type NodeUnitConfig struct { - NodeType string `json:"nodeType"` - Devices []DeviceInfo `json:"devices,omitempty"` - Resources []ResourceInfo `json:"resources,omitempty"` - Labels []string `json:"labels,omitempty"` - Priority uint32 `json:"priority,omitempty"` -} - -// UnitConfig board configuration. -type UnitConfig struct { - FormatVersion uint64 `json:"formatVersion"` - VendorVersion string `json:"vendorVersion"` - Nodes []NodeUnitConfig `json:"nodes"` -} - // ServiceInfo service info. type ServiceInfo struct { - VersionInfo - ID string `json:"id"` + ServiceID string `json:"serviceId"` ProviderID string `json:"providerId"` + Version string `json:"version"` GID uint32 `json:"gid"` URL string `json:"url"` Sha256 []byte `json:"sha256"` - Sha512 []byte `json:"sha512"` Size uint64 `json:"size"` } // LayerInfo layer info. type LayerInfo struct { - VersionInfo - ID string `json:"id"` - Digest string `json:"digest"` - URL string `json:"url"` - Sha256 []byte `json:"sha256"` - Sha512 []byte `json:"sha512"` - Size uint64 `json:"size"` -} - -// VersionInfo common version structure. -type VersionInfo struct { - AosVersion uint64 `json:"aosVersion"` - VendorVersion string `json:"vendorVersion"` - Description string `json:"description"` + LayerID string `json:"layerId"` + Digest string `json:"digest"` + Version string `json:"version"` + URL string `json:"url"` + Sha256 []byte `json:"sha256"` + Size uint64 `json:"size"` } // InstanceIdent instance identification information. @@ -176,12 +113,12 @@ type FirewallRule struct { // NetworkParameters networks parameters. type NetworkParameters struct { - NetworkID string - Subnet string - IP string - VlanID uint64 - DNSServers []string - FirewallRules []FirewallRule + NetworkID string `json:"networkId"` + Subnet string `json:"subnet"` + IP string `json:"ip"` + VlanID uint64 `json:"vlanId"` + DNSServers []string `json:"dnsServers"` + FirewallRules []FirewallRule `json:"firewallRules"` } // InstanceInfo instance information to start it. @@ -208,7 +145,7 @@ type ServiceDevice struct { // ServiceQuotas service quotas representation. type ServiceQuotas struct { - CPULimit *uint64 `json:"cpuLimit,omitempty"` + CPUDMIPSLimit *uint64 `json:"cpuDmipsLimit,omitempty"` RAMLimit *uint64 `json:"ramLimit,omitempty"` PIDsLimit *uint64 `json:"pidsLimit,omitempty"` NoFileLimit *uint64 `json:"noFileLimit,omitempty"` @@ -228,21 +165,86 @@ type RunParameters struct { RestartInterval Duration `json:"restartInterval,omitempty"` } +// AlertRulePercents describes alert rule. +type AlertRulePercents struct { + MinTimeout Duration `json:"minTimeout"` + MinThreshold float64 `json:"minThreshold"` + MaxThreshold float64 `json:"maxThreshold"` +} + +// AlertRulePoints describes alert rule. +type AlertRulePoints struct { + MinTimeout Duration `json:"minTimeout"` + MinThreshold uint64 `json:"minThreshold"` + MaxThreshold uint64 `json:"maxThreshold"` +} + +// PartitionAlertRule describes alert rule. +type PartitionAlertRule struct { + AlertRulePercents + Name string `json:"name"` +} + +// AlertRules define service monitoring alerts rules. +type AlertRules struct { + RAM *AlertRulePercents `json:"ram,omitempty"` + CPU *AlertRulePercents `json:"cpu,omitempty"` + UsedDisks []PartitionAlertRule `json:"usedDisks,omitempty"` + Download *AlertRulePoints `json:"download,omitempty"` + Upload *AlertRulePoints `json:"upload,omitempty"` +} + +// ResourceRatiosInfo resource ratios info. +type ResourceRatiosInfo struct { + CPU *float64 `json:"cpu"` + RAM *float64 `json:"ram"` + Storage *float64 `json:"storage"` +} + // ServiceConfig Aos service configuration. type ServiceConfig struct { Created time.Time `json:"created"` Author string `json:"author"` Hostname *string `json:"hostname,omitempty"` - Runner string `json:"runner"` + BalancingPolicy string `json:"balancingPolicy"` + Runners []string `json:"runners"` + RunParameters RunParameters `json:"runParameters,omitempty"` Sysctl map[string]string `json:"sysctl,omitempty"` OfflineTTL Duration `json:"offlineTtl,omitempty"` Quotas ServiceQuotas `json:"quotas"` + ResourceRatios *ResourceRatiosInfo `json:"resourceRatios"` AllowedConnections map[string]struct{} `json:"allowedConnections,omitempty"` Devices []ServiceDevice `json:"devices,omitempty"` Resources []string `json:"resources,omitempty"` Permissions map[string]map[string]string `json:"permissions,omitempty"` AlertRules *AlertRules `json:"alertRules,omitempty"` - RunParameters RunParameters `json:"runParameters,omitempty"` +} + +// PartitionUsage partition usage information. +type PartitionUsage struct { + Name string `json:"name"` + UsedSize uint64 `json:"usedSize"` +} + +// MonitoringData monitoring data. +type MonitoringData struct { + Timestamp time.Time `json:"timestamp"` + RAM uint64 `json:"ram"` + CPU uint64 `json:"cpu"` + Download uint64 `json:"download"` + Upload uint64 `json:"upload"` + Disk []PartitionUsage `json:"disk"` +} + +type InstanceMonitoring struct { + InstanceIdent + MonitoringData +} + +type NodeMonitoring struct { + NodeID string `json:"nodeId"` + NodeData MonitoringData `json:"nodeData"` + InstancesData []InstanceMonitoring `json:"instancesData"` } /*********************************************************************************************************************** @@ -289,7 +291,7 @@ func (t *Time) UnmarshalJSON(b []byte) (err error) { return aoserrors.Errorf(errFormat, value) } - intFields := make([]int, 3) //nolint:gomnd //time format has 3 fields HH:MM:SS + intFields := make([]int, 3) //nolint:mnd //time format has 3 fields HH:MM:SS for i, field := range strFields { if intFields[i], err = strconv.Atoi(field); err != nil { @@ -325,7 +327,7 @@ func (d *Duration) UnmarshalJSON(b []byte) (err error) { switch value := v.(type) { case float64: - d.Duration = time.Duration(value) + d.Duration = time.Duration(int64(value*float64(time.Second) + 0.5)) return nil diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/alerts.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/alerts.go new file mode 100644 index 00000000..a925d5b3 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/alerts.go @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import ( + "time" + + "github.com/aosedge/aos_common/aostypes" +) + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// AlertsMessageType alerts message type. +const AlertsMessageType = "alerts" + +// Alert tags. +const ( + AlertTagSystemError = "systemAlert" + AlertTagAosCore = "coreAlert" + AlertTagResourceValidate = "resourceValidateAlert" + AlertTagDeviceAllocate = "deviceAllocateAlert" + AlertTagSystemQuota = "systemQuotaAlert" + AlertTagInstanceQuota = "instanceQuotaAlert" + AlertTagDownloadProgress = "downloadProgressAlert" + AlertTagServiceInstance = "serviceInstanceAlert" +) + +// Download target types. +const ( + DownloadTargetComponent = "component" + DownloadTargetLayer = "layer" + DownloadTargetService = "service" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// AlertItem common alert data. +type AlertItem struct { + Timestamp time.Time `json:"timestamp"` + Tag string `json:"tag"` +} + +// SystemAlert system alert structure. +type SystemAlert struct { + AlertItem + NodeID string `json:"nodeId"` + Message string `json:"message"` +} + +// CoreAlert system alert structure. +type CoreAlert struct { + AlertItem + NodeID string `json:"nodeId"` + CoreComponent string `json:"coreComponent"` + Message string `json:"message"` +} + +// DownloadAlert download alert structure. +type DownloadAlert struct { + AlertItem + TargetType string `json:"targetType"` + TargetID string `json:"targetId"` + Version string `json:"version"` + Message string `json:"message"` + URL string `json:"url"` + DownloadedBytes string `json:"downloadedBytes"` + TotalBytes string `json:"totalBytes"` +} + +// SystemQuotaAlert system quota alert structure. +type SystemQuotaAlert struct { + AlertItem + NodeID string `json:"nodeId"` + Parameter string `json:"parameter"` + Value uint64 `json:"value"` + Status string `json:"-"` +} + +// InstanceQuotaAlert instance quota alert structure. +type InstanceQuotaAlert struct { + AlertItem + aostypes.InstanceIdent + Parameter string `json:"parameter"` + Value uint64 `json:"value"` + Status string `json:"-"` +} + +// DeviceAllocateAlert device allocate alert structure. +type DeviceAllocateAlert struct { + AlertItem + aostypes.InstanceIdent + NodeID string `json:"nodeId"` + Device string `json:"device"` + Message string `json:"message"` +} + +// ResourceValidateAlert resource validate alert structure. +type ResourceValidateAlert struct { + AlertItem + NodeID string `json:"nodeId"` + Name string `json:"name"` + Errors []ErrorInfo `json:"errors"` +} + +// ServiceInstanceAlert system alert structure. +type ServiceInstanceAlert struct { + AlertItem + aostypes.InstanceIdent + ServiceVersion string `json:"version"` + Message string `json:"message"` +} + +// Alerts alerts message structure. +type Alerts struct { + MessageType string `json:"messageType"` + Items []interface{} `json:"items"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/certificates.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/certificates.go new file mode 100644 index 00000000..526d8d54 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/certificates.go @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import "time" + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// Certificate message types. +const ( + RenewCertsNotificationMessageType = "renewCertificatesNotification" + IssuedUnitCertsMessageType = "issuedUnitCertificates" + IssueUnitCertsMessageType = "issueUnitCertificates" + InstallUnitCertsConfirmationMessageType = "installUnitCertificatesConfirmation" +) + +// UnitSecretVersion specifies supported version of UnitSecret message. +const UnitSecretVersion = "2.0.0" + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// IssuedCertData issued unit certificate data. +type IssuedCertData struct { + Type string `json:"type"` + NodeID string `json:"nodeId,omitempty"` + CertificateChain string `json:"certificateChain"` +} + +// InstallCertData install certificate data. +type InstallCertData struct { + Type string `json:"type"` + NodeID string `json:"nodeId,omitempty"` + Serial string `json:"serial"` + Status string `json:"status"` + Description string `json:"description,omitempty"` +} + +// RenewCertData renew certificate data. +type RenewCertData struct { + Type string `json:"type"` + NodeID string `json:"nodeId,omitempty"` + Serial string `json:"serial"` + ValidTill time.Time `json:"validTill"` +} + +// UnitSecrets keeps secrets for nodes. +type UnitSecrets struct { + Version string `json:"version"` + Nodes map[string]string `json:"nodes"` +} + +// IssueCertData issue certificate data. +type IssueCertData struct { + Type string `json:"type"` + NodeID string `json:"nodeId,omitempty"` + Csr string `json:"csr"` +} + +// RenewCertsNotification renew certificate notification from cloud with pwd. +type RenewCertsNotification struct { + MessageType string `json:"messageType"` + Certificates []RenewCertData `json:"certificates"` + UnitSecrets UnitSecrets `json:"unitSecrets"` +} + +// IssuedUnitCerts issued unit certificates info. +type IssuedUnitCerts struct { + MessageType string `json:"messageType"` + Certificates []IssuedCertData `json:"certificates"` +} + +// IssueUnitCerts issue unit certificates request. +type IssueUnitCerts struct { + MessageType string `json:"messageType"` + Requests []IssueCertData `json:"requests"` +} + +// InstallUnitCertsConfirmation install unit certificates confirmation. +type InstallUnitCertsConfirmation struct { + MessageType string `json:"messageType"` + Certificates []InstallCertData `json:"certificates"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/cloudprotocol.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/cloudprotocol.go index 9fa561ff..531c8059 100644 --- a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/cloudprotocol.go +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/cloudprotocol.go @@ -17,112 +17,14 @@ package cloudprotocol -import ( - "encoding/json" - "fmt" - "time" - - "github.com/aosedge/aos_common/aostypes" -) +import "encoding/json" /*********************************************************************************************************************** * Consts **********************************************************************************************************************/ // ProtocolVersion specifies supported protocol version. -const ProtocolVersion = 5 - -// UnitSecretVersion specifies supported version of UnitSecret message. -const UnitSecretVersion = 2 - -// Cloud message types. -const ( - DesiredStatusType = "desiredStatus" - RequestLogType = "requestLog" - ServiceDiscoveryType = "serviceDiscovery" - StateAcceptanceType = "stateAcceptance" - UpdateStateType = "updateState" - DeviceErrors = "deviceErrors" - RenewCertsNotificationType = "renewCertificatesNotification" - IssuedUnitCertsType = "issuedUnitCertificates" - OverrideEnvVarsType = "overrideEnvVars" -) - -// Device message types. -const ( - AlertsType = "alerts" - MonitoringDataType = "monitoringData" - NewStateType = "newState" - PushLogType = "pushLog" - StateRequestType = "stateRequest" - UnitStatusType = "unitStatus" - IssueUnitCertsType = "issueUnitCertificates" - InstallUnitCertsConfirmationType = "installUnitCertificatesConfirmation" - OverrideEnvVarsStatusType = "overrideEnvVarsStatus" -) - -// Alert tags. -const ( - AlertTagSystemError = "systemAlert" - AlertTagAosCore = "coreAlert" - AlertTagResourceValidate = "resourceValidateAlert" - AlertTagDeviceAllocate = "deviceAllocateAlert" - AlertTagSystemQuota = "systemQuotaAlert" - AlertTagInstanceQuota = "instanceQuotaAlert" - AlertTagDownloadProgress = "downloadProgressAlert" - AlertTagServiceInstance = "serviceInstanceAlert" -) - -// Unit statuses. -const ( - UnknownStatus = "unknown" - PendingStatus = "pending" - DownloadingStatus = "downloading" - DownloadedStatus = "downloaded" - InstallingStatus = "installing" - InstalledStatus = "installed" - RemovingStatus = "removing" - RemovedStatus = "removed" - ErrorStatus = "error" -) - -// SOTA/FOTA schedule type. -const ( - ForceUpdate = "force" - TriggerUpdate = "trigger" - TimetableUpdate = "timetable" -) - -// Service instance states. -const ( - InstanceStateActivating = "activating" - InstanceStateActive = "active" - InstanceStateInactive = "inactive" - InstanceStateFailed = "failed" -) - -// Download target types. -const ( - DownloadTargetComponent = "component" - DownloadTargetLayer = "layer" - DownloadTargetService = "service" -) - -// Partition types. -const ( - GenericPartition = "generic" - StoragesPartition = "storages" - StatesPartition = "states" - ServicesPartition = "services" - LayersPartition = "layers" -) - -// Log types. -const ( - SystemLog = "systemLog" - ServiceLog = "serviceLog" - CrashLog = "crashLog" -) +const ProtocolVersion = 6 /*********************************************************************************************************************** * Types @@ -130,8 +32,8 @@ const ( // ReceivedMessage structure for Aos incoming messages. type ReceivedMessage struct { - Header MessageHeader `json:"header"` - Data []byte `json:"data"` + Header MessageHeader `json:"header"` + Data json.RawMessage `json:"data"` } // Message structure for AOS messages. @@ -142,311 +44,8 @@ type Message struct { // MessageHeader message header. type MessageHeader struct { - Version uint64 `json:"version"` - SystemID string `json:"systemId"` - MessageType string `json:"messageType"` -} - -// ServiceDiscoveryRequest service discovery request. -type ServiceDiscoveryRequest struct{} - -// ServiceDiscoveryResponse service discovery response. -type ServiceDiscoveryResponse struct { - Version uint64 `json:"version"` - Connection ConnectionInfo `json:"connection"` -} - -// ConnectionInfo AMQP connection info. -type ConnectionInfo struct { - SendParams SendParams `json:"sendParams"` - ReceiveParams ReceiveParams `json:"receiveParams"` -} - -// SendParams AMQP send parameters. -type SendParams struct { - Host string `json:"host"` - User string `json:"user"` - Password string `json:"password"` - Mandatory bool `json:"mandatory"` - Immediate bool `json:"immediate"` - Exchange ExchangeParams `json:"exchange"` -} - -// ExchangeParams AMQP exchange parameters. -type ExchangeParams struct { - Name string `json:"name"` - Durable bool `json:"durable"` - AutoDetect bool `json:"autoDetect"` - Internal bool `json:"internal"` - NoWait bool `json:"noWait"` -} - -// ReceiveParams AMQP receive parameters. -type ReceiveParams struct { - Host string `json:"host"` - User string `json:"user"` - Password string `json:"password"` - Consumer string `json:"consumer"` - AutoAck bool `json:"autoAck"` - Exclusive bool `json:"exclusive"` - NoLocal bool `json:"noLocal"` - NoWait bool `json:"noWait"` - Queue QueueInfo `json:"queue"` -} - -// QueueInfo AMQP queue info. -type QueueInfo struct { - Name string `json:"name"` - Durable bool `json:"durable"` - DeleteWhenUnused bool `json:"deleteWhenUnused"` - Exclusive bool `json:"exclusive"` - NoWait bool `json:"noWait"` -} - -// InstanceFilter instance filter structure. -type InstanceFilter struct { - ServiceID *string `json:"serviceId,omitempty"` - SubjectID *string `json:"subjectId,omitempty"` - Instance *uint64 `json:"instance,omitempty"` -} - -// LogFilter request log message. -type LogFilter struct { - From *time.Time `json:"from"` - Till *time.Time `json:"till"` - NodeIDs []string `json:"nodeIds,omitempty"` - InstanceFilter -} - -// RequestLog request log message. -type RequestLog struct { - LogID string `json:"logId"` - LogType string `json:"logType"` - Filter LogFilter `json:"filter"` -} - -// DecryptionInfo update decryption info. -type DecryptionInfo struct { - BlockAlg string `json:"blockAlg"` - BlockIv []byte `json:"blockIv"` - BlockKey []byte `json:"blockKey"` - AsymAlg string `json:"asymAlg"` - ReceiverInfo *struct { - Serial string `json:"serial"` - Issuer []byte `json:"issuer"` - } `json:"receiverInfo"` -} - -// Signs message signature. -type Signs struct { - ChainName string `json:"chainName"` - Alg string `json:"alg"` - Value []byte `json:"value"` - TrustedTimestamp string `json:"trustedTimestamp"` - OcspValues []string `json:"ocspValues"` -} - -// CertificateChain certificate chain. -type CertificateChain struct { - Name string `json:"name"` - Fingerprints []string `json:"fingerprints"` -} - -// Certificate certificate structure. -type Certificate struct { - Fingerprint string `json:"fingerprint"` - Certificate []byte `json:"certificate"` -} - -// DecryptDataStruct struct contains how to decrypt data. -type DecryptDataStruct struct { - URLs []string `json:"urls"` - Sha256 []byte `json:"sha256"` - Sha512 []byte `json:"sha512"` - Size uint64 `json:"size"` - DecryptionInfo *DecryptionInfo `json:"decryptionInfo,omitempty"` - Signs *Signs `json:"signs,omitempty"` -} - -// StateAcceptance state acceptance message. -type StateAcceptance struct { - aostypes.InstanceIdent - Checksum string `json:"checksum"` - Result string `json:"result"` - Reason string `json:"reason"` -} - -// UpdateState state update message. -type UpdateState struct { - aostypes.InstanceIdent - Checksum string `json:"stateChecksum"` - State string `json:"state"` -} - -// NewState new state structure. -type NewState struct { - aostypes.InstanceIdent - Checksum string `json:"stateChecksum"` - State string `json:"state"` -} - -// StateRequest state request structure. -type StateRequest struct { - aostypes.InstanceIdent - Default bool `json:"default"` -} - -// SystemAlert system alert structure. -type SystemAlert struct { - NodeID string `json:"nodeId"` - Message string `json:"message"` -} - -// CoreAlert system alert structure. -type CoreAlert struct { - NodeID string `json:"nodeId"` - CoreComponent string `json:"coreComponent"` - Message string `json:"message"` -} - -// DownloadAlert download alert structure. -type DownloadAlert struct { - TargetType string `json:"targetType"` - TargetID string `json:"targetId"` - TargetAosVersion uint64 `json:"targetAosVersion"` - TargetVendorVersion string `json:"targetVendorVersion"` - Message string `json:"message"` - Progress string `json:"progress"` - URL string `json:"url"` - DownloadedBytes string `json:"downloadedBytes"` - TotalBytes string `json:"totalBytes"` -} - -// SystemQuotaAlert system quota alert structure. -type SystemQuotaAlert struct { - NodeID string `json:"nodeId"` - Parameter string `json:"parameter"` - Value uint64 `json:"value"` -} - -// InstanceQuotaAlert instance quota alert structure. -type InstanceQuotaAlert struct { - aostypes.InstanceIdent - Parameter string `json:"parameter"` - Value uint64 `json:"value"` -} - -// DeviceAllocateAlert device allocate alert structure. -type DeviceAllocateAlert struct { - aostypes.InstanceIdent - NodeID string `json:"nodeId"` - Device string `json:"device"` - Message string `json:"message"` -} - -// ResourceValidateError resource validate error structure. -type ResourceValidateError struct { - Name string `json:"name"` - Errors []string `json:"error"` -} - -// ResourceValidateAlert resource validate alert structure. -type ResourceValidateAlert struct { - NodeID string `json:"nodeId"` - ResourcesErrors []ResourceValidateError `json:"resourcesErrors"` -} - -// ServiceInstanceAlert system alert structure. -type ServiceInstanceAlert struct { - aostypes.InstanceIdent - AosVersion uint64 `json:"aosVersion"` - Message string `json:"message"` -} - -// AlertItem alert item structure. -type AlertItem struct { - Timestamp time.Time `json:"timestamp"` - Tag string `json:"tag"` - Payload interface{} `json:"payload"` -} - -// Alerts alerts message structure. -type Alerts []AlertItem - -// Monitoring monitoring message structure. -type Monitoring struct { - Nodes []NodeMonitoringData `json:"nodes"` -} - -// NodeMonitoringData node monitoring data. -type NodeMonitoringData struct { - MonitoringData - NodeID string `json:"nodeId"` - Timestamp time.Time `json:"timestamp"` - ServiceInstances []InstanceMonitoringData `json:"serviceInstances"` -} - -// MonitoringData monitoring data. -type MonitoringData struct { - RAM uint64 `json:"ram"` - CPU uint64 `json:"cpu"` - InTraffic uint64 `json:"inTraffic"` - OutTraffic uint64 `json:"outTraffic"` - Disk []PartitionUsage `json:"disk"` -} - -// PartitionUsage partition usage information. -type PartitionUsage struct { - Name string `json:"name"` - UsedSize uint64 `json:"usedSize"` -} - -// InstanceMonitoringData monitoring data for service. -type InstanceMonitoringData struct { - aostypes.InstanceIdent - MonitoringData -} - -// PushLog push service log structure. -type PushLog struct { - NodeID string `json:"nodeId"` - LogID string `json:"logId"` - PartsCount uint64 `json:"partsCount,omitempty"` - Part uint64 `json:"part,omitempty"` - Content []byte `json:"content,omitempty"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// UnitStatus unit status structure. -type UnitStatus struct { - UnitConfig []UnitConfigStatus `json:"unitConfig"` - Services []ServiceStatus `json:"services"` - Layers []LayerStatus `json:"layers,omitempty"` - Components []ComponentStatus `json:"components"` - Instances []InstanceStatus `json:"instances"` - UnitSubjects []string `json:"unitSubjects"` - Nodes []NodeInfo `json:"nodes"` -} - -// PartitionInfo partition information. -type PartitionInfo struct { - Name string `json:"name"` - Types []string `json:"types"` - TotalSize uint64 `json:"totalSize"` -} - -// SystemInfo system information. -type SystemInfo struct { - NumCPUs uint64 `json:"numCpus"` - TotalRAM uint64 `json:"totalRam"` - Partitions []PartitionInfo `json:"partitions"` -} - -// NodeInfo node information. -type NodeInfo struct { - NodeID string `json:"nodeId"` - NodeType string `json:"nodeType"` - SystemInfo + Version uint64 `json:"version"` + SystemID string `json:"systemId"` } // ErrorInfo error information. @@ -456,242 +55,9 @@ type ErrorInfo struct { Message string `json:"message,omitempty"` } -// InstanceStatus service instance runtime status. -type InstanceStatus struct { - aostypes.InstanceIdent - AosVersion uint64 `json:"aosVersion"` - StateChecksum string `json:"stateChecksum,omitempty"` - RunState string `json:"runState"` - NodeID string `json:"nodeId"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// UnitConfigStatus unit config status. -type UnitConfigStatus struct { - VendorVersion string `json:"vendorVersion"` - Status string `json:"status"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// ServiceStatus service status. -type ServiceStatus struct { - ID string `json:"id"` - AosVersion uint64 `json:"aosVersion"` - Status string `json:"status"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// LayerStatus layer status. -type LayerStatus struct { - ID string `json:"id"` - AosVersion uint64 `json:"aosVersion"` - Digest string `json:"digest"` - Status string `json:"status"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// ComponentStatus component status. -type ComponentStatus struct { - ID string `json:"id"` - AosVersion uint64 `json:"aosVersion"` - VendorVersion string `json:"vendorVersion"` - Status string `json:"status"` - ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` -} - -// ServiceInfo decrypted service info. -type ServiceInfo struct { - aostypes.VersionInfo - ID string `json:"id"` - ProviderID string `json:"providerId"` - DecryptDataStruct -} - -// LayerInfo decrypted layer info. -type LayerInfo struct { - aostypes.VersionInfo - ID string `json:"id"` - Digest string `json:"digest"` - DecryptDataStruct -} - -// ComponentInfo decrypted component info. -type ComponentInfo struct { - aostypes.VersionInfo - ID string `json:"id"` - Annotations json.RawMessage `json:"annotations,omitempty"` - DecryptDataStruct -} - -// InstanceInfo decrypted desired instance runtime info. -type InstanceInfo struct { - ServiceID string `json:"serviceId"` - SubjectID string `json:"subjectId"` - Priority uint64 `json:"priority"` - NumInstances uint64 `json:"numInstances"` - Labels []string `json:"labels"` -} - -// TimeSlot time slot with start and finish time. -type TimeSlot struct { - Start aostypes.Time `json:"start"` - Finish aostypes.Time `json:"finish"` -} - -// TimetableEntry entry for update timetable. -type TimetableEntry struct { - DayOfWeek uint `json:"dayOfWeek"` - TimeSlots []TimeSlot `json:"timeSlots"` -} - -// ScheduleRule rule for performing schedule update. -type ScheduleRule struct { - TTL uint64 `json:"ttl"` - Type string `json:"type"` - Timetable []TimetableEntry `json:"timetable"` -} - -// DesiredStatus desired status. -type DesiredStatus struct { - UnitConfig json.RawMessage `json:"unitConfig"` - Components []ComponentInfo `json:"components"` - Layers []LayerInfo `json:"layers"` - Services []ServiceInfo `json:"services"` - Instances []InstanceInfo `json:"instances"` - FOTASchedule ScheduleRule `json:"fotaSchedule"` - SOTASchedule ScheduleRule `json:"sotaSchedule"` - CertificateChains []CertificateChain `json:"certificateChains,omitempty"` - Certificates []Certificate `json:"certificates,omitempty"` -} - -// RenewCertData renew certificate data. -type RenewCertData struct { - Type string `json:"type"` - NodeID string `json:"nodeId,omitempty"` - Serial string `json:"serial"` - ValidTill time.Time `json:"validTill"` -} - -// RenewCertsNotification renew certificate notification from cloud with pwd. -type RenewCertsNotification struct { - Certificates []RenewCertData `json:"certificates"` - UnitSecret UnitSecret `json:"unitSecret"` -} - -// IssueCertData issue certificate data. -type IssueCertData struct { - Type string `json:"type"` - NodeID string `json:"nodeId,omitempty"` - Csr string `json:"csr"` -} - -// IssueUnitCerts issue unit certificates request. -type IssueUnitCerts struct { - Requests []IssueCertData `json:"requests"` -} - -// IssuedCertData issued unit certificate data. -type IssuedCertData struct { - Type string `json:"type"` - NodeID string `json:"nodeId,omitempty"` - CertificateChain string `json:"certificateChain"` -} - -// IssuedUnitCerts issued unit certificates info. -type IssuedUnitCerts struct { - Certificates []IssuedCertData `json:"certificates"` -} - -// InstallCertData install certificate data. -type InstallCertData struct { - Type string `json:"type"` - NodeID string `json:"nodeId,omitempty"` - Serial string `json:"serial"` - Status string `json:"status"` - Description string `json:"description,omitempty"` -} - -// InstallUnitCertsConfirmation install unit certificates confirmation. -type InstallUnitCertsConfirmation struct { - Certificates []InstallCertData `json:"certificates"` -} - -// OverrideEnvVars request to override service environment variables. -type OverrideEnvVars struct { - OverrideEnvVars []EnvVarsInstanceInfo `json:"overrideEnvVars"` -} - -// EnvVarsInstanceInfo struct with envs and related service and user. -type EnvVarsInstanceInfo struct { - InstanceFilter - EnvVars []EnvVarInfo `json:"envVars"` -} - -// EnvVarInfo env info with id and time to live. -type EnvVarInfo struct { - ID string `json:"id"` - Variable string `json:"variable"` - TTL *time.Time `json:"ttl"` -} - -// OverrideEnvVarsStatus override env status. -type OverrideEnvVarsStatus struct { - OverrideEnvVarsStatus []EnvVarsInstanceStatus `json:"overrideEnvVarsStatus"` -} - -// EnvVarsInstanceStatus struct with envs status and related service and user. -type EnvVarsInstanceStatus struct { - InstanceFilter - Statuses []EnvVarStatus `json:"statuses"` -} - -// EnvVarStatus env status with error message. -type EnvVarStatus struct { - ID string `json:"id"` - Error string `json:"error,omitempty"` -} - -// UnitSecret keeps unit secret used to decode secure device password. -type UnitSecret struct { - Version int `json:"version"` - Data struct { - OwnerPassword string `json:"ownerPassword"` - } `json:"data"` -} - -/*********************************************************************************************************************** - * Public - **********************************************************************************************************************/ - -func (service ServiceInfo) String() string { - return fmt.Sprintf("{id: %s, vendorVersion: %s aosVersion: %d, description: %s}", - service.ID, service.VendorVersion, service.AosVersion, service.Description) -} - -func (layer LayerInfo) String() string { - return fmt.Sprintf("{id: %s, digest: %s, vendorVersion: %s aosVersion: %d, description: %s}", - layer.ID, layer.Digest, layer.VendorVersion, layer.AosVersion, layer.Description) -} - -func (component ComponentInfo) String() string { - return fmt.Sprintf("{id: %s, annotations: %s, vendorVersion: %s aosVersion: %d, description: %s}", - component.ID, component.Annotations, component.VendorVersion, component.AosVersion, component.Description) -} - -func NewInstanceFilter(serviceID, subjectID string, instance int64) (filter InstanceFilter) { - if serviceID != "" { - filter.ServiceID = &serviceID - } - - if subjectID != "" { - filter.SubjectID = &subjectID - } - - if instance != -1 { - localInstance := (uint64)(instance) - - filter.Instance = &localInstance - } - - return filter +// InstanceFilter instance filter structure. +type InstanceFilter struct { + ServiceID *string `json:"serviceId,omitempty"` + SubjectID *string `json:"subjectId,omitempty"` + Instance *uint64 `json:"instance,omitempty"` } diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/desiredstatus.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/desiredstatus.go new file mode 100644 index 00000000..caff4172 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/desiredstatus.go @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import ( + "encoding/json" + "fmt" + + "github.com/aosedge/aos_common/aostypes" +) + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// DesiredStatusMessageType desired status message type. +const DesiredStatusMessageType = "desiredStatus" + +// SOTA/FOTA schedule type. +const ( + ForceUpdate = "force" + TriggerUpdate = "trigger" + TimetableUpdate = "timetable" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// FileSystemMount specifies a mount instructions. +type FileSystemMount struct { + Destination string `json:"destination"` + Type string `json:"type,omitempty"` + Source string `json:"source,omitempty"` + Options []string `json:"options,omitempty"` +} + +// HostInfo struct represents entry in /etc/hosts. +type HostInfo struct { + IP string `json:"ip"` + Hostname string `json:"hostname"` +} + +// DeviceInfo device information. +type DeviceInfo struct { + Name string `json:"name"` + SharedCount int `json:"sharedCount,omitempty"` + Groups []string `json:"groups,omitempty"` + HostDevices []string `json:"hostDevices"` +} + +// ResourceInfo resource information. +type ResourceInfo struct { + Name string `json:"name"` + Groups []string `json:"groups,omitempty"` + Mounts []FileSystemMount `json:"mounts,omitempty"` + Env []string `json:"env,omitempty"` + Hosts []HostInfo `json:"hosts,omitempty"` +} + +// NodeConfig node configuration. +type NodeConfig struct { + NodeID *string `json:"nodeId,omitempty"` + NodeType string `json:"nodeType"` + ResourceRatios *aostypes.ResourceRatiosInfo `json:"resourceRatios,omitempty"` + AlertRules *aostypes.AlertRules `json:"alertRules,omitempty"` + Devices []DeviceInfo `json:"devices,omitempty"` + Resources []ResourceInfo `json:"resources,omitempty"` + Labels []string `json:"labels,omitempty"` + Priority uint32 `json:"priority,omitempty"` +} + +// UnitConfig unit configuration. +type UnitConfig struct { + FormatVersion interface{} `json:"formatVersion"` + Version string `json:"version"` + Nodes []NodeConfig `json:"nodes"` +} + +// Signs message signature. +type Signs struct { + ChainName string `json:"chainName"` + Alg string `json:"alg"` + Value []byte `json:"value"` + TrustedTimestamp string `json:"trustedTimestamp"` + OcspValues []string `json:"ocspValues"` +} + +// DecryptionInfo update decryption info. +type DecryptionInfo struct { + BlockAlg string `json:"blockAlg"` + BlockIv []byte `json:"blockIv"` + BlockKey []byte `json:"blockKey"` + AsymAlg string `json:"asymAlg"` + ReceiverInfo *struct { + Serial string `json:"serial"` + Issuer []byte `json:"issuer"` + } `json:"receiverInfo"` +} + +// DownloadInfo struct contains how to download item. +type DownloadInfo struct { + URLs []string `json:"urls"` + Sha256 []byte `json:"sha256"` + Size uint64 `json:"size"` +} + +// NodeStatus node status. +type NodeStatus struct { + NodeID string `json:"nodeId"` + Status string `json:"status"` +} + +// ServiceInfo decrypted service info. +type ServiceInfo struct { + ServiceID string `json:"id"` + ProviderID string `json:"providerId"` + Version string `json:"version"` + DownloadInfo + DecryptionInfo DecryptionInfo `json:"decryptionInfo"` + Signs Signs `json:"signs"` +} + +// LayerInfo decrypted layer info. +type LayerInfo struct { + LayerID string `json:"id"` + Digest string `json:"digest"` + Version string `json:"version"` + DownloadInfo + DecryptionInfo DecryptionInfo `json:"decryptionInfo"` + Signs Signs `json:"signs"` +} + +// ComponentInfo decrypted component info. +type ComponentInfo struct { + ComponentID *string `json:"id,omitempty"` + ComponentType string `json:"type"` + Version string `json:"version"` + Annotations json.RawMessage `json:"annotations,omitempty"` + DownloadInfo + DecryptionInfo DecryptionInfo `json:"decryptionInfo"` + Signs Signs `json:"signs"` +} + +// InstanceInfo decrypted desired instance runtime info. +type InstanceInfo struct { + ServiceID string `json:"serviceId"` + SubjectID string `json:"subjectId"` + Priority uint64 `json:"priority"` + NumInstances uint64 `json:"numInstances"` + Labels []string `json:"labels"` +} + +// Certificate certificate structure. +type Certificate struct { + Certificate []byte `json:"certificate"` + Fingerprint string `json:"fingerprint"` +} + +// CertificateChain certificate chain. +type CertificateChain struct { + Name string `json:"name"` + Fingerprints []string `json:"fingerprints"` +} + +// TimeSlot time slot with start and finish time. +type TimeSlot struct { + Start aostypes.Time `json:"start"` + End aostypes.Time `json:"end"` +} + +// TimetableEntry entry for update timetable. +type TimetableEntry struct { + DayOfWeek uint `json:"dayOfWeek"` + TimeSlots []TimeSlot `json:"timeSlots"` +} + +// ScheduleRule rule for performing schedule update. +type ScheduleRule struct { + TTL uint64 `json:"ttl"` + Type string `json:"type"` + Timetable []TimetableEntry `json:"timetable"` +} + +// DesiredStatus desired status. +type DesiredStatus struct { + MessageType string `json:"messageType"` + UnitConfig *UnitConfig `json:"unitConfig,omitempty"` + Nodes []NodeStatus `json:"nodes"` + Components []ComponentInfo `json:"components"` + Layers []LayerInfo `json:"layers"` + Services []ServiceInfo `json:"services"` + Instances []InstanceInfo `json:"instances"` + FOTASchedule ScheduleRule `json:"fotaSchedule"` + SOTASchedule ScheduleRule `json:"sotaSchedule"` + Certificates []Certificate `json:"certificates,omitempty"` + CertificateChains []CertificateChain `json:"certificateChains,omitempty"` +} + +/*********************************************************************************************************************** + * Public + **********************************************************************************************************************/ + +func (service ServiceInfo) String() string { + return fmt.Sprintf("{id: %s, version: %s}", service.ServiceID, service.Version) +} + +func (layer LayerInfo) String() string { + return fmt.Sprintf("{id: %s, digest: %s, version: %s}", layer.LayerID, layer.Digest, layer.Version) +} + +func (component ComponentInfo) String() string { + id := "none" + + if component.ComponentID != nil { + id = *component.ComponentID + } + + return fmt.Sprintf("{id: %s, type: %s, annotations: %s, version: %s}", + id, component.ComponentType, component.Annotations, component.Version) +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/envvars.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/envvars.go new file mode 100644 index 00000000..f9c54415 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/envvars.go @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import "time" + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// EnvVars message types. +const ( + OverrideEnvVarsMessageType = "overrideEnvVars" + OverrideEnvVarsStatusMessageType = "overrideEnvVarsStatus" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// EnvVarsInstanceInfo struct with envs and related service and user. +type EnvVarsInstanceInfo struct { + InstanceFilter + Variables []EnvVarInfo `json:"variables"` +} + +// EnvVarInfo env info with id and time to live. +type EnvVarInfo struct { + Name string `json:"name"` + Value string `json:"value"` + TTL *time.Time `json:"ttl"` +} + +// EnvVarsInstanceStatus struct with envs status and related service and user. +type EnvVarsInstanceStatus struct { + InstanceFilter + Statuses []EnvVarStatus `json:"statuses"` +} + +// EnvVarStatus env status with error message. +type EnvVarStatus struct { + Name string `json:"name"` + ErrorInfo *ErrorInfo `json:"error,omitempty"` +} + +// OverrideEnvVars request to override service environment variables. +type OverrideEnvVars struct { + MessageType string `json:"messageType"` + Items []EnvVarsInstanceInfo `json:"items"` +} + +// OverrideEnvVarsStatus override env status. +type OverrideEnvVarsStatus struct { + MessageType string `json:"messageType"` + Statuses []EnvVarsInstanceStatus `json:"statuses"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/log.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/log.go new file mode 100644 index 00000000..defdc361 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/log.go @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import "time" + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// Log message types. +const ( + RequestLogMessageType = "requestLog" + PushLogMessageType = "pushLog" +) + +// Log types. +const ( + SystemLog = "systemLog" + ServiceLog = "serviceLog" + CrashLog = "crashLog" +) + +// Log statuses. +const ( + LogStatusOk = "ok" + LogStatusError = "error" + LogStatusEmpty = "empty" + LogStatusAbsent = "absent" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// LogUploadOptions request log message. +type LogUploadOptions struct { + Type string `json:"type"` + URL string `json:"url"` + BearerToken string `json:"bearerToken"` + BearerTokenTTL *time.Time `json:"bearerTokenTtl"` +} + +// LogFilter request log message. +type LogFilter struct { + From *time.Time `json:"from"` + Till *time.Time `json:"till"` + NodeIDs []string `json:"nodeIds,omitempty"` + UploadOptions *LogUploadOptions `json:"uploadOptions,omitempty"` + InstanceFilter +} + +// RequestLog request log message. +type RequestLog struct { + MessageType string `json:"messageType"` + LogID string `json:"logId"` + LogType string `json:"logType"` + Filter LogFilter `json:"filter"` +} + +// PushLog push service log structure. +type PushLog struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + LogID string `json:"logId"` + PartsCount uint64 `json:"partsCount,omitempty"` + Part uint64 `json:"part,omitempty"` + Content []byte `json:"content,omitempty"` + Status string `json:"status"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +/*********************************************************************************************************************** + * Public + **********************************************************************************************************************/ + +func NewInstanceFilter(serviceID, subjectID string, instance int64) (filter InstanceFilter) { + if serviceID != "" { + filter.ServiceID = &serviceID + } + + if subjectID != "" { + filter.SubjectID = &subjectID + } + + if instance != -1 { + localInstance := (uint64)(instance) + + filter.Instance = &localInstance + } + + return filter +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/monitoring.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/monitoring.go new file mode 100644 index 00000000..b0a5f1a0 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/monitoring.go @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import ( + "github.com/aosedge/aos_common/aostypes" +) + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// MonitoringMessageType monitoring message type. +const MonitoringMessageType = "monitoringData" + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// NodeMonitoringData node monitoring data. +type NodeMonitoringData struct { + NodeID string `json:"nodeId"` + Items []aostypes.MonitoringData `json:"items"` +} + +// InstanceMonitoringData monitoring data for service. +type InstanceMonitoringData struct { + aostypes.InstanceIdent + NodeID string `json:"nodeId"` + Items []aostypes.MonitoringData `json:"items"` +} + +// Monitoring monitoring message structure. +type Monitoring struct { + MessageType string `json:"messageType"` + Nodes []NodeMonitoringData `json:"nodes"` + ServiceInstances []InstanceMonitoringData `json:"serviceInstances"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/provisioning.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/provisioning.go new file mode 100644 index 00000000..2058e30b --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/provisioning.go @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2024 Renesas Electronics Corporation. +// Copyright (C) 2024 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// Provisioning message types. +const ( + StartProvisioningRequestMessageType = "startProvisioningRequest" + StartProvisioningResponseMessageType = "startProvisioningResponse" + FinishProvisioningRequestMessageType = "finishProvisioningRequest" + FinishProvisioningResponseMessageType = "finishProvisioningResponse" + DeprovisioningRequestMessageType = "deprovisioningRequest" + DeprovisioningResponseMessageType = "deprovisioningResponse" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// StartProvisioningRequest message. +type StartProvisioningRequest struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + Password string `json:"password"` +} + +// StartProvisioningResponse message. +type StartProvisioningResponse struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` + CSRs []IssueCertData `json:"csrs"` +} + +// FinishProvisioningRequest message. +type FinishProvisioningRequest struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + Certificates []IssuedCertData `json:"certificates"` + Password string `json:"password"` +} + +// FinishProvisioningResponse message. +type FinishProvisioningResponse struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// DeprovisioningRequest message. +type DeprovisioningRequest struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + Password string `json:"password"` +} + +// DeprovisioningResponse message. +type DeprovisioningResponse struct { + MessageType string `json:"messageType"` + NodeID string `json:"nodeId"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/servicediscovery.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/servicediscovery.go new file mode 100644 index 00000000..ab5fc041 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/servicediscovery.go @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// ServiceDiscoveryType service discovery message type. +const ServiceDiscoveryType = "serviceDiscovery" + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// ServiceDiscoveryRequest service discovery request. +type ServiceDiscoveryRequest struct{} + +// ServiceDiscoveryResponse service discovery response. +type ServiceDiscoveryResponse struct { + Version uint64 `json:"version"` + Connection ConnectionInfo `json:"connection"` +} + +// ConnectionInfo AMQP connection info. +type ConnectionInfo struct { + SendParams SendParams `json:"sendParams"` + ReceiveParams ReceiveParams `json:"receiveParams"` +} + +// SendParams AMQP send parameters. +type SendParams struct { + Host string `json:"host"` + User string `json:"user"` + Password string `json:"password"` + Mandatory bool `json:"mandatory"` + Immediate bool `json:"immediate"` + Exchange ExchangeParams `json:"exchange"` +} + +// ExchangeParams AMQP exchange parameters. +type ExchangeParams struct { + Name string `json:"name"` + Durable bool `json:"durable"` + AutoDetect bool `json:"autoDetect"` + Internal bool `json:"internal"` + NoWait bool `json:"noWait"` +} + +// ReceiveParams AMQP receive parameters. +type ReceiveParams struct { + Host string `json:"host"` + User string `json:"user"` + Password string `json:"password"` + Consumer string `json:"consumer"` + AutoAck bool `json:"autoAck"` + Exclusive bool `json:"exclusive"` + NoLocal bool `json:"noLocal"` + NoWait bool `json:"noWait"` + Queue QueueInfo `json:"queue"` +} + +// QueueInfo AMQP queue info. +type QueueInfo struct { + Name string `json:"name"` + Durable bool `json:"durable"` + DeleteWhenUnused bool `json:"deleteWhenUnused"` + Exclusive bool `json:"exclusive"` + NoWait bool `json:"noWait"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/state.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/state.go new file mode 100644 index 00000000..a86adfaf --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/state.go @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import "github.com/aosedge/aos_common/aostypes" + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// State message types. +const ( + StateAcceptanceMessageType = "stateAcceptance" + UpdateStateMessageType = "updateState" + NewStateMessageType = "newState" + StateRequestMessageType = "stateRequest" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// StateAcceptance state acceptance message. +type StateAcceptance struct { + MessageType string `json:"messageType"` + aostypes.InstanceIdent + Checksum string `json:"checksum"` + Result string `json:"result"` + Reason string `json:"reason"` +} + +// UpdateState state update message. +type UpdateState struct { + MessageType string `json:"messageType"` + aostypes.InstanceIdent + Checksum string `json:"stateChecksum"` + State string `json:"state"` +} + +// NewState new state structure. +type NewState struct { + MessageType string `json:"messageType"` + aostypes.InstanceIdent + Checksum string `json:"stateChecksum"` + State string `json:"state"` +} + +// StateRequest state request structure. +type StateRequest struct { + MessageType string `json:"messageType"` + aostypes.InstanceIdent + Default bool `json:"default"` +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go new file mode 100644 index 00000000..ac7dd55f --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go @@ -0,0 +1,223 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2021 Renesas Electronics Corporation. +// Copyright (C) 2021 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloudprotocol + +import ( + "encoding/json" + "strings" + + "github.com/aosedge/aos_common/aoserrors" + "github.com/aosedge/aos_common/aostypes" +) + +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +// UnitStatusMessageType unit status message type. +const UnitStatusMessageType = "unitStatus" + +// Instance statuses. +const ( + InstanceStateActivating = "activating" + InstanceStateActive = "active" + InstanceStateInactive = "inactive" + InstanceStateFailed = "failed" +) + +// Service/layers/components statuses. +const ( + UnknownStatus = "unknown" + PendingStatus = "pending" + DownloadingStatus = "downloading" + DownloadedStatus = "downloaded" + InstallingStatus = "installing" + InstalledStatus = "installed" + RemovingStatus = "removing" + RemovedStatus = "removed" + ErrorStatus = "error" +) + +// Partition types. +const ( + GenericPartition = "generic" + StoragesPartition = "storages" + StatesPartition = "states" + ServicesPartition = "services" + LayersPartition = "layers" +) + +// Node statuses. +const ( + NodeStatusUnprovisioned = "unprovisioned" + NodeStatusProvisioned = "provisioned" + NodeStatusPaused = "paused" + NodeStatusError = "error" +) + +// Node attribute names. +const ( + NodeAttrMainNode = "MainNode" + NodeAttrAosComponents = "AosComponents" + NodeAttrRunners = "NodeRunners" +) + +// Node attribute values. +const ( + AosComponentCM = "cm" + AosComponentIAM = "iam" + AosComponentSM = "sm" + AosComponentUM = "um" +) + +/*********************************************************************************************************************** + * Types + **********************************************************************************************************************/ + +// UnitConfigStatus unit config status. +type UnitConfigStatus struct { + Version string `json:"version"` + Status string `json:"status"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// CPUInfo cpu information. +type CPUInfo struct { + ModelName string `json:"modelName"` + NumCores uint64 `json:"totalNumCores"` + NumThreads uint64 `json:"totalNumThreads"` + Arch string `json:"arch"` + ArchFamily string `json:"archFamily"` + MaxDMIPs uint64 `json:"maxDmips"` +} + +// PartitionInfo partition information. +type PartitionInfo struct { + Name string `json:"name"` + Types []string `json:"types"` + TotalSize uint64 `json:"totalSize"` + Path string `json:"-"` +} + +// NodeInfo node information. +type NodeInfo struct { + NodeID string `json:"id"` + NodeType string `json:"type"` + Name string `json:"name"` + Status string `json:"status"` + CPUs []CPUInfo `json:"cpus,omitempty"` + OSType string `json:"osType"` + MaxDMIPs uint64 `json:"maxDmips"` + TotalRAM uint64 `json:"totalRam"` + Attrs map[string]interface{} `json:"attrs,omitempty"` + Partitions []PartitionInfo `json:"partitions,omitempty"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// ServiceStatus service status. +type ServiceStatus struct { + ServiceID string `json:"id"` + Version string `json:"version"` + Status string `json:"status"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// InstanceStatus service instance runtime status. +type InstanceStatus struct { + aostypes.InstanceIdent + ServiceVersion string `json:"version"` + StateChecksum string `json:"stateChecksum,omitempty"` + Status string `json:"status"` + NodeID string `json:"nodeId"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// LayerStatus layer status. +type LayerStatus struct { + LayerID string `json:"id"` + Digest string `json:"digest"` + Version string `json:"version"` + Status string `json:"status"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// ComponentStatus component status. +type ComponentStatus struct { + ComponentID string `json:"id"` + ComponentType string `json:"type"` + Version string `json:"version"` + NodeID string `json:"nodeId"` + Status string `json:"status"` + Annotations json.RawMessage `json:"annotations,omitempty"` + ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` +} + +// UnitStatus unit status structure. +type UnitStatus struct { + MessageType string `json:"messageType"` + IsDeltaInfo bool `json:"isDeltaInfo"` + UnitConfig []UnitConfigStatus `json:"unitConfig"` + Nodes []NodeInfo `json:"nodes"` + Services []ServiceStatus `json:"services"` + Instances []InstanceStatus `json:"instances"` + Layers []LayerStatus `json:"layers,omitempty"` + Components []ComponentStatus `json:"components"` + UnitSubjects []string `json:"unitSubjects"` +} + +/*********************************************************************************************************************** + * Public + **********************************************************************************************************************/ + +func (nodeInfo *NodeInfo) IsMainNode() bool { + _, ok := nodeInfo.Attrs[NodeAttrMainNode] + + return ok +} + +func (nodeInfo *NodeInfo) GetAosComponents() ([]string, error) { + return nodeInfo.attrToStringSlice(NodeAttrAosComponents) +} + +func (nodeInfo *NodeInfo) GetNodeRunners() ([]string, error) { + return nodeInfo.attrToStringSlice(NodeAttrRunners) +} + +/*********************************************************************************************************************** + * Private + **********************************************************************************************************************/ + +func (nodeInfo *NodeInfo) attrToStringSlice(attrName string) ([]string, error) { + attrValue, ok := nodeInfo.Attrs[attrName] + if !ok { + return nil, aoserrors.Errorf("attribute %s not found", attrName) + } + + attrString, ok := attrValue.(string) + if !ok { + return nil, aoserrors.New("invalid attribute type") + } + + values := strings.Split(attrString, ",") + + for i := range values { + values[i] = strings.TrimSpace(values[i]) + } + + return values, nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/common/common.pb.go b/vendor/github.com/aosedge/aos_common/api/common/common.pb.go new file mode 100644 index 00000000..b518971c --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/common/common.pb.go @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.26.0 +// source: common/v1/common.proto + +package common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ErrorInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AosCode int32 `protobuf:"varint,1,opt,name=aos_code,json=aosCode,proto3" json:"aos_code,omitempty"` + ExitCode int32 `protobuf:"varint,2,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ErrorInfo) Reset() { + *x = ErrorInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_common_v1_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ErrorInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ErrorInfo) ProtoMessage() {} + +func (x *ErrorInfo) ProtoReflect() protoreflect.Message { + mi := &file_common_v1_common_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead. +func (*ErrorInfo) Descriptor() ([]byte, []int) { + return file_common_v1_common_proto_rawDescGZIP(), []int{0} +} + +func (x *ErrorInfo) GetAosCode() int32 { + if x != nil { + return x.AosCode + } + return 0 +} + +func (x *ErrorInfo) GetExitCode() int32 { + if x != nil { + return x.ExitCode + } + return 0 +} + +func (x *ErrorInfo) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type InstanceIdent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + SubjectId string `protobuf:"bytes,2,opt,name=subject_id,json=subjectId,proto3" json:"subject_id,omitempty"` + Instance uint64 `protobuf:"varint,3,opt,name=instance,proto3" json:"instance,omitempty"` +} + +func (x *InstanceIdent) Reset() { + *x = InstanceIdent{} + if protoimpl.UnsafeEnabled { + mi := &file_common_v1_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceIdent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceIdent) ProtoMessage() {} + +func (x *InstanceIdent) ProtoReflect() protoreflect.Message { + mi := &file_common_v1_common_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceIdent.ProtoReflect.Descriptor instead. +func (*InstanceIdent) Descriptor() ([]byte, []int) { + return file_common_v1_common_proto_rawDescGZIP(), []int{1} +} + +func (x *InstanceIdent) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *InstanceIdent) GetSubjectId() string { + if x != nil { + return x.SubjectId + } + return "" +} + +func (x *InstanceIdent) GetInstance() uint64 { + if x != nil { + return x.Instance + } + return 0 +} + +var File_common_v1_common_proto protoreflect.FileDescriptor + +var file_common_v1_common_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x22, 0x5d, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x61, 0x6f, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, + 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x69, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_common_v1_common_proto_rawDescOnce sync.Once + file_common_v1_common_proto_rawDescData = file_common_v1_common_proto_rawDesc +) + +func file_common_v1_common_proto_rawDescGZIP() []byte { + file_common_v1_common_proto_rawDescOnce.Do(func() { + file_common_v1_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_v1_common_proto_rawDescData) + }) + return file_common_v1_common_proto_rawDescData +} + +var file_common_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_common_v1_common_proto_goTypes = []interface{}{ + (*ErrorInfo)(nil), // 0: common.v1.ErrorInfo + (*InstanceIdent)(nil), // 1: common.v1.InstanceIdent +} +var file_common_v1_common_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_common_v1_common_proto_init() } +func file_common_v1_common_proto_init() { + if File_common_v1_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_common_v1_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ErrorInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_v1_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceIdent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_common_v1_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_common_v1_common_proto_goTypes, + DependencyIndexes: file_common_v1_common_proto_depIdxs, + MessageInfos: file_common_v1_common_proto_msgTypes, + }.Build() + File_common_v1_common_proto = out.File + file_common_v1_common_proto_rawDesc = nil + file_common_v1_common_proto_goTypes = nil + file_common_v1_common_proto_depIdxs = nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler.pb.go b/vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler.pb.go new file mode 100644 index 00000000..64616d75 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler.pb.go @@ -0,0 +1,834 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.26.0 +// source: communicationmanager/v3/updatescheduler.proto + +package communicationmanager + +import ( + common "github.com/aosedge/aos_common/api/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type UpdateState int32 + +const ( + UpdateState_NO_UPDATE UpdateState = 0 + UpdateState_DOWNLOADING UpdateState = 1 + UpdateState_READY_TO_UPDATE UpdateState = 2 + UpdateState_UPDATING UpdateState = 3 +) + +// Enum value maps for UpdateState. +var ( + UpdateState_name = map[int32]string{ + 0: "NO_UPDATE", + 1: "DOWNLOADING", + 2: "READY_TO_UPDATE", + 3: "UPDATING", + } + UpdateState_value = map[string]int32{ + "NO_UPDATE": 0, + "DOWNLOADING": 1, + "READY_TO_UPDATE": 2, + "UPDATING": 3, + } +) + +func (x UpdateState) Enum() *UpdateState { + p := new(UpdateState) + *p = x + return p +} + +func (x UpdateState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UpdateState) Descriptor() protoreflect.EnumDescriptor { + return file_communicationmanager_v3_updatescheduler_proto_enumTypes[0].Descriptor() +} + +func (UpdateState) Type() protoreflect.EnumType { + return &file_communicationmanager_v3_updatescheduler_proto_enumTypes[0] +} + +func (x UpdateState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UpdateState.Descriptor instead. +func (UpdateState) EnumDescriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{0} +} + +type SchedulerNotifications struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to SchedulerNotification: + // + // *SchedulerNotifications_SotaStatus + // *SchedulerNotifications_FotaStatus + SchedulerNotification isSchedulerNotifications_SchedulerNotification `protobuf_oneof:"SchedulerNotification"` +} + +func (x *SchedulerNotifications) Reset() { + *x = SchedulerNotifications{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SchedulerNotifications) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SchedulerNotifications) ProtoMessage() {} + +func (x *SchedulerNotifications) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SchedulerNotifications.ProtoReflect.Descriptor instead. +func (*SchedulerNotifications) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{0} +} + +func (m *SchedulerNotifications) GetSchedulerNotification() isSchedulerNotifications_SchedulerNotification { + if m != nil { + return m.SchedulerNotification + } + return nil +} + +func (x *SchedulerNotifications) GetSotaStatus() *UpdateSOTAStatus { + if x, ok := x.GetSchedulerNotification().(*SchedulerNotifications_SotaStatus); ok { + return x.SotaStatus + } + return nil +} + +func (x *SchedulerNotifications) GetFotaStatus() *UpdateFOTAStatus { + if x, ok := x.GetSchedulerNotification().(*SchedulerNotifications_FotaStatus); ok { + return x.FotaStatus + } + return nil +} + +type isSchedulerNotifications_SchedulerNotification interface { + isSchedulerNotifications_SchedulerNotification() +} + +type SchedulerNotifications_SotaStatus struct { + SotaStatus *UpdateSOTAStatus `protobuf:"bytes,1,opt,name=sota_status,json=sotaStatus,proto3,oneof"` +} + +type SchedulerNotifications_FotaStatus struct { + FotaStatus *UpdateFOTAStatus `protobuf:"bytes,2,opt,name=fota_status,json=fotaStatus,proto3,oneof"` +} + +func (*SchedulerNotifications_SotaStatus) isSchedulerNotifications_SchedulerNotification() {} + +func (*SchedulerNotifications_FotaStatus) isSchedulerNotifications_SchedulerNotification() {} + +type UpdateFOTAStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State UpdateState `protobuf:"varint,1,opt,name=state,proto3,enum=communicationmanager.v3.UpdateState" json:"state,omitempty"` + Components []*ComponentInfo `protobuf:"bytes,2,rep,name=components,proto3" json:"components,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *UpdateFOTAStatus) Reset() { + *x = UpdateFOTAStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateFOTAStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFOTAStatus) ProtoMessage() {} + +func (x *UpdateFOTAStatus) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateFOTAStatus.ProtoReflect.Descriptor instead. +func (*UpdateFOTAStatus) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{1} +} + +func (x *UpdateFOTAStatus) GetState() UpdateState { + if x != nil { + return x.State + } + return UpdateState_NO_UPDATE +} + +func (x *UpdateFOTAStatus) GetComponents() []*ComponentInfo { + if x != nil { + return x.Components + } + return nil +} + +func (x *UpdateFOTAStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type UpdateSOTAStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State UpdateState `protobuf:"varint,1,opt,name=state,proto3,enum=communicationmanager.v3.UpdateState" json:"state,omitempty"` + UnitConfig *UnitConfigInfo `protobuf:"bytes,2,opt,name=unit_config,json=unitConfig,proto3" json:"unit_config,omitempty"` + InstallServices []*ServiceInfo `protobuf:"bytes,3,rep,name=install_services,json=installServices,proto3" json:"install_services,omitempty"` + RemoveServices []*ServiceInfo `protobuf:"bytes,4,rep,name=remove_services,json=removeServices,proto3" json:"remove_services,omitempty"` + InstallLayers []*LayerInfo `protobuf:"bytes,5,rep,name=install_layers,json=installLayers,proto3" json:"install_layers,omitempty"` + RemoveLayers []*LayerInfo `protobuf:"bytes,6,rep,name=remove_layers,json=removeLayers,proto3" json:"remove_layers,omitempty"` + RebalanceRequest bool `protobuf:"varint,7,opt,name=rebalance_request,json=rebalanceRequest,proto3" json:"rebalance_request,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,8,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *UpdateSOTAStatus) Reset() { + *x = UpdateSOTAStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSOTAStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSOTAStatus) ProtoMessage() {} + +func (x *UpdateSOTAStatus) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSOTAStatus.ProtoReflect.Descriptor instead. +func (*UpdateSOTAStatus) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateSOTAStatus) GetState() UpdateState { + if x != nil { + return x.State + } + return UpdateState_NO_UPDATE +} + +func (x *UpdateSOTAStatus) GetUnitConfig() *UnitConfigInfo { + if x != nil { + return x.UnitConfig + } + return nil +} + +func (x *UpdateSOTAStatus) GetInstallServices() []*ServiceInfo { + if x != nil { + return x.InstallServices + } + return nil +} + +func (x *UpdateSOTAStatus) GetRemoveServices() []*ServiceInfo { + if x != nil { + return x.RemoveServices + } + return nil +} + +func (x *UpdateSOTAStatus) GetInstallLayers() []*LayerInfo { + if x != nil { + return x.InstallLayers + } + return nil +} + +func (x *UpdateSOTAStatus) GetRemoveLayers() []*LayerInfo { + if x != nil { + return x.RemoveLayers + } + return nil +} + +func (x *UpdateSOTAStatus) GetRebalanceRequest() bool { + if x != nil { + return x.RebalanceRequest + } + return false +} + +func (x *UpdateSOTAStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type ComponentInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ComponentId string `protobuf:"bytes,1,opt,name=component_id,json=componentId,proto3" json:"component_id,omitempty"` + ComponentType string `protobuf:"bytes,2,opt,name=component_type,json=componentType,proto3" json:"component_type,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *ComponentInfo) Reset() { + *x = ComponentInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComponentInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentInfo) ProtoMessage() {} + +func (x *ComponentInfo) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentInfo.ProtoReflect.Descriptor instead. +func (*ComponentInfo) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{3} +} + +func (x *ComponentInfo) GetComponentId() string { + if x != nil { + return x.ComponentId + } + return "" +} + +func (x *ComponentInfo) GetComponentType() string { + if x != nil { + return x.ComponentType + } + return "" +} + +func (x *ComponentInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type UnitConfigInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *UnitConfigInfo) Reset() { + *x = UnitConfigInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnitConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnitConfigInfo) ProtoMessage() {} + +func (x *UnitConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnitConfigInfo.ProtoReflect.Descriptor instead. +func (*UnitConfigInfo) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{4} +} + +func (x *UnitConfigInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type ServiceInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *ServiceInfo) Reset() { + *x = ServiceInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceInfo) ProtoMessage() {} + +func (x *ServiceInfo) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead. +func (*ServiceInfo) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{5} +} + +func (x *ServiceInfo) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *ServiceInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type LayerInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LayerId string `protobuf:"bytes,1,opt,name=layer_id,json=layerId,proto3" json:"layer_id,omitempty"` + Digest string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *LayerInfo) Reset() { + *x = LayerInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LayerInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LayerInfo) ProtoMessage() {} + +func (x *LayerInfo) ProtoReflect() protoreflect.Message { + mi := &file_communicationmanager_v3_updatescheduler_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LayerInfo.ProtoReflect.Descriptor instead. +func (*LayerInfo) Descriptor() ([]byte, []int) { + return file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP(), []int{6} +} + +func (x *LayerInfo) GetLayerId() string { + if x != nil { + return x.LayerId + } + return "" +} + +func (x *LayerInfo) GetDigest() string { + if x != nil { + return x.Digest + } + return "" +} + +func (x *LayerInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +var File_communicationmanager_v3_updatescheduler_proto protoreflect.FileDescriptor + +var file_communicationmanager_v3_updatescheduler_proto_rawDesc = []byte{ + 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, + 0x0a, 0x16, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x73, 0x6f, 0x74, 0x61, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x4f, + 0x54, 0x41, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x6f, 0x74, 0x61, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x66, 0x6f, 0x74, 0x61, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x4f, 0x54, 0x41, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x6f, 0x74, 0x61, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x42, 0x17, 0x0a, 0x15, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc2, 0x01, + 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x4f, 0x54, 0x41, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x46, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0xa5, 0x04, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x4f, 0x54, + 0x41, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, + 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x33, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4f, 0x0a, + 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x4d, + 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x49, 0x0a, + 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x0d, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x72, 0x65, + 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x73, 0x0a, 0x0d, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x25, + 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0x2a, 0x0a, 0x0e, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x46, 0x0a, 0x0b, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x22, 0x58, 0x0a, 0x09, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2a, 0x50, 0x0a, + 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, + 0x4e, 0x4f, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x44, + 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, + 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x54, 0x4f, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, + 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x55, 0x50, 0x44, 0x41, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x32, + 0x89, 0x02, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x46, 0x4f, 0x54, 0x41, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, + 0x43, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x4f, 0x54, 0x41, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x22, 0x00, 0x12, 0x65, 0x0a, 0x16, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, + 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x00, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_communicationmanager_v3_updatescheduler_proto_rawDescOnce sync.Once + file_communicationmanager_v3_updatescheduler_proto_rawDescData = file_communicationmanager_v3_updatescheduler_proto_rawDesc +) + +func file_communicationmanager_v3_updatescheduler_proto_rawDescGZIP() []byte { + file_communicationmanager_v3_updatescheduler_proto_rawDescOnce.Do(func() { + file_communicationmanager_v3_updatescheduler_proto_rawDescData = protoimpl.X.CompressGZIP(file_communicationmanager_v3_updatescheduler_proto_rawDescData) + }) + return file_communicationmanager_v3_updatescheduler_proto_rawDescData +} + +var file_communicationmanager_v3_updatescheduler_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_communicationmanager_v3_updatescheduler_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_communicationmanager_v3_updatescheduler_proto_goTypes = []interface{}{ + (UpdateState)(0), // 0: communicationmanager.v3.UpdateState + (*SchedulerNotifications)(nil), // 1: communicationmanager.v3.SchedulerNotifications + (*UpdateFOTAStatus)(nil), // 2: communicationmanager.v3.UpdateFOTAStatus + (*UpdateSOTAStatus)(nil), // 3: communicationmanager.v3.UpdateSOTAStatus + (*ComponentInfo)(nil), // 4: communicationmanager.v3.ComponentInfo + (*UnitConfigInfo)(nil), // 5: communicationmanager.v3.UnitConfigInfo + (*ServiceInfo)(nil), // 6: communicationmanager.v3.ServiceInfo + (*LayerInfo)(nil), // 7: communicationmanager.v3.LayerInfo + (*common.ErrorInfo)(nil), // 8: common.v1.ErrorInfo + (*emptypb.Empty)(nil), // 9: google.protobuf.Empty +} +var file_communicationmanager_v3_updatescheduler_proto_depIdxs = []int32{ + 3, // 0: communicationmanager.v3.SchedulerNotifications.sota_status:type_name -> communicationmanager.v3.UpdateSOTAStatus + 2, // 1: communicationmanager.v3.SchedulerNotifications.fota_status:type_name -> communicationmanager.v3.UpdateFOTAStatus + 0, // 2: communicationmanager.v3.UpdateFOTAStatus.state:type_name -> communicationmanager.v3.UpdateState + 4, // 3: communicationmanager.v3.UpdateFOTAStatus.components:type_name -> communicationmanager.v3.ComponentInfo + 8, // 4: communicationmanager.v3.UpdateFOTAStatus.error:type_name -> common.v1.ErrorInfo + 0, // 5: communicationmanager.v3.UpdateSOTAStatus.state:type_name -> communicationmanager.v3.UpdateState + 5, // 6: communicationmanager.v3.UpdateSOTAStatus.unit_config:type_name -> communicationmanager.v3.UnitConfigInfo + 6, // 7: communicationmanager.v3.UpdateSOTAStatus.install_services:type_name -> communicationmanager.v3.ServiceInfo + 6, // 8: communicationmanager.v3.UpdateSOTAStatus.remove_services:type_name -> communicationmanager.v3.ServiceInfo + 7, // 9: communicationmanager.v3.UpdateSOTAStatus.install_layers:type_name -> communicationmanager.v3.LayerInfo + 7, // 10: communicationmanager.v3.UpdateSOTAStatus.remove_layers:type_name -> communicationmanager.v3.LayerInfo + 8, // 11: communicationmanager.v3.UpdateSOTAStatus.error:type_name -> common.v1.ErrorInfo + 9, // 12: communicationmanager.v3.UpdateSchedulerService.StartFOTAUpdate:input_type -> google.protobuf.Empty + 9, // 13: communicationmanager.v3.UpdateSchedulerService.StartSOTAUpdate:input_type -> google.protobuf.Empty + 9, // 14: communicationmanager.v3.UpdateSchedulerService.SubscribeNotifications:input_type -> google.protobuf.Empty + 9, // 15: communicationmanager.v3.UpdateSchedulerService.StartFOTAUpdate:output_type -> google.protobuf.Empty + 9, // 16: communicationmanager.v3.UpdateSchedulerService.StartSOTAUpdate:output_type -> google.protobuf.Empty + 1, // 17: communicationmanager.v3.UpdateSchedulerService.SubscribeNotifications:output_type -> communicationmanager.v3.SchedulerNotifications + 15, // [15:18] is the sub-list for method output_type + 12, // [12:15] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_communicationmanager_v3_updatescheduler_proto_init() } +func file_communicationmanager_v3_updatescheduler_proto_init() { + if File_communicationmanager_v3_updatescheduler_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_communicationmanager_v3_updatescheduler_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SchedulerNotifications); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateFOTAStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSOTAStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComponentInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnitConfigInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LayerInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_communicationmanager_v3_updatescheduler_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*SchedulerNotifications_SotaStatus)(nil), + (*SchedulerNotifications_FotaStatus)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_communicationmanager_v3_updatescheduler_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_communicationmanager_v3_updatescheduler_proto_goTypes, + DependencyIndexes: file_communicationmanager_v3_updatescheduler_proto_depIdxs, + EnumInfos: file_communicationmanager_v3_updatescheduler_proto_enumTypes, + MessageInfos: file_communicationmanager_v3_updatescheduler_proto_msgTypes, + }.Build() + File_communicationmanager_v3_updatescheduler_proto = out.File + file_communicationmanager_v3_updatescheduler_proto_rawDesc = nil + file_communicationmanager_v3_updatescheduler_proto_goTypes = nil + file_communicationmanager_v3_updatescheduler_proto_depIdxs = nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler_grpc.pb.go b/vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler_grpc.pb.go similarity index 76% rename from vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler_grpc.pb.go rename to vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler_grpc.pb.go index 0ffdd2a0..14adaadb 100644 --- a/vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler_grpc.pb.go +++ b/vendor/github.com/aosedge/aos_common/api/communicationmanager/updatescheduler_grpc.pb.go @@ -1,13 +1,17 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.26.0 +// source: communicationmanager/v3/updatescheduler.proto package communicationmanager import ( context "context" - empty "github.com/golang/protobuf/ptypes/empty" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file @@ -19,9 +23,9 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type UpdateSchedulerServiceClient interface { - StartFOTAUpdate(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) - StartSOTAUpdate(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) - SubscribeNotifications(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (UpdateSchedulerService_SubscribeNotificationsClient, error) + StartFOTAUpdate(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + StartSOTAUpdate(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + SubscribeNotifications(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (UpdateSchedulerService_SubscribeNotificationsClient, error) } type updateSchedulerServiceClient struct { @@ -32,26 +36,26 @@ func NewUpdateSchedulerServiceClient(cc grpc.ClientConnInterface) UpdateSchedule return &updateSchedulerServiceClient{cc} } -func (c *updateSchedulerServiceClient) StartFOTAUpdate(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/communicationmanager.v2.UpdateSchedulerService/StartFOTAUpdate", in, out, opts...) +func (c *updateSchedulerServiceClient) StartFOTAUpdate(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/communicationmanager.v3.UpdateSchedulerService/StartFOTAUpdate", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *updateSchedulerServiceClient) StartSOTAUpdate(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/communicationmanager.v2.UpdateSchedulerService/StartSOTAUpdate", in, out, opts...) +func (c *updateSchedulerServiceClient) StartSOTAUpdate(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/communicationmanager.v3.UpdateSchedulerService/StartSOTAUpdate", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *updateSchedulerServiceClient) SubscribeNotifications(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (UpdateSchedulerService_SubscribeNotificationsClient, error) { - stream, err := c.cc.NewStream(ctx, &UpdateSchedulerService_ServiceDesc.Streams[0], "/communicationmanager.v2.UpdateSchedulerService/SubscribeNotifications", opts...) +func (c *updateSchedulerServiceClient) SubscribeNotifications(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (UpdateSchedulerService_SubscribeNotificationsClient, error) { + stream, err := c.cc.NewStream(ctx, &UpdateSchedulerService_ServiceDesc.Streams[0], "/communicationmanager.v3.UpdateSchedulerService/SubscribeNotifications", opts...) if err != nil { return nil, err } @@ -86,9 +90,9 @@ func (x *updateSchedulerServiceSubscribeNotificationsClient) Recv() (*SchedulerN // All implementations must embed UnimplementedUpdateSchedulerServiceServer // for forward compatibility type UpdateSchedulerServiceServer interface { - StartFOTAUpdate(context.Context, *empty.Empty) (*empty.Empty, error) - StartSOTAUpdate(context.Context, *empty.Empty) (*empty.Empty, error) - SubscribeNotifications(*empty.Empty, UpdateSchedulerService_SubscribeNotificationsServer) error + StartFOTAUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + StartSOTAUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + SubscribeNotifications(*emptypb.Empty, UpdateSchedulerService_SubscribeNotificationsServer) error mustEmbedUnimplementedUpdateSchedulerServiceServer() } @@ -96,13 +100,13 @@ type UpdateSchedulerServiceServer interface { type UnimplementedUpdateSchedulerServiceServer struct { } -func (UnimplementedUpdateSchedulerServiceServer) StartFOTAUpdate(context.Context, *empty.Empty) (*empty.Empty, error) { +func (UnimplementedUpdateSchedulerServiceServer) StartFOTAUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method StartFOTAUpdate not implemented") } -func (UnimplementedUpdateSchedulerServiceServer) StartSOTAUpdate(context.Context, *empty.Empty) (*empty.Empty, error) { +func (UnimplementedUpdateSchedulerServiceServer) StartSOTAUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method StartSOTAUpdate not implemented") } -func (UnimplementedUpdateSchedulerServiceServer) SubscribeNotifications(*empty.Empty, UpdateSchedulerService_SubscribeNotificationsServer) error { +func (UnimplementedUpdateSchedulerServiceServer) SubscribeNotifications(*emptypb.Empty, UpdateSchedulerService_SubscribeNotificationsServer) error { return status.Errorf(codes.Unimplemented, "method SubscribeNotifications not implemented") } func (UnimplementedUpdateSchedulerServiceServer) mustEmbedUnimplementedUpdateSchedulerServiceServer() { @@ -120,7 +124,7 @@ func RegisterUpdateSchedulerServiceServer(s grpc.ServiceRegistrar, srv UpdateSch } func _UpdateSchedulerService_StartFOTAUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -129,16 +133,16 @@ func _UpdateSchedulerService_StartFOTAUpdate_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/communicationmanager.v2.UpdateSchedulerService/StartFOTAUpdate", + FullMethod: "/communicationmanager.v3.UpdateSchedulerService/StartFOTAUpdate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UpdateSchedulerServiceServer).StartFOTAUpdate(ctx, req.(*empty.Empty)) + return srv.(UpdateSchedulerServiceServer).StartFOTAUpdate(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _UpdateSchedulerService_StartSOTAUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -147,16 +151,16 @@ func _UpdateSchedulerService_StartSOTAUpdate_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/communicationmanager.v2.UpdateSchedulerService/StartSOTAUpdate", + FullMethod: "/communicationmanager.v3.UpdateSchedulerService/StartSOTAUpdate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UpdateSchedulerServiceServer).StartSOTAUpdate(ctx, req.(*empty.Empty)) + return srv.(UpdateSchedulerServiceServer).StartSOTAUpdate(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _UpdateSchedulerService_SubscribeNotifications_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(empty.Empty) + m := new(emptypb.Empty) if err := stream.RecvMsg(m); err != nil { return err } @@ -180,7 +184,7 @@ func (x *updateSchedulerServiceSubscribeNotificationsServer) Send(m *SchedulerNo // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var UpdateSchedulerService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "communicationmanager.v2.UpdateSchedulerService", + ServiceName: "communicationmanager.v3.UpdateSchedulerService", HandlerType: (*UpdateSchedulerServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -199,5 +203,5 @@ var UpdateSchedulerService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "communicationmanager/v2/updatescheduler.proto", + Metadata: "communicationmanager/v3/updatescheduler.proto", } diff --git a/vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler.pb.go b/vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler.pb.go deleted file mode 100644 index 25efd56c..00000000 --- a/vendor/github.com/aosedge/aos_common/api/communicationmanager/v2/updatescheduler.pb.go +++ /dev/null @@ -1,813 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.6.1 -// source: communicationmanager/v2/updatescheduler.proto - -package communicationmanager - -import ( - empty "github.com/golang/protobuf/ptypes/empty" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type UpdateState int32 - -const ( - UpdateState_NO_UPDATE UpdateState = 0 - UpdateState_DOWNLOADING UpdateState = 1 - UpdateState_READY_TO_UPDATE UpdateState = 2 - UpdateState_UPDATING UpdateState = 3 -) - -// Enum value maps for UpdateState. -var ( - UpdateState_name = map[int32]string{ - 0: "NO_UPDATE", - 1: "DOWNLOADING", - 2: "READY_TO_UPDATE", - 3: "UPDATING", - } - UpdateState_value = map[string]int32{ - "NO_UPDATE": 0, - "DOWNLOADING": 1, - "READY_TO_UPDATE": 2, - "UPDATING": 3, - } -) - -func (x UpdateState) Enum() *UpdateState { - p := new(UpdateState) - *p = x - return p -} - -func (x UpdateState) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UpdateState) Descriptor() protoreflect.EnumDescriptor { - return file_communicationmanager_v2_updatescheduler_proto_enumTypes[0].Descriptor() -} - -func (UpdateState) Type() protoreflect.EnumType { - return &file_communicationmanager_v2_updatescheduler_proto_enumTypes[0] -} - -func (x UpdateState) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UpdateState.Descriptor instead. -func (UpdateState) EnumDescriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{0} -} - -type SchedulerNotifications struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to SchedulerNotification: - // *SchedulerNotifications_SotaStatus - // *SchedulerNotifications_FotaStatus - SchedulerNotification isSchedulerNotifications_SchedulerNotification `protobuf_oneof:"SchedulerNotification"` -} - -func (x *SchedulerNotifications) Reset() { - *x = SchedulerNotifications{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchedulerNotifications) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchedulerNotifications) ProtoMessage() {} - -func (x *SchedulerNotifications) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchedulerNotifications.ProtoReflect.Descriptor instead. -func (*SchedulerNotifications) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{0} -} - -func (m *SchedulerNotifications) GetSchedulerNotification() isSchedulerNotifications_SchedulerNotification { - if m != nil { - return m.SchedulerNotification - } - return nil -} - -func (x *SchedulerNotifications) GetSotaStatus() *UpdateSOTAStatus { - if x, ok := x.GetSchedulerNotification().(*SchedulerNotifications_SotaStatus); ok { - return x.SotaStatus - } - return nil -} - -func (x *SchedulerNotifications) GetFotaStatus() *UpdateFOTAStatus { - if x, ok := x.GetSchedulerNotification().(*SchedulerNotifications_FotaStatus); ok { - return x.FotaStatus - } - return nil -} - -type isSchedulerNotifications_SchedulerNotification interface { - isSchedulerNotifications_SchedulerNotification() -} - -type SchedulerNotifications_SotaStatus struct { - SotaStatus *UpdateSOTAStatus `protobuf:"bytes,1,opt,name=sota_status,json=sotaStatus,proto3,oneof"` -} - -type SchedulerNotifications_FotaStatus struct { - FotaStatus *UpdateFOTAStatus `protobuf:"bytes,2,opt,name=fota_status,json=fotaStatus,proto3,oneof"` -} - -func (*SchedulerNotifications_SotaStatus) isSchedulerNotifications_SchedulerNotification() {} - -func (*SchedulerNotifications_FotaStatus) isSchedulerNotifications_SchedulerNotification() {} - -type UpdateFOTAStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - State UpdateState `protobuf:"varint,1,opt,name=state,proto3,enum=communicationmanager.v2.UpdateState" json:"state,omitempty"` - Components []*ComponentInfo `protobuf:"bytes,2,rep,name=components,proto3" json:"components,omitempty"` - UnitConfig *UnitConfigInfo `protobuf:"bytes,3,opt,name=unit_config,json=unitConfig,proto3" json:"unit_config,omitempty"` - Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *UpdateFOTAStatus) Reset() { - *x = UpdateFOTAStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateFOTAStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateFOTAStatus) ProtoMessage() {} - -func (x *UpdateFOTAStatus) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateFOTAStatus.ProtoReflect.Descriptor instead. -func (*UpdateFOTAStatus) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{1} -} - -func (x *UpdateFOTAStatus) GetState() UpdateState { - if x != nil { - return x.State - } - return UpdateState_NO_UPDATE -} - -func (x *UpdateFOTAStatus) GetComponents() []*ComponentInfo { - if x != nil { - return x.Components - } - return nil -} - -func (x *UpdateFOTAStatus) GetUnitConfig() *UnitConfigInfo { - if x != nil { - return x.UnitConfig - } - return nil -} - -func (x *UpdateFOTAStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type UpdateSOTAStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - State UpdateState `protobuf:"varint,1,opt,name=state,proto3,enum=communicationmanager.v2.UpdateState" json:"state,omitempty"` - InstallServices []*ServiceInfo `protobuf:"bytes,2,rep,name=install_services,json=installServices,proto3" json:"install_services,omitempty"` - RemoveServices []*ServiceInfo `protobuf:"bytes,3,rep,name=remove_services,json=removeServices,proto3" json:"remove_services,omitempty"` - InstallLayers []*LayerInfo `protobuf:"bytes,4,rep,name=install_layers,json=installLayers,proto3" json:"install_layers,omitempty"` - RemoveLayers []*LayerInfo `protobuf:"bytes,5,rep,name=remove_layers,json=removeLayers,proto3" json:"remove_layers,omitempty"` - Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *UpdateSOTAStatus) Reset() { - *x = UpdateSOTAStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateSOTAStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateSOTAStatus) ProtoMessage() {} - -func (x *UpdateSOTAStatus) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateSOTAStatus.ProtoReflect.Descriptor instead. -func (*UpdateSOTAStatus) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{2} -} - -func (x *UpdateSOTAStatus) GetState() UpdateState { - if x != nil { - return x.State - } - return UpdateState_NO_UPDATE -} - -func (x *UpdateSOTAStatus) GetInstallServices() []*ServiceInfo { - if x != nil { - return x.InstallServices - } - return nil -} - -func (x *UpdateSOTAStatus) GetRemoveServices() []*ServiceInfo { - if x != nil { - return x.RemoveServices - } - return nil -} - -func (x *UpdateSOTAStatus) GetInstallLayers() []*LayerInfo { - if x != nil { - return x.InstallLayers - } - return nil -} - -func (x *UpdateSOTAStatus) GetRemoveLayers() []*LayerInfo { - if x != nil { - return x.RemoveLayers - } - return nil -} - -func (x *UpdateSOTAStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type ComponentInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - AosVersion uint64 `protobuf:"varint,2,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - VendorVersion string `protobuf:"bytes,3,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` -} - -func (x *ComponentInfo) Reset() { - *x = ComponentInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ComponentInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ComponentInfo) ProtoMessage() {} - -func (x *ComponentInfo) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ComponentInfo.ProtoReflect.Descriptor instead. -func (*ComponentInfo) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{3} -} - -func (x *ComponentInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ComponentInfo) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *ComponentInfo) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -type UnitConfigInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VendorVersion string `protobuf:"bytes,1,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` -} - -func (x *UnitConfigInfo) Reset() { - *x = UnitConfigInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UnitConfigInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UnitConfigInfo) ProtoMessage() {} - -func (x *UnitConfigInfo) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UnitConfigInfo.ProtoReflect.Descriptor instead. -func (*UnitConfigInfo) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{4} -} - -func (x *UnitConfigInfo) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -type ServiceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - AosVersion uint64 `protobuf:"varint,2,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` -} - -func (x *ServiceInfo) Reset() { - *x = ServiceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceInfo) ProtoMessage() {} - -func (x *ServiceInfo) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead. -func (*ServiceInfo) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{5} -} - -func (x *ServiceInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ServiceInfo) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -type LayerInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - AosVersion uint64 `protobuf:"varint,2,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - Digest string `protobuf:"bytes,3,opt,name=digest,proto3" json:"digest,omitempty"` -} - -func (x *LayerInfo) Reset() { - *x = LayerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LayerInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LayerInfo) ProtoMessage() {} - -func (x *LayerInfo) ProtoReflect() protoreflect.Message { - mi := &file_communicationmanager_v2_updatescheduler_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LayerInfo.ProtoReflect.Descriptor instead. -func (*LayerInfo) Descriptor() ([]byte, []int) { - return file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP(), []int{6} -} - -func (x *LayerInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *LayerInfo) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *LayerInfo) GetDigest() string { - if x != nil { - return x.Digest - } - return "" -} - -var File_communicationmanager_v2_updatescheduler_proto protoreflect.FileDescriptor - -var file_communicationmanager_v2_updatescheduler_proto_rawDesc = []byte{ - 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x16, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, - 0x6c, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x4c, 0x0a, 0x0b, 0x73, 0x6f, 0x74, 0x61, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x4f, 0x54, 0x41, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x48, 0x00, 0x52, 0x0a, 0x73, 0x6f, 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4c, - 0x0a, 0x0b, 0x66, 0x6f, 0x74, 0x61, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x46, 0x4f, 0x54, 0x41, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, - 0x52, 0x0a, 0x66, 0x6f, 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x17, 0x0a, 0x15, - 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf6, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x46, 0x4f, 0x54, 0x41, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x46, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x48, - 0x0a, 0x0b, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x6e, - 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x75, 0x6e, - 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x98, - 0x03, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x4f, 0x54, 0x41, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x4f, 0x0a, 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x12, 0x4d, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, - 0x49, 0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x32, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0d, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x0d, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x67, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, - 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0a, 0x61, 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x37, 0x0a, 0x0e, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x0b, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, - 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0a, 0x61, 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x09, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, 0x73, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x61, - 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, - 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, - 0x74, 0x2a, 0x50, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, - 0x0f, 0x0a, 0x0b, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, - 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x54, 0x4f, 0x5f, 0x55, 0x50, 0x44, - 0x41, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x55, 0x50, 0x44, 0x41, 0x54, 0x49, 0x4e, - 0x47, 0x10, 0x03, 0x32, 0x89, 0x02, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, - 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, - 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x46, 0x4f, 0x54, 0x41, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x4f, 0x54, 0x41, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x65, 0x0a, 0x16, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x62, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2f, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x00, 0x30, 0x01, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_communicationmanager_v2_updatescheduler_proto_rawDescOnce sync.Once - file_communicationmanager_v2_updatescheduler_proto_rawDescData = file_communicationmanager_v2_updatescheduler_proto_rawDesc -) - -func file_communicationmanager_v2_updatescheduler_proto_rawDescGZIP() []byte { - file_communicationmanager_v2_updatescheduler_proto_rawDescOnce.Do(func() { - file_communicationmanager_v2_updatescheduler_proto_rawDescData = protoimpl.X.CompressGZIP(file_communicationmanager_v2_updatescheduler_proto_rawDescData) - }) - return file_communicationmanager_v2_updatescheduler_proto_rawDescData -} - -var file_communicationmanager_v2_updatescheduler_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_communicationmanager_v2_updatescheduler_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_communicationmanager_v2_updatescheduler_proto_goTypes = []interface{}{ - (UpdateState)(0), // 0: communicationmanager.v2.UpdateState - (*SchedulerNotifications)(nil), // 1: communicationmanager.v2.SchedulerNotifications - (*UpdateFOTAStatus)(nil), // 2: communicationmanager.v2.UpdateFOTAStatus - (*UpdateSOTAStatus)(nil), // 3: communicationmanager.v2.UpdateSOTAStatus - (*ComponentInfo)(nil), // 4: communicationmanager.v2.ComponentInfo - (*UnitConfigInfo)(nil), // 5: communicationmanager.v2.UnitConfigInfo - (*ServiceInfo)(nil), // 6: communicationmanager.v2.ServiceInfo - (*LayerInfo)(nil), // 7: communicationmanager.v2.LayerInfo - (*empty.Empty)(nil), // 8: google.protobuf.Empty -} -var file_communicationmanager_v2_updatescheduler_proto_depIdxs = []int32{ - 3, // 0: communicationmanager.v2.SchedulerNotifications.sota_status:type_name -> communicationmanager.v2.UpdateSOTAStatus - 2, // 1: communicationmanager.v2.SchedulerNotifications.fota_status:type_name -> communicationmanager.v2.UpdateFOTAStatus - 0, // 2: communicationmanager.v2.UpdateFOTAStatus.state:type_name -> communicationmanager.v2.UpdateState - 4, // 3: communicationmanager.v2.UpdateFOTAStatus.components:type_name -> communicationmanager.v2.ComponentInfo - 5, // 4: communicationmanager.v2.UpdateFOTAStatus.unit_config:type_name -> communicationmanager.v2.UnitConfigInfo - 0, // 5: communicationmanager.v2.UpdateSOTAStatus.state:type_name -> communicationmanager.v2.UpdateState - 6, // 6: communicationmanager.v2.UpdateSOTAStatus.install_services:type_name -> communicationmanager.v2.ServiceInfo - 6, // 7: communicationmanager.v2.UpdateSOTAStatus.remove_services:type_name -> communicationmanager.v2.ServiceInfo - 7, // 8: communicationmanager.v2.UpdateSOTAStatus.install_layers:type_name -> communicationmanager.v2.LayerInfo - 7, // 9: communicationmanager.v2.UpdateSOTAStatus.remove_layers:type_name -> communicationmanager.v2.LayerInfo - 8, // 10: communicationmanager.v2.UpdateSchedulerService.StartFOTAUpdate:input_type -> google.protobuf.Empty - 8, // 11: communicationmanager.v2.UpdateSchedulerService.StartSOTAUpdate:input_type -> google.protobuf.Empty - 8, // 12: communicationmanager.v2.UpdateSchedulerService.SubscribeNotifications:input_type -> google.protobuf.Empty - 8, // 13: communicationmanager.v2.UpdateSchedulerService.StartFOTAUpdate:output_type -> google.protobuf.Empty - 8, // 14: communicationmanager.v2.UpdateSchedulerService.StartSOTAUpdate:output_type -> google.protobuf.Empty - 1, // 15: communicationmanager.v2.UpdateSchedulerService.SubscribeNotifications:output_type -> communicationmanager.v2.SchedulerNotifications - 13, // [13:16] is the sub-list for method output_type - 10, // [10:13] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name -} - -func init() { file_communicationmanager_v2_updatescheduler_proto_init() } -func file_communicationmanager_v2_updatescheduler_proto_init() { - if File_communicationmanager_v2_updatescheduler_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_communicationmanager_v2_updatescheduler_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchedulerNotifications); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateFOTAStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateSOTAStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ComponentInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnitConfigInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LayerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_communicationmanager_v2_updatescheduler_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*SchedulerNotifications_SotaStatus)(nil), - (*SchedulerNotifications_FotaStatus)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_communicationmanager_v2_updatescheduler_proto_rawDesc, - NumEnums: 1, - NumMessages: 7, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_communicationmanager_v2_updatescheduler_proto_goTypes, - DependencyIndexes: file_communicationmanager_v2_updatescheduler_proto_depIdxs, - EnumInfos: file_communicationmanager_v2_updatescheduler_proto_enumTypes, - MessageInfos: file_communicationmanager_v2_updatescheduler_proto_msgTypes, - }.Build() - File_communicationmanager_v2_updatescheduler_proto = out.File - file_communicationmanager_v2_updatescheduler_proto_rawDesc = nil - file_communicationmanager_v2_updatescheduler_proto_goTypes = nil - file_communicationmanager_v2_updatescheduler_proto_depIdxs = nil -} diff --git a/vendor/github.com/aosedge/aos_common/api/iamanager/iamanager.pb.go b/vendor/github.com/aosedge/aos_common/api/iamanager/iamanager.pb.go new file mode 100644 index 00000000..351bd5c9 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/iamanager/iamanager.pb.go @@ -0,0 +1,3223 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.26.0 +// source: iamanager/v5/iamanager.proto + +package iamanager + +import ( + common "github.com/aosedge/aos_common/api/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PartitionInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Types []string `protobuf:"bytes,2,rep,name=types,proto3" json:"types,omitempty"` + TotalSize uint64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *PartitionInfo) Reset() { + *x = PartitionInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PartitionInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartitionInfo) ProtoMessage() {} + +func (x *PartitionInfo) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartitionInfo.ProtoReflect.Descriptor instead. +func (*PartitionInfo) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{0} +} + +func (x *PartitionInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PartitionInfo) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + +func (x *PartitionInfo) GetTotalSize() uint64 { + if x != nil { + return x.TotalSize + } + return 0 +} + +func (x *PartitionInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type CPUInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + NumCores uint64 `protobuf:"varint,2,opt,name=num_cores,json=numCores,proto3" json:"num_cores,omitempty"` + NumThreads uint64 `protobuf:"varint,3,opt,name=num_threads,json=numThreads,proto3" json:"num_threads,omitempty"` + Arch string `protobuf:"bytes,4,opt,name=arch,proto3" json:"arch,omitempty"` + ArchFamily string `protobuf:"bytes,5,opt,name=arch_family,json=archFamily,proto3" json:"arch_family,omitempty"` + MaxDmips uint64 `protobuf:"varint,6,opt,name=max_dmips,json=maxDmips,proto3" json:"max_dmips,omitempty"` +} + +func (x *CPUInfo) Reset() { + *x = CPUInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CPUInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CPUInfo) ProtoMessage() {} + +func (x *CPUInfo) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CPUInfo.ProtoReflect.Descriptor instead. +func (*CPUInfo) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{1} +} + +func (x *CPUInfo) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *CPUInfo) GetNumCores() uint64 { + if x != nil { + return x.NumCores + } + return 0 +} + +func (x *CPUInfo) GetNumThreads() uint64 { + if x != nil { + return x.NumThreads + } + return 0 +} + +func (x *CPUInfo) GetArch() string { + if x != nil { + return x.Arch + } + return "" +} + +func (x *CPUInfo) GetArchFamily() string { + if x != nil { + return x.ArchFamily + } + return "" +} + +func (x *CPUInfo) GetMaxDmips() uint64 { + if x != nil { + return x.MaxDmips + } + return 0 +} + +type NodeAttribute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NodeAttribute) Reset() { + *x = NodeAttribute{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeAttribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeAttribute) ProtoMessage() {} + +func (x *NodeAttribute) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeAttribute.ProtoReflect.Descriptor instead. +func (*NodeAttribute) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{2} +} + +func (x *NodeAttribute) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeAttribute) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type NodeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + NodeType string `protobuf:"bytes,2,opt,name=node_type,json=nodeType,proto3" json:"node_type,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type,omitempty"` + Cpus []*CPUInfo `protobuf:"bytes,6,rep,name=cpus,proto3" json:"cpus,omitempty"` + MaxDmips uint64 `protobuf:"varint,7,opt,name=max_dmips,json=maxDmips,proto3" json:"max_dmips,omitempty"` + TotalRam uint64 `protobuf:"varint,8,opt,name=total_ram,json=totalRam,proto3" json:"total_ram,omitempty"` + Partitions []*PartitionInfo `protobuf:"bytes,9,rep,name=partitions,proto3" json:"partitions,omitempty"` + Attrs []*NodeAttribute `protobuf:"bytes,10,rep,name=attrs,proto3" json:"attrs,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,11,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *NodeInfo) Reset() { + *x = NodeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo) ProtoMessage() {} + +func (x *NodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead. +func (*NodeInfo) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{3} +} + +func (x *NodeInfo) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *NodeInfo) GetNodeType() string { + if x != nil { + return x.NodeType + } + return "" +} + +func (x *NodeInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeInfo) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *NodeInfo) GetOsType() string { + if x != nil { + return x.OsType + } + return "" +} + +func (x *NodeInfo) GetCpus() []*CPUInfo { + if x != nil { + return x.Cpus + } + return nil +} + +func (x *NodeInfo) GetMaxDmips() uint64 { + if x != nil { + return x.MaxDmips + } + return 0 +} + +func (x *NodeInfo) GetTotalRam() uint64 { + if x != nil { + return x.TotalRam + } + return 0 +} + +func (x *NodeInfo) GetPartitions() []*PartitionInfo { + if x != nil { + return x.Partitions + } + return nil +} + +func (x *NodeInfo) GetAttrs() []*NodeAttribute { + if x != nil { + return x.Attrs + } + return nil +} + +func (x *NodeInfo) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type GetCertRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` + Serial string `protobuf:"bytes,3,opt,name=serial,proto3" json:"serial,omitempty"` +} + +func (x *GetCertRequest) Reset() { + *x = GetCertRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCertRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCertRequest) ProtoMessage() {} + +func (x *GetCertRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCertRequest.ProtoReflect.Descriptor instead. +func (*GetCertRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{4} +} + +func (x *GetCertRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *GetCertRequest) GetIssuer() []byte { + if x != nil { + return x.Issuer + } + return nil +} + +func (x *GetCertRequest) GetSerial() string { + if x != nil { + return x.Serial + } + return "" +} + +type GetCertResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + CertUrl string `protobuf:"bytes,2,opt,name=cert_url,json=certUrl,proto3" json:"cert_url,omitempty"` + KeyUrl string `protobuf:"bytes,3,opt,name=key_url,json=keyUrl,proto3" json:"key_url,omitempty"` +} + +func (x *GetCertResponse) Reset() { + *x = GetCertResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCertResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCertResponse) ProtoMessage() {} + +func (x *GetCertResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCertResponse.ProtoReflect.Descriptor instead. +func (*GetCertResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{5} +} + +func (x *GetCertResponse) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *GetCertResponse) GetCertUrl() string { + if x != nil { + return x.CertUrl + } + return "" +} + +func (x *GetCertResponse) GetKeyUrl() string { + if x != nil { + return x.KeyUrl + } + return "" +} + +type SystemInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SystemId string `protobuf:"bytes,1,opt,name=system_id,json=systemId,proto3" json:"system_id,omitempty"` + UnitModel string `protobuf:"bytes,2,opt,name=unit_model,json=unitModel,proto3" json:"unit_model,omitempty"` +} + +func (x *SystemInfo) Reset() { + *x = SystemInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemInfo) ProtoMessage() {} + +func (x *SystemInfo) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemInfo.ProtoReflect.Descriptor instead. +func (*SystemInfo) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{6} +} + +func (x *SystemInfo) GetSystemId() string { + if x != nil { + return x.SystemId + } + return "" +} + +func (x *SystemInfo) GetUnitModel() string { + if x != nil { + return x.UnitModel + } + return "" +} + +type Subjects struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Subjects []string `protobuf:"bytes,1,rep,name=subjects,proto3" json:"subjects,omitempty"` +} + +func (x *Subjects) Reset() { + *x = Subjects{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Subjects) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Subjects) ProtoMessage() {} + +func (x *Subjects) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Subjects.ProtoReflect.Descriptor instead. +func (*Subjects) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{7} +} + +func (x *Subjects) GetSubjects() []string { + if x != nil { + return x.Subjects + } + return nil +} + +type PermissionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` + FunctionalServerId string `protobuf:"bytes,2,opt,name=functional_server_id,json=functionalServerId,proto3" json:"functional_server_id,omitempty"` +} + +func (x *PermissionsRequest) Reset() { + *x = PermissionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PermissionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PermissionsRequest) ProtoMessage() {} + +func (x *PermissionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PermissionsRequest.ProtoReflect.Descriptor instead. +func (*PermissionsRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{8} +} + +func (x *PermissionsRequest) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + +func (x *PermissionsRequest) GetFunctionalServerId() string { + if x != nil { + return x.FunctionalServerId + } + return "" +} + +type PermissionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Permissions *Permissions `protobuf:"bytes,2,opt,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (x *PermissionsResponse) Reset() { + *x = PermissionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PermissionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PermissionsResponse) ProtoMessage() {} + +func (x *PermissionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PermissionsResponse.ProtoReflect.Descriptor instead. +func (*PermissionsResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{9} +} + +func (x *PermissionsResponse) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *PermissionsResponse) GetPermissions() *Permissions { + if x != nil { + return x.Permissions + } + return nil +} + +type NodesID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *NodesID) Reset() { + *x = NodesID{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodesID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodesID) ProtoMessage() {} + +func (x *NodesID) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodesID.ProtoReflect.Descriptor instead. +func (*NodesID) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{10} +} + +func (x *NodesID) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type GetCertTypesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` +} + +func (x *GetCertTypesRequest) Reset() { + *x = GetCertTypesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCertTypesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCertTypesRequest) ProtoMessage() {} + +func (x *GetCertTypesRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCertTypesRequest.ProtoReflect.Descriptor instead. +func (*GetCertTypesRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{11} +} + +func (x *GetCertTypesRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +type CertTypes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"` +} + +func (x *CertTypes) Reset() { + *x = CertTypes{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertTypes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertTypes) ProtoMessage() {} + +func (x *CertTypes) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CertTypes.ProtoReflect.Descriptor instead. +func (*CertTypes) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{12} +} + +func (x *CertTypes) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + +type CreateKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *CreateKeyRequest) Reset() { + *x = CreateKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateKeyRequest) ProtoMessage() {} + +func (x *CreateKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateKeyRequest.ProtoReflect.Descriptor instead. +func (*CreateKeyRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateKeyRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *CreateKeyRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *CreateKeyRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CreateKeyRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Csr string `protobuf:"bytes,3,opt,name=csr,proto3" json:"csr,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *CreateKeyResponse) Reset() { + *x = CreateKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateKeyResponse) ProtoMessage() {} + +func (x *CreateKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateKeyResponse.ProtoReflect.Descriptor instead. +func (*CreateKeyResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateKeyResponse) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *CreateKeyResponse) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CreateKeyResponse) GetCsr() string { + if x != nil { + return x.Csr + } + return "" +} + +func (x *CreateKeyResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type ApplyCertRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Cert string `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` +} + +func (x *ApplyCertRequest) Reset() { + *x = ApplyCertRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyCertRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyCertRequest) ProtoMessage() {} + +func (x *ApplyCertRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyCertRequest.ProtoReflect.Descriptor instead. +func (*ApplyCertRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{15} +} + +func (x *ApplyCertRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *ApplyCertRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ApplyCertRequest) GetCert() string { + if x != nil { + return x.Cert + } + return "" +} + +type ApplyCertResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + CertUrl string `protobuf:"bytes,3,opt,name=cert_url,json=certUrl,proto3" json:"cert_url,omitempty"` + Serial string `protobuf:"bytes,4,opt,name=serial,proto3" json:"serial,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *ApplyCertResponse) Reset() { + *x = ApplyCertResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyCertResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyCertResponse) ProtoMessage() {} + +func (x *ApplyCertResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyCertResponse.ProtoReflect.Descriptor instead. +func (*ApplyCertResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{16} +} + +func (x *ApplyCertResponse) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *ApplyCertResponse) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ApplyCertResponse) GetCertUrl() string { + if x != nil { + return x.CertUrl + } + return "" +} + +func (x *ApplyCertResponse) GetSerial() string { + if x != nil { + return x.Serial + } + return "" +} + +func (x *ApplyCertResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type Permissions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Permissions map[string]string `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Permissions) Reset() { + *x = Permissions{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Permissions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Permissions) ProtoMessage() {} + +func (x *Permissions) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Permissions.ProtoReflect.Descriptor instead. +func (*Permissions) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{17} +} + +func (x *Permissions) GetPermissions() map[string]string { + if x != nil { + return x.Permissions + } + return nil +} + +type RegisterInstanceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Permissions map[string]*Permissions `protobuf:"bytes,2,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *RegisterInstanceRequest) Reset() { + *x = RegisterInstanceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterInstanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterInstanceRequest) ProtoMessage() {} + +func (x *RegisterInstanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterInstanceRequest.ProtoReflect.Descriptor instead. +func (*RegisterInstanceRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{18} +} + +func (x *RegisterInstanceRequest) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *RegisterInstanceRequest) GetPermissions() map[string]*Permissions { + if x != nil { + return x.Permissions + } + return nil +} + +type RegisterInstanceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` +} + +func (x *RegisterInstanceResponse) Reset() { + *x = RegisterInstanceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterInstanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterInstanceResponse) ProtoMessage() {} + +func (x *RegisterInstanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterInstanceResponse.ProtoReflect.Descriptor instead. +func (*RegisterInstanceResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{19} +} + +func (x *RegisterInstanceResponse) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + +type UnregisterInstanceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` +} + +func (x *UnregisterInstanceRequest) Reset() { + *x = UnregisterInstanceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnregisterInstanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnregisterInstanceRequest) ProtoMessage() {} + +func (x *UnregisterInstanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnregisterInstanceRequest.ProtoReflect.Descriptor instead. +func (*UnregisterInstanceRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{20} +} + +func (x *UnregisterInstanceRequest) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +type GetNodeInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` +} + +func (x *GetNodeInfoRequest) Reset() { + *x = GetNodeInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeInfoRequest) ProtoMessage() {} + +func (x *GetNodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeInfoRequest.ProtoReflect.Descriptor instead. +func (*GetNodeInfoRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{21} +} + +func (x *GetNodeInfoRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +type PauseNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` +} + +func (x *PauseNodeRequest) Reset() { + *x = PauseNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PauseNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PauseNodeRequest) ProtoMessage() {} + +func (x *PauseNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PauseNodeRequest.ProtoReflect.Descriptor instead. +func (*PauseNodeRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{22} +} + +func (x *PauseNodeRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +type PauseNodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error *common.ErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *PauseNodeResponse) Reset() { + *x = PauseNodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PauseNodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PauseNodeResponse) ProtoMessage() {} + +func (x *PauseNodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PauseNodeResponse.ProtoReflect.Descriptor instead. +func (*PauseNodeResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{23} +} + +func (x *PauseNodeResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type ResumeNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` +} + +func (x *ResumeNodeRequest) Reset() { + *x = ResumeNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResumeNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResumeNodeRequest) ProtoMessage() {} + +func (x *ResumeNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResumeNodeRequest.ProtoReflect.Descriptor instead. +func (*ResumeNodeRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{24} +} + +func (x *ResumeNodeRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +type ResumeNodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error *common.ErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *ResumeNodeResponse) Reset() { + *x = ResumeNodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResumeNodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResumeNodeResponse) ProtoMessage() {} + +func (x *ResumeNodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResumeNodeResponse.ProtoReflect.Descriptor instead. +func (*ResumeNodeResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{25} +} + +func (x *ResumeNodeResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type StartProvisioningRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *StartProvisioningRequest) Reset() { + *x = StartProvisioningRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartProvisioningRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartProvisioningRequest) ProtoMessage() {} + +func (x *StartProvisioningRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartProvisioningRequest.ProtoReflect.Descriptor instead. +func (*StartProvisioningRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{26} +} + +func (x *StartProvisioningRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *StartProvisioningRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type StartProvisioningResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error *common.ErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *StartProvisioningResponse) Reset() { + *x = StartProvisioningResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartProvisioningResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartProvisioningResponse) ProtoMessage() {} + +func (x *StartProvisioningResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartProvisioningResponse.ProtoReflect.Descriptor instead. +func (*StartProvisioningResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{27} +} + +func (x *StartProvisioningResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type FinishProvisioningRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *FinishProvisioningRequest) Reset() { + *x = FinishProvisioningRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FinishProvisioningRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FinishProvisioningRequest) ProtoMessage() {} + +func (x *FinishProvisioningRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FinishProvisioningRequest.ProtoReflect.Descriptor instead. +func (*FinishProvisioningRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{28} +} + +func (x *FinishProvisioningRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *FinishProvisioningRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type FinishProvisioningResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error *common.ErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *FinishProvisioningResponse) Reset() { + *x = FinishProvisioningResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FinishProvisioningResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FinishProvisioningResponse) ProtoMessage() {} + +func (x *FinishProvisioningResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FinishProvisioningResponse.ProtoReflect.Descriptor instead. +func (*FinishProvisioningResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{29} +} + +func (x *FinishProvisioningResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type DeprovisionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *DeprovisionRequest) Reset() { + *x = DeprovisionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprovisionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprovisionRequest) ProtoMessage() {} + +func (x *DeprovisionRequest) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprovisionRequest.ProtoReflect.Descriptor instead. +func (*DeprovisionRequest) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{30} +} + +func (x *DeprovisionRequest) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *DeprovisionRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type DeprovisionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error *common.ErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *DeprovisionResponse) Reset() { + *x = DeprovisionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprovisionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprovisionResponse) ProtoMessage() {} + +func (x *DeprovisionResponse) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprovisionResponse.ProtoReflect.Descriptor instead. +func (*DeprovisionResponse) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{31} +} + +func (x *DeprovisionResponse) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type IAMIncomingMessages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to IAMIncomingMessage: + // + // *IAMIncomingMessages_StartProvisioningRequest + // *IAMIncomingMessages_GetCertTypesRequest + // *IAMIncomingMessages_FinishProvisioningRequest + // *IAMIncomingMessages_DeprovisionRequest + // *IAMIncomingMessages_PauseNodeRequest + // *IAMIncomingMessages_ResumeNodeRequest + // *IAMIncomingMessages_CreateKeyRequest + // *IAMIncomingMessages_ApplyCertRequest + IAMIncomingMessage isIAMIncomingMessages_IAMIncomingMessage `protobuf_oneof:"IAMIncomingMessage"` +} + +func (x *IAMIncomingMessages) Reset() { + *x = IAMIncomingMessages{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IAMIncomingMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IAMIncomingMessages) ProtoMessage() {} + +func (x *IAMIncomingMessages) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IAMIncomingMessages.ProtoReflect.Descriptor instead. +func (*IAMIncomingMessages) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{32} +} + +func (m *IAMIncomingMessages) GetIAMIncomingMessage() isIAMIncomingMessages_IAMIncomingMessage { + if m != nil { + return m.IAMIncomingMessage + } + return nil +} + +func (x *IAMIncomingMessages) GetStartProvisioningRequest() *StartProvisioningRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_StartProvisioningRequest); ok { + return x.StartProvisioningRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetGetCertTypesRequest() *GetCertTypesRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_GetCertTypesRequest); ok { + return x.GetCertTypesRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetFinishProvisioningRequest() *FinishProvisioningRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_FinishProvisioningRequest); ok { + return x.FinishProvisioningRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetDeprovisionRequest() *DeprovisionRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_DeprovisionRequest); ok { + return x.DeprovisionRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetPauseNodeRequest() *PauseNodeRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_PauseNodeRequest); ok { + return x.PauseNodeRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetResumeNodeRequest() *ResumeNodeRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_ResumeNodeRequest); ok { + return x.ResumeNodeRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetCreateKeyRequest() *CreateKeyRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_CreateKeyRequest); ok { + return x.CreateKeyRequest + } + return nil +} + +func (x *IAMIncomingMessages) GetApplyCertRequest() *ApplyCertRequest { + if x, ok := x.GetIAMIncomingMessage().(*IAMIncomingMessages_ApplyCertRequest); ok { + return x.ApplyCertRequest + } + return nil +} + +type isIAMIncomingMessages_IAMIncomingMessage interface { + isIAMIncomingMessages_IAMIncomingMessage() +} + +type IAMIncomingMessages_StartProvisioningRequest struct { + StartProvisioningRequest *StartProvisioningRequest `protobuf:"bytes,1,opt,name=start_provisioning_request,json=startProvisioningRequest,proto3,oneof"` +} + +type IAMIncomingMessages_GetCertTypesRequest struct { + GetCertTypesRequest *GetCertTypesRequest `protobuf:"bytes,2,opt,name=get_cert_types_request,json=getCertTypesRequest,proto3,oneof"` +} + +type IAMIncomingMessages_FinishProvisioningRequest struct { + FinishProvisioningRequest *FinishProvisioningRequest `protobuf:"bytes,3,opt,name=finish_provisioning_request,json=finishProvisioningRequest,proto3,oneof"` +} + +type IAMIncomingMessages_DeprovisionRequest struct { + DeprovisionRequest *DeprovisionRequest `protobuf:"bytes,4,opt,name=deprovision_request,json=deprovisionRequest,proto3,oneof"` +} + +type IAMIncomingMessages_PauseNodeRequest struct { + PauseNodeRequest *PauseNodeRequest `protobuf:"bytes,5,opt,name=pause_node_request,json=pauseNodeRequest,proto3,oneof"` +} + +type IAMIncomingMessages_ResumeNodeRequest struct { + ResumeNodeRequest *ResumeNodeRequest `protobuf:"bytes,6,opt,name=resume_node_request,json=resumeNodeRequest,proto3,oneof"` +} + +type IAMIncomingMessages_CreateKeyRequest struct { + CreateKeyRequest *CreateKeyRequest `protobuf:"bytes,7,opt,name=create_key_request,json=createKeyRequest,proto3,oneof"` +} + +type IAMIncomingMessages_ApplyCertRequest struct { + ApplyCertRequest *ApplyCertRequest `protobuf:"bytes,8,opt,name=apply_cert_request,json=applyCertRequest,proto3,oneof"` +} + +func (*IAMIncomingMessages_StartProvisioningRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_GetCertTypesRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_FinishProvisioningRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_DeprovisionRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_PauseNodeRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_ResumeNodeRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_CreateKeyRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +func (*IAMIncomingMessages_ApplyCertRequest) isIAMIncomingMessages_IAMIncomingMessage() {} + +type IAMOutgoingMessages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to IAMOutgoingMessage: + // + // *IAMOutgoingMessages_NodeInfo + // *IAMOutgoingMessages_StartProvisioningResponse + // *IAMOutgoingMessages_CertTypesResponse + // *IAMOutgoingMessages_FinishProvisioningResponse + // *IAMOutgoingMessages_DeprovisionResponse + // *IAMOutgoingMessages_PauseNodeResponse + // *IAMOutgoingMessages_ResumeNodeResponse + // *IAMOutgoingMessages_CreateKeyResponse + // *IAMOutgoingMessages_ApplyCertResponse + IAMOutgoingMessage isIAMOutgoingMessages_IAMOutgoingMessage `protobuf_oneof:"IAMOutgoingMessage"` +} + +func (x *IAMOutgoingMessages) Reset() { + *x = IAMOutgoingMessages{} + if protoimpl.UnsafeEnabled { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IAMOutgoingMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IAMOutgoingMessages) ProtoMessage() {} + +func (x *IAMOutgoingMessages) ProtoReflect() protoreflect.Message { + mi := &file_iamanager_v5_iamanager_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IAMOutgoingMessages.ProtoReflect.Descriptor instead. +func (*IAMOutgoingMessages) Descriptor() ([]byte, []int) { + return file_iamanager_v5_iamanager_proto_rawDescGZIP(), []int{33} +} + +func (m *IAMOutgoingMessages) GetIAMOutgoingMessage() isIAMOutgoingMessages_IAMOutgoingMessage { + if m != nil { + return m.IAMOutgoingMessage + } + return nil +} + +func (x *IAMOutgoingMessages) GetNodeInfo() *NodeInfo { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_NodeInfo); ok { + return x.NodeInfo + } + return nil +} + +func (x *IAMOutgoingMessages) GetStartProvisioningResponse() *StartProvisioningResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_StartProvisioningResponse); ok { + return x.StartProvisioningResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetCertTypesResponse() *CertTypes { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_CertTypesResponse); ok { + return x.CertTypesResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetFinishProvisioningResponse() *FinishProvisioningResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_FinishProvisioningResponse); ok { + return x.FinishProvisioningResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetDeprovisionResponse() *DeprovisionResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_DeprovisionResponse); ok { + return x.DeprovisionResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetPauseNodeResponse() *PauseNodeResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_PauseNodeResponse); ok { + return x.PauseNodeResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetResumeNodeResponse() *ResumeNodeResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_ResumeNodeResponse); ok { + return x.ResumeNodeResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetCreateKeyResponse() *CreateKeyResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_CreateKeyResponse); ok { + return x.CreateKeyResponse + } + return nil +} + +func (x *IAMOutgoingMessages) GetApplyCertResponse() *ApplyCertResponse { + if x, ok := x.GetIAMOutgoingMessage().(*IAMOutgoingMessages_ApplyCertResponse); ok { + return x.ApplyCertResponse + } + return nil +} + +type isIAMOutgoingMessages_IAMOutgoingMessage interface { + isIAMOutgoingMessages_IAMOutgoingMessage() +} + +type IAMOutgoingMessages_NodeInfo struct { + NodeInfo *NodeInfo `protobuf:"bytes,1,opt,name=node_info,json=nodeInfo,proto3,oneof"` +} + +type IAMOutgoingMessages_StartProvisioningResponse struct { + StartProvisioningResponse *StartProvisioningResponse `protobuf:"bytes,2,opt,name=start_provisioning_response,json=startProvisioningResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_CertTypesResponse struct { + CertTypesResponse *CertTypes `protobuf:"bytes,3,opt,name=cert_types_response,json=certTypesResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_FinishProvisioningResponse struct { + FinishProvisioningResponse *FinishProvisioningResponse `protobuf:"bytes,4,opt,name=finish_provisioning_response,json=finishProvisioningResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_DeprovisionResponse struct { + DeprovisionResponse *DeprovisionResponse `protobuf:"bytes,5,opt,name=deprovision_response,json=deprovisionResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_PauseNodeResponse struct { + PauseNodeResponse *PauseNodeResponse `protobuf:"bytes,6,opt,name=pause_node_response,json=pauseNodeResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_ResumeNodeResponse struct { + ResumeNodeResponse *ResumeNodeResponse `protobuf:"bytes,7,opt,name=resume_node_response,json=resumeNodeResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_CreateKeyResponse struct { + CreateKeyResponse *CreateKeyResponse `protobuf:"bytes,8,opt,name=create_key_response,json=createKeyResponse,proto3,oneof"` +} + +type IAMOutgoingMessages_ApplyCertResponse struct { + ApplyCertResponse *ApplyCertResponse `protobuf:"bytes,9,opt,name=apply_cert_response,json=applyCertResponse,proto3,oneof"` +} + +func (*IAMOutgoingMessages_NodeInfo) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_StartProvisioningResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_CertTypesResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_FinishProvisioningResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_DeprovisionResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_PauseNodeResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_ResumeNodeResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_CreateKeyResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +func (*IAMOutgoingMessages_ApplyCertResponse) isIAMOutgoingMessages_IAMOutgoingMessage() {} + +var File_iamanager_v5_iamanager_proto protoreflect.FileDescriptor + +var file_iamanager_v5_iamanager_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x76, 0x35, 0x2f, 0x69, + 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, + 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x6c, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, + 0xb8, 0x01, 0x0a, 0x07, 0x43, 0x50, 0x55, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x75, + 0x6d, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6e, + 0x75, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x74, + 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6e, 0x75, + 0x6d, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x63, 0x68, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x0a, 0x0b, + 0x61, 0x72, 0x63, 0x68, 0x5f, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x61, 0x72, 0x63, 0x68, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x6d, 0x69, 0x70, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x6d, 0x61, 0x78, 0x44, 0x6d, 0x69, 0x70, 0x73, 0x22, 0x39, 0x0a, 0x0d, 0x4e, 0x6f, + 0x64, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x86, 0x03, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, + 0x04, 0x63, 0x70, 0x75, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x43, 0x50, 0x55, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x04, 0x63, 0x70, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, + 0x64, 0x6d, 0x69, 0x70, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, + 0x44, 0x6d, 0x69, 0x70, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x72, + 0x61, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x52, + 0x61, 0x6d, 0x12, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x31, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x05, 0x61, 0x74, 0x74, + 0x72, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x54, + 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, + 0x72, 0x69, 0x61, 0x6c, 0x22, 0x59, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, + 0x65, 0x72, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x65, 0x72, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x55, 0x72, 0x6c, 0x22, + 0x48, 0x0a, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, + 0x09, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x6e, + 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x75, 0x6e, 0x69, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x26, 0x0a, 0x08, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x73, 0x22, 0x5e, 0x0a, 0x12, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x30, 0x0a, 0x14, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, + 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x88, 0x01, 0x0a, 0x13, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, + 0x3b, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1b, 0x0a, 0x07, + 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x2e, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x09, 0x43, 0x65, 0x72, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x75, 0x0a, 0x10, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x22, 0x7e, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x73, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x63, 0x73, 0x72, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x22, 0x53, 0x0a, 0x10, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x63, 0x65, 0x72, 0x74, 0x22, 0x9f, 0x01, 0x0a, 0x11, 0x41, 0x70, 0x70, + 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, + 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, + 0x65, 0x72, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x65, 0x72, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x12, 0x2a, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x9b, 0x01, 0x0a, 0x0b, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x84, 0x02, 0x0a, 0x17, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0b, 0x70, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x36, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x59, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x32, 0x0a, 0x18, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x22, 0x51, 0x0a, 0x19, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x2d, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, + 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, + 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x10, 0x50, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, + 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x11, 0x50, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x22, 0x2c, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, + 0x64, 0x22, 0x40, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x22, 0x4f, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x22, 0x47, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x50, 0x0a, + 0x19, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, + 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, + 0x48, 0x0a, 0x1a, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x49, 0x0a, 0x12, 0x44, 0x65, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x22, 0x41, 0x0a, 0x13, 0x44, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xf0, 0x05, 0x0a, 0x13, 0x49, 0x41, 0x4d, 0x49, + 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, + 0x66, 0x0a, 0x1a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x35, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x18, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x58, 0x0a, 0x16, 0x67, 0x65, 0x74, 0x5f, 0x63, + 0x65, 0x72, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65, + 0x74, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x69, 0x0a, 0x1b, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, + 0x00, 0x52, 0x19, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x13, + 0x64, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x64, + 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x4e, 0x0a, 0x12, 0x70, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, + 0x10, 0x70, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x51, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, + 0x00, 0x52, 0x11, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x6b, + 0x65, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x12, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x5f, 0x63, 0x65, + 0x72, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, + 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x42, 0x14, 0x0a, 0x12, 0x49, 0x41, 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, + 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xad, 0x06, 0x0a, 0x13, 0x49, + 0x41, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, + 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x69, 0x0a, 0x1b, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x5f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x19, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x13, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, + 0x2e, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x48, 0x00, 0x52, 0x11, 0x63, 0x65, + 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x6c, 0x0a, 0x1c, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, + 0x00, 0x52, 0x1a, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, + 0x14, 0x64, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, + 0x52, 0x13, 0x64, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x13, 0x70, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x35, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x11, 0x70, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x12, 0x72, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, + 0x0a, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x11, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x51, 0x0a, 0x13, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, + 0x00, 0x52, 0x11, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x14, 0x0a, 0x12, 0x49, 0x41, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, + 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x9d, 0x01, 0x0a, 0x10, 0x49, + 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x3f, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, + 0x12, 0x48, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, 0x1c, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x65, + 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x69, 0x61, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xf0, 0x01, 0x0a, 0x18, 0x49, + 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x18, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0b, + 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x35, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x00, 0x12, 0x4e, 0x0a, + 0x18, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, + 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x00, 0x30, 0x01, 0x32, 0x76, 0x0a, + 0x1b, 0x49, 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x57, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, + 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, + 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xcc, 0x02, 0x0a, 0x15, 0x49, 0x41, 0x4d, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x73, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x44, 0x22, + 0x00, 0x12, 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, + 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x35, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x14, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, + 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x49, 0x41, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, + 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x21, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x49, 0x41, 0x4d, 0x49, 0x6e, + 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x00, + 0x28, 0x01, 0x30, 0x01, 0x32, 0xb4, 0x01, 0x0a, 0x0f, 0x49, 0x41, 0x4d, 0x4e, 0x6f, 0x64, 0x65, + 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x09, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0a, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4e, 0x6f, 0x64, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x8f, 0x03, 0x0a, 0x16, + 0x49, 0x41, 0x4d, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x69, 0x61, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x73, 0x22, 0x00, 0x12, 0x66, 0x0a, 0x11, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x69, 0x61, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x27, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, + 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x69, 0x0a, 0x12, + 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, + 0x6e, 0x67, 0x12, 0x27, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x35, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x69, 0x61, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, + 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x0b, 0x44, 0x65, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xb7, 0x01, + 0x0a, 0x15, 0x49, 0x41, 0x4d, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x35, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x35, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x09, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x43, 0x65, 0x72, 0x74, 0x12, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x35, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x35, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xd5, 0x01, 0x0a, 0x15, 0x49, 0x41, 0x4d, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x63, 0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x25, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x69, + 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x2e, 0x69, + 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x35, 0x2e, 0x55, 0x6e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_iamanager_v5_iamanager_proto_rawDescOnce sync.Once + file_iamanager_v5_iamanager_proto_rawDescData = file_iamanager_v5_iamanager_proto_rawDesc +) + +func file_iamanager_v5_iamanager_proto_rawDescGZIP() []byte { + file_iamanager_v5_iamanager_proto_rawDescOnce.Do(func() { + file_iamanager_v5_iamanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_iamanager_v5_iamanager_proto_rawDescData) + }) + return file_iamanager_v5_iamanager_proto_rawDescData +} + +var file_iamanager_v5_iamanager_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_iamanager_v5_iamanager_proto_goTypes = []interface{}{ + (*PartitionInfo)(nil), // 0: iamanager.v5.PartitionInfo + (*CPUInfo)(nil), // 1: iamanager.v5.CPUInfo + (*NodeAttribute)(nil), // 2: iamanager.v5.NodeAttribute + (*NodeInfo)(nil), // 3: iamanager.v5.NodeInfo + (*GetCertRequest)(nil), // 4: iamanager.v5.GetCertRequest + (*GetCertResponse)(nil), // 5: iamanager.v5.GetCertResponse + (*SystemInfo)(nil), // 6: iamanager.v5.SystemInfo + (*Subjects)(nil), // 7: iamanager.v5.Subjects + (*PermissionsRequest)(nil), // 8: iamanager.v5.PermissionsRequest + (*PermissionsResponse)(nil), // 9: iamanager.v5.PermissionsResponse + (*NodesID)(nil), // 10: iamanager.v5.NodesID + (*GetCertTypesRequest)(nil), // 11: iamanager.v5.GetCertTypesRequest + (*CertTypes)(nil), // 12: iamanager.v5.CertTypes + (*CreateKeyRequest)(nil), // 13: iamanager.v5.CreateKeyRequest + (*CreateKeyResponse)(nil), // 14: iamanager.v5.CreateKeyResponse + (*ApplyCertRequest)(nil), // 15: iamanager.v5.ApplyCertRequest + (*ApplyCertResponse)(nil), // 16: iamanager.v5.ApplyCertResponse + (*Permissions)(nil), // 17: iamanager.v5.Permissions + (*RegisterInstanceRequest)(nil), // 18: iamanager.v5.RegisterInstanceRequest + (*RegisterInstanceResponse)(nil), // 19: iamanager.v5.RegisterInstanceResponse + (*UnregisterInstanceRequest)(nil), // 20: iamanager.v5.UnregisterInstanceRequest + (*GetNodeInfoRequest)(nil), // 21: iamanager.v5.GetNodeInfoRequest + (*PauseNodeRequest)(nil), // 22: iamanager.v5.PauseNodeRequest + (*PauseNodeResponse)(nil), // 23: iamanager.v5.PauseNodeResponse + (*ResumeNodeRequest)(nil), // 24: iamanager.v5.ResumeNodeRequest + (*ResumeNodeResponse)(nil), // 25: iamanager.v5.ResumeNodeResponse + (*StartProvisioningRequest)(nil), // 26: iamanager.v5.StartProvisioningRequest + (*StartProvisioningResponse)(nil), // 27: iamanager.v5.StartProvisioningResponse + (*FinishProvisioningRequest)(nil), // 28: iamanager.v5.FinishProvisioningRequest + (*FinishProvisioningResponse)(nil), // 29: iamanager.v5.FinishProvisioningResponse + (*DeprovisionRequest)(nil), // 30: iamanager.v5.DeprovisionRequest + (*DeprovisionResponse)(nil), // 31: iamanager.v5.DeprovisionResponse + (*IAMIncomingMessages)(nil), // 32: iamanager.v5.IAMIncomingMessages + (*IAMOutgoingMessages)(nil), // 33: iamanager.v5.IAMOutgoingMessages + nil, // 34: iamanager.v5.Permissions.PermissionsEntry + nil, // 35: iamanager.v5.RegisterInstanceRequest.PermissionsEntry + (*common.ErrorInfo)(nil), // 36: common.v1.ErrorInfo + (*common.InstanceIdent)(nil), // 37: common.v1.InstanceIdent + (*emptypb.Empty)(nil), // 38: google.protobuf.Empty +} +var file_iamanager_v5_iamanager_proto_depIdxs = []int32{ + 1, // 0: iamanager.v5.NodeInfo.cpus:type_name -> iamanager.v5.CPUInfo + 0, // 1: iamanager.v5.NodeInfo.partitions:type_name -> iamanager.v5.PartitionInfo + 2, // 2: iamanager.v5.NodeInfo.attrs:type_name -> iamanager.v5.NodeAttribute + 36, // 3: iamanager.v5.NodeInfo.error:type_name -> common.v1.ErrorInfo + 37, // 4: iamanager.v5.PermissionsResponse.instance:type_name -> common.v1.InstanceIdent + 17, // 5: iamanager.v5.PermissionsResponse.permissions:type_name -> iamanager.v5.Permissions + 36, // 6: iamanager.v5.CreateKeyResponse.error:type_name -> common.v1.ErrorInfo + 36, // 7: iamanager.v5.ApplyCertResponse.error:type_name -> common.v1.ErrorInfo + 34, // 8: iamanager.v5.Permissions.permissions:type_name -> iamanager.v5.Permissions.PermissionsEntry + 37, // 9: iamanager.v5.RegisterInstanceRequest.instance:type_name -> common.v1.InstanceIdent + 35, // 10: iamanager.v5.RegisterInstanceRequest.permissions:type_name -> iamanager.v5.RegisterInstanceRequest.PermissionsEntry + 37, // 11: iamanager.v5.UnregisterInstanceRequest.instance:type_name -> common.v1.InstanceIdent + 36, // 12: iamanager.v5.PauseNodeResponse.error:type_name -> common.v1.ErrorInfo + 36, // 13: iamanager.v5.ResumeNodeResponse.error:type_name -> common.v1.ErrorInfo + 36, // 14: iamanager.v5.StartProvisioningResponse.error:type_name -> common.v1.ErrorInfo + 36, // 15: iamanager.v5.FinishProvisioningResponse.error:type_name -> common.v1.ErrorInfo + 36, // 16: iamanager.v5.DeprovisionResponse.error:type_name -> common.v1.ErrorInfo + 26, // 17: iamanager.v5.IAMIncomingMessages.start_provisioning_request:type_name -> iamanager.v5.StartProvisioningRequest + 11, // 18: iamanager.v5.IAMIncomingMessages.get_cert_types_request:type_name -> iamanager.v5.GetCertTypesRequest + 28, // 19: iamanager.v5.IAMIncomingMessages.finish_provisioning_request:type_name -> iamanager.v5.FinishProvisioningRequest + 30, // 20: iamanager.v5.IAMIncomingMessages.deprovision_request:type_name -> iamanager.v5.DeprovisionRequest + 22, // 21: iamanager.v5.IAMIncomingMessages.pause_node_request:type_name -> iamanager.v5.PauseNodeRequest + 24, // 22: iamanager.v5.IAMIncomingMessages.resume_node_request:type_name -> iamanager.v5.ResumeNodeRequest + 13, // 23: iamanager.v5.IAMIncomingMessages.create_key_request:type_name -> iamanager.v5.CreateKeyRequest + 15, // 24: iamanager.v5.IAMIncomingMessages.apply_cert_request:type_name -> iamanager.v5.ApplyCertRequest + 3, // 25: iamanager.v5.IAMOutgoingMessages.node_info:type_name -> iamanager.v5.NodeInfo + 27, // 26: iamanager.v5.IAMOutgoingMessages.start_provisioning_response:type_name -> iamanager.v5.StartProvisioningResponse + 12, // 27: iamanager.v5.IAMOutgoingMessages.cert_types_response:type_name -> iamanager.v5.CertTypes + 29, // 28: iamanager.v5.IAMOutgoingMessages.finish_provisioning_response:type_name -> iamanager.v5.FinishProvisioningResponse + 31, // 29: iamanager.v5.IAMOutgoingMessages.deprovision_response:type_name -> iamanager.v5.DeprovisionResponse + 23, // 30: iamanager.v5.IAMOutgoingMessages.pause_node_response:type_name -> iamanager.v5.PauseNodeResponse + 25, // 31: iamanager.v5.IAMOutgoingMessages.resume_node_response:type_name -> iamanager.v5.ResumeNodeResponse + 14, // 32: iamanager.v5.IAMOutgoingMessages.create_key_response:type_name -> iamanager.v5.CreateKeyResponse + 16, // 33: iamanager.v5.IAMOutgoingMessages.apply_cert_response:type_name -> iamanager.v5.ApplyCertResponse + 17, // 34: iamanager.v5.RegisterInstanceRequest.PermissionsEntry.value:type_name -> iamanager.v5.Permissions + 38, // 35: iamanager.v5.IAMPublicService.GetNodeInfo:input_type -> google.protobuf.Empty + 4, // 36: iamanager.v5.IAMPublicService.GetCert:input_type -> iamanager.v5.GetCertRequest + 38, // 37: iamanager.v5.IAMPublicIdentityService.GetSystemInfo:input_type -> google.protobuf.Empty + 38, // 38: iamanager.v5.IAMPublicIdentityService.GetSubjects:input_type -> google.protobuf.Empty + 38, // 39: iamanager.v5.IAMPublicIdentityService.SubscribeSubjectsChanged:input_type -> google.protobuf.Empty + 8, // 40: iamanager.v5.IAMPublicPermissionsService.GetPermissions:input_type -> iamanager.v5.PermissionsRequest + 38, // 41: iamanager.v5.IAMPublicNodesService.GetAllNodeIDs:input_type -> google.protobuf.Empty + 21, // 42: iamanager.v5.IAMPublicNodesService.GetNodeInfo:input_type -> iamanager.v5.GetNodeInfoRequest + 38, // 43: iamanager.v5.IAMPublicNodesService.SubscribeNodeChanged:input_type -> google.protobuf.Empty + 33, // 44: iamanager.v5.IAMPublicNodesService.RegisterNode:input_type -> iamanager.v5.IAMOutgoingMessages + 22, // 45: iamanager.v5.IAMNodesService.PauseNode:input_type -> iamanager.v5.PauseNodeRequest + 24, // 46: iamanager.v5.IAMNodesService.ResumeNode:input_type -> iamanager.v5.ResumeNodeRequest + 11, // 47: iamanager.v5.IAMProvisioningService.GetCertTypes:input_type -> iamanager.v5.GetCertTypesRequest + 26, // 48: iamanager.v5.IAMProvisioningService.StartProvisioning:input_type -> iamanager.v5.StartProvisioningRequest + 28, // 49: iamanager.v5.IAMProvisioningService.FinishProvisioning:input_type -> iamanager.v5.FinishProvisioningRequest + 30, // 50: iamanager.v5.IAMProvisioningService.Deprovision:input_type -> iamanager.v5.DeprovisionRequest + 13, // 51: iamanager.v5.IAMCertificateService.CreateKey:input_type -> iamanager.v5.CreateKeyRequest + 15, // 52: iamanager.v5.IAMCertificateService.ApplyCert:input_type -> iamanager.v5.ApplyCertRequest + 18, // 53: iamanager.v5.IAMPermissionsService.RegisterInstance:input_type -> iamanager.v5.RegisterInstanceRequest + 20, // 54: iamanager.v5.IAMPermissionsService.UnregisterInstance:input_type -> iamanager.v5.UnregisterInstanceRequest + 3, // 55: iamanager.v5.IAMPublicService.GetNodeInfo:output_type -> iamanager.v5.NodeInfo + 5, // 56: iamanager.v5.IAMPublicService.GetCert:output_type -> iamanager.v5.GetCertResponse + 6, // 57: iamanager.v5.IAMPublicIdentityService.GetSystemInfo:output_type -> iamanager.v5.SystemInfo + 7, // 58: iamanager.v5.IAMPublicIdentityService.GetSubjects:output_type -> iamanager.v5.Subjects + 7, // 59: iamanager.v5.IAMPublicIdentityService.SubscribeSubjectsChanged:output_type -> iamanager.v5.Subjects + 9, // 60: iamanager.v5.IAMPublicPermissionsService.GetPermissions:output_type -> iamanager.v5.PermissionsResponse + 10, // 61: iamanager.v5.IAMPublicNodesService.GetAllNodeIDs:output_type -> iamanager.v5.NodesID + 3, // 62: iamanager.v5.IAMPublicNodesService.GetNodeInfo:output_type -> iamanager.v5.NodeInfo + 3, // 63: iamanager.v5.IAMPublicNodesService.SubscribeNodeChanged:output_type -> iamanager.v5.NodeInfo + 32, // 64: iamanager.v5.IAMPublicNodesService.RegisterNode:output_type -> iamanager.v5.IAMIncomingMessages + 23, // 65: iamanager.v5.IAMNodesService.PauseNode:output_type -> iamanager.v5.PauseNodeResponse + 25, // 66: iamanager.v5.IAMNodesService.ResumeNode:output_type -> iamanager.v5.ResumeNodeResponse + 12, // 67: iamanager.v5.IAMProvisioningService.GetCertTypes:output_type -> iamanager.v5.CertTypes + 27, // 68: iamanager.v5.IAMProvisioningService.StartProvisioning:output_type -> iamanager.v5.StartProvisioningResponse + 29, // 69: iamanager.v5.IAMProvisioningService.FinishProvisioning:output_type -> iamanager.v5.FinishProvisioningResponse + 31, // 70: iamanager.v5.IAMProvisioningService.Deprovision:output_type -> iamanager.v5.DeprovisionResponse + 14, // 71: iamanager.v5.IAMCertificateService.CreateKey:output_type -> iamanager.v5.CreateKeyResponse + 16, // 72: iamanager.v5.IAMCertificateService.ApplyCert:output_type -> iamanager.v5.ApplyCertResponse + 19, // 73: iamanager.v5.IAMPermissionsService.RegisterInstance:output_type -> iamanager.v5.RegisterInstanceResponse + 38, // 74: iamanager.v5.IAMPermissionsService.UnregisterInstance:output_type -> google.protobuf.Empty + 55, // [55:75] is the sub-list for method output_type + 35, // [35:55] is the sub-list for method input_type + 35, // [35:35] is the sub-list for extension type_name + 35, // [35:35] is the sub-list for extension extendee + 0, // [0:35] is the sub-list for field type_name +} + +func init() { file_iamanager_v5_iamanager_proto_init() } +func file_iamanager_v5_iamanager_proto_init() { + if File_iamanager_v5_iamanager_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_iamanager_v5_iamanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PartitionInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CPUInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeAttribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCertRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCertResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Subjects); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PermissionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PermissionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodesID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCertTypesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertTypes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyCertRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyCertResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Permissions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterInstanceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterInstanceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnregisterInstanceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PauseNodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PauseNodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeNodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeNodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartProvisioningRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartProvisioningResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FinishProvisioningRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FinishProvisioningResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprovisionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprovisionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IAMIncomingMessages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_iamanager_v5_iamanager_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IAMOutgoingMessages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_iamanager_v5_iamanager_proto_msgTypes[32].OneofWrappers = []interface{}{ + (*IAMIncomingMessages_StartProvisioningRequest)(nil), + (*IAMIncomingMessages_GetCertTypesRequest)(nil), + (*IAMIncomingMessages_FinishProvisioningRequest)(nil), + (*IAMIncomingMessages_DeprovisionRequest)(nil), + (*IAMIncomingMessages_PauseNodeRequest)(nil), + (*IAMIncomingMessages_ResumeNodeRequest)(nil), + (*IAMIncomingMessages_CreateKeyRequest)(nil), + (*IAMIncomingMessages_ApplyCertRequest)(nil), + } + file_iamanager_v5_iamanager_proto_msgTypes[33].OneofWrappers = []interface{}{ + (*IAMOutgoingMessages_NodeInfo)(nil), + (*IAMOutgoingMessages_StartProvisioningResponse)(nil), + (*IAMOutgoingMessages_CertTypesResponse)(nil), + (*IAMOutgoingMessages_FinishProvisioningResponse)(nil), + (*IAMOutgoingMessages_DeprovisionResponse)(nil), + (*IAMOutgoingMessages_PauseNodeResponse)(nil), + (*IAMOutgoingMessages_ResumeNodeResponse)(nil), + (*IAMOutgoingMessages_CreateKeyResponse)(nil), + (*IAMOutgoingMessages_ApplyCertResponse)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_iamanager_v5_iamanager_proto_rawDesc, + NumEnums: 0, + NumMessages: 36, + NumExtensions: 0, + NumServices: 8, + }, + GoTypes: file_iamanager_v5_iamanager_proto_goTypes, + DependencyIndexes: file_iamanager_v5_iamanager_proto_depIdxs, + MessageInfos: file_iamanager_v5_iamanager_proto_msgTypes, + }.Build() + File_iamanager_v5_iamanager_proto = out.File + file_iamanager_v5_iamanager_proto_rawDesc = nil + file_iamanager_v5_iamanager_proto_goTypes = nil + file_iamanager_v5_iamanager_proto_depIdxs = nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager_grpc.pb.go b/vendor/github.com/aosedge/aos_common/api/iamanager/iamanager_grpc.pb.go similarity index 59% rename from vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager_grpc.pb.go rename to vendor/github.com/aosedge/aos_common/api/iamanager/iamanager_grpc.pb.go index 27f9b014..dd5d5939 100644 --- a/vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager_grpc.pb.go +++ b/vendor/github.com/aosedge/aos_common/api/iamanager/iamanager_grpc.pb.go @@ -1,17 +1,17 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.12.4 -// source: iamanager/v4/iamanager.proto +// - protoc v5.26.0 +// source: iamanager/v5/iamanager.proto package iamanager import ( context "context" - empty "github.com/golang/protobuf/ptypes/empty" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file @@ -23,8 +23,7 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type IAMPublicServiceClient interface { - GetAPIVersion(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*APIVersion, error) - GetNodeInfo(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*NodeInfo, error) + GetNodeInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NodeInfo, error) GetCert(ctx context.Context, in *GetCertRequest, opts ...grpc.CallOption) (*GetCertResponse, error) } @@ -36,18 +35,9 @@ func NewIAMPublicServiceClient(cc grpc.ClientConnInterface) IAMPublicServiceClie return &iAMPublicServiceClient{cc} } -func (c *iAMPublicServiceClient) GetAPIVersion(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*APIVersion, error) { - out := new(APIVersion) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicService/GetAPIVersion", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *iAMPublicServiceClient) GetNodeInfo(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*NodeInfo, error) { +func (c *iAMPublicServiceClient) GetNodeInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NodeInfo, error) { out := new(NodeInfo) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicService/GetNodeInfo", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicService/GetNodeInfo", in, out, opts...) if err != nil { return nil, err } @@ -56,7 +46,7 @@ func (c *iAMPublicServiceClient) GetNodeInfo(ctx context.Context, in *empty.Empt func (c *iAMPublicServiceClient) GetCert(ctx context.Context, in *GetCertRequest, opts ...grpc.CallOption) (*GetCertResponse, error) { out := new(GetCertResponse) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicService/GetCert", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicService/GetCert", in, out, opts...) if err != nil { return nil, err } @@ -67,8 +57,7 @@ func (c *iAMPublicServiceClient) GetCert(ctx context.Context, in *GetCertRequest // All implementations must embed UnimplementedIAMPublicServiceServer // for forward compatibility type IAMPublicServiceServer interface { - GetAPIVersion(context.Context, *empty.Empty) (*APIVersion, error) - GetNodeInfo(context.Context, *empty.Empty) (*NodeInfo, error) + GetNodeInfo(context.Context, *emptypb.Empty) (*NodeInfo, error) GetCert(context.Context, *GetCertRequest) (*GetCertResponse, error) mustEmbedUnimplementedIAMPublicServiceServer() } @@ -77,10 +66,7 @@ type IAMPublicServiceServer interface { type UnimplementedIAMPublicServiceServer struct { } -func (UnimplementedIAMPublicServiceServer) GetAPIVersion(context.Context, *empty.Empty) (*APIVersion, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAPIVersion not implemented") -} -func (UnimplementedIAMPublicServiceServer) GetNodeInfo(context.Context, *empty.Empty) (*NodeInfo, error) { +func (UnimplementedIAMPublicServiceServer) GetNodeInfo(context.Context, *emptypb.Empty) (*NodeInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method GetNodeInfo not implemented") } func (UnimplementedIAMPublicServiceServer) GetCert(context.Context, *GetCertRequest) (*GetCertResponse, error) { @@ -99,26 +85,8 @@ func RegisterIAMPublicServiceServer(s grpc.ServiceRegistrar, srv IAMPublicServic s.RegisterService(&IAMPublicService_ServiceDesc, srv) } -func _IAMPublicService_GetAPIVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(IAMPublicServiceServer).GetAPIVersion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/iamanager.v4.IAMPublicService/GetAPIVersion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMPublicServiceServer).GetAPIVersion(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - func _IAMPublicService_GetNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -127,10 +95,10 @@ func _IAMPublicService_GetNodeInfo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPublicService/GetNodeInfo", + FullMethod: "/iamanager.v5.IAMPublicService/GetNodeInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMPublicServiceServer).GetNodeInfo(ctx, req.(*empty.Empty)) + return srv.(IAMPublicServiceServer).GetNodeInfo(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -145,7 +113,7 @@ func _IAMPublicService_GetCert_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPublicService/GetCert", + FullMethod: "/iamanager.v5.IAMPublicService/GetCert", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMPublicServiceServer).GetCert(ctx, req.(*GetCertRequest)) @@ -157,13 +125,9 @@ func _IAMPublicService_GetCert_Handler(srv interface{}, ctx context.Context, dec // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMPublicService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMPublicService", + ServiceName: "iamanager.v5.IAMPublicService", HandlerType: (*IAMPublicServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "GetAPIVersion", - Handler: _IAMPublicService_GetAPIVersion_Handler, - }, { MethodName: "GetNodeInfo", Handler: _IAMPublicService_GetNodeInfo_Handler, @@ -174,16 +138,16 @@ var IAMPublicService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } // IAMPublicIdentityServiceClient is the client API for IAMPublicIdentityService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type IAMPublicIdentityServiceClient interface { - GetSystemInfo(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SystemInfo, error) - GetSubjects(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Subjects, error) - SubscribeSubjectsChanged(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (IAMPublicIdentityService_SubscribeSubjectsChangedClient, error) + GetSystemInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SystemInfo, error) + GetSubjects(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Subjects, error) + SubscribeSubjectsChanged(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (IAMPublicIdentityService_SubscribeSubjectsChangedClient, error) } type iAMPublicIdentityServiceClient struct { @@ -194,26 +158,26 @@ func NewIAMPublicIdentityServiceClient(cc grpc.ClientConnInterface) IAMPublicIde return &iAMPublicIdentityServiceClient{cc} } -func (c *iAMPublicIdentityServiceClient) GetSystemInfo(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SystemInfo, error) { +func (c *iAMPublicIdentityServiceClient) GetSystemInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SystemInfo, error) { out := new(SystemInfo) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicIdentityService/GetSystemInfo", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicIdentityService/GetSystemInfo", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *iAMPublicIdentityServiceClient) GetSubjects(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Subjects, error) { +func (c *iAMPublicIdentityServiceClient) GetSubjects(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Subjects, error) { out := new(Subjects) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicIdentityService/GetSubjects", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicIdentityService/GetSubjects", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *iAMPublicIdentityServiceClient) SubscribeSubjectsChanged(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (IAMPublicIdentityService_SubscribeSubjectsChangedClient, error) { - stream, err := c.cc.NewStream(ctx, &IAMPublicIdentityService_ServiceDesc.Streams[0], "/iamanager.v4.IAMPublicIdentityService/SubscribeSubjectsChanged", opts...) +func (c *iAMPublicIdentityServiceClient) SubscribeSubjectsChanged(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (IAMPublicIdentityService_SubscribeSubjectsChangedClient, error) { + stream, err := c.cc.NewStream(ctx, &IAMPublicIdentityService_ServiceDesc.Streams[0], "/iamanager.v5.IAMPublicIdentityService/SubscribeSubjectsChanged", opts...) if err != nil { return nil, err } @@ -248,9 +212,9 @@ func (x *iAMPublicIdentityServiceSubscribeSubjectsChangedClient) Recv() (*Subjec // All implementations must embed UnimplementedIAMPublicIdentityServiceServer // for forward compatibility type IAMPublicIdentityServiceServer interface { - GetSystemInfo(context.Context, *empty.Empty) (*SystemInfo, error) - GetSubjects(context.Context, *empty.Empty) (*Subjects, error) - SubscribeSubjectsChanged(*empty.Empty, IAMPublicIdentityService_SubscribeSubjectsChangedServer) error + GetSystemInfo(context.Context, *emptypb.Empty) (*SystemInfo, error) + GetSubjects(context.Context, *emptypb.Empty) (*Subjects, error) + SubscribeSubjectsChanged(*emptypb.Empty, IAMPublicIdentityService_SubscribeSubjectsChangedServer) error mustEmbedUnimplementedIAMPublicIdentityServiceServer() } @@ -258,13 +222,13 @@ type IAMPublicIdentityServiceServer interface { type UnimplementedIAMPublicIdentityServiceServer struct { } -func (UnimplementedIAMPublicIdentityServiceServer) GetSystemInfo(context.Context, *empty.Empty) (*SystemInfo, error) { +func (UnimplementedIAMPublicIdentityServiceServer) GetSystemInfo(context.Context, *emptypb.Empty) (*SystemInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSystemInfo not implemented") } -func (UnimplementedIAMPublicIdentityServiceServer) GetSubjects(context.Context, *empty.Empty) (*Subjects, error) { +func (UnimplementedIAMPublicIdentityServiceServer) GetSubjects(context.Context, *emptypb.Empty) (*Subjects, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSubjects not implemented") } -func (UnimplementedIAMPublicIdentityServiceServer) SubscribeSubjectsChanged(*empty.Empty, IAMPublicIdentityService_SubscribeSubjectsChangedServer) error { +func (UnimplementedIAMPublicIdentityServiceServer) SubscribeSubjectsChanged(*emptypb.Empty, IAMPublicIdentityService_SubscribeSubjectsChangedServer) error { return status.Errorf(codes.Unimplemented, "method SubscribeSubjectsChanged not implemented") } func (UnimplementedIAMPublicIdentityServiceServer) mustEmbedUnimplementedIAMPublicIdentityServiceServer() { @@ -282,7 +246,7 @@ func RegisterIAMPublicIdentityServiceServer(s grpc.ServiceRegistrar, srv IAMPubl } func _IAMPublicIdentityService_GetSystemInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -291,16 +255,16 @@ func _IAMPublicIdentityService_GetSystemInfo_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPublicIdentityService/GetSystemInfo", + FullMethod: "/iamanager.v5.IAMPublicIdentityService/GetSystemInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMPublicIdentityServiceServer).GetSystemInfo(ctx, req.(*empty.Empty)) + return srv.(IAMPublicIdentityServiceServer).GetSystemInfo(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _IAMPublicIdentityService_GetSubjects_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -309,16 +273,16 @@ func _IAMPublicIdentityService_GetSubjects_Handler(srv interface{}, ctx context. } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPublicIdentityService/GetSubjects", + FullMethod: "/iamanager.v5.IAMPublicIdentityService/GetSubjects", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMPublicIdentityServiceServer).GetSubjects(ctx, req.(*empty.Empty)) + return srv.(IAMPublicIdentityServiceServer).GetSubjects(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _IAMPublicIdentityService_SubscribeSubjectsChanged_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(empty.Empty) + m := new(emptypb.Empty) if err := stream.RecvMsg(m); err != nil { return err } @@ -342,7 +306,7 @@ func (x *iAMPublicIdentityServiceSubscribeSubjectsChangedServer) Send(m *Subject // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMPublicIdentityService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMPublicIdentityService", + ServiceName: "iamanager.v5.IAMPublicIdentityService", HandlerType: (*IAMPublicIdentityServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -361,7 +325,7 @@ var IAMPublicIdentityService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } // IAMPublicPermissionsServiceClient is the client API for IAMPublicPermissionsService service. @@ -381,7 +345,7 @@ func NewIAMPublicPermissionsServiceClient(cc grpc.ClientConnInterface) IAMPublic func (c *iAMPublicPermissionsServiceClient) GetPermissions(ctx context.Context, in *PermissionsRequest, opts ...grpc.CallOption) (*PermissionsResponse, error) { out := new(PermissionsResponse) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPublicPermissionsService/GetPermissions", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicPermissionsService/GetPermissions", in, out, opts...) if err != nil { return nil, err } @@ -427,7 +391,7 @@ func _IAMPublicPermissionsService_GetPermissions_Handler(srv interface{}, ctx co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPublicPermissionsService/GetPermissions", + FullMethod: "/iamanager.v5.IAMPublicPermissionsService/GetPermissions", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMPublicPermissionsServiceServer).GetPermissions(ctx, req.(*PermissionsRequest)) @@ -439,7 +403,7 @@ func _IAMPublicPermissionsService_GetPermissions_Handler(srv interface{}, ctx co // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMPublicPermissionsService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMPublicPermissionsService", + ServiceName: "iamanager.v5.IAMPublicPermissionsService", HandlerType: (*IAMPublicPermissionsServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -448,236 +412,548 @@ var IAMPublicPermissionsService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } -// IAMProvisioningServiceClient is the client API for IAMProvisioningService service. +// IAMPublicNodesServiceClient is the client API for IAMPublicNodesService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type IAMProvisioningServiceClient interface { - GetAllNodeIDs(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*NodesID, error) - GetCertTypes(ctx context.Context, in *GetCertTypesRequest, opts ...grpc.CallOption) (*CertTypes, error) - SetOwner(ctx context.Context, in *SetOwnerRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Clear(ctx context.Context, in *ClearRequest, opts ...grpc.CallOption) (*empty.Empty, error) - EncryptDisk(ctx context.Context, in *EncryptDiskRequest, opts ...grpc.CallOption) (*empty.Empty, error) - FinishProvisioning(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) +type IAMPublicNodesServiceClient interface { + GetAllNodeIDs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NodesID, error) + GetNodeInfo(ctx context.Context, in *GetNodeInfoRequest, opts ...grpc.CallOption) (*NodeInfo, error) + SubscribeNodeChanged(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (IAMPublicNodesService_SubscribeNodeChangedClient, error) + RegisterNode(ctx context.Context, opts ...grpc.CallOption) (IAMPublicNodesService_RegisterNodeClient, error) } -type iAMProvisioningServiceClient struct { +type iAMPublicNodesServiceClient struct { cc grpc.ClientConnInterface } -func NewIAMProvisioningServiceClient(cc grpc.ClientConnInterface) IAMProvisioningServiceClient { - return &iAMProvisioningServiceClient{cc} +func NewIAMPublicNodesServiceClient(cc grpc.ClientConnInterface) IAMPublicNodesServiceClient { + return &iAMPublicNodesServiceClient{cc} } -func (c *iAMProvisioningServiceClient) GetAllNodeIDs(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*NodesID, error) { +func (c *iAMPublicNodesServiceClient) GetAllNodeIDs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NodesID, error) { out := new(NodesID) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/GetAllNodeIDs", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicNodesService/GetAllNodeIDs", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *iAMProvisioningServiceClient) GetCertTypes(ctx context.Context, in *GetCertTypesRequest, opts ...grpc.CallOption) (*CertTypes, error) { - out := new(CertTypes) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/GetCertTypes", in, out, opts...) +func (c *iAMPublicNodesServiceClient) GetNodeInfo(ctx context.Context, in *GetNodeInfoRequest, opts ...grpc.CallOption) (*NodeInfo, error) { + out := new(NodeInfo) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPublicNodesService/GetNodeInfo", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *iAMProvisioningServiceClient) SetOwner(ctx context.Context, in *SetOwnerRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/SetOwner", in, out, opts...) +func (c *iAMPublicNodesServiceClient) SubscribeNodeChanged(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (IAMPublicNodesService_SubscribeNodeChangedClient, error) { + stream, err := c.cc.NewStream(ctx, &IAMPublicNodesService_ServiceDesc.Streams[0], "/iamanager.v5.IAMPublicNodesService/SubscribeNodeChanged", opts...) if err != nil { return nil, err } - return out, nil + x := &iAMPublicNodesServiceSubscribeNodeChangedClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil } -func (c *iAMProvisioningServiceClient) Clear(ctx context.Context, in *ClearRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/Clear", in, out, opts...) - if err != nil { +type IAMPublicNodesService_SubscribeNodeChangedClient interface { + Recv() (*NodeInfo, error) + grpc.ClientStream +} + +type iAMPublicNodesServiceSubscribeNodeChangedClient struct { + grpc.ClientStream +} + +func (x *iAMPublicNodesServiceSubscribeNodeChangedClient) Recv() (*NodeInfo, error) { + m := new(NodeInfo) + if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } - return out, nil + return m, nil } -func (c *iAMProvisioningServiceClient) EncryptDisk(ctx context.Context, in *EncryptDiskRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/EncryptDisk", in, out, opts...) +func (c *iAMPublicNodesServiceClient) RegisterNode(ctx context.Context, opts ...grpc.CallOption) (IAMPublicNodesService_RegisterNodeClient, error) { + stream, err := c.cc.NewStream(ctx, &IAMPublicNodesService_ServiceDesc.Streams[1], "/iamanager.v5.IAMPublicNodesService/RegisterNode", opts...) if err != nil { return nil, err } - return out, nil + x := &iAMPublicNodesServiceRegisterNodeClient{stream} + return x, nil } -func (c *iAMProvisioningServiceClient) FinishProvisioning(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMProvisioningService/FinishProvisioning", in, out, opts...) - if err != nil { +type IAMPublicNodesService_RegisterNodeClient interface { + Send(*IAMOutgoingMessages) error + Recv() (*IAMIncomingMessages, error) + grpc.ClientStream +} + +type iAMPublicNodesServiceRegisterNodeClient struct { + grpc.ClientStream +} + +func (x *iAMPublicNodesServiceRegisterNodeClient) Send(m *IAMOutgoingMessages) error { + return x.ClientStream.SendMsg(m) +} + +func (x *iAMPublicNodesServiceRegisterNodeClient) Recv() (*IAMIncomingMessages, error) { + m := new(IAMIncomingMessages) + if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } - return out, nil + return m, nil } -// IAMProvisioningServiceServer is the server API for IAMProvisioningService service. -// All implementations must embed UnimplementedIAMProvisioningServiceServer +// IAMPublicNodesServiceServer is the server API for IAMPublicNodesService service. +// All implementations must embed UnimplementedIAMPublicNodesServiceServer // for forward compatibility -type IAMProvisioningServiceServer interface { - GetAllNodeIDs(context.Context, *empty.Empty) (*NodesID, error) - GetCertTypes(context.Context, *GetCertTypesRequest) (*CertTypes, error) - SetOwner(context.Context, *SetOwnerRequest) (*empty.Empty, error) - Clear(context.Context, *ClearRequest) (*empty.Empty, error) - EncryptDisk(context.Context, *EncryptDiskRequest) (*empty.Empty, error) - FinishProvisioning(context.Context, *empty.Empty) (*empty.Empty, error) - mustEmbedUnimplementedIAMProvisioningServiceServer() +type IAMPublicNodesServiceServer interface { + GetAllNodeIDs(context.Context, *emptypb.Empty) (*NodesID, error) + GetNodeInfo(context.Context, *GetNodeInfoRequest) (*NodeInfo, error) + SubscribeNodeChanged(*emptypb.Empty, IAMPublicNodesService_SubscribeNodeChangedServer) error + RegisterNode(IAMPublicNodesService_RegisterNodeServer) error + mustEmbedUnimplementedIAMPublicNodesServiceServer() } -// UnimplementedIAMProvisioningServiceServer must be embedded to have forward compatible implementations. -type UnimplementedIAMProvisioningServiceServer struct { +// UnimplementedIAMPublicNodesServiceServer must be embedded to have forward compatible implementations. +type UnimplementedIAMPublicNodesServiceServer struct { } -func (UnimplementedIAMProvisioningServiceServer) GetAllNodeIDs(context.Context, *empty.Empty) (*NodesID, error) { +func (UnimplementedIAMPublicNodesServiceServer) GetAllNodeIDs(context.Context, *emptypb.Empty) (*NodesID, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAllNodeIDs not implemented") } -func (UnimplementedIAMProvisioningServiceServer) GetCertTypes(context.Context, *GetCertTypesRequest) (*CertTypes, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCertTypes not implemented") +func (UnimplementedIAMPublicNodesServiceServer) GetNodeInfo(context.Context, *GetNodeInfoRequest) (*NodeInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNodeInfo not implemented") } -func (UnimplementedIAMProvisioningServiceServer) SetOwner(context.Context, *SetOwnerRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetOwner not implemented") +func (UnimplementedIAMPublicNodesServiceServer) SubscribeNodeChanged(*emptypb.Empty, IAMPublicNodesService_SubscribeNodeChangedServer) error { + return status.Errorf(codes.Unimplemented, "method SubscribeNodeChanged not implemented") } -func (UnimplementedIAMProvisioningServiceServer) Clear(context.Context, *ClearRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Clear not implemented") +func (UnimplementedIAMPublicNodesServiceServer) RegisterNode(IAMPublicNodesService_RegisterNodeServer) error { + return status.Errorf(codes.Unimplemented, "method RegisterNode not implemented") } -func (UnimplementedIAMProvisioningServiceServer) EncryptDisk(context.Context, *EncryptDiskRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method EncryptDisk not implemented") +func (UnimplementedIAMPublicNodesServiceServer) mustEmbedUnimplementedIAMPublicNodesServiceServer() {} + +// UnsafeIAMPublicNodesServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IAMPublicNodesServiceServer will +// result in compilation errors. +type UnsafeIAMPublicNodesServiceServer interface { + mustEmbedUnimplementedIAMPublicNodesServiceServer() } -func (UnimplementedIAMProvisioningServiceServer) FinishProvisioning(context.Context, *empty.Empty) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinishProvisioning not implemented") + +func RegisterIAMPublicNodesServiceServer(s grpc.ServiceRegistrar, srv IAMPublicNodesServiceServer) { + s.RegisterService(&IAMPublicNodesService_ServiceDesc, srv) } -func (UnimplementedIAMProvisioningServiceServer) mustEmbedUnimplementedIAMProvisioningServiceServer() { + +func _IAMPublicNodesService_GetAllNodeIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IAMPublicNodesServiceServer).GetAllNodeIDs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/iamanager.v5.IAMPublicNodesService/GetAllNodeIDs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IAMPublicNodesServiceServer).GetAllNodeIDs(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) } -// UnsafeIAMProvisioningServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to IAMProvisioningServiceServer will +func _IAMPublicNodesService_GetNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IAMPublicNodesServiceServer).GetNodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/iamanager.v5.IAMPublicNodesService/GetNodeInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IAMPublicNodesServiceServer).GetNodeInfo(ctx, req.(*GetNodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IAMPublicNodesService_SubscribeNodeChanged_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(emptypb.Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(IAMPublicNodesServiceServer).SubscribeNodeChanged(m, &iAMPublicNodesServiceSubscribeNodeChangedServer{stream}) +} + +type IAMPublicNodesService_SubscribeNodeChangedServer interface { + Send(*NodeInfo) error + grpc.ServerStream +} + +type iAMPublicNodesServiceSubscribeNodeChangedServer struct { + grpc.ServerStream +} + +func (x *iAMPublicNodesServiceSubscribeNodeChangedServer) Send(m *NodeInfo) error { + return x.ServerStream.SendMsg(m) +} + +func _IAMPublicNodesService_RegisterNode_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(IAMPublicNodesServiceServer).RegisterNode(&iAMPublicNodesServiceRegisterNodeServer{stream}) +} + +type IAMPublicNodesService_RegisterNodeServer interface { + Send(*IAMIncomingMessages) error + Recv() (*IAMOutgoingMessages, error) + grpc.ServerStream +} + +type iAMPublicNodesServiceRegisterNodeServer struct { + grpc.ServerStream +} + +func (x *iAMPublicNodesServiceRegisterNodeServer) Send(m *IAMIncomingMessages) error { + return x.ServerStream.SendMsg(m) +} + +func (x *iAMPublicNodesServiceRegisterNodeServer) Recv() (*IAMOutgoingMessages, error) { + m := new(IAMOutgoingMessages) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// IAMPublicNodesService_ServiceDesc is the grpc.ServiceDesc for IAMPublicNodesService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IAMPublicNodesService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "iamanager.v5.IAMPublicNodesService", + HandlerType: (*IAMPublicNodesServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAllNodeIDs", + Handler: _IAMPublicNodesService_GetAllNodeIDs_Handler, + }, + { + MethodName: "GetNodeInfo", + Handler: _IAMPublicNodesService_GetNodeInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "SubscribeNodeChanged", + Handler: _IAMPublicNodesService_SubscribeNodeChanged_Handler, + ServerStreams: true, + }, + { + StreamName: "RegisterNode", + Handler: _IAMPublicNodesService_RegisterNode_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "iamanager/v5/iamanager.proto", +} + +// IAMNodesServiceClient is the client API for IAMNodesService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type IAMNodesServiceClient interface { + PauseNode(ctx context.Context, in *PauseNodeRequest, opts ...grpc.CallOption) (*PauseNodeResponse, error) + ResumeNode(ctx context.Context, in *ResumeNodeRequest, opts ...grpc.CallOption) (*ResumeNodeResponse, error) +} + +type iAMNodesServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIAMNodesServiceClient(cc grpc.ClientConnInterface) IAMNodesServiceClient { + return &iAMNodesServiceClient{cc} +} + +func (c *iAMNodesServiceClient) PauseNode(ctx context.Context, in *PauseNodeRequest, opts ...grpc.CallOption) (*PauseNodeResponse, error) { + out := new(PauseNodeResponse) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMNodesService/PauseNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iAMNodesServiceClient) ResumeNode(ctx context.Context, in *ResumeNodeRequest, opts ...grpc.CallOption) (*ResumeNodeResponse, error) { + out := new(ResumeNodeResponse) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMNodesService/ResumeNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IAMNodesServiceServer is the server API for IAMNodesService service. +// All implementations must embed UnimplementedIAMNodesServiceServer +// for forward compatibility +type IAMNodesServiceServer interface { + PauseNode(context.Context, *PauseNodeRequest) (*PauseNodeResponse, error) + ResumeNode(context.Context, *ResumeNodeRequest) (*ResumeNodeResponse, error) + mustEmbedUnimplementedIAMNodesServiceServer() +} + +// UnimplementedIAMNodesServiceServer must be embedded to have forward compatible implementations. +type UnimplementedIAMNodesServiceServer struct { +} + +func (UnimplementedIAMNodesServiceServer) PauseNode(context.Context, *PauseNodeRequest) (*PauseNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PauseNode not implemented") +} +func (UnimplementedIAMNodesServiceServer) ResumeNode(context.Context, *ResumeNodeRequest) (*ResumeNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeNode not implemented") +} +func (UnimplementedIAMNodesServiceServer) mustEmbedUnimplementedIAMNodesServiceServer() {} + +// UnsafeIAMNodesServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IAMNodesServiceServer will // result in compilation errors. -type UnsafeIAMProvisioningServiceServer interface { - mustEmbedUnimplementedIAMProvisioningServiceServer() +type UnsafeIAMNodesServiceServer interface { + mustEmbedUnimplementedIAMNodesServiceServer() } -func RegisterIAMProvisioningServiceServer(s grpc.ServiceRegistrar, srv IAMProvisioningServiceServer) { - s.RegisterService(&IAMProvisioningService_ServiceDesc, srv) +func RegisterIAMNodesServiceServer(s grpc.ServiceRegistrar, srv IAMNodesServiceServer) { + s.RegisterService(&IAMNodesService_ServiceDesc, srv) } -func _IAMProvisioningService_GetAllNodeIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) +func _IAMNodesService_PauseNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PauseNodeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).GetAllNodeIDs(ctx, in) + return srv.(IAMNodesServiceServer).PauseNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/GetAllNodeIDs", + FullMethod: "/iamanager.v5.IAMNodesService/PauseNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).GetAllNodeIDs(ctx, req.(*empty.Empty)) + return srv.(IAMNodesServiceServer).PauseNode(ctx, req.(*PauseNodeRequest)) } return interceptor(ctx, in, info, handler) } -func _IAMProvisioningService_GetCertTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCertTypesRequest) +func _IAMNodesService_ResumeNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeNodeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).GetCertTypes(ctx, in) + return srv.(IAMNodesServiceServer).ResumeNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/GetCertTypes", + FullMethod: "/iamanager.v5.IAMNodesService/ResumeNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).GetCertTypes(ctx, req.(*GetCertTypesRequest)) + return srv.(IAMNodesServiceServer).ResumeNode(ctx, req.(*ResumeNodeRequest)) } return interceptor(ctx, in, info, handler) } -func _IAMProvisioningService_SetOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetOwnerRequest) +// IAMNodesService_ServiceDesc is the grpc.ServiceDesc for IAMNodesService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IAMNodesService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "iamanager.v5.IAMNodesService", + HandlerType: (*IAMNodesServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PauseNode", + Handler: _IAMNodesService_PauseNode_Handler, + }, + { + MethodName: "ResumeNode", + Handler: _IAMNodesService_ResumeNode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "iamanager/v5/iamanager.proto", +} + +// IAMProvisioningServiceClient is the client API for IAMProvisioningService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type IAMProvisioningServiceClient interface { + GetCertTypes(ctx context.Context, in *GetCertTypesRequest, opts ...grpc.CallOption) (*CertTypes, error) + StartProvisioning(ctx context.Context, in *StartProvisioningRequest, opts ...grpc.CallOption) (*StartProvisioningResponse, error) + FinishProvisioning(ctx context.Context, in *FinishProvisioningRequest, opts ...grpc.CallOption) (*FinishProvisioningResponse, error) + Deprovision(ctx context.Context, in *DeprovisionRequest, opts ...grpc.CallOption) (*DeprovisionResponse, error) +} + +type iAMProvisioningServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIAMProvisioningServiceClient(cc grpc.ClientConnInterface) IAMProvisioningServiceClient { + return &iAMProvisioningServiceClient{cc} +} + +func (c *iAMProvisioningServiceClient) GetCertTypes(ctx context.Context, in *GetCertTypesRequest, opts ...grpc.CallOption) (*CertTypes, error) { + out := new(CertTypes) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMProvisioningService/GetCertTypes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iAMProvisioningServiceClient) StartProvisioning(ctx context.Context, in *StartProvisioningRequest, opts ...grpc.CallOption) (*StartProvisioningResponse, error) { + out := new(StartProvisioningResponse) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMProvisioningService/StartProvisioning", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iAMProvisioningServiceClient) FinishProvisioning(ctx context.Context, in *FinishProvisioningRequest, opts ...grpc.CallOption) (*FinishProvisioningResponse, error) { + out := new(FinishProvisioningResponse) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMProvisioningService/FinishProvisioning", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iAMProvisioningServiceClient) Deprovision(ctx context.Context, in *DeprovisionRequest, opts ...grpc.CallOption) (*DeprovisionResponse, error) { + out := new(DeprovisionResponse) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMProvisioningService/Deprovision", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IAMProvisioningServiceServer is the server API for IAMProvisioningService service. +// All implementations must embed UnimplementedIAMProvisioningServiceServer +// for forward compatibility +type IAMProvisioningServiceServer interface { + GetCertTypes(context.Context, *GetCertTypesRequest) (*CertTypes, error) + StartProvisioning(context.Context, *StartProvisioningRequest) (*StartProvisioningResponse, error) + FinishProvisioning(context.Context, *FinishProvisioningRequest) (*FinishProvisioningResponse, error) + Deprovision(context.Context, *DeprovisionRequest) (*DeprovisionResponse, error) + mustEmbedUnimplementedIAMProvisioningServiceServer() +} + +// UnimplementedIAMProvisioningServiceServer must be embedded to have forward compatible implementations. +type UnimplementedIAMProvisioningServiceServer struct { +} + +func (UnimplementedIAMProvisioningServiceServer) GetCertTypes(context.Context, *GetCertTypesRequest) (*CertTypes, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCertTypes not implemented") +} +func (UnimplementedIAMProvisioningServiceServer) StartProvisioning(context.Context, *StartProvisioningRequest) (*StartProvisioningResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartProvisioning not implemented") +} +func (UnimplementedIAMProvisioningServiceServer) FinishProvisioning(context.Context, *FinishProvisioningRequest) (*FinishProvisioningResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinishProvisioning not implemented") +} +func (UnimplementedIAMProvisioningServiceServer) Deprovision(context.Context, *DeprovisionRequest) (*DeprovisionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deprovision not implemented") +} +func (UnimplementedIAMProvisioningServiceServer) mustEmbedUnimplementedIAMProvisioningServiceServer() { +} + +// UnsafeIAMProvisioningServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IAMProvisioningServiceServer will +// result in compilation errors. +type UnsafeIAMProvisioningServiceServer interface { + mustEmbedUnimplementedIAMProvisioningServiceServer() +} + +func RegisterIAMProvisioningServiceServer(s grpc.ServiceRegistrar, srv IAMProvisioningServiceServer) { + s.RegisterService(&IAMProvisioningService_ServiceDesc, srv) +} + +func _IAMProvisioningService_GetCertTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCertTypesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).SetOwner(ctx, in) + return srv.(IAMProvisioningServiceServer).GetCertTypes(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/SetOwner", + FullMethod: "/iamanager.v5.IAMProvisioningService/GetCertTypes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).SetOwner(ctx, req.(*SetOwnerRequest)) + return srv.(IAMProvisioningServiceServer).GetCertTypes(ctx, req.(*GetCertTypesRequest)) } return interceptor(ctx, in, info, handler) } -func _IAMProvisioningService_Clear_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearRequest) +func _IAMProvisioningService_StartProvisioning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartProvisioningRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).Clear(ctx, in) + return srv.(IAMProvisioningServiceServer).StartProvisioning(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/Clear", + FullMethod: "/iamanager.v5.IAMProvisioningService/StartProvisioning", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).Clear(ctx, req.(*ClearRequest)) + return srv.(IAMProvisioningServiceServer).StartProvisioning(ctx, req.(*StartProvisioningRequest)) } return interceptor(ctx, in, info, handler) } -func _IAMProvisioningService_EncryptDisk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EncryptDiskRequest) +func _IAMProvisioningService_FinishProvisioning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FinishProvisioningRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).EncryptDisk(ctx, in) + return srv.(IAMProvisioningServiceServer).FinishProvisioning(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/EncryptDisk", + FullMethod: "/iamanager.v5.IAMProvisioningService/FinishProvisioning", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).EncryptDisk(ctx, req.(*EncryptDiskRequest)) + return srv.(IAMProvisioningServiceServer).FinishProvisioning(ctx, req.(*FinishProvisioningRequest)) } return interceptor(ctx, in, info, handler) } -func _IAMProvisioningService_FinishProvisioning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) +func _IAMProvisioningService_Deprovision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeprovisionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(IAMProvisioningServiceServer).FinishProvisioning(ctx, in) + return srv.(IAMProvisioningServiceServer).Deprovision(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMProvisioningService/FinishProvisioning", + FullMethod: "/iamanager.v5.IAMProvisioningService/Deprovision", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IAMProvisioningServiceServer).FinishProvisioning(ctx, req.(*empty.Empty)) + return srv.(IAMProvisioningServiceServer).Deprovision(ctx, req.(*DeprovisionRequest)) } return interceptor(ctx, in, info, handler) } @@ -686,36 +962,28 @@ func _IAMProvisioningService_FinishProvisioning_Handler(srv interface{}, ctx con // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMProvisioningService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMProvisioningService", + ServiceName: "iamanager.v5.IAMProvisioningService", HandlerType: (*IAMProvisioningServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "GetAllNodeIDs", - Handler: _IAMProvisioningService_GetAllNodeIDs_Handler, - }, { MethodName: "GetCertTypes", Handler: _IAMProvisioningService_GetCertTypes_Handler, }, { - MethodName: "SetOwner", - Handler: _IAMProvisioningService_SetOwner_Handler, - }, - { - MethodName: "Clear", - Handler: _IAMProvisioningService_Clear_Handler, - }, - { - MethodName: "EncryptDisk", - Handler: _IAMProvisioningService_EncryptDisk_Handler, + MethodName: "StartProvisioning", + Handler: _IAMProvisioningService_StartProvisioning_Handler, }, { MethodName: "FinishProvisioning", Handler: _IAMProvisioningService_FinishProvisioning_Handler, }, + { + MethodName: "Deprovision", + Handler: _IAMProvisioningService_Deprovision_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } // IAMCertificateServiceClient is the client API for IAMCertificateService service. @@ -736,7 +1004,7 @@ func NewIAMCertificateServiceClient(cc grpc.ClientConnInterface) IAMCertificateS func (c *iAMCertificateServiceClient) CreateKey(ctx context.Context, in *CreateKeyRequest, opts ...grpc.CallOption) (*CreateKeyResponse, error) { out := new(CreateKeyResponse) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMCertificateService/CreateKey", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMCertificateService/CreateKey", in, out, opts...) if err != nil { return nil, err } @@ -745,7 +1013,7 @@ func (c *iAMCertificateServiceClient) CreateKey(ctx context.Context, in *CreateK func (c *iAMCertificateServiceClient) ApplyCert(ctx context.Context, in *ApplyCertRequest, opts ...grpc.CallOption) (*ApplyCertResponse, error) { out := new(ApplyCertResponse) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMCertificateService/ApplyCert", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMCertificateService/ApplyCert", in, out, opts...) if err != nil { return nil, err } @@ -794,7 +1062,7 @@ func _IAMCertificateService_CreateKey_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMCertificateService/CreateKey", + FullMethod: "/iamanager.v5.IAMCertificateService/CreateKey", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMCertificateServiceServer).CreateKey(ctx, req.(*CreateKeyRequest)) @@ -812,7 +1080,7 @@ func _IAMCertificateService_ApplyCert_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMCertificateService/ApplyCert", + FullMethod: "/iamanager.v5.IAMCertificateService/ApplyCert", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMCertificateServiceServer).ApplyCert(ctx, req.(*ApplyCertRequest)) @@ -824,7 +1092,7 @@ func _IAMCertificateService_ApplyCert_Handler(srv interface{}, ctx context.Conte // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMCertificateService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMCertificateService", + ServiceName: "iamanager.v5.IAMCertificateService", HandlerType: (*IAMCertificateServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -837,7 +1105,7 @@ var IAMCertificateService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } // IAMPermissionsServiceClient is the client API for IAMPermissionsService service. @@ -845,7 +1113,7 @@ var IAMCertificateService_ServiceDesc = grpc.ServiceDesc{ // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type IAMPermissionsServiceClient interface { RegisterInstance(ctx context.Context, in *RegisterInstanceRequest, opts ...grpc.CallOption) (*RegisterInstanceResponse, error) - UnregisterInstance(ctx context.Context, in *UnregisterInstanceRequest, opts ...grpc.CallOption) (*empty.Empty, error) + UnregisterInstance(ctx context.Context, in *UnregisterInstanceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type iAMPermissionsServiceClient struct { @@ -858,16 +1126,16 @@ func NewIAMPermissionsServiceClient(cc grpc.ClientConnInterface) IAMPermissionsS func (c *iAMPermissionsServiceClient) RegisterInstance(ctx context.Context, in *RegisterInstanceRequest, opts ...grpc.CallOption) (*RegisterInstanceResponse, error) { out := new(RegisterInstanceResponse) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPermissionsService/RegisterInstance", in, out, opts...) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPermissionsService/RegisterInstance", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *iAMPermissionsServiceClient) UnregisterInstance(ctx context.Context, in *UnregisterInstanceRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/iamanager.v4.IAMPermissionsService/UnregisterInstance", in, out, opts...) +func (c *iAMPermissionsServiceClient) UnregisterInstance(ctx context.Context, in *UnregisterInstanceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/iamanager.v5.IAMPermissionsService/UnregisterInstance", in, out, opts...) if err != nil { return nil, err } @@ -879,7 +1147,7 @@ func (c *iAMPermissionsServiceClient) UnregisterInstance(ctx context.Context, in // for forward compatibility type IAMPermissionsServiceServer interface { RegisterInstance(context.Context, *RegisterInstanceRequest) (*RegisterInstanceResponse, error) - UnregisterInstance(context.Context, *UnregisterInstanceRequest) (*empty.Empty, error) + UnregisterInstance(context.Context, *UnregisterInstanceRequest) (*emptypb.Empty, error) mustEmbedUnimplementedIAMPermissionsServiceServer() } @@ -890,7 +1158,7 @@ type UnimplementedIAMPermissionsServiceServer struct { func (UnimplementedIAMPermissionsServiceServer) RegisterInstance(context.Context, *RegisterInstanceRequest) (*RegisterInstanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterInstance not implemented") } -func (UnimplementedIAMPermissionsServiceServer) UnregisterInstance(context.Context, *UnregisterInstanceRequest) (*empty.Empty, error) { +func (UnimplementedIAMPermissionsServiceServer) UnregisterInstance(context.Context, *UnregisterInstanceRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UnregisterInstance not implemented") } func (UnimplementedIAMPermissionsServiceServer) mustEmbedUnimplementedIAMPermissionsServiceServer() {} @@ -916,7 +1184,7 @@ func _IAMPermissionsService_RegisterInstance_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPermissionsService/RegisterInstance", + FullMethod: "/iamanager.v5.IAMPermissionsService/RegisterInstance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMPermissionsServiceServer).RegisterInstance(ctx, req.(*RegisterInstanceRequest)) @@ -934,7 +1202,7 @@ func _IAMPermissionsService_UnregisterInstance_Handler(srv interface{}, ctx cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/iamanager.v4.IAMPermissionsService/UnregisterInstance", + FullMethod: "/iamanager.v5.IAMPermissionsService/UnregisterInstance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(IAMPermissionsServiceServer).UnregisterInstance(ctx, req.(*UnregisterInstanceRequest)) @@ -946,7 +1214,7 @@ func _IAMPermissionsService_UnregisterInstance_Handler(srv interface{}, ctx cont // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IAMPermissionsService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "iamanager.v4.IAMPermissionsService", + ServiceName: "iamanager.v5.IAMPermissionsService", HandlerType: (*IAMPermissionsServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -959,5 +1227,5 @@ var IAMPermissionsService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "iamanager/v4/iamanager.proto", + Metadata: "iamanager/v5/iamanager.proto", } diff --git a/vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager.pb.go b/vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager.pb.go deleted file mode 100644 index 1a280893..00000000 --- a/vendor/github.com/aosedge/aos_common/api/iamanager/v4/iamanager.pb.go +++ /dev/null @@ -1,1925 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 -// source: iamanager/v4/iamanager.proto - -package iamanager - -import ( - empty "github.com/golang/protobuf/ptypes/empty" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type APIVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *APIVersion) Reset() { - *x = APIVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *APIVersion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*APIVersion) ProtoMessage() {} - -func (x *APIVersion) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use APIVersion.ProtoReflect.Descriptor instead. -func (*APIVersion) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{0} -} - -func (x *APIVersion) GetVersion() uint64 { - if x != nil { - return x.Version - } - return 0 -} - -type NodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - NodeType string `protobuf:"bytes,2,opt,name=node_type,json=nodeType,proto3" json:"node_type,omitempty"` -} - -func (x *NodeInfo) Reset() { - *x = NodeInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeInfo) ProtoMessage() {} - -func (x *NodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead. -func (*NodeInfo) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{1} -} - -func (x *NodeInfo) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *NodeInfo) GetNodeType() string { - if x != nil { - return x.NodeType - } - return "" -} - -type GetCertRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` - Serial string `protobuf:"bytes,3,opt,name=serial,proto3" json:"serial,omitempty"` -} - -func (x *GetCertRequest) Reset() { - *x = GetCertRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetCertRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCertRequest) ProtoMessage() {} - -func (x *GetCertRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCertRequest.ProtoReflect.Descriptor instead. -func (*GetCertRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{2} -} - -func (x *GetCertRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *GetCertRequest) GetIssuer() []byte { - if x != nil { - return x.Issuer - } - return nil -} - -func (x *GetCertRequest) GetSerial() string { - if x != nil { - return x.Serial - } - return "" -} - -type GetCertResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - CertUrl string `protobuf:"bytes,2,opt,name=cert_url,json=certUrl,proto3" json:"cert_url,omitempty"` - KeyUrl string `protobuf:"bytes,3,opt,name=key_url,json=keyUrl,proto3" json:"key_url,omitempty"` -} - -func (x *GetCertResponse) Reset() { - *x = GetCertResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetCertResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCertResponse) ProtoMessage() {} - -func (x *GetCertResponse) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCertResponse.ProtoReflect.Descriptor instead. -func (*GetCertResponse) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{3} -} - -func (x *GetCertResponse) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *GetCertResponse) GetCertUrl() string { - if x != nil { - return x.CertUrl - } - return "" -} - -func (x *GetCertResponse) GetKeyUrl() string { - if x != nil { - return x.KeyUrl - } - return "" -} - -type SystemInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SystemId string `protobuf:"bytes,1,opt,name=system_id,json=systemId,proto3" json:"system_id,omitempty"` - UnitModel string `protobuf:"bytes,2,opt,name=unit_model,json=unitModel,proto3" json:"unit_model,omitempty"` -} - -func (x *SystemInfo) Reset() { - *x = SystemInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemInfo) ProtoMessage() {} - -func (x *SystemInfo) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemInfo.ProtoReflect.Descriptor instead. -func (*SystemInfo) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{4} -} - -func (x *SystemInfo) GetSystemId() string { - if x != nil { - return x.SystemId - } - return "" -} - -func (x *SystemInfo) GetUnitModel() string { - if x != nil { - return x.UnitModel - } - return "" -} - -type Subjects struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Subjects []string `protobuf:"bytes,1,rep,name=subjects,proto3" json:"subjects,omitempty"` -} - -func (x *Subjects) Reset() { - *x = Subjects{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Subjects) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Subjects) ProtoMessage() {} - -func (x *Subjects) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Subjects.ProtoReflect.Descriptor instead. -func (*Subjects) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{5} -} - -func (x *Subjects) GetSubjects() []string { - if x != nil { - return x.Subjects - } - return nil -} - -type PermissionsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` - FunctionalServerId string `protobuf:"bytes,2,opt,name=functional_server_id,json=functionalServerId,proto3" json:"functional_server_id,omitempty"` -} - -func (x *PermissionsRequest) Reset() { - *x = PermissionsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PermissionsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PermissionsRequest) ProtoMessage() {} - -func (x *PermissionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PermissionsRequest.ProtoReflect.Descriptor instead. -func (*PermissionsRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{6} -} - -func (x *PermissionsRequest) GetSecret() string { - if x != nil { - return x.Secret - } - return "" -} - -func (x *PermissionsRequest) GetFunctionalServerId() string { - if x != nil { - return x.FunctionalServerId - } - return "" -} - -type InstanceIdent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - SubjectId string `protobuf:"bytes,2,opt,name=subject_id,json=subjectId,proto3" json:"subject_id,omitempty"` - Instance uint64 `protobuf:"varint,3,opt,name=instance,proto3" json:"instance,omitempty"` -} - -func (x *InstanceIdent) Reset() { - *x = InstanceIdent{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceIdent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceIdent) ProtoMessage() {} - -func (x *InstanceIdent) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceIdent.ProtoReflect.Descriptor instead. -func (*InstanceIdent) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{7} -} - -func (x *InstanceIdent) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *InstanceIdent) GetSubjectId() string { - if x != nil { - return x.SubjectId - } - return "" -} - -func (x *InstanceIdent) GetInstance() uint64 { - if x != nil { - return x.Instance - } - return 0 -} - -type PermissionsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Permissions *Permissions `protobuf:"bytes,2,opt,name=permissions,proto3" json:"permissions,omitempty"` -} - -func (x *PermissionsResponse) Reset() { - *x = PermissionsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PermissionsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PermissionsResponse) ProtoMessage() {} - -func (x *PermissionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PermissionsResponse.ProtoReflect.Descriptor instead. -func (*PermissionsResponse) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{8} -} - -func (x *PermissionsResponse) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *PermissionsResponse) GetPermissions() *Permissions { - if x != nil { - return x.Permissions - } - return nil -} - -type NodesID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` -} - -func (x *NodesID) Reset() { - *x = NodesID{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodesID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodesID) ProtoMessage() {} - -func (x *NodesID) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodesID.ProtoReflect.Descriptor instead. -func (*NodesID) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{9} -} - -func (x *NodesID) GetIds() []string { - if x != nil { - return x.Ids - } - return nil -} - -type GetCertTypesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` -} - -func (x *GetCertTypesRequest) Reset() { - *x = GetCertTypesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetCertTypesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCertTypesRequest) ProtoMessage() {} - -func (x *GetCertTypesRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCertTypesRequest.ProtoReflect.Descriptor instead. -func (*GetCertTypesRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{10} -} - -func (x *GetCertTypesRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -type CertTypes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"` -} - -func (x *CertTypes) Reset() { - *x = CertTypes{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CertTypes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CertTypes) ProtoMessage() {} - -func (x *CertTypes) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CertTypes.ProtoReflect.Descriptor instead. -func (*CertTypes) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{11} -} - -func (x *CertTypes) GetTypes() []string { - if x != nil { - return x.Types - } - return nil -} - -type SetOwnerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *SetOwnerRequest) Reset() { - *x = SetOwnerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetOwnerRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetOwnerRequest) ProtoMessage() {} - -func (x *SetOwnerRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetOwnerRequest.ProtoReflect.Descriptor instead. -func (*SetOwnerRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{12} -} - -func (x *SetOwnerRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *SetOwnerRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *SetOwnerRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type ClearRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` -} - -func (x *ClearRequest) Reset() { - *x = ClearRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearRequest) ProtoMessage() {} - -func (x *ClearRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearRequest.ProtoReflect.Descriptor instead. -func (*ClearRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{13} -} - -func (x *ClearRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *ClearRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -type EncryptDiskRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *EncryptDiskRequest) Reset() { - *x = EncryptDiskRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EncryptDiskRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EncryptDiskRequest) ProtoMessage() {} - -func (x *EncryptDiskRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EncryptDiskRequest.ProtoReflect.Descriptor instead. -func (*EncryptDiskRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{14} -} - -func (x *EncryptDiskRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *EncryptDiskRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type CreateKeyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *CreateKeyRequest) Reset() { - *x = CreateKeyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateKeyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateKeyRequest) ProtoMessage() {} - -func (x *CreateKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateKeyRequest.ProtoReflect.Descriptor instead. -func (*CreateKeyRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{15} -} - -func (x *CreateKeyRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *CreateKeyRequest) GetSubject() string { - if x != nil { - return x.Subject - } - return "" -} - -func (x *CreateKeyRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *CreateKeyRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type CreateKeyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Csr string `protobuf:"bytes,3,opt,name=csr,proto3" json:"csr,omitempty"` -} - -func (x *CreateKeyResponse) Reset() { - *x = CreateKeyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateKeyResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateKeyResponse) ProtoMessage() {} - -func (x *CreateKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateKeyResponse.ProtoReflect.Descriptor instead. -func (*CreateKeyResponse) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{16} -} - -func (x *CreateKeyResponse) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *CreateKeyResponse) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *CreateKeyResponse) GetCsr() string { - if x != nil { - return x.Csr - } - return "" -} - -type ApplyCertRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Cert string `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` -} - -func (x *ApplyCertRequest) Reset() { - *x = ApplyCertRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApplyCertRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApplyCertRequest) ProtoMessage() {} - -func (x *ApplyCertRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApplyCertRequest.ProtoReflect.Descriptor instead. -func (*ApplyCertRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{17} -} - -func (x *ApplyCertRequest) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *ApplyCertRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *ApplyCertRequest) GetCert() string { - if x != nil { - return x.Cert - } - return "" -} - -type ApplyCertResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - CertUrl string `protobuf:"bytes,3,opt,name=cert_url,json=certUrl,proto3" json:"cert_url,omitempty"` - Serial string `protobuf:"bytes,4,opt,name=serial,proto3" json:"serial,omitempty"` -} - -func (x *ApplyCertResponse) Reset() { - *x = ApplyCertResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApplyCertResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApplyCertResponse) ProtoMessage() {} - -func (x *ApplyCertResponse) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApplyCertResponse.ProtoReflect.Descriptor instead. -func (*ApplyCertResponse) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{18} -} - -func (x *ApplyCertResponse) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *ApplyCertResponse) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *ApplyCertResponse) GetCertUrl() string { - if x != nil { - return x.CertUrl - } - return "" -} - -func (x *ApplyCertResponse) GetSerial() string { - if x != nil { - return x.Serial - } - return "" -} - -type Permissions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Permissions map[string]string `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Permissions) Reset() { - *x = Permissions{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Permissions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Permissions) ProtoMessage() {} - -func (x *Permissions) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Permissions.ProtoReflect.Descriptor instead. -func (*Permissions) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{19} -} - -func (x *Permissions) GetPermissions() map[string]string { - if x != nil { - return x.Permissions - } - return nil -} - -type RegisterInstanceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Permissions map[string]*Permissions `protobuf:"bytes,2,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *RegisterInstanceRequest) Reset() { - *x = RegisterInstanceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegisterInstanceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegisterInstanceRequest) ProtoMessage() {} - -func (x *RegisterInstanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegisterInstanceRequest.ProtoReflect.Descriptor instead. -func (*RegisterInstanceRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{20} -} - -func (x *RegisterInstanceRequest) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *RegisterInstanceRequest) GetPermissions() map[string]*Permissions { - if x != nil { - return x.Permissions - } - return nil -} - -type RegisterInstanceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` -} - -func (x *RegisterInstanceResponse) Reset() { - *x = RegisterInstanceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegisterInstanceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegisterInstanceResponse) ProtoMessage() {} - -func (x *RegisterInstanceResponse) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegisterInstanceResponse.ProtoReflect.Descriptor instead. -func (*RegisterInstanceResponse) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{21} -} - -func (x *RegisterInstanceResponse) GetSecret() string { - if x != nil { - return x.Secret - } - return "" -} - -type UnregisterInstanceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` -} - -func (x *UnregisterInstanceRequest) Reset() { - *x = UnregisterInstanceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UnregisterInstanceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UnregisterInstanceRequest) ProtoMessage() {} - -func (x *UnregisterInstanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_iamanager_v4_iamanager_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UnregisterInstanceRequest.ProtoReflect.Descriptor instead. -func (*UnregisterInstanceRequest) Descriptor() ([]byte, []int) { - return file_iamanager_v4_iamanager_proto_rawDescGZIP(), []int{22} -} - -func (x *UnregisterInstanceRequest) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -var File_iamanager_v4_iamanager_proto protoreflect.FileDescriptor - -var file_iamanager_v4_iamanager_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x76, 0x34, 0x2f, 0x69, - 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, - 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x1a, 0x1b, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0a, 0x41, 0x50, 0x49, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x40, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, - 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x22, 0x54, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, - 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x59, 0x0a, 0x0f, 0x47, 0x65, 0x74, - 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x19, 0x0a, 0x08, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x65, 0x72, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6b, - 0x65, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x65, - 0x79, 0x55, 0x72, 0x6c, 0x22, 0x48, 0x0a, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x26, - 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x5e, 0x0a, 0x12, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x12, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x69, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x13, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x1b, 0x0a, 0x07, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x2e, 0x0a, 0x13, - 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x09, - 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, - 0x5a, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x3b, 0x0a, 0x0c, 0x43, - 0x6c, 0x65, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, - 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, - 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x49, 0x0a, 0x12, 0x45, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x44, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, - 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x22, 0x75, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x52, 0x0a, 0x11, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x63, 0x73, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x73, 0x72, 0x22, 0x53, - 0x0a, 0x10, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, - 0x65, 0x72, 0x74, 0x22, 0x73, 0x0a, 0x11, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x65, 0x72, 0x74, 0x55, 0x72, 0x6c, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x9b, 0x01, 0x0a, 0x0b, 0x50, 0x65, 0x72, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, - 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x50, 0x65, 0x72, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x87, 0x02, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0b, 0x70, - 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x36, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x59, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x22, 0x32, 0x0a, 0x18, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x22, 0x54, 0x0a, 0x19, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x32, 0xe2, 0x01, 0x0a, 0x10, 0x49, - 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x43, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x41, 0x50, 0x49, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, - 0x12, 0x1c, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, - 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x47, 0x65, - 0x74, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, - 0xf0, 0x01, 0x0a, 0x18, 0x49, 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0d, - 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x22, - 0x00, 0x12, 0x3f, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x18, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x53, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x00, - 0x30, 0x01, 0x32, 0x76, 0x0a, 0x1b, 0x49, 0x41, 0x4d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, - 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x57, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xbf, 0x03, 0x0a, 0x16, 0x49, - 0x41, 0x4d, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x4e, - 0x6f, 0x64, 0x65, 0x49, 0x44, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, - 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4e, 0x6f, - 0x64, 0x65, 0x73, 0x49, 0x44, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, 0x65, - 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x69, 0x61, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x12, 0x1d, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, - 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x05, 0x43, 0x6c, - 0x65, 0x61, 0x72, 0x12, 0x1a, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0b, 0x45, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x20, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x44, - 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x12, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0xb7, 0x01, 0x0a, - 0x15, 0x49, 0x41, 0x4d, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x09, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, - 0x65, 0x72, 0x74, 0x12, 0x1e, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x34, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xd5, 0x01, 0x0a, 0x15, 0x49, 0x41, 0x4d, 0x50, 0x65, - 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x63, 0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x12, 0x25, 0x2e, 0x69, 0x61, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x34, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x69, 0x61, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x2e, 0x69, 0x61, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_iamanager_v4_iamanager_proto_rawDescOnce sync.Once - file_iamanager_v4_iamanager_proto_rawDescData = file_iamanager_v4_iamanager_proto_rawDesc -) - -func file_iamanager_v4_iamanager_proto_rawDescGZIP() []byte { - file_iamanager_v4_iamanager_proto_rawDescOnce.Do(func() { - file_iamanager_v4_iamanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_iamanager_v4_iamanager_proto_rawDescData) - }) - return file_iamanager_v4_iamanager_proto_rawDescData -} - -var file_iamanager_v4_iamanager_proto_msgTypes = make([]protoimpl.MessageInfo, 25) -var file_iamanager_v4_iamanager_proto_goTypes = []interface{}{ - (*APIVersion)(nil), // 0: iamanager.v4.APIVersion - (*NodeInfo)(nil), // 1: iamanager.v4.NodeInfo - (*GetCertRequest)(nil), // 2: iamanager.v4.GetCertRequest - (*GetCertResponse)(nil), // 3: iamanager.v4.GetCertResponse - (*SystemInfo)(nil), // 4: iamanager.v4.SystemInfo - (*Subjects)(nil), // 5: iamanager.v4.Subjects - (*PermissionsRequest)(nil), // 6: iamanager.v4.PermissionsRequest - (*InstanceIdent)(nil), // 7: iamanager.v4.InstanceIdent - (*PermissionsResponse)(nil), // 8: iamanager.v4.PermissionsResponse - (*NodesID)(nil), // 9: iamanager.v4.NodesID - (*GetCertTypesRequest)(nil), // 10: iamanager.v4.GetCertTypesRequest - (*CertTypes)(nil), // 11: iamanager.v4.CertTypes - (*SetOwnerRequest)(nil), // 12: iamanager.v4.SetOwnerRequest - (*ClearRequest)(nil), // 13: iamanager.v4.ClearRequest - (*EncryptDiskRequest)(nil), // 14: iamanager.v4.EncryptDiskRequest - (*CreateKeyRequest)(nil), // 15: iamanager.v4.CreateKeyRequest - (*CreateKeyResponse)(nil), // 16: iamanager.v4.CreateKeyResponse - (*ApplyCertRequest)(nil), // 17: iamanager.v4.ApplyCertRequest - (*ApplyCertResponse)(nil), // 18: iamanager.v4.ApplyCertResponse - (*Permissions)(nil), // 19: iamanager.v4.Permissions - (*RegisterInstanceRequest)(nil), // 20: iamanager.v4.RegisterInstanceRequest - (*RegisterInstanceResponse)(nil), // 21: iamanager.v4.RegisterInstanceResponse - (*UnregisterInstanceRequest)(nil), // 22: iamanager.v4.UnregisterInstanceRequest - nil, // 23: iamanager.v4.Permissions.PermissionsEntry - nil, // 24: iamanager.v4.RegisterInstanceRequest.PermissionsEntry - (*empty.Empty)(nil), // 25: google.protobuf.Empty -} -var file_iamanager_v4_iamanager_proto_depIdxs = []int32{ - 7, // 0: iamanager.v4.PermissionsResponse.instance:type_name -> iamanager.v4.InstanceIdent - 19, // 1: iamanager.v4.PermissionsResponse.permissions:type_name -> iamanager.v4.Permissions - 23, // 2: iamanager.v4.Permissions.permissions:type_name -> iamanager.v4.Permissions.PermissionsEntry - 7, // 3: iamanager.v4.RegisterInstanceRequest.instance:type_name -> iamanager.v4.InstanceIdent - 24, // 4: iamanager.v4.RegisterInstanceRequest.permissions:type_name -> iamanager.v4.RegisterInstanceRequest.PermissionsEntry - 7, // 5: iamanager.v4.UnregisterInstanceRequest.instance:type_name -> iamanager.v4.InstanceIdent - 19, // 6: iamanager.v4.RegisterInstanceRequest.PermissionsEntry.value:type_name -> iamanager.v4.Permissions - 25, // 7: iamanager.v4.IAMPublicService.GetAPIVersion:input_type -> google.protobuf.Empty - 25, // 8: iamanager.v4.IAMPublicService.GetNodeInfo:input_type -> google.protobuf.Empty - 2, // 9: iamanager.v4.IAMPublicService.GetCert:input_type -> iamanager.v4.GetCertRequest - 25, // 10: iamanager.v4.IAMPublicIdentityService.GetSystemInfo:input_type -> google.protobuf.Empty - 25, // 11: iamanager.v4.IAMPublicIdentityService.GetSubjects:input_type -> google.protobuf.Empty - 25, // 12: iamanager.v4.IAMPublicIdentityService.SubscribeSubjectsChanged:input_type -> google.protobuf.Empty - 6, // 13: iamanager.v4.IAMPublicPermissionsService.GetPermissions:input_type -> iamanager.v4.PermissionsRequest - 25, // 14: iamanager.v4.IAMProvisioningService.GetAllNodeIDs:input_type -> google.protobuf.Empty - 10, // 15: iamanager.v4.IAMProvisioningService.GetCertTypes:input_type -> iamanager.v4.GetCertTypesRequest - 12, // 16: iamanager.v4.IAMProvisioningService.SetOwner:input_type -> iamanager.v4.SetOwnerRequest - 13, // 17: iamanager.v4.IAMProvisioningService.Clear:input_type -> iamanager.v4.ClearRequest - 14, // 18: iamanager.v4.IAMProvisioningService.EncryptDisk:input_type -> iamanager.v4.EncryptDiskRequest - 25, // 19: iamanager.v4.IAMProvisioningService.FinishProvisioning:input_type -> google.protobuf.Empty - 15, // 20: iamanager.v4.IAMCertificateService.CreateKey:input_type -> iamanager.v4.CreateKeyRequest - 17, // 21: iamanager.v4.IAMCertificateService.ApplyCert:input_type -> iamanager.v4.ApplyCertRequest - 20, // 22: iamanager.v4.IAMPermissionsService.RegisterInstance:input_type -> iamanager.v4.RegisterInstanceRequest - 22, // 23: iamanager.v4.IAMPermissionsService.UnregisterInstance:input_type -> iamanager.v4.UnregisterInstanceRequest - 0, // 24: iamanager.v4.IAMPublicService.GetAPIVersion:output_type -> iamanager.v4.APIVersion - 1, // 25: iamanager.v4.IAMPublicService.GetNodeInfo:output_type -> iamanager.v4.NodeInfo - 3, // 26: iamanager.v4.IAMPublicService.GetCert:output_type -> iamanager.v4.GetCertResponse - 4, // 27: iamanager.v4.IAMPublicIdentityService.GetSystemInfo:output_type -> iamanager.v4.SystemInfo - 5, // 28: iamanager.v4.IAMPublicIdentityService.GetSubjects:output_type -> iamanager.v4.Subjects - 5, // 29: iamanager.v4.IAMPublicIdentityService.SubscribeSubjectsChanged:output_type -> iamanager.v4.Subjects - 8, // 30: iamanager.v4.IAMPublicPermissionsService.GetPermissions:output_type -> iamanager.v4.PermissionsResponse - 9, // 31: iamanager.v4.IAMProvisioningService.GetAllNodeIDs:output_type -> iamanager.v4.NodesID - 11, // 32: iamanager.v4.IAMProvisioningService.GetCertTypes:output_type -> iamanager.v4.CertTypes - 25, // 33: iamanager.v4.IAMProvisioningService.SetOwner:output_type -> google.protobuf.Empty - 25, // 34: iamanager.v4.IAMProvisioningService.Clear:output_type -> google.protobuf.Empty - 25, // 35: iamanager.v4.IAMProvisioningService.EncryptDisk:output_type -> google.protobuf.Empty - 25, // 36: iamanager.v4.IAMProvisioningService.FinishProvisioning:output_type -> google.protobuf.Empty - 16, // 37: iamanager.v4.IAMCertificateService.CreateKey:output_type -> iamanager.v4.CreateKeyResponse - 18, // 38: iamanager.v4.IAMCertificateService.ApplyCert:output_type -> iamanager.v4.ApplyCertResponse - 21, // 39: iamanager.v4.IAMPermissionsService.RegisterInstance:output_type -> iamanager.v4.RegisterInstanceResponse - 25, // 40: iamanager.v4.IAMPermissionsService.UnregisterInstance:output_type -> google.protobuf.Empty - 24, // [24:41] is the sub-list for method output_type - 7, // [7:24] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_iamanager_v4_iamanager_proto_init() } -func file_iamanager_v4_iamanager_proto_init() { - if File_iamanager_v4_iamanager_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_iamanager_v4_iamanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*APIVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCertRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCertResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Subjects); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PermissionsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceIdent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PermissionsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodesID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCertTypesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CertTypes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOwnerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EncryptDiskRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateKeyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateKeyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplyCertRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplyCertResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Permissions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterInstanceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterInstanceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_iamanager_v4_iamanager_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnregisterInstanceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_iamanager_v4_iamanager_proto_rawDesc, - NumEnums: 0, - NumMessages: 25, - NumExtensions: 0, - NumServices: 6, - }, - GoTypes: file_iamanager_v4_iamanager_proto_goTypes, - DependencyIndexes: file_iamanager_v4_iamanager_proto_depIdxs, - MessageInfos: file_iamanager_v4_iamanager_proto_msgTypes, - }.Build() - File_iamanager_v4_iamanager_proto = out.File - file_iamanager_v4_iamanager_proto_rawDesc = nil - file_iamanager_v4_iamanager_proto_goTypes = nil - file_iamanager_v4_iamanager_proto_depIdxs = nil -} diff --git a/vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager.pb.go b/vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager.pb.go new file mode 100644 index 00000000..dd864834 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager.pb.go @@ -0,0 +1,4891 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.26.0 +// source: servicemanager/v4/servicemanager.proto + +package servicemanager + +import ( + common "github.com/aosedge/aos_common/api/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ConnectionEnum int32 + +const ( + ConnectionEnum_DISCONNECTED ConnectionEnum = 0 + ConnectionEnum_CONNECTED ConnectionEnum = 1 +) + +// Enum value maps for ConnectionEnum. +var ( + ConnectionEnum_name = map[int32]string{ + 0: "DISCONNECTED", + 1: "CONNECTED", + } + ConnectionEnum_value = map[string]int32{ + "DISCONNECTED": 0, + "CONNECTED": 1, + } +) + +func (x ConnectionEnum) Enum() *ConnectionEnum { + p := new(ConnectionEnum) + *p = x + return p +} + +func (x ConnectionEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConnectionEnum) Descriptor() protoreflect.EnumDescriptor { + return file_servicemanager_v4_servicemanager_proto_enumTypes[0].Descriptor() +} + +func (ConnectionEnum) Type() protoreflect.EnumType { + return &file_servicemanager_v4_servicemanager_proto_enumTypes[0] +} + +func (x ConnectionEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConnectionEnum.Descriptor instead. +func (ConnectionEnum) EnumDescriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{0} +} + +type SMIncomingMessages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to SMIncomingMessage: + // + // *SMIncomingMessages_GetNodeConfigStatus + // *SMIncomingMessages_CheckNodeConfig + // *SMIncomingMessages_SetNodeConfig + // *SMIncomingMessages_RunInstances + // *SMIncomingMessages_OverrideEnvVars + // *SMIncomingMessages_SystemLogRequest + // *SMIncomingMessages_InstanceLogRequest + // *SMIncomingMessages_InstanceCrashLogRequest + // *SMIncomingMessages_GetAverageMonitoring + // *SMIncomingMessages_ConnectionStatus + // *SMIncomingMessages_ImageContentInfo + // *SMIncomingMessages_ImageContent + // *SMIncomingMessages_UpdateNetworks + // *SMIncomingMessages_ClockSync + SMIncomingMessage isSMIncomingMessages_SMIncomingMessage `protobuf_oneof:"SMIncomingMessage"` +} + +func (x *SMIncomingMessages) Reset() { + *x = SMIncomingMessages{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMIncomingMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMIncomingMessages) ProtoMessage() {} + +func (x *SMIncomingMessages) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SMIncomingMessages.ProtoReflect.Descriptor instead. +func (*SMIncomingMessages) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{0} +} + +func (m *SMIncomingMessages) GetSMIncomingMessage() isSMIncomingMessages_SMIncomingMessage { + if m != nil { + return m.SMIncomingMessage + } + return nil +} + +func (x *SMIncomingMessages) GetGetNodeConfigStatus() *GetNodeConfigStatus { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_GetNodeConfigStatus); ok { + return x.GetNodeConfigStatus + } + return nil +} + +func (x *SMIncomingMessages) GetCheckNodeConfig() *CheckNodeConfig { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_CheckNodeConfig); ok { + return x.CheckNodeConfig + } + return nil +} + +func (x *SMIncomingMessages) GetSetNodeConfig() *SetNodeConfig { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_SetNodeConfig); ok { + return x.SetNodeConfig + } + return nil +} + +func (x *SMIncomingMessages) GetRunInstances() *RunInstances { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_RunInstances); ok { + return x.RunInstances + } + return nil +} + +func (x *SMIncomingMessages) GetOverrideEnvVars() *OverrideEnvVars { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_OverrideEnvVars); ok { + return x.OverrideEnvVars + } + return nil +} + +func (x *SMIncomingMessages) GetSystemLogRequest() *SystemLogRequest { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_SystemLogRequest); ok { + return x.SystemLogRequest + } + return nil +} + +func (x *SMIncomingMessages) GetInstanceLogRequest() *InstanceLogRequest { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_InstanceLogRequest); ok { + return x.InstanceLogRequest + } + return nil +} + +func (x *SMIncomingMessages) GetInstanceCrashLogRequest() *InstanceCrashLogRequest { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_InstanceCrashLogRequest); ok { + return x.InstanceCrashLogRequest + } + return nil +} + +func (x *SMIncomingMessages) GetGetAverageMonitoring() *GetAverageMonitoring { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_GetAverageMonitoring); ok { + return x.GetAverageMonitoring + } + return nil +} + +func (x *SMIncomingMessages) GetConnectionStatus() *ConnectionStatus { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ConnectionStatus); ok { + return x.ConnectionStatus + } + return nil +} + +func (x *SMIncomingMessages) GetImageContentInfo() *ImageContentInfo { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ImageContentInfo); ok { + return x.ImageContentInfo + } + return nil +} + +func (x *SMIncomingMessages) GetImageContent() *ImageContent { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ImageContent); ok { + return x.ImageContent + } + return nil +} + +func (x *SMIncomingMessages) GetUpdateNetworks() *UpdateNetworks { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_UpdateNetworks); ok { + return x.UpdateNetworks + } + return nil +} + +func (x *SMIncomingMessages) GetClockSync() *ClockSync { + if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ClockSync); ok { + return x.ClockSync + } + return nil +} + +type isSMIncomingMessages_SMIncomingMessage interface { + isSMIncomingMessages_SMIncomingMessage() +} + +type SMIncomingMessages_GetNodeConfigStatus struct { + GetNodeConfigStatus *GetNodeConfigStatus `protobuf:"bytes,1,opt,name=get_node_config_status,json=getNodeConfigStatus,proto3,oneof"` +} + +type SMIncomingMessages_CheckNodeConfig struct { + CheckNodeConfig *CheckNodeConfig `protobuf:"bytes,2,opt,name=check_node_config,json=checkNodeConfig,proto3,oneof"` +} + +type SMIncomingMessages_SetNodeConfig struct { + SetNodeConfig *SetNodeConfig `protobuf:"bytes,3,opt,name=set_node_config,json=setNodeConfig,proto3,oneof"` +} + +type SMIncomingMessages_RunInstances struct { + RunInstances *RunInstances `protobuf:"bytes,4,opt,name=run_instances,json=runInstances,proto3,oneof"` +} + +type SMIncomingMessages_OverrideEnvVars struct { + OverrideEnvVars *OverrideEnvVars `protobuf:"bytes,5,opt,name=override_env_vars,json=overrideEnvVars,proto3,oneof"` +} + +type SMIncomingMessages_SystemLogRequest struct { + SystemLogRequest *SystemLogRequest `protobuf:"bytes,6,opt,name=system_log_request,json=systemLogRequest,proto3,oneof"` +} + +type SMIncomingMessages_InstanceLogRequest struct { + InstanceLogRequest *InstanceLogRequest `protobuf:"bytes,7,opt,name=instance_log_request,json=instanceLogRequest,proto3,oneof"` +} + +type SMIncomingMessages_InstanceCrashLogRequest struct { + InstanceCrashLogRequest *InstanceCrashLogRequest `protobuf:"bytes,8,opt,name=instance_crash_log_request,json=instanceCrashLogRequest,proto3,oneof"` +} + +type SMIncomingMessages_GetAverageMonitoring struct { + GetAverageMonitoring *GetAverageMonitoring `protobuf:"bytes,9,opt,name=get_average_monitoring,json=getAverageMonitoring,proto3,oneof"` +} + +type SMIncomingMessages_ConnectionStatus struct { + ConnectionStatus *ConnectionStatus `protobuf:"bytes,10,opt,name=connection_status,json=connectionStatus,proto3,oneof"` +} + +type SMIncomingMessages_ImageContentInfo struct { + ImageContentInfo *ImageContentInfo `protobuf:"bytes,11,opt,name=image_content_info,json=imageContentInfo,proto3,oneof"` +} + +type SMIncomingMessages_ImageContent struct { + ImageContent *ImageContent `protobuf:"bytes,12,opt,name=image_content,json=imageContent,proto3,oneof"` +} + +type SMIncomingMessages_UpdateNetworks struct { + UpdateNetworks *UpdateNetworks `protobuf:"bytes,13,opt,name=update_networks,json=updateNetworks,proto3,oneof"` +} + +type SMIncomingMessages_ClockSync struct { + ClockSync *ClockSync `protobuf:"bytes,14,opt,name=clock_sync,json=clockSync,proto3,oneof"` +} + +func (*SMIncomingMessages_GetNodeConfigStatus) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_CheckNodeConfig) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_SetNodeConfig) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_RunInstances) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_OverrideEnvVars) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_SystemLogRequest) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_InstanceLogRequest) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_InstanceCrashLogRequest) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_GetAverageMonitoring) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_ConnectionStatus) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_ImageContentInfo) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_ImageContent) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_UpdateNetworks) isSMIncomingMessages_SMIncomingMessage() {} + +func (*SMIncomingMessages_ClockSync) isSMIncomingMessages_SMIncomingMessage() {} + +type GetNodeConfigStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetNodeConfigStatus) Reset() { + *x = GetNodeConfigStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeConfigStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeConfigStatus) ProtoMessage() {} + +func (x *GetNodeConfigStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeConfigStatus.ProtoReflect.Descriptor instead. +func (*GetNodeConfigStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{1} +} + +type CheckNodeConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeConfig string `protobuf:"bytes,1,opt,name=node_config,json=nodeConfig,proto3" json:"node_config,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *CheckNodeConfig) Reset() { + *x = CheckNodeConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckNodeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckNodeConfig) ProtoMessage() {} + +func (x *CheckNodeConfig) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckNodeConfig.ProtoReflect.Descriptor instead. +func (*CheckNodeConfig) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{2} +} + +func (x *CheckNodeConfig) GetNodeConfig() string { + if x != nil { + return x.NodeConfig + } + return "" +} + +func (x *CheckNodeConfig) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type SetNodeConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeConfig string `protobuf:"bytes,1,opt,name=node_config,json=nodeConfig,proto3" json:"node_config,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *SetNodeConfig) Reset() { + *x = SetNodeConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetNodeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetNodeConfig) ProtoMessage() {} + +func (x *SetNodeConfig) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetNodeConfig.ProtoReflect.Descriptor instead. +func (*SetNodeConfig) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{3} +} + +func (x *SetNodeConfig) GetNodeConfig() string { + if x != nil { + return x.NodeConfig + } + return "" +} + +func (x *SetNodeConfig) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type UpdateNetworks struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Networks []*NetworkParameters `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` +} + +func (x *UpdateNetworks) Reset() { + *x = UpdateNetworks{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNetworks) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNetworks) ProtoMessage() {} + +func (x *UpdateNetworks) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateNetworks.ProtoReflect.Descriptor instead. +func (*UpdateNetworks) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateNetworks) GetNetworks() []*NetworkParameters { + if x != nil { + return x.Networks + } + return nil +} + +type ClockSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=current_time,json=currentTime,proto3" json:"current_time,omitempty"` +} + +func (x *ClockSync) Reset() { + *x = ClockSync{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClockSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClockSync) ProtoMessage() {} + +func (x *ClockSync) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClockSync.ProtoReflect.Descriptor instead. +func (*ClockSync) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{5} +} + +func (x *ClockSync) GetCurrentTime() *timestamppb.Timestamp { + if x != nil { + return x.CurrentTime + } + return nil +} + +type RunInstances struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Services []*ServiceInfo `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` + Layers []*LayerInfo `protobuf:"bytes,2,rep,name=layers,proto3" json:"layers,omitempty"` + Instances []*InstanceInfo `protobuf:"bytes,3,rep,name=instances,proto3" json:"instances,omitempty"` + ForceRestart bool `protobuf:"varint,4,opt,name=force_restart,json=forceRestart,proto3" json:"force_restart,omitempty"` +} + +func (x *RunInstances) Reset() { + *x = RunInstances{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunInstances) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunInstances) ProtoMessage() {} + +func (x *RunInstances) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunInstances.ProtoReflect.Descriptor instead. +func (*RunInstances) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{6} +} + +func (x *RunInstances) GetServices() []*ServiceInfo { + if x != nil { + return x.Services + } + return nil +} + +func (x *RunInstances) GetLayers() []*LayerInfo { + if x != nil { + return x.Layers + } + return nil +} + +func (x *RunInstances) GetInstances() []*InstanceInfo { + if x != nil { + return x.Instances + } + return nil +} + +func (x *RunInstances) GetForceRestart() bool { + if x != nil { + return x.ForceRestart + } + return false +} + +type ServiceInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + ProviderId string `protobuf:"bytes,2,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Gid uint32 `protobuf:"varint,4,opt,name=gid,proto3" json:"gid,omitempty"` + Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"` + Sha256 []byte `protobuf:"bytes,6,opt,name=sha256,proto3" json:"sha256,omitempty"` + Size uint64 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ServiceInfo) Reset() { + *x = ServiceInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceInfo) ProtoMessage() {} + +func (x *ServiceInfo) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead. +func (*ServiceInfo) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{7} +} + +func (x *ServiceInfo) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *ServiceInfo) GetProviderId() string { + if x != nil { + return x.ProviderId + } + return "" +} + +func (x *ServiceInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ServiceInfo) GetGid() uint32 { + if x != nil { + return x.Gid + } + return 0 +} + +func (x *ServiceInfo) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ServiceInfo) GetSha256() []byte { + if x != nil { + return x.Sha256 + } + return nil +} + +func (x *ServiceInfo) GetSize() uint64 { + if x != nil { + return x.Size + } + return 0 +} + +type LayerInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LayerId string `protobuf:"bytes,1,opt,name=layer_id,json=layerId,proto3" json:"layer_id,omitempty"` + Digest string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` + Sha256 []byte `protobuf:"bytes,5,opt,name=sha256,proto3" json:"sha256,omitempty"` + Size uint64 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *LayerInfo) Reset() { + *x = LayerInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LayerInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LayerInfo) ProtoMessage() {} + +func (x *LayerInfo) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LayerInfo.ProtoReflect.Descriptor instead. +func (*LayerInfo) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{8} +} + +func (x *LayerInfo) GetLayerId() string { + if x != nil { + return x.LayerId + } + return "" +} + +func (x *LayerInfo) GetDigest() string { + if x != nil { + return x.Digest + } + return "" +} + +func (x *LayerInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *LayerInfo) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *LayerInfo) GetSha256() []byte { + if x != nil { + return x.Sha256 + } + return nil +} + +func (x *LayerInfo) GetSize() uint64 { + if x != nil { + return x.Size + } + return 0 +} + +type FirewallRule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DstIp string `protobuf:"bytes,1,opt,name=dst_ip,json=dstIp,proto3" json:"dst_ip,omitempty"` + DstPort string `protobuf:"bytes,2,opt,name=dst_port,json=dstPort,proto3" json:"dst_port,omitempty"` + Proto string `protobuf:"bytes,3,opt,name=proto,proto3" json:"proto,omitempty"` + SrcIp string `protobuf:"bytes,4,opt,name=src_ip,json=srcIp,proto3" json:"src_ip,omitempty"` +} + +func (x *FirewallRule) Reset() { + *x = FirewallRule{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FirewallRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FirewallRule) ProtoMessage() {} + +func (x *FirewallRule) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FirewallRule.ProtoReflect.Descriptor instead. +func (*FirewallRule) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{9} +} + +func (x *FirewallRule) GetDstIp() string { + if x != nil { + return x.DstIp + } + return "" +} + +func (x *FirewallRule) GetDstPort() string { + if x != nil { + return x.DstPort + } + return "" +} + +func (x *FirewallRule) GetProto() string { + if x != nil { + return x.Proto + } + return "" +} + +func (x *FirewallRule) GetSrcIp() string { + if x != nil { + return x.SrcIp + } + return "" +} + +type NetworkParameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NetworkId string `protobuf:"bytes,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` + Subnet string `protobuf:"bytes,2,opt,name=subnet,proto3" json:"subnet,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + VlanId uint64 `protobuf:"varint,4,opt,name=vlan_id,json=vlanId,proto3" json:"vlan_id,omitempty"` + DnsServers []string `protobuf:"bytes,5,rep,name=dns_servers,json=dnsServers,proto3" json:"dns_servers,omitempty"` + Rules []*FirewallRule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules,omitempty"` +} + +func (x *NetworkParameters) Reset() { + *x = NetworkParameters{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkParameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkParameters) ProtoMessage() {} + +func (x *NetworkParameters) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkParameters.ProtoReflect.Descriptor instead. +func (*NetworkParameters) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{10} +} + +func (x *NetworkParameters) GetNetworkId() string { + if x != nil { + return x.NetworkId + } + return "" +} + +func (x *NetworkParameters) GetSubnet() string { + if x != nil { + return x.Subnet + } + return "" +} + +func (x *NetworkParameters) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *NetworkParameters) GetVlanId() uint64 { + if x != nil { + return x.VlanId + } + return 0 +} + +func (x *NetworkParameters) GetDnsServers() []string { + if x != nil { + return x.DnsServers + } + return nil +} + +func (x *NetworkParameters) GetRules() []*FirewallRule { + if x != nil { + return x.Rules + } + return nil +} + +type InstanceInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Uid uint32 `protobuf:"varint,2,opt,name=uid,proto3" json:"uid,omitempty"` + Priority uint64 `protobuf:"varint,3,opt,name=priority,proto3" json:"priority,omitempty"` + StoragePath string `protobuf:"bytes,4,opt,name=storage_path,json=storagePath,proto3" json:"storage_path,omitempty"` + StatePath string `protobuf:"bytes,5,opt,name=state_path,json=statePath,proto3" json:"state_path,omitempty"` + NetworkParameters *NetworkParameters `protobuf:"bytes,6,opt,name=network_parameters,json=networkParameters,proto3" json:"network_parameters,omitempty"` +} + +func (x *InstanceInfo) Reset() { + *x = InstanceInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceInfo) ProtoMessage() {} + +func (x *InstanceInfo) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceInfo.ProtoReflect.Descriptor instead. +func (*InstanceInfo) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{11} +} + +func (x *InstanceInfo) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *InstanceInfo) GetUid() uint32 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *InstanceInfo) GetPriority() uint64 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *InstanceInfo) GetStoragePath() string { + if x != nil { + return x.StoragePath + } + return "" +} + +func (x *InstanceInfo) GetStatePath() string { + if x != nil { + return x.StatePath + } + return "" +} + +func (x *InstanceInfo) GetNetworkParameters() *NetworkParameters { + if x != nil { + return x.NetworkParameters + } + return nil +} + +type OverrideEnvVars struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EnvVars []*OverrideInstanceEnvVar `protobuf:"bytes,1,rep,name=env_vars,json=envVars,proto3" json:"env_vars,omitempty"` +} + +func (x *OverrideEnvVars) Reset() { + *x = OverrideEnvVars{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OverrideEnvVars) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OverrideEnvVars) ProtoMessage() {} + +func (x *OverrideEnvVars) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OverrideEnvVars.ProtoReflect.Descriptor instead. +func (*OverrideEnvVars) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{12} +} + +func (x *OverrideEnvVars) GetEnvVars() []*OverrideInstanceEnvVar { + if x != nil { + return x.EnvVars + } + return nil +} + +type OverrideInstanceEnvVar struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceFilter *InstanceFilter `protobuf:"bytes,1,opt,name=instance_filter,json=instanceFilter,proto3" json:"instance_filter,omitempty"` + Variables []*EnvVarInfo `protobuf:"bytes,2,rep,name=variables,proto3" json:"variables,omitempty"` +} + +func (x *OverrideInstanceEnvVar) Reset() { + *x = OverrideInstanceEnvVar{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OverrideInstanceEnvVar) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OverrideInstanceEnvVar) ProtoMessage() {} + +func (x *OverrideInstanceEnvVar) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OverrideInstanceEnvVar.ProtoReflect.Descriptor instead. +func (*OverrideInstanceEnvVar) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{13} +} + +func (x *OverrideInstanceEnvVar) GetInstanceFilter() *InstanceFilter { + if x != nil { + return x.InstanceFilter + } + return nil +} + +func (x *OverrideInstanceEnvVar) GetVariables() []*EnvVarInfo { + if x != nil { + return x.Variables + } + return nil +} + +type EnvVarInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Ttl *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=ttl,proto3" json:"ttl,omitempty"` +} + +func (x *EnvVarInfo) Reset() { + *x = EnvVarInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnvVarInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnvVarInfo) ProtoMessage() {} + +func (x *EnvVarInfo) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnvVarInfo.ProtoReflect.Descriptor instead. +func (*EnvVarInfo) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{14} +} + +func (x *EnvVarInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EnvVarInfo) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *EnvVarInfo) GetTtl() *timestamppb.Timestamp { + if x != nil { + return x.Ttl + } + return nil +} + +type SystemLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` + From *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` + Till *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=till,proto3" json:"till,omitempty"` +} + +func (x *SystemLogRequest) Reset() { + *x = SystemLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemLogRequest) ProtoMessage() {} + +func (x *SystemLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemLogRequest.ProtoReflect.Descriptor instead. +func (*SystemLogRequest) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{15} +} + +func (x *SystemLogRequest) GetLogId() string { + if x != nil { + return x.LogId + } + return "" +} + +func (x *SystemLogRequest) GetFrom() *timestamppb.Timestamp { + if x != nil { + return x.From + } + return nil +} + +func (x *SystemLogRequest) GetTill() *timestamppb.Timestamp { + if x != nil { + return x.Till + } + return nil +} + +type InstanceFilter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + SubjectId string `protobuf:"bytes,2,opt,name=subject_id,json=subjectId,proto3" json:"subject_id,omitempty"` + Instance int64 `protobuf:"varint,3,opt,name=instance,proto3" json:"instance,omitempty"` +} + +func (x *InstanceFilter) Reset() { + *x = InstanceFilter{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceFilter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceFilter) ProtoMessage() {} + +func (x *InstanceFilter) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceFilter.ProtoReflect.Descriptor instead. +func (*InstanceFilter) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{16} +} + +func (x *InstanceFilter) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *InstanceFilter) GetSubjectId() string { + if x != nil { + return x.SubjectId + } + return "" +} + +func (x *InstanceFilter) GetInstance() int64 { + if x != nil { + return x.Instance + } + return 0 +} + +type InstanceLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` + InstanceFilter *InstanceFilter `protobuf:"bytes,2,opt,name=instance_filter,json=instanceFilter,proto3" json:"instance_filter,omitempty"` + From *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` + Till *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=till,proto3" json:"till,omitempty"` +} + +func (x *InstanceLogRequest) Reset() { + *x = InstanceLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceLogRequest) ProtoMessage() {} + +func (x *InstanceLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceLogRequest.ProtoReflect.Descriptor instead. +func (*InstanceLogRequest) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{17} +} + +func (x *InstanceLogRequest) GetLogId() string { + if x != nil { + return x.LogId + } + return "" +} + +func (x *InstanceLogRequest) GetInstanceFilter() *InstanceFilter { + if x != nil { + return x.InstanceFilter + } + return nil +} + +func (x *InstanceLogRequest) GetFrom() *timestamppb.Timestamp { + if x != nil { + return x.From + } + return nil +} + +func (x *InstanceLogRequest) GetTill() *timestamppb.Timestamp { + if x != nil { + return x.Till + } + return nil +} + +type InstanceCrashLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` + InstanceFilter *InstanceFilter `protobuf:"bytes,2,opt,name=instance_filter,json=instanceFilter,proto3" json:"instance_filter,omitempty"` + From *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` + Till *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=till,proto3" json:"till,omitempty"` +} + +func (x *InstanceCrashLogRequest) Reset() { + *x = InstanceCrashLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceCrashLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceCrashLogRequest) ProtoMessage() {} + +func (x *InstanceCrashLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceCrashLogRequest.ProtoReflect.Descriptor instead. +func (*InstanceCrashLogRequest) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{18} +} + +func (x *InstanceCrashLogRequest) GetLogId() string { + if x != nil { + return x.LogId + } + return "" +} + +func (x *InstanceCrashLogRequest) GetInstanceFilter() *InstanceFilter { + if x != nil { + return x.InstanceFilter + } + return nil +} + +func (x *InstanceCrashLogRequest) GetFrom() *timestamppb.Timestamp { + if x != nil { + return x.From + } + return nil +} + +func (x *InstanceCrashLogRequest) GetTill() *timestamppb.Timestamp { + if x != nil { + return x.Till + } + return nil +} + +type GetAverageMonitoring struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetAverageMonitoring) Reset() { + *x = GetAverageMonitoring{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAverageMonitoring) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAverageMonitoring) ProtoMessage() {} + +func (x *GetAverageMonitoring) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAverageMonitoring.ProtoReflect.Descriptor instead. +func (*GetAverageMonitoring) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{19} +} + +type ConnectionStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CloudStatus ConnectionEnum `protobuf:"varint,1,opt,name=cloud_status,json=cloudStatus,proto3,enum=servicemanager.v4.ConnectionEnum" json:"cloud_status,omitempty"` +} + +func (x *ConnectionStatus) Reset() { + *x = ConnectionStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConnectionStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConnectionStatus) ProtoMessage() {} + +func (x *ConnectionStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConnectionStatus.ProtoReflect.Descriptor instead. +func (*ConnectionStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{20} +} + +func (x *ConnectionStatus) GetCloudStatus() ConnectionEnum { + if x != nil { + return x.CloudStatus + } + return ConnectionEnum_DISCONNECTED +} + +type ImageContentInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ImageFiles []*ImageFile `protobuf:"bytes,2,rep,name=image_files,json=imageFiles,proto3" json:"image_files,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *ImageContentInfo) Reset() { + *x = ImageContentInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageContentInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageContentInfo) ProtoMessage() {} + +func (x *ImageContentInfo) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageContentInfo.ProtoReflect.Descriptor instead. +func (*ImageContentInfo) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{21} +} + +func (x *ImageContentInfo) GetRequestId() uint64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *ImageContentInfo) GetImageFiles() []*ImageFile { + if x != nil { + return x.ImageFiles + } + return nil +} + +func (x *ImageContentInfo) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type ImageFile struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelativePath string `protobuf:"bytes,1,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` + Sha256 []byte `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` + Size uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ImageFile) Reset() { + *x = ImageFile{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageFile) ProtoMessage() {} + +func (x *ImageFile) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageFile.ProtoReflect.Descriptor instead. +func (*ImageFile) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{22} +} + +func (x *ImageFile) GetRelativePath() string { + if x != nil { + return x.RelativePath + } + return "" +} + +func (x *ImageFile) GetSha256() []byte { + if x != nil { + return x.Sha256 + } + return nil +} + +func (x *ImageFile) GetSize() uint64 { + if x != nil { + return x.Size + } + return 0 +} + +type ImageContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + RelativePath string `protobuf:"bytes,2,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` + PartsCount uint64 `protobuf:"varint,3,opt,name=parts_count,json=partsCount,proto3" json:"parts_count,omitempty"` + Part uint64 `protobuf:"varint,4,opt,name=part,proto3" json:"part,omitempty"` + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *ImageContent) Reset() { + *x = ImageContent{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageContent) ProtoMessage() {} + +func (x *ImageContent) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageContent.ProtoReflect.Descriptor instead. +func (*ImageContent) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{23} +} + +func (x *ImageContent) GetRequestId() uint64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *ImageContent) GetRelativePath() string { + if x != nil { + return x.RelativePath + } + return "" +} + +func (x *ImageContent) GetPartsCount() uint64 { + if x != nil { + return x.PartsCount + } + return 0 +} + +func (x *ImageContent) GetPart() uint64 { + if x != nil { + return x.Part + } + return 0 +} + +func (x *ImageContent) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type SMOutgoingMessages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to SMOutgoingMessage: + // + // *SMOutgoingMessages_NodeConfigStatus + // *SMOutgoingMessages_RunInstancesStatus + // *SMOutgoingMessages_UpdateInstancesStatus + // *SMOutgoingMessages_OverrideEnvVarStatus + // *SMOutgoingMessages_Log + // *SMOutgoingMessages_InstantMonitoring + // *SMOutgoingMessages_AverageMonitoring + // *SMOutgoingMessages_Alert + // *SMOutgoingMessages_ImageContentRequest + // *SMOutgoingMessages_ClockSyncRequest + SMOutgoingMessage isSMOutgoingMessages_SMOutgoingMessage `protobuf_oneof:"SMOutgoingMessage"` +} + +func (x *SMOutgoingMessages) Reset() { + *x = SMOutgoingMessages{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMOutgoingMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMOutgoingMessages) ProtoMessage() {} + +func (x *SMOutgoingMessages) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SMOutgoingMessages.ProtoReflect.Descriptor instead. +func (*SMOutgoingMessages) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{24} +} + +func (m *SMOutgoingMessages) GetSMOutgoingMessage() isSMOutgoingMessages_SMOutgoingMessage { + if m != nil { + return m.SMOutgoingMessage + } + return nil +} + +func (x *SMOutgoingMessages) GetNodeConfigStatus() *NodeConfigStatus { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_NodeConfigStatus); ok { + return x.NodeConfigStatus + } + return nil +} + +func (x *SMOutgoingMessages) GetRunInstancesStatus() *RunInstancesStatus { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_RunInstancesStatus); ok { + return x.RunInstancesStatus + } + return nil +} + +func (x *SMOutgoingMessages) GetUpdateInstancesStatus() *UpdateInstancesStatus { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_UpdateInstancesStatus); ok { + return x.UpdateInstancesStatus + } + return nil +} + +func (x *SMOutgoingMessages) GetOverrideEnvVarStatus() *OverrideEnvVarStatus { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_OverrideEnvVarStatus); ok { + return x.OverrideEnvVarStatus + } + return nil +} + +func (x *SMOutgoingMessages) GetLog() *LogData { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_Log); ok { + return x.Log + } + return nil +} + +func (x *SMOutgoingMessages) GetInstantMonitoring() *InstantMonitoring { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_InstantMonitoring); ok { + return x.InstantMonitoring + } + return nil +} + +func (x *SMOutgoingMessages) GetAverageMonitoring() *AverageMonitoring { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_AverageMonitoring); ok { + return x.AverageMonitoring + } + return nil +} + +func (x *SMOutgoingMessages) GetAlert() *Alert { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_Alert); ok { + return x.Alert + } + return nil +} + +func (x *SMOutgoingMessages) GetImageContentRequest() *ImageContentRequest { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_ImageContentRequest); ok { + return x.ImageContentRequest + } + return nil +} + +func (x *SMOutgoingMessages) GetClockSyncRequest() *ClockSyncRequest { + if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_ClockSyncRequest); ok { + return x.ClockSyncRequest + } + return nil +} + +type isSMOutgoingMessages_SMOutgoingMessage interface { + isSMOutgoingMessages_SMOutgoingMessage() +} + +type SMOutgoingMessages_NodeConfigStatus struct { + NodeConfigStatus *NodeConfigStatus `protobuf:"bytes,2,opt,name=node_config_status,json=nodeConfigStatus,proto3,oneof"` +} + +type SMOutgoingMessages_RunInstancesStatus struct { + RunInstancesStatus *RunInstancesStatus `protobuf:"bytes,3,opt,name=run_instances_status,json=runInstancesStatus,proto3,oneof"` +} + +type SMOutgoingMessages_UpdateInstancesStatus struct { + UpdateInstancesStatus *UpdateInstancesStatus `protobuf:"bytes,4,opt,name=update_instances_status,json=updateInstancesStatus,proto3,oneof"` +} + +type SMOutgoingMessages_OverrideEnvVarStatus struct { + OverrideEnvVarStatus *OverrideEnvVarStatus `protobuf:"bytes,5,opt,name=override_env_var_status,json=overrideEnvVarStatus,proto3,oneof"` +} + +type SMOutgoingMessages_Log struct { + Log *LogData `protobuf:"bytes,6,opt,name=log,proto3,oneof"` +} + +type SMOutgoingMessages_InstantMonitoring struct { + InstantMonitoring *InstantMonitoring `protobuf:"bytes,7,opt,name=instant_monitoring,json=instantMonitoring,proto3,oneof"` +} + +type SMOutgoingMessages_AverageMonitoring struct { + AverageMonitoring *AverageMonitoring `protobuf:"bytes,8,opt,name=average_monitoring,json=averageMonitoring,proto3,oneof"` +} + +type SMOutgoingMessages_Alert struct { + Alert *Alert `protobuf:"bytes,9,opt,name=alert,proto3,oneof"` +} + +type SMOutgoingMessages_ImageContentRequest struct { + ImageContentRequest *ImageContentRequest `protobuf:"bytes,10,opt,name=image_content_request,json=imageContentRequest,proto3,oneof"` +} + +type SMOutgoingMessages_ClockSyncRequest struct { + ClockSyncRequest *ClockSyncRequest `protobuf:"bytes,11,opt,name=clock_sync_request,json=clockSyncRequest,proto3,oneof"` +} + +func (*SMOutgoingMessages_NodeConfigStatus) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_RunInstancesStatus) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_UpdateInstancesStatus) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_OverrideEnvVarStatus) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_Log) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_InstantMonitoring) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_AverageMonitoring) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_Alert) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_ImageContentRequest) isSMOutgoingMessages_SMOutgoingMessage() {} + +func (*SMOutgoingMessages_ClockSyncRequest) isSMOutgoingMessages_SMOutgoingMessage() {} + +type Partition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Types []string `protobuf:"bytes,2,rep,name=types,proto3" json:"types,omitempty"` + TotalSize uint64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` +} + +func (x *Partition) Reset() { + *x = Partition{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Partition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Partition) ProtoMessage() {} + +func (x *Partition) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Partition.ProtoReflect.Descriptor instead. +func (*Partition) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{25} +} + +func (x *Partition) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Partition) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + +func (x *Partition) GetTotalSize() uint64 { + if x != nil { + return x.TotalSize + } + return 0 +} + +type NodeConfigStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + NodeType string `protobuf:"bytes,2,opt,name=node_type,json=nodeType,proto3" json:"node_type,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *NodeConfigStatus) Reset() { + *x = NodeConfigStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeConfigStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeConfigStatus) ProtoMessage() {} + +func (x *NodeConfigStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeConfigStatus.ProtoReflect.Descriptor instead. +func (*NodeConfigStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{26} +} + +func (x *NodeConfigStatus) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *NodeConfigStatus) GetNodeType() string { + if x != nil { + return x.NodeType + } + return "" +} + +func (x *NodeConfigStatus) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *NodeConfigStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type RunInstancesStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instances []*InstanceStatus `protobuf:"bytes,1,rep,name=instances,proto3" json:"instances,omitempty"` +} + +func (x *RunInstancesStatus) Reset() { + *x = RunInstancesStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunInstancesStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunInstancesStatus) ProtoMessage() {} + +func (x *RunInstancesStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunInstancesStatus.ProtoReflect.Descriptor instead. +func (*RunInstancesStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{27} +} + +func (x *RunInstancesStatus) GetInstances() []*InstanceStatus { + if x != nil { + return x.Instances + } + return nil +} + +type UpdateInstancesStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instances []*InstanceStatus `protobuf:"bytes,1,rep,name=instances,proto3" json:"instances,omitempty"` +} + +func (x *UpdateInstancesStatus) Reset() { + *x = UpdateInstancesStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateInstancesStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateInstancesStatus) ProtoMessage() {} + +func (x *UpdateInstancesStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateInstancesStatus.ProtoReflect.Descriptor instead. +func (*UpdateInstancesStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{28} +} + +func (x *UpdateInstancesStatus) GetInstances() []*InstanceStatus { + if x != nil { + return x.Instances + } + return nil +} + +type InstanceStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` + RunState string `protobuf:"bytes,3,opt,name=run_state,json=runState,proto3" json:"run_state,omitempty"` + ErrorInfo *common.ErrorInfo `protobuf:"bytes,4,opt,name=error_info,json=errorInfo,proto3" json:"error_info,omitempty"` +} + +func (x *InstanceStatus) Reset() { + *x = InstanceStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceStatus) ProtoMessage() {} + +func (x *InstanceStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceStatus.ProtoReflect.Descriptor instead. +func (*InstanceStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{29} +} + +func (x *InstanceStatus) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *InstanceStatus) GetServiceVersion() string { + if x != nil { + return x.ServiceVersion + } + return "" +} + +func (x *InstanceStatus) GetRunState() string { + if x != nil { + return x.RunState + } + return "" +} + +func (x *InstanceStatus) GetErrorInfo() *common.ErrorInfo { + if x != nil { + return x.ErrorInfo + } + return nil +} + +type OverrideEnvVarStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EnvVarsStatus []*EnvVarInstanceStatus `protobuf:"bytes,1,rep,name=env_vars_status,json=envVarsStatus,proto3" json:"env_vars_status,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *OverrideEnvVarStatus) Reset() { + *x = OverrideEnvVarStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OverrideEnvVarStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OverrideEnvVarStatus) ProtoMessage() {} + +func (x *OverrideEnvVarStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OverrideEnvVarStatus.ProtoReflect.Descriptor instead. +func (*OverrideEnvVarStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{30} +} + +func (x *OverrideEnvVarStatus) GetEnvVarsStatus() []*EnvVarInstanceStatus { + if x != nil { + return x.EnvVarsStatus + } + return nil +} + +func (x *OverrideEnvVarStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type EnvVarInstanceStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceFilter *InstanceFilter `protobuf:"bytes,1,opt,name=instance_filter,json=instanceFilter,proto3" json:"instance_filter,omitempty"` + Statuses []*EnvVarStatus `protobuf:"bytes,2,rep,name=statuses,proto3" json:"statuses,omitempty"` +} + +func (x *EnvVarInstanceStatus) Reset() { + *x = EnvVarInstanceStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnvVarInstanceStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnvVarInstanceStatus) ProtoMessage() {} + +func (x *EnvVarInstanceStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnvVarInstanceStatus.ProtoReflect.Descriptor instead. +func (*EnvVarInstanceStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{31} +} + +func (x *EnvVarInstanceStatus) GetInstanceFilter() *InstanceFilter { + if x != nil { + return x.InstanceFilter + } + return nil +} + +func (x *EnvVarInstanceStatus) GetStatuses() []*EnvVarStatus { + if x != nil { + return x.Statuses + } + return nil +} + +type EnvVarStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *EnvVarStatus) Reset() { + *x = EnvVarStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnvVarStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnvVarStatus) ProtoMessage() {} + +func (x *EnvVarStatus) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnvVarStatus.ProtoReflect.Descriptor instead. +func (*EnvVarStatus) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{32} +} + +func (x *EnvVarStatus) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EnvVarStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type LogData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` + PartCount uint64 `protobuf:"varint,2,opt,name=part_count,json=partCount,proto3" json:"part_count,omitempty"` + Part uint64 `protobuf:"varint,3,opt,name=part,proto3" json:"part,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *LogData) Reset() { + *x = LogData{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogData) ProtoMessage() {} + +func (x *LogData) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogData.ProtoReflect.Descriptor instead. +func (*LogData) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{33} +} + +func (x *LogData) GetLogId() string { + if x != nil { + return x.LogId + } + return "" +} + +func (x *LogData) GetPartCount() uint64 { + if x != nil { + return x.PartCount + } + return 0 +} + +func (x *LogData) GetPart() uint64 { + if x != nil { + return x.Part + } + return 0 +} + +func (x *LogData) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *LogData) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *LogData) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type InstantMonitoring struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeMonitoring *MonitoringData `protobuf:"bytes,1,opt,name=node_monitoring,json=nodeMonitoring,proto3" json:"node_monitoring,omitempty"` + InstancesMonitoring []*InstanceMonitoring `protobuf:"bytes,2,rep,name=instances_monitoring,json=instancesMonitoring,proto3" json:"instances_monitoring,omitempty"` +} + +func (x *InstantMonitoring) Reset() { + *x = InstantMonitoring{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstantMonitoring) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstantMonitoring) ProtoMessage() {} + +func (x *InstantMonitoring) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstantMonitoring.ProtoReflect.Descriptor instead. +func (*InstantMonitoring) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{34} +} + +func (x *InstantMonitoring) GetNodeMonitoring() *MonitoringData { + if x != nil { + return x.NodeMonitoring + } + return nil +} + +func (x *InstantMonitoring) GetInstancesMonitoring() []*InstanceMonitoring { + if x != nil { + return x.InstancesMonitoring + } + return nil +} + +type AverageMonitoring struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeMonitoring *MonitoringData `protobuf:"bytes,1,opt,name=node_monitoring,json=nodeMonitoring,proto3" json:"node_monitoring,omitempty"` + InstancesMonitoring []*InstanceMonitoring `protobuf:"bytes,2,rep,name=instances_monitoring,json=instancesMonitoring,proto3" json:"instances_monitoring,omitempty"` +} + +func (x *AverageMonitoring) Reset() { + *x = AverageMonitoring{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AverageMonitoring) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AverageMonitoring) ProtoMessage() {} + +func (x *AverageMonitoring) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AverageMonitoring.ProtoReflect.Descriptor instead. +func (*AverageMonitoring) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{35} +} + +func (x *AverageMonitoring) GetNodeMonitoring() *MonitoringData { + if x != nil { + return x.NodeMonitoring + } + return nil +} + +func (x *AverageMonitoring) GetInstancesMonitoring() []*InstanceMonitoring { + if x != nil { + return x.InstancesMonitoring + } + return nil +} + +type MonitoringData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ram uint64 `protobuf:"varint,1,opt,name=ram,proto3" json:"ram,omitempty"` + Cpu uint64 `protobuf:"varint,2,opt,name=cpu,proto3" json:"cpu,omitempty"` + Disk []*PartitionUsage `protobuf:"bytes,3,rep,name=disk,proto3" json:"disk,omitempty"` + Download uint64 `protobuf:"varint,4,opt,name=download,proto3" json:"download,omitempty"` + Upload uint64 `protobuf:"varint,5,opt,name=upload,proto3" json:"upload,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *MonitoringData) Reset() { + *x = MonitoringData{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MonitoringData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MonitoringData) ProtoMessage() {} + +func (x *MonitoringData) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MonitoringData.ProtoReflect.Descriptor instead. +func (*MonitoringData) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{36} +} + +func (x *MonitoringData) GetRam() uint64 { + if x != nil { + return x.Ram + } + return 0 +} + +func (x *MonitoringData) GetCpu() uint64 { + if x != nil { + return x.Cpu + } + return 0 +} + +func (x *MonitoringData) GetDisk() []*PartitionUsage { + if x != nil { + return x.Disk + } + return nil +} + +func (x *MonitoringData) GetDownload() uint64 { + if x != nil { + return x.Download + } + return 0 +} + +func (x *MonitoringData) GetUpload() uint64 { + if x != nil { + return x.Upload + } + return 0 +} + +func (x *MonitoringData) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +type PartitionUsage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + UsedSize uint64 `protobuf:"varint,2,opt,name=used_size,json=usedSize,proto3" json:"used_size,omitempty"` +} + +func (x *PartitionUsage) Reset() { + *x = PartitionUsage{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PartitionUsage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartitionUsage) ProtoMessage() {} + +func (x *PartitionUsage) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartitionUsage.ProtoReflect.Descriptor instead. +func (*PartitionUsage) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{37} +} + +func (x *PartitionUsage) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PartitionUsage) GetUsedSize() uint64 { + if x != nil { + return x.UsedSize + } + return 0 +} + +type InstanceMonitoring struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + MonitoringData *MonitoringData `protobuf:"bytes,2,opt,name=monitoring_data,json=monitoringData,proto3" json:"monitoring_data,omitempty"` +} + +func (x *InstanceMonitoring) Reset() { + *x = InstanceMonitoring{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceMonitoring) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceMonitoring) ProtoMessage() {} + +func (x *InstanceMonitoring) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceMonitoring.ProtoReflect.Descriptor instead. +func (*InstanceMonitoring) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{38} +} + +func (x *InstanceMonitoring) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *InstanceMonitoring) GetMonitoringData() *MonitoringData { + if x != nil { + return x.MonitoringData + } + return nil +} + +type Alert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` + // Types that are assignable to AlertItem: + // + // *Alert_SystemQuotaAlert + // *Alert_InstanceQuotaAlert + // *Alert_ResourceValidateAlert + // *Alert_DeviceAllocateAlert + // *Alert_SystemAlert + // *Alert_CoreAlert + // *Alert_InstanceAlert + AlertItem isAlert_AlertItem `protobuf_oneof:"AlertItem"` +} + +func (x *Alert) Reset() { + *x = Alert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Alert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Alert) ProtoMessage() {} + +func (x *Alert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Alert.ProtoReflect.Descriptor instead. +func (*Alert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{39} +} + +func (x *Alert) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *Alert) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (m *Alert) GetAlertItem() isAlert_AlertItem { + if m != nil { + return m.AlertItem + } + return nil +} + +func (x *Alert) GetSystemQuotaAlert() *SystemQuotaAlert { + if x, ok := x.GetAlertItem().(*Alert_SystemQuotaAlert); ok { + return x.SystemQuotaAlert + } + return nil +} + +func (x *Alert) GetInstanceQuotaAlert() *InstanceQuotaAlert { + if x, ok := x.GetAlertItem().(*Alert_InstanceQuotaAlert); ok { + return x.InstanceQuotaAlert + } + return nil +} + +func (x *Alert) GetResourceValidateAlert() *ResourceValidateAlert { + if x, ok := x.GetAlertItem().(*Alert_ResourceValidateAlert); ok { + return x.ResourceValidateAlert + } + return nil +} + +func (x *Alert) GetDeviceAllocateAlert() *DeviceAllocateAlert { + if x, ok := x.GetAlertItem().(*Alert_DeviceAllocateAlert); ok { + return x.DeviceAllocateAlert + } + return nil +} + +func (x *Alert) GetSystemAlert() *SystemAlert { + if x, ok := x.GetAlertItem().(*Alert_SystemAlert); ok { + return x.SystemAlert + } + return nil +} + +func (x *Alert) GetCoreAlert() *CoreAlert { + if x, ok := x.GetAlertItem().(*Alert_CoreAlert); ok { + return x.CoreAlert + } + return nil +} + +func (x *Alert) GetInstanceAlert() *InstanceAlert { + if x, ok := x.GetAlertItem().(*Alert_InstanceAlert); ok { + return x.InstanceAlert + } + return nil +} + +type isAlert_AlertItem interface { + isAlert_AlertItem() +} + +type Alert_SystemQuotaAlert struct { + SystemQuotaAlert *SystemQuotaAlert `protobuf:"bytes,3,opt,name=system_quota_alert,json=systemQuotaAlert,proto3,oneof"` +} + +type Alert_InstanceQuotaAlert struct { + InstanceQuotaAlert *InstanceQuotaAlert `protobuf:"bytes,4,opt,name=instance_quota_alert,json=instanceQuotaAlert,proto3,oneof"` +} + +type Alert_ResourceValidateAlert struct { + ResourceValidateAlert *ResourceValidateAlert `protobuf:"bytes,5,opt,name=resource_validate_alert,json=resourceValidateAlert,proto3,oneof"` +} + +type Alert_DeviceAllocateAlert struct { + DeviceAllocateAlert *DeviceAllocateAlert `protobuf:"bytes,6,opt,name=device_allocate_alert,json=deviceAllocateAlert,proto3,oneof"` +} + +type Alert_SystemAlert struct { + SystemAlert *SystemAlert `protobuf:"bytes,7,opt,name=system_alert,json=systemAlert,proto3,oneof"` +} + +type Alert_CoreAlert struct { + CoreAlert *CoreAlert `protobuf:"bytes,8,opt,name=core_alert,json=coreAlert,proto3,oneof"` +} + +type Alert_InstanceAlert struct { + InstanceAlert *InstanceAlert `protobuf:"bytes,9,opt,name=instance_alert,json=instanceAlert,proto3,oneof"` +} + +func (*Alert_SystemQuotaAlert) isAlert_AlertItem() {} + +func (*Alert_InstanceQuotaAlert) isAlert_AlertItem() {} + +func (*Alert_ResourceValidateAlert) isAlert_AlertItem() {} + +func (*Alert_DeviceAllocateAlert) isAlert_AlertItem() {} + +func (*Alert_SystemAlert) isAlert_AlertItem() {} + +func (*Alert_CoreAlert) isAlert_AlertItem() {} + +func (*Alert_InstanceAlert) isAlert_AlertItem() {} + +type ImageContentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + RequestId uint64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` +} + +func (x *ImageContentRequest) Reset() { + *x = ImageContentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageContentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageContentRequest) ProtoMessage() {} + +func (x *ImageContentRequest) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageContentRequest.ProtoReflect.Descriptor instead. +func (*ImageContentRequest) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{40} +} + +func (x *ImageContentRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ImageContentRequest) GetRequestId() uint64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *ImageContentRequest) GetContentType() string { + if x != nil { + return x.ContentType + } + return "" +} + +type ClockSyncRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ClockSyncRequest) Reset() { + *x = ClockSyncRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClockSyncRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClockSyncRequest) ProtoMessage() {} + +func (x *ClockSyncRequest) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[41] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClockSyncRequest.ProtoReflect.Descriptor instead. +func (*ClockSyncRequest) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{41} +} + +type SystemQuotaAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Parameter string `protobuf:"bytes,1,opt,name=parameter,proto3" json:"parameter,omitempty"` + Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *SystemQuotaAlert) Reset() { + *x = SystemQuotaAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemQuotaAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemQuotaAlert) ProtoMessage() {} + +func (x *SystemQuotaAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[42] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemQuotaAlert.ProtoReflect.Descriptor instead. +func (*SystemQuotaAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{42} +} + +func (x *SystemQuotaAlert) GetParameter() string { + if x != nil { + return x.Parameter + } + return "" +} + +func (x *SystemQuotaAlert) GetValue() uint64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *SystemQuotaAlert) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type InstanceQuotaAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Parameter string `protobuf:"bytes,2,opt,name=parameter,proto3" json:"parameter,omitempty"` + Value uint64 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *InstanceQuotaAlert) Reset() { + *x = InstanceQuotaAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceQuotaAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceQuotaAlert) ProtoMessage() {} + +func (x *InstanceQuotaAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceQuotaAlert.ProtoReflect.Descriptor instead. +func (*InstanceQuotaAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{43} +} + +func (x *InstanceQuotaAlert) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *InstanceQuotaAlert) GetParameter() string { + if x != nil { + return x.Parameter + } + return "" +} + +func (x *InstanceQuotaAlert) GetValue() uint64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *InstanceQuotaAlert) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type DeviceAllocateAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *DeviceAllocateAlert) Reset() { + *x = DeviceAllocateAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceAllocateAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceAllocateAlert) ProtoMessage() {} + +func (x *DeviceAllocateAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[44] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceAllocateAlert.ProtoReflect.Descriptor instead. +func (*DeviceAllocateAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{44} +} + +func (x *DeviceAllocateAlert) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *DeviceAllocateAlert) GetDevice() string { + if x != nil { + return x.Device + } + return "" +} + +func (x *DeviceAllocateAlert) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ResourceValidateAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Errors []*common.ErrorInfo `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` +} + +func (x *ResourceValidateAlert) Reset() { + *x = ResourceValidateAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResourceValidateAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceValidateAlert) ProtoMessage() {} + +func (x *ResourceValidateAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[45] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceValidateAlert.ProtoReflect.Descriptor instead. +func (*ResourceValidateAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{45} +} + +func (x *ResourceValidateAlert) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ResourceValidateAlert) GetErrors() []*common.ErrorInfo { + if x != nil { + return x.Errors + } + return nil +} + +type SystemAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *SystemAlert) Reset() { + *x = SystemAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemAlert) ProtoMessage() {} + +func (x *SystemAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[46] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemAlert.ProtoReflect.Descriptor instead. +func (*SystemAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{46} +} + +func (x *SystemAlert) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CoreAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CoreComponent string `protobuf:"bytes,1,opt,name=core_component,json=coreComponent,proto3" json:"core_component,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CoreAlert) Reset() { + *x = CoreAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CoreAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CoreAlert) ProtoMessage() {} + +func (x *CoreAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[47] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CoreAlert.ProtoReflect.Descriptor instead. +func (*CoreAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{47} +} + +func (x *CoreAlert) GetCoreComponent() string { + if x != nil { + return x.CoreComponent + } + return "" +} + +func (x *CoreAlert) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type InstanceAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instance *common.InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *InstanceAlert) Reset() { + *x = InstanceAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceAlert) ProtoMessage() {} + +func (x *InstanceAlert) ProtoReflect() protoreflect.Message { + mi := &file_servicemanager_v4_servicemanager_proto_msgTypes[48] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceAlert.ProtoReflect.Descriptor instead. +func (*InstanceAlert) Descriptor() ([]byte, []int) { + return file_servicemanager_v4_servicemanager_proto_rawDescGZIP(), []int{48} +} + +func (x *InstanceAlert) GetInstance() *common.InstanceIdent { + if x != nil { + return x.Instance + } + return nil +} + +func (x *InstanceAlert) GetServiceVersion() string { + if x != nil { + return x.ServiceVersion + } + return "" +} + +func (x *InstanceAlert) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_servicemanager_v4_servicemanager_proto protoreflect.FileDescriptor + +var file_servicemanager_v4_servicemanager_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2f, 0x76, 0x34, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x09, 0x0a, 0x12, 0x53, 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, + 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x16, 0x67, + 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, + 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4e, + 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0f, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4a, 0x0a, 0x0f, + 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x65, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x34, 0x2e, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, + 0x48, 0x00, 0x52, 0x0c, 0x72, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, + 0x12, 0x50, 0x0a, 0x11, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x65, 0x6e, 0x76, + 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, + 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x48, + 0x00, 0x52, 0x0f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, + 0x72, 0x73, 0x12, 0x53, 0x0a, 0x12, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x6c, 0x6f, 0x67, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x34, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4c, 0x6f, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x69, 0x0a, 0x1a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, + 0x72, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x43, 0x72, 0x61, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x17, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x72, + 0x61, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5f, 0x0a, + 0x16, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x34, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, + 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x14, 0x67, 0x65, 0x74, 0x41, 0x76, 0x65, + 0x72, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x52, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, + 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x53, 0x0a, 0x12, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x34, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x10, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x46, 0x0a, 0x0d, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x34, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, + 0x00, 0x52, 0x0c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, + 0x4c, 0x0a, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x3d, 0x0a, + 0x0a, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x48, + 0x00, 0x52, 0x09, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x42, 0x13, 0x0a, 0x11, + 0x53, 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4c, 0x0a, 0x0f, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x4a, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x6f, + 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0x52, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x40, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x08, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x22, 0x4a, 0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, + 0x79, 0x6e, 0x63, 0x12, 0x3d, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x22, 0xe4, 0x01, 0x0a, 0x0c, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, + 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x34, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x65, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x6f, 0x72, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x22, 0xb7, 0x01, 0x0a, 0x0b, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, + 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, + 0x69, 0x7a, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x09, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x6d, 0x0a, 0x0c, + 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x15, 0x0a, 0x06, + 0x64, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x73, + 0x74, 0x49, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x72, 0x63, 0x5f, 0x69, 0x70, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x72, 0x63, 0x49, 0x70, 0x22, 0xcb, 0x01, 0x0a, 0x11, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x17, 0x0a, 0x07, 0x76, 0x6c, 0x61, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x76, 0x6c, 0x61, 0x6e, 0x49, + 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x6e, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x75, + 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x0c, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x75, + 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, + 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x53, 0x0a, 0x12, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, + 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x52, 0x11, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x22, 0x57, 0x0a, 0x0f, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x08, 0x65, 0x6e, 0x76, 0x5f, + 0x76, 0x61, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4f, + 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x45, + 0x6e, 0x76, 0x56, 0x61, 0x72, 0x52, 0x07, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x22, 0xa1, + 0x01, 0x0a, 0x16, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x12, 0x4a, 0x0a, 0x0f, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x45, 0x6e, 0x76, + 0x56, 0x61, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x73, 0x22, 0x64, 0x0a, 0x0a, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x03, 0x74, 0x74, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x22, 0x89, 0x01, 0x0a, 0x10, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, + 0x06, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, + 0x6f, 0x67, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, + 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, + 0x74, 0x69, 0x6c, 0x6c, 0x22, 0x6a, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x22, 0xd7, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x4a, + 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x04, 0x66, 0x72, + 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, + 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x22, 0xdc, 0x01, 0x0a, 0x17, 0x49, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x72, 0x61, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x4a, 0x0a, + 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x04, 0x66, 0x72, 0x6f, + 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6c, + 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, + 0x67, 0x22, 0x58, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0b, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x10, + 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, + 0x3d, 0x0a, 0x0b, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x2a, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x5c, 0x0a, 0x09, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, + 0x61, 0x32, 0x35, 0x36, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x0c, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x61, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x61, + 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xe2, 0x06, 0x0a, 0x12, 0x53, 0x4d, 0x4f, 0x75, 0x74, + 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x53, 0x0a, + 0x12, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, + 0x52, 0x10, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x59, 0x0a, 0x14, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x12, 0x72, 0x75, 0x6e, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x62, 0x0a, + 0x17, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x34, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x60, 0x0a, 0x17, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x65, 0x6e, + 0x76, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, + 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x14, 0x6f, + 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x03, + 0x6c, 0x6f, 0x67, 0x12, 0x55, 0x0a, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x6d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4d, 0x6f, 0x6e, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, + 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x55, 0x0a, 0x12, 0x61, 0x76, + 0x65, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x41, 0x76, 0x65, 0x72, 0x61, + 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x11, + 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, + 0x67, 0x12, 0x30, 0x0a, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x61, 0x6c, + 0x65, 0x72, 0x74, 0x12, 0x5c, 0x0a, 0x15, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x13, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x34, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x13, 0x0a, 0x11, 0x53, 0x4d, 0x4f, 0x75, 0x74, 0x67, + 0x6f, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x54, 0x0a, 0x09, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, + 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x55, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x58, 0x0a, 0x15, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x75, 0x6e, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x75, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x33, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x93, 0x01, 0x0a, 0x14, 0x4f, 0x76, 0x65, 0x72, + 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x4f, 0x0a, 0x0f, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x45, 0x6e, + 0x76, 0x56, 0x61, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x0d, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x9f, 0x01, + 0x0a, 0x14, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4a, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x22, + 0x4e, 0x0a, 0x0c, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, + 0xab, 0x01, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x15, 0x0a, 0x06, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x04, 0x70, 0x61, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xb9, 0x01, + 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x6e, 0x67, 0x12, 0x4a, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, + 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, + 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x0e, 0x6e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x58, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, + 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x13, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x4d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x22, 0xb9, 0x01, 0x0a, 0x11, 0x41, 0x76, + 0x65, 0x72, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x4a, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, + 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x6e, 0x6f, 0x64, + 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x58, 0x0a, 0x14, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x13, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x4d, 0x6f, 0x6e, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x22, 0xd9, 0x01, 0x0a, 0x0e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x72, 0x61, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, + 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x35, 0x0a, 0x04, + 0x64, 0x69, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x04, 0x64, + 0x69, 0x73, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x22, 0x41, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x75, 0x73, 0x65, 0x64, + 0x53, 0x69, 0x7a, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a, 0x08, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x4d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x6d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x22, 0xa1, 0x05, + 0x0a, 0x05, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x12, 0x53, 0x0a, 0x12, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x71, 0x75, + 0x6f, 0x74, 0x61, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, + 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x51, 0x75, + 0x6f, 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x59, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, + 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, 0x6c, + 0x65, 0x72, 0x74, 0x12, 0x62, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, + 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x5c, 0x0a, 0x15, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, + 0x52, 0x13, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, + 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x0c, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, + 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x3d, 0x0a, 0x0a, 0x63, 0x6f, + 0x72, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x34, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x09, + 0x63, 0x6f, 0x72, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x49, 0x0a, 0x0e, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x6c, + 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, + 0x6c, 0x65, 0x72, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x49, 0x74, 0x65, + 0x6d, 0x22, 0x69, 0x0a, 0x13, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x12, 0x0a, 0x10, + 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x5e, 0x0a, 0x10, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, + 0x6c, 0x65, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x96, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, + 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x7d, 0x0a, 0x13, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, + 0x12, 0x34, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x59, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, + 0x72, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4c, 0x0a, 0x09, + 0x43, 0x6f, 0x72, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x72, + 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x0d, 0x49, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x34, 0x0a, 0x08, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x31, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x49, 0x53, 0x43, 0x4f, + 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, + 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x01, 0x32, 0x6d, 0x0a, 0x09, 0x53, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x4d, 0x12, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, + 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x25, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x2e, 0x53, + 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_servicemanager_v4_servicemanager_proto_rawDescOnce sync.Once + file_servicemanager_v4_servicemanager_proto_rawDescData = file_servicemanager_v4_servicemanager_proto_rawDesc +) + +func file_servicemanager_v4_servicemanager_proto_rawDescGZIP() []byte { + file_servicemanager_v4_servicemanager_proto_rawDescOnce.Do(func() { + file_servicemanager_v4_servicemanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_servicemanager_v4_servicemanager_proto_rawDescData) + }) + return file_servicemanager_v4_servicemanager_proto_rawDescData +} + +var file_servicemanager_v4_servicemanager_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_servicemanager_v4_servicemanager_proto_msgTypes = make([]protoimpl.MessageInfo, 49) +var file_servicemanager_v4_servicemanager_proto_goTypes = []interface{}{ + (ConnectionEnum)(0), // 0: servicemanager.v4.ConnectionEnum + (*SMIncomingMessages)(nil), // 1: servicemanager.v4.SMIncomingMessages + (*GetNodeConfigStatus)(nil), // 2: servicemanager.v4.GetNodeConfigStatus + (*CheckNodeConfig)(nil), // 3: servicemanager.v4.CheckNodeConfig + (*SetNodeConfig)(nil), // 4: servicemanager.v4.SetNodeConfig + (*UpdateNetworks)(nil), // 5: servicemanager.v4.UpdateNetworks + (*ClockSync)(nil), // 6: servicemanager.v4.ClockSync + (*RunInstances)(nil), // 7: servicemanager.v4.RunInstances + (*ServiceInfo)(nil), // 8: servicemanager.v4.ServiceInfo + (*LayerInfo)(nil), // 9: servicemanager.v4.LayerInfo + (*FirewallRule)(nil), // 10: servicemanager.v4.FirewallRule + (*NetworkParameters)(nil), // 11: servicemanager.v4.NetworkParameters + (*InstanceInfo)(nil), // 12: servicemanager.v4.InstanceInfo + (*OverrideEnvVars)(nil), // 13: servicemanager.v4.OverrideEnvVars + (*OverrideInstanceEnvVar)(nil), // 14: servicemanager.v4.OverrideInstanceEnvVar + (*EnvVarInfo)(nil), // 15: servicemanager.v4.EnvVarInfo + (*SystemLogRequest)(nil), // 16: servicemanager.v4.SystemLogRequest + (*InstanceFilter)(nil), // 17: servicemanager.v4.InstanceFilter + (*InstanceLogRequest)(nil), // 18: servicemanager.v4.InstanceLogRequest + (*InstanceCrashLogRequest)(nil), // 19: servicemanager.v4.InstanceCrashLogRequest + (*GetAverageMonitoring)(nil), // 20: servicemanager.v4.GetAverageMonitoring + (*ConnectionStatus)(nil), // 21: servicemanager.v4.ConnectionStatus + (*ImageContentInfo)(nil), // 22: servicemanager.v4.ImageContentInfo + (*ImageFile)(nil), // 23: servicemanager.v4.ImageFile + (*ImageContent)(nil), // 24: servicemanager.v4.ImageContent + (*SMOutgoingMessages)(nil), // 25: servicemanager.v4.SMOutgoingMessages + (*Partition)(nil), // 26: servicemanager.v4.Partition + (*NodeConfigStatus)(nil), // 27: servicemanager.v4.NodeConfigStatus + (*RunInstancesStatus)(nil), // 28: servicemanager.v4.RunInstancesStatus + (*UpdateInstancesStatus)(nil), // 29: servicemanager.v4.UpdateInstancesStatus + (*InstanceStatus)(nil), // 30: servicemanager.v4.InstanceStatus + (*OverrideEnvVarStatus)(nil), // 31: servicemanager.v4.OverrideEnvVarStatus + (*EnvVarInstanceStatus)(nil), // 32: servicemanager.v4.EnvVarInstanceStatus + (*EnvVarStatus)(nil), // 33: servicemanager.v4.EnvVarStatus + (*LogData)(nil), // 34: servicemanager.v4.LogData + (*InstantMonitoring)(nil), // 35: servicemanager.v4.InstantMonitoring + (*AverageMonitoring)(nil), // 36: servicemanager.v4.AverageMonitoring + (*MonitoringData)(nil), // 37: servicemanager.v4.MonitoringData + (*PartitionUsage)(nil), // 38: servicemanager.v4.PartitionUsage + (*InstanceMonitoring)(nil), // 39: servicemanager.v4.InstanceMonitoring + (*Alert)(nil), // 40: servicemanager.v4.Alert + (*ImageContentRequest)(nil), // 41: servicemanager.v4.ImageContentRequest + (*ClockSyncRequest)(nil), // 42: servicemanager.v4.ClockSyncRequest + (*SystemQuotaAlert)(nil), // 43: servicemanager.v4.SystemQuotaAlert + (*InstanceQuotaAlert)(nil), // 44: servicemanager.v4.InstanceQuotaAlert + (*DeviceAllocateAlert)(nil), // 45: servicemanager.v4.DeviceAllocateAlert + (*ResourceValidateAlert)(nil), // 46: servicemanager.v4.ResourceValidateAlert + (*SystemAlert)(nil), // 47: servicemanager.v4.SystemAlert + (*CoreAlert)(nil), // 48: servicemanager.v4.CoreAlert + (*InstanceAlert)(nil), // 49: servicemanager.v4.InstanceAlert + (*timestamppb.Timestamp)(nil), // 50: google.protobuf.Timestamp + (*common.InstanceIdent)(nil), // 51: common.v1.InstanceIdent + (*common.ErrorInfo)(nil), // 52: common.v1.ErrorInfo +} +var file_servicemanager_v4_servicemanager_proto_depIdxs = []int32{ + 2, // 0: servicemanager.v4.SMIncomingMessages.get_node_config_status:type_name -> servicemanager.v4.GetNodeConfigStatus + 3, // 1: servicemanager.v4.SMIncomingMessages.check_node_config:type_name -> servicemanager.v4.CheckNodeConfig + 4, // 2: servicemanager.v4.SMIncomingMessages.set_node_config:type_name -> servicemanager.v4.SetNodeConfig + 7, // 3: servicemanager.v4.SMIncomingMessages.run_instances:type_name -> servicemanager.v4.RunInstances + 13, // 4: servicemanager.v4.SMIncomingMessages.override_env_vars:type_name -> servicemanager.v4.OverrideEnvVars + 16, // 5: servicemanager.v4.SMIncomingMessages.system_log_request:type_name -> servicemanager.v4.SystemLogRequest + 18, // 6: servicemanager.v4.SMIncomingMessages.instance_log_request:type_name -> servicemanager.v4.InstanceLogRequest + 19, // 7: servicemanager.v4.SMIncomingMessages.instance_crash_log_request:type_name -> servicemanager.v4.InstanceCrashLogRequest + 20, // 8: servicemanager.v4.SMIncomingMessages.get_average_monitoring:type_name -> servicemanager.v4.GetAverageMonitoring + 21, // 9: servicemanager.v4.SMIncomingMessages.connection_status:type_name -> servicemanager.v4.ConnectionStatus + 22, // 10: servicemanager.v4.SMIncomingMessages.image_content_info:type_name -> servicemanager.v4.ImageContentInfo + 24, // 11: servicemanager.v4.SMIncomingMessages.image_content:type_name -> servicemanager.v4.ImageContent + 5, // 12: servicemanager.v4.SMIncomingMessages.update_networks:type_name -> servicemanager.v4.UpdateNetworks + 6, // 13: servicemanager.v4.SMIncomingMessages.clock_sync:type_name -> servicemanager.v4.ClockSync + 11, // 14: servicemanager.v4.UpdateNetworks.networks:type_name -> servicemanager.v4.NetworkParameters + 50, // 15: servicemanager.v4.ClockSync.current_time:type_name -> google.protobuf.Timestamp + 8, // 16: servicemanager.v4.RunInstances.services:type_name -> servicemanager.v4.ServiceInfo + 9, // 17: servicemanager.v4.RunInstances.layers:type_name -> servicemanager.v4.LayerInfo + 12, // 18: servicemanager.v4.RunInstances.instances:type_name -> servicemanager.v4.InstanceInfo + 10, // 19: servicemanager.v4.NetworkParameters.rules:type_name -> servicemanager.v4.FirewallRule + 51, // 20: servicemanager.v4.InstanceInfo.instance:type_name -> common.v1.InstanceIdent + 11, // 21: servicemanager.v4.InstanceInfo.network_parameters:type_name -> servicemanager.v4.NetworkParameters + 14, // 22: servicemanager.v4.OverrideEnvVars.env_vars:type_name -> servicemanager.v4.OverrideInstanceEnvVar + 17, // 23: servicemanager.v4.OverrideInstanceEnvVar.instance_filter:type_name -> servicemanager.v4.InstanceFilter + 15, // 24: servicemanager.v4.OverrideInstanceEnvVar.variables:type_name -> servicemanager.v4.EnvVarInfo + 50, // 25: servicemanager.v4.EnvVarInfo.ttl:type_name -> google.protobuf.Timestamp + 50, // 26: servicemanager.v4.SystemLogRequest.from:type_name -> google.protobuf.Timestamp + 50, // 27: servicemanager.v4.SystemLogRequest.till:type_name -> google.protobuf.Timestamp + 17, // 28: servicemanager.v4.InstanceLogRequest.instance_filter:type_name -> servicemanager.v4.InstanceFilter + 50, // 29: servicemanager.v4.InstanceLogRequest.from:type_name -> google.protobuf.Timestamp + 50, // 30: servicemanager.v4.InstanceLogRequest.till:type_name -> google.protobuf.Timestamp + 17, // 31: servicemanager.v4.InstanceCrashLogRequest.instance_filter:type_name -> servicemanager.v4.InstanceFilter + 50, // 32: servicemanager.v4.InstanceCrashLogRequest.from:type_name -> google.protobuf.Timestamp + 50, // 33: servicemanager.v4.InstanceCrashLogRequest.till:type_name -> google.protobuf.Timestamp + 0, // 34: servicemanager.v4.ConnectionStatus.cloud_status:type_name -> servicemanager.v4.ConnectionEnum + 23, // 35: servicemanager.v4.ImageContentInfo.image_files:type_name -> servicemanager.v4.ImageFile + 52, // 36: servicemanager.v4.ImageContentInfo.error:type_name -> common.v1.ErrorInfo + 27, // 37: servicemanager.v4.SMOutgoingMessages.node_config_status:type_name -> servicemanager.v4.NodeConfigStatus + 28, // 38: servicemanager.v4.SMOutgoingMessages.run_instances_status:type_name -> servicemanager.v4.RunInstancesStatus + 29, // 39: servicemanager.v4.SMOutgoingMessages.update_instances_status:type_name -> servicemanager.v4.UpdateInstancesStatus + 31, // 40: servicemanager.v4.SMOutgoingMessages.override_env_var_status:type_name -> servicemanager.v4.OverrideEnvVarStatus + 34, // 41: servicemanager.v4.SMOutgoingMessages.log:type_name -> servicemanager.v4.LogData + 35, // 42: servicemanager.v4.SMOutgoingMessages.instant_monitoring:type_name -> servicemanager.v4.InstantMonitoring + 36, // 43: servicemanager.v4.SMOutgoingMessages.average_monitoring:type_name -> servicemanager.v4.AverageMonitoring + 40, // 44: servicemanager.v4.SMOutgoingMessages.alert:type_name -> servicemanager.v4.Alert + 41, // 45: servicemanager.v4.SMOutgoingMessages.image_content_request:type_name -> servicemanager.v4.ImageContentRequest + 42, // 46: servicemanager.v4.SMOutgoingMessages.clock_sync_request:type_name -> servicemanager.v4.ClockSyncRequest + 52, // 47: servicemanager.v4.NodeConfigStatus.error:type_name -> common.v1.ErrorInfo + 30, // 48: servicemanager.v4.RunInstancesStatus.instances:type_name -> servicemanager.v4.InstanceStatus + 30, // 49: servicemanager.v4.UpdateInstancesStatus.instances:type_name -> servicemanager.v4.InstanceStatus + 51, // 50: servicemanager.v4.InstanceStatus.instance:type_name -> common.v1.InstanceIdent + 52, // 51: servicemanager.v4.InstanceStatus.error_info:type_name -> common.v1.ErrorInfo + 32, // 52: servicemanager.v4.OverrideEnvVarStatus.env_vars_status:type_name -> servicemanager.v4.EnvVarInstanceStatus + 52, // 53: servicemanager.v4.OverrideEnvVarStatus.error:type_name -> common.v1.ErrorInfo + 17, // 54: servicemanager.v4.EnvVarInstanceStatus.instance_filter:type_name -> servicemanager.v4.InstanceFilter + 33, // 55: servicemanager.v4.EnvVarInstanceStatus.statuses:type_name -> servicemanager.v4.EnvVarStatus + 52, // 56: servicemanager.v4.EnvVarStatus.error:type_name -> common.v1.ErrorInfo + 52, // 57: servicemanager.v4.LogData.error:type_name -> common.v1.ErrorInfo + 37, // 58: servicemanager.v4.InstantMonitoring.node_monitoring:type_name -> servicemanager.v4.MonitoringData + 39, // 59: servicemanager.v4.InstantMonitoring.instances_monitoring:type_name -> servicemanager.v4.InstanceMonitoring + 37, // 60: servicemanager.v4.AverageMonitoring.node_monitoring:type_name -> servicemanager.v4.MonitoringData + 39, // 61: servicemanager.v4.AverageMonitoring.instances_monitoring:type_name -> servicemanager.v4.InstanceMonitoring + 38, // 62: servicemanager.v4.MonitoringData.disk:type_name -> servicemanager.v4.PartitionUsage + 50, // 63: servicemanager.v4.MonitoringData.timestamp:type_name -> google.protobuf.Timestamp + 51, // 64: servicemanager.v4.InstanceMonitoring.instance:type_name -> common.v1.InstanceIdent + 37, // 65: servicemanager.v4.InstanceMonitoring.monitoring_data:type_name -> servicemanager.v4.MonitoringData + 50, // 66: servicemanager.v4.Alert.timestamp:type_name -> google.protobuf.Timestamp + 43, // 67: servicemanager.v4.Alert.system_quota_alert:type_name -> servicemanager.v4.SystemQuotaAlert + 44, // 68: servicemanager.v4.Alert.instance_quota_alert:type_name -> servicemanager.v4.InstanceQuotaAlert + 46, // 69: servicemanager.v4.Alert.resource_validate_alert:type_name -> servicemanager.v4.ResourceValidateAlert + 45, // 70: servicemanager.v4.Alert.device_allocate_alert:type_name -> servicemanager.v4.DeviceAllocateAlert + 47, // 71: servicemanager.v4.Alert.system_alert:type_name -> servicemanager.v4.SystemAlert + 48, // 72: servicemanager.v4.Alert.core_alert:type_name -> servicemanager.v4.CoreAlert + 49, // 73: servicemanager.v4.Alert.instance_alert:type_name -> servicemanager.v4.InstanceAlert + 51, // 74: servicemanager.v4.InstanceQuotaAlert.instance:type_name -> common.v1.InstanceIdent + 51, // 75: servicemanager.v4.DeviceAllocateAlert.instance:type_name -> common.v1.InstanceIdent + 52, // 76: servicemanager.v4.ResourceValidateAlert.errors:type_name -> common.v1.ErrorInfo + 51, // 77: servicemanager.v4.InstanceAlert.instance:type_name -> common.v1.InstanceIdent + 25, // 78: servicemanager.v4.SMService.RegisterSM:input_type -> servicemanager.v4.SMOutgoingMessages + 1, // 79: servicemanager.v4.SMService.RegisterSM:output_type -> servicemanager.v4.SMIncomingMessages + 79, // [79:80] is the sub-list for method output_type + 78, // [78:79] is the sub-list for method input_type + 78, // [78:78] is the sub-list for extension type_name + 78, // [78:78] is the sub-list for extension extendee + 0, // [0:78] is the sub-list for field type_name +} + +func init() { file_servicemanager_v4_servicemanager_proto_init() } +func file_servicemanager_v4_servicemanager_proto_init() { + if File_servicemanager_v4_servicemanager_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_servicemanager_v4_servicemanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMIncomingMessages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeConfigStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckNodeConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetNodeConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNetworks); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClockSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RunInstances); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LayerInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FirewallRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkParameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OverrideEnvVars); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OverrideInstanceEnvVar); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnvVarInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceFilter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceCrashLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAverageMonitoring); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConnectionStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageContentInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageFile); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMOutgoingMessages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Partition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeConfigStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RunInstancesStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateInstancesStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OverrideEnvVarStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnvVarInstanceStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnvVarStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstantMonitoring); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AverageMonitoring); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MonitoringData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PartitionUsage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceMonitoring); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Alert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageContentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClockSyncRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemQuotaAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceQuotaAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceAllocateAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResourceValidateAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CoreAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceAlert); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_servicemanager_v4_servicemanager_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*SMIncomingMessages_GetNodeConfigStatus)(nil), + (*SMIncomingMessages_CheckNodeConfig)(nil), + (*SMIncomingMessages_SetNodeConfig)(nil), + (*SMIncomingMessages_RunInstances)(nil), + (*SMIncomingMessages_OverrideEnvVars)(nil), + (*SMIncomingMessages_SystemLogRequest)(nil), + (*SMIncomingMessages_InstanceLogRequest)(nil), + (*SMIncomingMessages_InstanceCrashLogRequest)(nil), + (*SMIncomingMessages_GetAverageMonitoring)(nil), + (*SMIncomingMessages_ConnectionStatus)(nil), + (*SMIncomingMessages_ImageContentInfo)(nil), + (*SMIncomingMessages_ImageContent)(nil), + (*SMIncomingMessages_UpdateNetworks)(nil), + (*SMIncomingMessages_ClockSync)(nil), + } + file_servicemanager_v4_servicemanager_proto_msgTypes[24].OneofWrappers = []interface{}{ + (*SMOutgoingMessages_NodeConfigStatus)(nil), + (*SMOutgoingMessages_RunInstancesStatus)(nil), + (*SMOutgoingMessages_UpdateInstancesStatus)(nil), + (*SMOutgoingMessages_OverrideEnvVarStatus)(nil), + (*SMOutgoingMessages_Log)(nil), + (*SMOutgoingMessages_InstantMonitoring)(nil), + (*SMOutgoingMessages_AverageMonitoring)(nil), + (*SMOutgoingMessages_Alert)(nil), + (*SMOutgoingMessages_ImageContentRequest)(nil), + (*SMOutgoingMessages_ClockSyncRequest)(nil), + } + file_servicemanager_v4_servicemanager_proto_msgTypes[39].OneofWrappers = []interface{}{ + (*Alert_SystemQuotaAlert)(nil), + (*Alert_InstanceQuotaAlert)(nil), + (*Alert_ResourceValidateAlert)(nil), + (*Alert_DeviceAllocateAlert)(nil), + (*Alert_SystemAlert)(nil), + (*Alert_CoreAlert)(nil), + (*Alert_InstanceAlert)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_servicemanager_v4_servicemanager_proto_rawDesc, + NumEnums: 1, + NumMessages: 49, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_servicemanager_v4_servicemanager_proto_goTypes, + DependencyIndexes: file_servicemanager_v4_servicemanager_proto_depIdxs, + EnumInfos: file_servicemanager_v4_servicemanager_proto_enumTypes, + MessageInfos: file_servicemanager_v4_servicemanager_proto_msgTypes, + }.Build() + File_servicemanager_v4_servicemanager_proto = out.File + file_servicemanager_v4_servicemanager_proto_rawDesc = nil + file_servicemanager_v4_servicemanager_proto_goTypes = nil + file_servicemanager_v4_servicemanager_proto_depIdxs = nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager_grpc.pb.go b/vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager_grpc.pb.go similarity index 94% rename from vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager_grpc.pb.go rename to vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager_grpc.pb.go index 7c608828..69011712 100644 --- a/vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager_grpc.pb.go +++ b/vendor/github.com/aosedge/aos_common/api/servicemanager/servicemanager_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v4.25.0 -// source: servicemanager/v3/servicemanager.proto +// - protoc v5.26.0 +// source: servicemanager/v4/servicemanager.proto package servicemanager @@ -34,7 +34,7 @@ func NewSMServiceClient(cc grpc.ClientConnInterface) SMServiceClient { } func (c *sMServiceClient) RegisterSM(ctx context.Context, opts ...grpc.CallOption) (SMService_RegisterSMClient, error) { - stream, err := c.cc.NewStream(ctx, &SMService_ServiceDesc.Streams[0], "/servicemanager.v3.SMService/RegisterSM", opts...) + stream, err := c.cc.NewStream(ctx, &SMService_ServiceDesc.Streams[0], "/servicemanager.v4.SMService/RegisterSM", opts...) if err != nil { return nil, err } @@ -122,7 +122,7 @@ func (x *sMServiceRegisterSMServer) Recv() (*SMOutgoingMessages, error) { // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SMService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "servicemanager.v3.SMService", + ServiceName: "servicemanager.v4.SMService", HandlerType: (*SMServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ @@ -133,5 +133,5 @@ var SMService_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "servicemanager/v3/servicemanager.proto", + Metadata: "servicemanager/v4/servicemanager.proto", } diff --git a/vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager.pb.go b/vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager.pb.go deleted file mode 100644 index 63df4142..00000000 --- a/vendor/github.com/aosedge/aos_common/api/servicemanager/v3/servicemanager.pb.go +++ /dev/null @@ -1,5128 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v4.25.0 -// source: servicemanager/v3/servicemanager.proto - -package servicemanager - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ConnectionEnum int32 - -const ( - ConnectionEnum_DISCONNECTED ConnectionEnum = 0 - ConnectionEnum_CONNECTED ConnectionEnum = 1 -) - -// Enum value maps for ConnectionEnum. -var ( - ConnectionEnum_name = map[int32]string{ - 0: "DISCONNECTED", - 1: "CONNECTED", - } - ConnectionEnum_value = map[string]int32{ - "DISCONNECTED": 0, - "CONNECTED": 1, - } -) - -func (x ConnectionEnum) Enum() *ConnectionEnum { - p := new(ConnectionEnum) - *p = x - return p -} - -func (x ConnectionEnum) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ConnectionEnum) Descriptor() protoreflect.EnumDescriptor { - return file_servicemanager_v3_servicemanager_proto_enumTypes[0].Descriptor() -} - -func (ConnectionEnum) Type() protoreflect.EnumType { - return &file_servicemanager_v3_servicemanager_proto_enumTypes[0] -} - -func (x ConnectionEnum) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ConnectionEnum.Descriptor instead. -func (ConnectionEnum) EnumDescriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{0} -} - -type SMIncomingMessages struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to SMIncomingMessage: - // - // *SMIncomingMessages_GetUnitConfigStatus - // *SMIncomingMessages_CheckUnitConfig - // *SMIncomingMessages_SetUnitConfig - // *SMIncomingMessages_RunInstances - // *SMIncomingMessages_OverrideEnvVars - // *SMIncomingMessages_SystemLogRequest - // *SMIncomingMessages_InstanceLogRequest - // *SMIncomingMessages_InstanceCrashLogRequest - // *SMIncomingMessages_GetNodeMonitoring - // *SMIncomingMessages_ConnectionStatus - // *SMIncomingMessages_ImageContentInfo - // *SMIncomingMessages_ImageContent - // *SMIncomingMessages_UpdateNetworks - // *SMIncomingMessages_ClockSync - SMIncomingMessage isSMIncomingMessages_SMIncomingMessage `protobuf_oneof:"SMIncomingMessage"` -} - -func (x *SMIncomingMessages) Reset() { - *x = SMIncomingMessages{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMIncomingMessages) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMIncomingMessages) ProtoMessage() {} - -func (x *SMIncomingMessages) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SMIncomingMessages.ProtoReflect.Descriptor instead. -func (*SMIncomingMessages) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{0} -} - -func (m *SMIncomingMessages) GetSMIncomingMessage() isSMIncomingMessages_SMIncomingMessage { - if m != nil { - return m.SMIncomingMessage - } - return nil -} - -func (x *SMIncomingMessages) GetGetUnitConfigStatus() *GetUnitConfigStatus { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_GetUnitConfigStatus); ok { - return x.GetUnitConfigStatus - } - return nil -} - -func (x *SMIncomingMessages) GetCheckUnitConfig() *CheckUnitConfig { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_CheckUnitConfig); ok { - return x.CheckUnitConfig - } - return nil -} - -func (x *SMIncomingMessages) GetSetUnitConfig() *SetUnitConfig { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_SetUnitConfig); ok { - return x.SetUnitConfig - } - return nil -} - -func (x *SMIncomingMessages) GetRunInstances() *RunInstances { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_RunInstances); ok { - return x.RunInstances - } - return nil -} - -func (x *SMIncomingMessages) GetOverrideEnvVars() *OverrideEnvVars { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_OverrideEnvVars); ok { - return x.OverrideEnvVars - } - return nil -} - -func (x *SMIncomingMessages) GetSystemLogRequest() *SystemLogRequest { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_SystemLogRequest); ok { - return x.SystemLogRequest - } - return nil -} - -func (x *SMIncomingMessages) GetInstanceLogRequest() *InstanceLogRequest { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_InstanceLogRequest); ok { - return x.InstanceLogRequest - } - return nil -} - -func (x *SMIncomingMessages) GetInstanceCrashLogRequest() *InstanceCrashLogRequest { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_InstanceCrashLogRequest); ok { - return x.InstanceCrashLogRequest - } - return nil -} - -func (x *SMIncomingMessages) GetGetNodeMonitoring() *GetNodeMonitoring { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_GetNodeMonitoring); ok { - return x.GetNodeMonitoring - } - return nil -} - -func (x *SMIncomingMessages) GetConnectionStatus() *ConnectionStatus { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ConnectionStatus); ok { - return x.ConnectionStatus - } - return nil -} - -func (x *SMIncomingMessages) GetImageContentInfo() *ImageContentInfo { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ImageContentInfo); ok { - return x.ImageContentInfo - } - return nil -} - -func (x *SMIncomingMessages) GetImageContent() *ImageContent { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ImageContent); ok { - return x.ImageContent - } - return nil -} - -func (x *SMIncomingMessages) GetUpdateNetworks() *UpdateNetworks { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_UpdateNetworks); ok { - return x.UpdateNetworks - } - return nil -} - -func (x *SMIncomingMessages) GetClockSync() *ClockSync { - if x, ok := x.GetSMIncomingMessage().(*SMIncomingMessages_ClockSync); ok { - return x.ClockSync - } - return nil -} - -type isSMIncomingMessages_SMIncomingMessage interface { - isSMIncomingMessages_SMIncomingMessage() -} - -type SMIncomingMessages_GetUnitConfigStatus struct { - GetUnitConfigStatus *GetUnitConfigStatus `protobuf:"bytes,1,opt,name=get_unit_config_status,json=getUnitConfigStatus,proto3,oneof"` -} - -type SMIncomingMessages_CheckUnitConfig struct { - CheckUnitConfig *CheckUnitConfig `protobuf:"bytes,2,opt,name=check_unit_config,json=checkUnitConfig,proto3,oneof"` -} - -type SMIncomingMessages_SetUnitConfig struct { - SetUnitConfig *SetUnitConfig `protobuf:"bytes,3,opt,name=set_unit_config,json=setUnitConfig,proto3,oneof"` -} - -type SMIncomingMessages_RunInstances struct { - RunInstances *RunInstances `protobuf:"bytes,4,opt,name=run_instances,json=runInstances,proto3,oneof"` -} - -type SMIncomingMessages_OverrideEnvVars struct { - OverrideEnvVars *OverrideEnvVars `protobuf:"bytes,5,opt,name=override_env_vars,json=overrideEnvVars,proto3,oneof"` -} - -type SMIncomingMessages_SystemLogRequest struct { - SystemLogRequest *SystemLogRequest `protobuf:"bytes,6,opt,name=system_log_request,json=systemLogRequest,proto3,oneof"` -} - -type SMIncomingMessages_InstanceLogRequest struct { - InstanceLogRequest *InstanceLogRequest `protobuf:"bytes,7,opt,name=instance_log_request,json=instanceLogRequest,proto3,oneof"` -} - -type SMIncomingMessages_InstanceCrashLogRequest struct { - InstanceCrashLogRequest *InstanceCrashLogRequest `protobuf:"bytes,8,opt,name=instance_crash_log_request,json=instanceCrashLogRequest,proto3,oneof"` -} - -type SMIncomingMessages_GetNodeMonitoring struct { - GetNodeMonitoring *GetNodeMonitoring `protobuf:"bytes,9,opt,name=get_node_monitoring,json=getNodeMonitoring,proto3,oneof"` -} - -type SMIncomingMessages_ConnectionStatus struct { - ConnectionStatus *ConnectionStatus `protobuf:"bytes,10,opt,name=connection_status,json=connectionStatus,proto3,oneof"` -} - -type SMIncomingMessages_ImageContentInfo struct { - ImageContentInfo *ImageContentInfo `protobuf:"bytes,11,opt,name=image_content_info,json=imageContentInfo,proto3,oneof"` -} - -type SMIncomingMessages_ImageContent struct { - ImageContent *ImageContent `protobuf:"bytes,12,opt,name=image_content,json=imageContent,proto3,oneof"` -} - -type SMIncomingMessages_UpdateNetworks struct { - UpdateNetworks *UpdateNetworks `protobuf:"bytes,13,opt,name=update_networks,json=updateNetworks,proto3,oneof"` -} - -type SMIncomingMessages_ClockSync struct { - ClockSync *ClockSync `protobuf:"bytes,14,opt,name=clock_sync,json=clockSync,proto3,oneof"` -} - -func (*SMIncomingMessages_GetUnitConfigStatus) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_CheckUnitConfig) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_SetUnitConfig) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_RunInstances) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_OverrideEnvVars) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_SystemLogRequest) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_InstanceLogRequest) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_InstanceCrashLogRequest) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_GetNodeMonitoring) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_ConnectionStatus) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_ImageContentInfo) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_ImageContent) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_UpdateNetworks) isSMIncomingMessages_SMIncomingMessage() {} - -func (*SMIncomingMessages_ClockSync) isSMIncomingMessages_SMIncomingMessage() {} - -type GetUnitConfigStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetUnitConfigStatus) Reset() { - *x = GetUnitConfigStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUnitConfigStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUnitConfigStatus) ProtoMessage() {} - -func (x *GetUnitConfigStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUnitConfigStatus.ProtoReflect.Descriptor instead. -func (*GetUnitConfigStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{1} -} - -type CheckUnitConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UnitConfig string `protobuf:"bytes,1,opt,name=unit_config,json=unitConfig,proto3" json:"unit_config,omitempty"` - VendorVersion string `protobuf:"bytes,2,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` -} - -func (x *CheckUnitConfig) Reset() { - *x = CheckUnitConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckUnitConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckUnitConfig) ProtoMessage() {} - -func (x *CheckUnitConfig) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CheckUnitConfig.ProtoReflect.Descriptor instead. -func (*CheckUnitConfig) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{2} -} - -func (x *CheckUnitConfig) GetUnitConfig() string { - if x != nil { - return x.UnitConfig - } - return "" -} - -func (x *CheckUnitConfig) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -type SetUnitConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UnitConfig string `protobuf:"bytes,1,opt,name=unit_config,json=unitConfig,proto3" json:"unit_config,omitempty"` - VendorVersion string `protobuf:"bytes,2,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` -} - -func (x *SetUnitConfig) Reset() { - *x = SetUnitConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetUnitConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetUnitConfig) ProtoMessage() {} - -func (x *SetUnitConfig) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetUnitConfig.ProtoReflect.Descriptor instead. -func (*SetUnitConfig) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{3} -} - -func (x *SetUnitConfig) GetUnitConfig() string { - if x != nil { - return x.UnitConfig - } - return "" -} - -func (x *SetUnitConfig) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -type UpdateNetworks struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Networks []*NetworkParameters `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` -} - -func (x *UpdateNetworks) Reset() { - *x = UpdateNetworks{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateNetworks) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateNetworks) ProtoMessage() {} - -func (x *UpdateNetworks) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateNetworks.ProtoReflect.Descriptor instead. -func (*UpdateNetworks) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{4} -} - -func (x *UpdateNetworks) GetNetworks() []*NetworkParameters { - if x != nil { - return x.Networks - } - return nil -} - -type ClockSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CurrentTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=current_time,json=currentTime,proto3" json:"current_time,omitempty"` -} - -func (x *ClockSync) Reset() { - *x = ClockSync{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClockSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClockSync) ProtoMessage() {} - -func (x *ClockSync) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClockSync.ProtoReflect.Descriptor instead. -func (*ClockSync) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{5} -} - -func (x *ClockSync) GetCurrentTime() *timestamppb.Timestamp { - if x != nil { - return x.CurrentTime - } - return nil -} - -type RunInstances struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Services []*ServiceInfo `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` - Layers []*LayerInfo `protobuf:"bytes,2,rep,name=layers,proto3" json:"layers,omitempty"` - Instances []*InstanceInfo `protobuf:"bytes,3,rep,name=instances,proto3" json:"instances,omitempty"` - ForceRestart bool `protobuf:"varint,4,opt,name=force_restart,json=forceRestart,proto3" json:"force_restart,omitempty"` -} - -func (x *RunInstances) Reset() { - *x = RunInstances{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RunInstances) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RunInstances) ProtoMessage() {} - -func (x *RunInstances) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RunInstances.ProtoReflect.Descriptor instead. -func (*RunInstances) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{6} -} - -func (x *RunInstances) GetServices() []*ServiceInfo { - if x != nil { - return x.Services - } - return nil -} - -func (x *RunInstances) GetLayers() []*LayerInfo { - if x != nil { - return x.Layers - } - return nil -} - -func (x *RunInstances) GetInstances() []*InstanceInfo { - if x != nil { - return x.Instances - } - return nil -} - -func (x *RunInstances) GetForceRestart() bool { - if x != nil { - return x.ForceRestart - } - return false -} - -type ServiceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VersionInfo *VersionInfo `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - ServiceId string `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - ProviderId string `protobuf:"bytes,4,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"` - Gid uint32 `protobuf:"varint,5,opt,name=gid,proto3" json:"gid,omitempty"` - Sha256 []byte `protobuf:"bytes,6,opt,name=sha256,proto3" json:"sha256,omitempty"` - Sha512 []byte `protobuf:"bytes,7,opt,name=sha512,proto3" json:"sha512,omitempty"` - Size uint64 `protobuf:"varint,8,opt,name=size,proto3" json:"size,omitempty"` -} - -func (x *ServiceInfo) Reset() { - *x = ServiceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceInfo) ProtoMessage() {} - -func (x *ServiceInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead. -func (*ServiceInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{7} -} - -func (x *ServiceInfo) GetVersionInfo() *VersionInfo { - if x != nil { - return x.VersionInfo - } - return nil -} - -func (x *ServiceInfo) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ServiceInfo) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *ServiceInfo) GetProviderId() string { - if x != nil { - return x.ProviderId - } - return "" -} - -func (x *ServiceInfo) GetGid() uint32 { - if x != nil { - return x.Gid - } - return 0 -} - -func (x *ServiceInfo) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *ServiceInfo) GetSha512() []byte { - if x != nil { - return x.Sha512 - } - return nil -} - -func (x *ServiceInfo) GetSize() uint64 { - if x != nil { - return x.Size - } - return 0 -} - -type LayerInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VersionInfo *VersionInfo `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - LayerId string `protobuf:"bytes,3,opt,name=layer_id,json=layerId,proto3" json:"layer_id,omitempty"` - Digest string `protobuf:"bytes,4,opt,name=digest,proto3" json:"digest,omitempty"` - Sha256 []byte `protobuf:"bytes,5,opt,name=sha256,proto3" json:"sha256,omitempty"` - Sha512 []byte `protobuf:"bytes,6,opt,name=sha512,proto3" json:"sha512,omitempty"` - Size uint64 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"` -} - -func (x *LayerInfo) Reset() { - *x = LayerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LayerInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LayerInfo) ProtoMessage() {} - -func (x *LayerInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LayerInfo.ProtoReflect.Descriptor instead. -func (*LayerInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{8} -} - -func (x *LayerInfo) GetVersionInfo() *VersionInfo { - if x != nil { - return x.VersionInfo - } - return nil -} - -func (x *LayerInfo) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *LayerInfo) GetLayerId() string { - if x != nil { - return x.LayerId - } - return "" -} - -func (x *LayerInfo) GetDigest() string { - if x != nil { - return x.Digest - } - return "" -} - -func (x *LayerInfo) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *LayerInfo) GetSha512() []byte { - if x != nil { - return x.Sha512 - } - return nil -} - -func (x *LayerInfo) GetSize() uint64 { - if x != nil { - return x.Size - } - return 0 -} - -type VersionInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AosVersion uint64 `protobuf:"varint,1,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - VendorVersion string `protobuf:"bytes,2,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *VersionInfo) Reset() { - *x = VersionInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersionInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersionInfo) ProtoMessage() {} - -func (x *VersionInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VersionInfo.ProtoReflect.Descriptor instead. -func (*VersionInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{9} -} - -func (x *VersionInfo) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *VersionInfo) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -func (x *VersionInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type FirewallRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DstIp string `protobuf:"bytes,1,opt,name=dst_ip,json=dstIp,proto3" json:"dst_ip,omitempty"` - DstPort string `protobuf:"bytes,2,opt,name=dst_port,json=dstPort,proto3" json:"dst_port,omitempty"` - Proto string `protobuf:"bytes,3,opt,name=proto,proto3" json:"proto,omitempty"` - SrcIp string `protobuf:"bytes,4,opt,name=src_ip,json=srcIp,proto3" json:"src_ip,omitempty"` -} - -func (x *FirewallRule) Reset() { - *x = FirewallRule{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FirewallRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FirewallRule) ProtoMessage() {} - -func (x *FirewallRule) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FirewallRule.ProtoReflect.Descriptor instead. -func (*FirewallRule) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{10} -} - -func (x *FirewallRule) GetDstIp() string { - if x != nil { - return x.DstIp - } - return "" -} - -func (x *FirewallRule) GetDstPort() string { - if x != nil { - return x.DstPort - } - return "" -} - -func (x *FirewallRule) GetProto() string { - if x != nil { - return x.Proto - } - return "" -} - -func (x *FirewallRule) GetSrcIp() string { - if x != nil { - return x.SrcIp - } - return "" -} - -type NetworkParameters struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NetworkId string `protobuf:"bytes,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` - Subnet string `protobuf:"bytes,2,opt,name=subnet,proto3" json:"subnet,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - VlanId uint64 `protobuf:"varint,4,opt,name=vlan_id,json=vlanId,proto3" json:"vlan_id,omitempty"` - DnsServers []string `protobuf:"bytes,5,rep,name=dns_servers,json=dnsServers,proto3" json:"dns_servers,omitempty"` - Rules []*FirewallRule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules,omitempty"` -} - -func (x *NetworkParameters) Reset() { - *x = NetworkParameters{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkParameters) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkParameters) ProtoMessage() {} - -func (x *NetworkParameters) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkParameters.ProtoReflect.Descriptor instead. -func (*NetworkParameters) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{11} -} - -func (x *NetworkParameters) GetNetworkId() string { - if x != nil { - return x.NetworkId - } - return "" -} - -func (x *NetworkParameters) GetSubnet() string { - if x != nil { - return x.Subnet - } - return "" -} - -func (x *NetworkParameters) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *NetworkParameters) GetVlanId() uint64 { - if x != nil { - return x.VlanId - } - return 0 -} - -func (x *NetworkParameters) GetDnsServers() []string { - if x != nil { - return x.DnsServers - } - return nil -} - -func (x *NetworkParameters) GetRules() []*FirewallRule { - if x != nil { - return x.Rules - } - return nil -} - -type InstanceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Uid uint32 `protobuf:"varint,2,opt,name=uid,proto3" json:"uid,omitempty"` - Priority uint64 `protobuf:"varint,3,opt,name=priority,proto3" json:"priority,omitempty"` - StoragePath string `protobuf:"bytes,4,opt,name=storage_path,json=storagePath,proto3" json:"storage_path,omitempty"` - StatePath string `protobuf:"bytes,5,opt,name=state_path,json=statePath,proto3" json:"state_path,omitempty"` - NetworkParameters *NetworkParameters `protobuf:"bytes,6,opt,name=network_parameters,json=networkParameters,proto3" json:"network_parameters,omitempty"` -} - -func (x *InstanceInfo) Reset() { - *x = InstanceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceInfo) ProtoMessage() {} - -func (x *InstanceInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceInfo.ProtoReflect.Descriptor instead. -func (*InstanceInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{12} -} - -func (x *InstanceInfo) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceInfo) GetUid() uint32 { - if x != nil { - return x.Uid - } - return 0 -} - -func (x *InstanceInfo) GetPriority() uint64 { - if x != nil { - return x.Priority - } - return 0 -} - -func (x *InstanceInfo) GetStoragePath() string { - if x != nil { - return x.StoragePath - } - return "" -} - -func (x *InstanceInfo) GetStatePath() string { - if x != nil { - return x.StatePath - } - return "" -} - -func (x *InstanceInfo) GetNetworkParameters() *NetworkParameters { - if x != nil { - return x.NetworkParameters - } - return nil -} - -type OverrideEnvVars struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EnvVars []*OverrideInstanceEnvVar `protobuf:"bytes,1,rep,name=env_vars,json=envVars,proto3" json:"env_vars,omitempty"` -} - -func (x *OverrideEnvVars) Reset() { - *x = OverrideEnvVars{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OverrideEnvVars) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OverrideEnvVars) ProtoMessage() {} - -func (x *OverrideEnvVars) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OverrideEnvVars.ProtoReflect.Descriptor instead. -func (*OverrideEnvVars) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{13} -} - -func (x *OverrideEnvVars) GetEnvVars() []*OverrideInstanceEnvVar { - if x != nil { - return x.EnvVars - } - return nil -} - -type OverrideInstanceEnvVar struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Vars []*EnvVarInfo `protobuf:"bytes,2,rep,name=vars,proto3" json:"vars,omitempty"` -} - -func (x *OverrideInstanceEnvVar) Reset() { - *x = OverrideInstanceEnvVar{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OverrideInstanceEnvVar) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OverrideInstanceEnvVar) ProtoMessage() {} - -func (x *OverrideInstanceEnvVar) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OverrideInstanceEnvVar.ProtoReflect.Descriptor instead. -func (*OverrideInstanceEnvVar) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{14} -} - -func (x *OverrideInstanceEnvVar) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *OverrideInstanceEnvVar) GetVars() []*EnvVarInfo { - if x != nil { - return x.Vars - } - return nil -} - -type EnvVarInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VarId string `protobuf:"bytes,1,opt,name=var_id,json=varId,proto3" json:"var_id,omitempty"` - Variable string `protobuf:"bytes,2,opt,name=variable,proto3" json:"variable,omitempty"` - Ttl *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=ttl,proto3" json:"ttl,omitempty"` -} - -func (x *EnvVarInfo) Reset() { - *x = EnvVarInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnvVarInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnvVarInfo) ProtoMessage() {} - -func (x *EnvVarInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnvVarInfo.ProtoReflect.Descriptor instead. -func (*EnvVarInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{15} -} - -func (x *EnvVarInfo) GetVarId() string { - if x != nil { - return x.VarId - } - return "" -} - -func (x *EnvVarInfo) GetVariable() string { - if x != nil { - return x.Variable - } - return "" -} - -func (x *EnvVarInfo) GetTtl() *timestamppb.Timestamp { - if x != nil { - return x.Ttl - } - return nil -} - -type SystemLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` - From *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` - Till *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=till,proto3" json:"till,omitempty"` -} - -func (x *SystemLogRequest) Reset() { - *x = SystemLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemLogRequest) ProtoMessage() {} - -func (x *SystemLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemLogRequest.ProtoReflect.Descriptor instead. -func (*SystemLogRequest) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{16} -} - -func (x *SystemLogRequest) GetLogId() string { - if x != nil { - return x.LogId - } - return "" -} - -func (x *SystemLogRequest) GetFrom() *timestamppb.Timestamp { - if x != nil { - return x.From - } - return nil -} - -func (x *SystemLogRequest) GetTill() *timestamppb.Timestamp { - if x != nil { - return x.Till - } - return nil -} - -type InstanceLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` - Instance *InstanceIdent `protobuf:"bytes,2,opt,name=instance,proto3" json:"instance,omitempty"` - From *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` - Till *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=till,proto3" json:"till,omitempty"` -} - -func (x *InstanceLogRequest) Reset() { - *x = InstanceLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceLogRequest) ProtoMessage() {} - -func (x *InstanceLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceLogRequest.ProtoReflect.Descriptor instead. -func (*InstanceLogRequest) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{17} -} - -func (x *InstanceLogRequest) GetLogId() string { - if x != nil { - return x.LogId - } - return "" -} - -func (x *InstanceLogRequest) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceLogRequest) GetFrom() *timestamppb.Timestamp { - if x != nil { - return x.From - } - return nil -} - -func (x *InstanceLogRequest) GetTill() *timestamppb.Timestamp { - if x != nil { - return x.Till - } - return nil -} - -type InstanceCrashLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` - Instance *InstanceIdent `protobuf:"bytes,2,opt,name=instance,proto3" json:"instance,omitempty"` - From *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` - Till *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=till,proto3" json:"till,omitempty"` -} - -func (x *InstanceCrashLogRequest) Reset() { - *x = InstanceCrashLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceCrashLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceCrashLogRequest) ProtoMessage() {} - -func (x *InstanceCrashLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceCrashLogRequest.ProtoReflect.Descriptor instead. -func (*InstanceCrashLogRequest) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{18} -} - -func (x *InstanceCrashLogRequest) GetLogId() string { - if x != nil { - return x.LogId - } - return "" -} - -func (x *InstanceCrashLogRequest) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceCrashLogRequest) GetFrom() *timestamppb.Timestamp { - if x != nil { - return x.From - } - return nil -} - -func (x *InstanceCrashLogRequest) GetTill() *timestamppb.Timestamp { - if x != nil { - return x.Till - } - return nil -} - -type GetNodeMonitoring struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetNodeMonitoring) Reset() { - *x = GetNodeMonitoring{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetNodeMonitoring) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetNodeMonitoring) ProtoMessage() {} - -func (x *GetNodeMonitoring) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetNodeMonitoring.ProtoReflect.Descriptor instead. -func (*GetNodeMonitoring) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{19} -} - -type ConnectionStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CloudStatus ConnectionEnum `protobuf:"varint,1,opt,name=cloud_status,json=cloudStatus,proto3,enum=servicemanager.v3.ConnectionEnum" json:"cloud_status,omitempty"` -} - -func (x *ConnectionStatus) Reset() { - *x = ConnectionStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConnectionStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConnectionStatus) ProtoMessage() {} - -func (x *ConnectionStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConnectionStatus.ProtoReflect.Descriptor instead. -func (*ConnectionStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{20} -} - -func (x *ConnectionStatus) GetCloudStatus() ConnectionEnum { - if x != nil { - return x.CloudStatus - } - return ConnectionEnum_DISCONNECTED -} - -type ImageContentInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - ImageFiles []*ImageFile `protobuf:"bytes,2,rep,name=image_files,json=imageFiles,proto3" json:"image_files,omitempty"` - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *ImageContentInfo) Reset() { - *x = ImageContentInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImageContentInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImageContentInfo) ProtoMessage() {} - -func (x *ImageContentInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImageContentInfo.ProtoReflect.Descriptor instead. -func (*ImageContentInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{21} -} - -func (x *ImageContentInfo) GetRequestId() uint64 { - if x != nil { - return x.RequestId - } - return 0 -} - -func (x *ImageContentInfo) GetImageFiles() []*ImageFile { - if x != nil { - return x.ImageFiles - } - return nil -} - -func (x *ImageContentInfo) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type ImageFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RelativePath string `protobuf:"bytes,1,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` - Sha256 []byte `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` - Size uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` -} - -func (x *ImageFile) Reset() { - *x = ImageFile{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImageFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImageFile) ProtoMessage() {} - -func (x *ImageFile) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImageFile.ProtoReflect.Descriptor instead. -func (*ImageFile) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{22} -} - -func (x *ImageFile) GetRelativePath() string { - if x != nil { - return x.RelativePath - } - return "" -} - -func (x *ImageFile) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *ImageFile) GetSize() uint64 { - if x != nil { - return x.Size - } - return 0 -} - -type ImageContent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - RelativePath string `protobuf:"bytes,2,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` - PartsCount uint64 `protobuf:"varint,3,opt,name=parts_count,json=partsCount,proto3" json:"parts_count,omitempty"` - Part uint64 `protobuf:"varint,4,opt,name=part,proto3" json:"part,omitempty"` - Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *ImageContent) Reset() { - *x = ImageContent{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImageContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImageContent) ProtoMessage() {} - -func (x *ImageContent) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImageContent.ProtoReflect.Descriptor instead. -func (*ImageContent) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{23} -} - -func (x *ImageContent) GetRequestId() uint64 { - if x != nil { - return x.RequestId - } - return 0 -} - -func (x *ImageContent) GetRelativePath() string { - if x != nil { - return x.RelativePath - } - return "" -} - -func (x *ImageContent) GetPartsCount() uint64 { - if x != nil { - return x.PartsCount - } - return 0 -} - -func (x *ImageContent) GetPart() uint64 { - if x != nil { - return x.Part - } - return 0 -} - -func (x *ImageContent) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -type SMOutgoingMessages struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to SMOutgoingMessage: - // - // *SMOutgoingMessages_NodeConfiguration - // *SMOutgoingMessages_UnitConfigStatus - // *SMOutgoingMessages_RunInstancesStatus - // *SMOutgoingMessages_UpdateInstancesStatus - // *SMOutgoingMessages_OverrideEnvVarStatus - // *SMOutgoingMessages_Log - // *SMOutgoingMessages_NodeMonitoring - // *SMOutgoingMessages_Alert - // *SMOutgoingMessages_ImageContentRequest - // *SMOutgoingMessages_ClockSyncRequest - SMOutgoingMessage isSMOutgoingMessages_SMOutgoingMessage `protobuf_oneof:"SMOutgoingMessage"` -} - -func (x *SMOutgoingMessages) Reset() { - *x = SMOutgoingMessages{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMOutgoingMessages) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMOutgoingMessages) ProtoMessage() {} - -func (x *SMOutgoingMessages) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SMOutgoingMessages.ProtoReflect.Descriptor instead. -func (*SMOutgoingMessages) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{24} -} - -func (m *SMOutgoingMessages) GetSMOutgoingMessage() isSMOutgoingMessages_SMOutgoingMessage { - if m != nil { - return m.SMOutgoingMessage - } - return nil -} - -func (x *SMOutgoingMessages) GetNodeConfiguration() *NodeConfiguration { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_NodeConfiguration); ok { - return x.NodeConfiguration - } - return nil -} - -func (x *SMOutgoingMessages) GetUnitConfigStatus() *UnitConfigStatus { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_UnitConfigStatus); ok { - return x.UnitConfigStatus - } - return nil -} - -func (x *SMOutgoingMessages) GetRunInstancesStatus() *RunInstancesStatus { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_RunInstancesStatus); ok { - return x.RunInstancesStatus - } - return nil -} - -func (x *SMOutgoingMessages) GetUpdateInstancesStatus() *UpdateInstancesStatus { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_UpdateInstancesStatus); ok { - return x.UpdateInstancesStatus - } - return nil -} - -func (x *SMOutgoingMessages) GetOverrideEnvVarStatus() *OverrideEnvVarStatus { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_OverrideEnvVarStatus); ok { - return x.OverrideEnvVarStatus - } - return nil -} - -func (x *SMOutgoingMessages) GetLog() *LogData { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_Log); ok { - return x.Log - } - return nil -} - -func (x *SMOutgoingMessages) GetNodeMonitoring() *NodeMonitoring { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_NodeMonitoring); ok { - return x.NodeMonitoring - } - return nil -} - -func (x *SMOutgoingMessages) GetAlert() *Alert { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_Alert); ok { - return x.Alert - } - return nil -} - -func (x *SMOutgoingMessages) GetImageContentRequest() *ImageContentRequest { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_ImageContentRequest); ok { - return x.ImageContentRequest - } - return nil -} - -func (x *SMOutgoingMessages) GetClockSyncRequest() *ClockSyncRequest { - if x, ok := x.GetSMOutgoingMessage().(*SMOutgoingMessages_ClockSyncRequest); ok { - return x.ClockSyncRequest - } - return nil -} - -type isSMOutgoingMessages_SMOutgoingMessage interface { - isSMOutgoingMessages_SMOutgoingMessage() -} - -type SMOutgoingMessages_NodeConfiguration struct { - NodeConfiguration *NodeConfiguration `protobuf:"bytes,1,opt,name=node_configuration,json=nodeConfiguration,proto3,oneof"` -} - -type SMOutgoingMessages_UnitConfigStatus struct { - UnitConfigStatus *UnitConfigStatus `protobuf:"bytes,2,opt,name=unit_config_status,json=unitConfigStatus,proto3,oneof"` -} - -type SMOutgoingMessages_RunInstancesStatus struct { - RunInstancesStatus *RunInstancesStatus `protobuf:"bytes,3,opt,name=run_instances_status,json=runInstancesStatus,proto3,oneof"` -} - -type SMOutgoingMessages_UpdateInstancesStatus struct { - UpdateInstancesStatus *UpdateInstancesStatus `protobuf:"bytes,4,opt,name=update_instances_status,json=updateInstancesStatus,proto3,oneof"` -} - -type SMOutgoingMessages_OverrideEnvVarStatus struct { - OverrideEnvVarStatus *OverrideEnvVarStatus `protobuf:"bytes,5,opt,name=override_env_var_status,json=overrideEnvVarStatus,proto3,oneof"` -} - -type SMOutgoingMessages_Log struct { - Log *LogData `protobuf:"bytes,6,opt,name=log,proto3,oneof"` -} - -type SMOutgoingMessages_NodeMonitoring struct { - NodeMonitoring *NodeMonitoring `protobuf:"bytes,7,opt,name=node_monitoring,json=nodeMonitoring,proto3,oneof"` -} - -type SMOutgoingMessages_Alert struct { - Alert *Alert `protobuf:"bytes,8,opt,name=alert,proto3,oneof"` -} - -type SMOutgoingMessages_ImageContentRequest struct { - ImageContentRequest *ImageContentRequest `protobuf:"bytes,9,opt,name=image_content_request,json=imageContentRequest,proto3,oneof"` -} - -type SMOutgoingMessages_ClockSyncRequest struct { - ClockSyncRequest *ClockSyncRequest `protobuf:"bytes,10,opt,name=clock_sync_request,json=clockSyncRequest,proto3,oneof"` -} - -func (*SMOutgoingMessages_NodeConfiguration) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_UnitConfigStatus) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_RunInstancesStatus) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_UpdateInstancesStatus) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_OverrideEnvVarStatus) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_Log) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_NodeMonitoring) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_Alert) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_ImageContentRequest) isSMOutgoingMessages_SMOutgoingMessage() {} - -func (*SMOutgoingMessages_ClockSyncRequest) isSMOutgoingMessages_SMOutgoingMessage() {} - -type NodeConfiguration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - NodeType string `protobuf:"bytes,2,opt,name=node_type,json=nodeType,proto3" json:"node_type,omitempty"` - RemoteNode bool `protobuf:"varint,3,opt,name=remote_node,json=remoteNode,proto3" json:"remote_node,omitempty"` - RunnerFeatures []string `protobuf:"bytes,4,rep,name=runner_features,json=runnerFeatures,proto3" json:"runner_features,omitempty"` - NumCpus uint64 `protobuf:"varint,5,opt,name=num_cpus,json=numCpus,proto3" json:"num_cpus,omitempty"` - TotalRam uint64 `protobuf:"varint,6,opt,name=total_ram,json=totalRam,proto3" json:"total_ram,omitempty"` - Partitions []*Partition `protobuf:"bytes,7,rep,name=partitions,proto3" json:"partitions,omitempty"` -} - -func (x *NodeConfiguration) Reset() { - *x = NodeConfiguration{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeConfiguration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeConfiguration) ProtoMessage() {} - -func (x *NodeConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeConfiguration.ProtoReflect.Descriptor instead. -func (*NodeConfiguration) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{25} -} - -func (x *NodeConfiguration) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *NodeConfiguration) GetNodeType() string { - if x != nil { - return x.NodeType - } - return "" -} - -func (x *NodeConfiguration) GetRemoteNode() bool { - if x != nil { - return x.RemoteNode - } - return false -} - -func (x *NodeConfiguration) GetRunnerFeatures() []string { - if x != nil { - return x.RunnerFeatures - } - return nil -} - -func (x *NodeConfiguration) GetNumCpus() uint64 { - if x != nil { - return x.NumCpus - } - return 0 -} - -func (x *NodeConfiguration) GetTotalRam() uint64 { - if x != nil { - return x.TotalRam - } - return 0 -} - -func (x *NodeConfiguration) GetPartitions() []*Partition { - if x != nil { - return x.Partitions - } - return nil -} - -type Partition struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Types []string `protobuf:"bytes,2,rep,name=types,proto3" json:"types,omitempty"` - TotalSize uint64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` -} - -func (x *Partition) Reset() { - *x = Partition{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Partition) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Partition) ProtoMessage() {} - -func (x *Partition) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Partition.ProtoReflect.Descriptor instead. -func (*Partition) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{26} -} - -func (x *Partition) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Partition) GetTypes() []string { - if x != nil { - return x.Types - } - return nil -} - -func (x *Partition) GetTotalSize() uint64 { - if x != nil { - return x.TotalSize - } - return 0 -} - -type UnitConfigStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VendorVersion string `protobuf:"bytes,1,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *UnitConfigStatus) Reset() { - *x = UnitConfigStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UnitConfigStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UnitConfigStatus) ProtoMessage() {} - -func (x *UnitConfigStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UnitConfigStatus.ProtoReflect.Descriptor instead. -func (*UnitConfigStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{27} -} - -func (x *UnitConfigStatus) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -func (x *UnitConfigStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type RunInstancesStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instances []*InstanceStatus `protobuf:"bytes,1,rep,name=instances,proto3" json:"instances,omitempty"` -} - -func (x *RunInstancesStatus) Reset() { - *x = RunInstancesStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RunInstancesStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RunInstancesStatus) ProtoMessage() {} - -func (x *RunInstancesStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RunInstancesStatus.ProtoReflect.Descriptor instead. -func (*RunInstancesStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{28} -} - -func (x *RunInstancesStatus) GetInstances() []*InstanceStatus { - if x != nil { - return x.Instances - } - return nil -} - -type UpdateInstancesStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instances []*InstanceStatus `protobuf:"bytes,1,rep,name=instances,proto3" json:"instances,omitempty"` -} - -func (x *UpdateInstancesStatus) Reset() { - *x = UpdateInstancesStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateInstancesStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateInstancesStatus) ProtoMessage() {} - -func (x *UpdateInstancesStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateInstancesStatus.ProtoReflect.Descriptor instead. -func (*UpdateInstancesStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{29} -} - -func (x *UpdateInstancesStatus) GetInstances() []*InstanceStatus { - if x != nil { - return x.Instances - } - return nil -} - -type InstanceStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - AosVersion uint64 `protobuf:"varint,2,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - RunState string `protobuf:"bytes,3,opt,name=run_state,json=runState,proto3" json:"run_state,omitempty"` - ErrorInfo *ErrorInfo `protobuf:"bytes,4,opt,name=error_info,json=errorInfo,proto3" json:"error_info,omitempty"` -} - -func (x *InstanceStatus) Reset() { - *x = InstanceStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceStatus) ProtoMessage() {} - -func (x *InstanceStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceStatus.ProtoReflect.Descriptor instead. -func (*InstanceStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{30} -} - -func (x *InstanceStatus) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceStatus) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *InstanceStatus) GetRunState() string { - if x != nil { - return x.RunState - } - return "" -} - -func (x *InstanceStatus) GetErrorInfo() *ErrorInfo { - if x != nil { - return x.ErrorInfo - } - return nil -} - -type InstanceIdent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - SubjectId string `protobuf:"bytes,2,opt,name=subject_id,json=subjectId,proto3" json:"subject_id,omitempty"` - Instance int64 `protobuf:"varint,3,opt,name=instance,proto3" json:"instance,omitempty"` -} - -func (x *InstanceIdent) Reset() { - *x = InstanceIdent{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceIdent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceIdent) ProtoMessage() {} - -func (x *InstanceIdent) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceIdent.ProtoReflect.Descriptor instead. -func (*InstanceIdent) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{31} -} - -func (x *InstanceIdent) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *InstanceIdent) GetSubjectId() string { - if x != nil { - return x.SubjectId - } - return "" -} - -func (x *InstanceIdent) GetInstance() int64 { - if x != nil { - return x.Instance - } - return 0 -} - -type ErrorInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AosCode int32 `protobuf:"varint,1,opt,name=aos_code,json=aosCode,proto3" json:"aos_code,omitempty"` - ExitCode int32 `protobuf:"varint,2,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *ErrorInfo) Reset() { - *x = ErrorInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ErrorInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ErrorInfo) ProtoMessage() {} - -func (x *ErrorInfo) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead. -func (*ErrorInfo) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{32} -} - -func (x *ErrorInfo) GetAosCode() int32 { - if x != nil { - return x.AosCode - } - return 0 -} - -func (x *ErrorInfo) GetExitCode() int32 { - if x != nil { - return x.ExitCode - } - return 0 -} - -func (x *ErrorInfo) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type OverrideEnvVarStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EnvVarsStatus []*EnvVarInstanceStatus `protobuf:"bytes,1,rep,name=env_vars_status,json=envVarsStatus,proto3" json:"env_vars_status,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *OverrideEnvVarStatus) Reset() { - *x = OverrideEnvVarStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OverrideEnvVarStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OverrideEnvVarStatus) ProtoMessage() {} - -func (x *OverrideEnvVarStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OverrideEnvVarStatus.ProtoReflect.Descriptor instead. -func (*OverrideEnvVarStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{33} -} - -func (x *OverrideEnvVarStatus) GetEnvVarsStatus() []*EnvVarInstanceStatus { - if x != nil { - return x.EnvVarsStatus - } - return nil -} - -func (x *OverrideEnvVarStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type EnvVarInstanceStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - VarsStatus []*EnvVarStatus `protobuf:"bytes,2,rep,name=vars_status,json=varsStatus,proto3" json:"vars_status,omitempty"` -} - -func (x *EnvVarInstanceStatus) Reset() { - *x = EnvVarInstanceStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnvVarInstanceStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnvVarInstanceStatus) ProtoMessage() {} - -func (x *EnvVarInstanceStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnvVarInstanceStatus.ProtoReflect.Descriptor instead. -func (*EnvVarInstanceStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{34} -} - -func (x *EnvVarInstanceStatus) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *EnvVarInstanceStatus) GetVarsStatus() []*EnvVarStatus { - if x != nil { - return x.VarsStatus - } - return nil -} - -type EnvVarStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VarId string `protobuf:"bytes,1,opt,name=var_id,json=varId,proto3" json:"var_id,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *EnvVarStatus) Reset() { - *x = EnvVarStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnvVarStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnvVarStatus) ProtoMessage() {} - -func (x *EnvVarStatus) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnvVarStatus.ProtoReflect.Descriptor instead. -func (*EnvVarStatus) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{35} -} - -func (x *EnvVarStatus) GetVarId() string { - if x != nil { - return x.VarId - } - return "" -} - -func (x *EnvVarStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type LogData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` - PartCount uint64 `protobuf:"varint,2,opt,name=part_count,json=partCount,proto3" json:"part_count,omitempty"` - Part uint64 `protobuf:"varint,3,opt,name=part,proto3" json:"part,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *LogData) Reset() { - *x = LogData{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LogData) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogData) ProtoMessage() {} - -func (x *LogData) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LogData.ProtoReflect.Descriptor instead. -func (*LogData) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{36} -} - -func (x *LogData) GetLogId() string { - if x != nil { - return x.LogId - } - return "" -} - -func (x *LogData) GetPartCount() uint64 { - if x != nil { - return x.PartCount - } - return 0 -} - -func (x *LogData) GetPart() uint64 { - if x != nil { - return x.Part - } - return 0 -} - -func (x *LogData) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *LogData) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type NodeMonitoring struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - MonitoringData *MonitoringData `protobuf:"bytes,2,opt,name=monitoring_data,json=monitoringData,proto3" json:"monitoring_data,omitempty"` - InstanceMonitoring []*InstanceMonitoring `protobuf:"bytes,3,rep,name=instance_monitoring,json=instanceMonitoring,proto3" json:"instance_monitoring,omitempty"` -} - -func (x *NodeMonitoring) Reset() { - *x = NodeMonitoring{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeMonitoring) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeMonitoring) ProtoMessage() {} - -func (x *NodeMonitoring) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeMonitoring.ProtoReflect.Descriptor instead. -func (*NodeMonitoring) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{37} -} - -func (x *NodeMonitoring) GetTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - -func (x *NodeMonitoring) GetMonitoringData() *MonitoringData { - if x != nil { - return x.MonitoringData - } - return nil -} - -func (x *NodeMonitoring) GetInstanceMonitoring() []*InstanceMonitoring { - if x != nil { - return x.InstanceMonitoring - } - return nil -} - -type MonitoringData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ram uint64 `protobuf:"varint,1,opt,name=ram,proto3" json:"ram,omitempty"` - Cpu uint64 `protobuf:"varint,2,opt,name=cpu,proto3" json:"cpu,omitempty"` - Disk []*PartitionUsage `protobuf:"bytes,3,rep,name=disk,proto3" json:"disk,omitempty"` - InTraffic uint64 `protobuf:"varint,4,opt,name=in_traffic,json=inTraffic,proto3" json:"in_traffic,omitempty"` - OutTraffic uint64 `protobuf:"varint,5,opt,name=out_traffic,json=outTraffic,proto3" json:"out_traffic,omitempty"` -} - -func (x *MonitoringData) Reset() { - *x = MonitoringData{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MonitoringData) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MonitoringData) ProtoMessage() {} - -func (x *MonitoringData) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MonitoringData.ProtoReflect.Descriptor instead. -func (*MonitoringData) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{38} -} - -func (x *MonitoringData) GetRam() uint64 { - if x != nil { - return x.Ram - } - return 0 -} - -func (x *MonitoringData) GetCpu() uint64 { - if x != nil { - return x.Cpu - } - return 0 -} - -func (x *MonitoringData) GetDisk() []*PartitionUsage { - if x != nil { - return x.Disk - } - return nil -} - -func (x *MonitoringData) GetInTraffic() uint64 { - if x != nil { - return x.InTraffic - } - return 0 -} - -func (x *MonitoringData) GetOutTraffic() uint64 { - if x != nil { - return x.OutTraffic - } - return 0 -} - -type PartitionUsage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - UsedSize uint64 `protobuf:"varint,2,opt,name=used_size,json=usedSize,proto3" json:"used_size,omitempty"` -} - -func (x *PartitionUsage) Reset() { - *x = PartitionUsage{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PartitionUsage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PartitionUsage) ProtoMessage() {} - -func (x *PartitionUsage) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PartitionUsage.ProtoReflect.Descriptor instead. -func (*PartitionUsage) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{39} -} - -func (x *PartitionUsage) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PartitionUsage) GetUsedSize() uint64 { - if x != nil { - return x.UsedSize - } - return 0 -} - -type InstanceMonitoring struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - MonitoringData *MonitoringData `protobuf:"bytes,2,opt,name=monitoring_data,json=monitoringData,proto3" json:"monitoring_data,omitempty"` -} - -func (x *InstanceMonitoring) Reset() { - *x = InstanceMonitoring{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceMonitoring) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceMonitoring) ProtoMessage() {} - -func (x *InstanceMonitoring) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceMonitoring.ProtoReflect.Descriptor instead. -func (*InstanceMonitoring) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{40} -} - -func (x *InstanceMonitoring) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceMonitoring) GetMonitoringData() *MonitoringData { - if x != nil { - return x.MonitoringData - } - return nil -} - -type Alert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` - // Types that are assignable to Payload: - // - // *Alert_SystemQuotaAlert - // *Alert_InstanceQuotaAlert - // *Alert_ResourceValidateAlert - // *Alert_DeviceAllocateAlert - // *Alert_SystemAlert - // *Alert_CoreAlert - // *Alert_InstanceAlert - Payload isAlert_Payload `protobuf_oneof:"Payload"` -} - -func (x *Alert) Reset() { - *x = Alert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Alert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Alert) ProtoMessage() {} - -func (x *Alert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Alert.ProtoReflect.Descriptor instead. -func (*Alert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{41} -} - -func (x *Alert) GetTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - -func (x *Alert) GetTag() string { - if x != nil { - return x.Tag - } - return "" -} - -func (m *Alert) GetPayload() isAlert_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (x *Alert) GetSystemQuotaAlert() *SystemQuotaAlert { - if x, ok := x.GetPayload().(*Alert_SystemQuotaAlert); ok { - return x.SystemQuotaAlert - } - return nil -} - -func (x *Alert) GetInstanceQuotaAlert() *InstanceQuotaAlert { - if x, ok := x.GetPayload().(*Alert_InstanceQuotaAlert); ok { - return x.InstanceQuotaAlert - } - return nil -} - -func (x *Alert) GetResourceValidateAlert() *ResourceValidateAlert { - if x, ok := x.GetPayload().(*Alert_ResourceValidateAlert); ok { - return x.ResourceValidateAlert - } - return nil -} - -func (x *Alert) GetDeviceAllocateAlert() *DeviceAllocateAlert { - if x, ok := x.GetPayload().(*Alert_DeviceAllocateAlert); ok { - return x.DeviceAllocateAlert - } - return nil -} - -func (x *Alert) GetSystemAlert() *SystemAlert { - if x, ok := x.GetPayload().(*Alert_SystemAlert); ok { - return x.SystemAlert - } - return nil -} - -func (x *Alert) GetCoreAlert() *CoreAlert { - if x, ok := x.GetPayload().(*Alert_CoreAlert); ok { - return x.CoreAlert - } - return nil -} - -func (x *Alert) GetInstanceAlert() *InstanceAlert { - if x, ok := x.GetPayload().(*Alert_InstanceAlert); ok { - return x.InstanceAlert - } - return nil -} - -type isAlert_Payload interface { - isAlert_Payload() -} - -type Alert_SystemQuotaAlert struct { - SystemQuotaAlert *SystemQuotaAlert `protobuf:"bytes,3,opt,name=system_quota_alert,json=systemQuotaAlert,proto3,oneof"` -} - -type Alert_InstanceQuotaAlert struct { - InstanceQuotaAlert *InstanceQuotaAlert `protobuf:"bytes,4,opt,name=instance_quota_alert,json=instanceQuotaAlert,proto3,oneof"` -} - -type Alert_ResourceValidateAlert struct { - ResourceValidateAlert *ResourceValidateAlert `protobuf:"bytes,5,opt,name=resource_validate_alert,json=resourceValidateAlert,proto3,oneof"` -} - -type Alert_DeviceAllocateAlert struct { - DeviceAllocateAlert *DeviceAllocateAlert `protobuf:"bytes,6,opt,name=device_allocate_alert,json=deviceAllocateAlert,proto3,oneof"` -} - -type Alert_SystemAlert struct { - SystemAlert *SystemAlert `protobuf:"bytes,7,opt,name=system_alert,json=systemAlert,proto3,oneof"` -} - -type Alert_CoreAlert struct { - CoreAlert *CoreAlert `protobuf:"bytes,8,opt,name=core_alert,json=coreAlert,proto3,oneof"` -} - -type Alert_InstanceAlert struct { - InstanceAlert *InstanceAlert `protobuf:"bytes,9,opt,name=instance_alert,json=instanceAlert,proto3,oneof"` -} - -func (*Alert_SystemQuotaAlert) isAlert_Payload() {} - -func (*Alert_InstanceQuotaAlert) isAlert_Payload() {} - -func (*Alert_ResourceValidateAlert) isAlert_Payload() {} - -func (*Alert_DeviceAllocateAlert) isAlert_Payload() {} - -func (*Alert_SystemAlert) isAlert_Payload() {} - -func (*Alert_CoreAlert) isAlert_Payload() {} - -func (*Alert_InstanceAlert) isAlert_Payload() {} - -type ImageContentRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - RequestId uint64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` -} - -func (x *ImageContentRequest) Reset() { - *x = ImageContentRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImageContentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImageContentRequest) ProtoMessage() {} - -func (x *ImageContentRequest) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImageContentRequest.ProtoReflect.Descriptor instead. -func (*ImageContentRequest) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{42} -} - -func (x *ImageContentRequest) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ImageContentRequest) GetRequestId() uint64 { - if x != nil { - return x.RequestId - } - return 0 -} - -func (x *ImageContentRequest) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -type ClockSyncRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ClockSyncRequest) Reset() { - *x = ClockSyncRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClockSyncRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClockSyncRequest) ProtoMessage() {} - -func (x *ClockSyncRequest) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClockSyncRequest.ProtoReflect.Descriptor instead. -func (*ClockSyncRequest) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{43} -} - -type SystemQuotaAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Parameter string `protobuf:"bytes,1,opt,name=parameter,proto3" json:"parameter,omitempty"` - Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *SystemQuotaAlert) Reset() { - *x = SystemQuotaAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemQuotaAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemQuotaAlert) ProtoMessage() {} - -func (x *SystemQuotaAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemQuotaAlert.ProtoReflect.Descriptor instead. -func (*SystemQuotaAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{44} -} - -func (x *SystemQuotaAlert) GetParameter() string { - if x != nil { - return x.Parameter - } - return "" -} - -func (x *SystemQuotaAlert) GetValue() uint64 { - if x != nil { - return x.Value - } - return 0 -} - -type InstanceQuotaAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Parameter string `protobuf:"bytes,2,opt,name=parameter,proto3" json:"parameter,omitempty"` - Value uint64 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *InstanceQuotaAlert) Reset() { - *x = InstanceQuotaAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceQuotaAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceQuotaAlert) ProtoMessage() {} - -func (x *InstanceQuotaAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceQuotaAlert.ProtoReflect.Descriptor instead. -func (*InstanceQuotaAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{45} -} - -func (x *InstanceQuotaAlert) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceQuotaAlert) GetParameter() string { - if x != nil { - return x.Parameter - } - return "" -} - -func (x *InstanceQuotaAlert) GetValue() uint64 { - if x != nil { - return x.Value - } - return 0 -} - -type DeviceAllocateAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *DeviceAllocateAlert) Reset() { - *x = DeviceAllocateAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeviceAllocateAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeviceAllocateAlert) ProtoMessage() {} - -func (x *DeviceAllocateAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeviceAllocateAlert.ProtoReflect.Descriptor instead. -func (*DeviceAllocateAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{46} -} - -func (x *DeviceAllocateAlert) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *DeviceAllocateAlert) GetDevice() string { - if x != nil { - return x.Device - } - return "" -} - -func (x *DeviceAllocateAlert) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type ResourceValidateAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Errors []*ResourceValidateErrors `protobuf:"bytes,1,rep,name=errors,proto3" json:"errors,omitempty"` -} - -func (x *ResourceValidateAlert) Reset() { - *x = ResourceValidateAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceValidateAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceValidateAlert) ProtoMessage() {} - -func (x *ResourceValidateAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceValidateAlert.ProtoReflect.Descriptor instead. -func (*ResourceValidateAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{47} -} - -func (x *ResourceValidateAlert) GetErrors() []*ResourceValidateErrors { - if x != nil { - return x.Errors - } - return nil -} - -type ResourceValidateErrors struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ErrorMsg []string `protobuf:"bytes,2,rep,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` -} - -func (x *ResourceValidateErrors) Reset() { - *x = ResourceValidateErrors{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceValidateErrors) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceValidateErrors) ProtoMessage() {} - -func (x *ResourceValidateErrors) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceValidateErrors.ProtoReflect.Descriptor instead. -func (*ResourceValidateErrors) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{48} -} - -func (x *ResourceValidateErrors) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ResourceValidateErrors) GetErrorMsg() []string { - if x != nil { - return x.ErrorMsg - } - return nil -} - -type SystemAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *SystemAlert) Reset() { - *x = SystemAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemAlert) ProtoMessage() {} - -func (x *SystemAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemAlert.ProtoReflect.Descriptor instead. -func (*SystemAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{49} -} - -func (x *SystemAlert) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type CoreAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CoreComponent string `protobuf:"bytes,1,opt,name=core_component,json=coreComponent,proto3" json:"core_component,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *CoreAlert) Reset() { - *x = CoreAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CoreAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CoreAlert) ProtoMessage() {} - -func (x *CoreAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CoreAlert.ProtoReflect.Descriptor instead. -func (*CoreAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{50} -} - -func (x *CoreAlert) GetCoreComponent() string { - if x != nil { - return x.CoreComponent - } - return "" -} - -func (x *CoreAlert) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type InstanceAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Instance *InstanceIdent `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - AosVersion uint64 `protobuf:"varint,2,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *InstanceAlert) Reset() { - *x = InstanceAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InstanceAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceAlert) ProtoMessage() {} - -func (x *InstanceAlert) ProtoReflect() protoreflect.Message { - mi := &file_servicemanager_v3_servicemanager_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceAlert.ProtoReflect.Descriptor instead. -func (*InstanceAlert) Descriptor() ([]byte, []int) { - return file_servicemanager_v3_servicemanager_proto_rawDescGZIP(), []int{51} -} - -func (x *InstanceAlert) GetInstance() *InstanceIdent { - if x != nil { - return x.Instance - } - return nil -} - -func (x *InstanceAlert) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *InstanceAlert) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -var File_servicemanager_v3_servicemanager_proto protoreflect.FileDescriptor - -var file_servicemanager_v3_servicemanager_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x09, 0x0a, - 0x12, 0x53, 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x16, 0x67, 0x65, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x13, 0x67, - 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x6e, 0x69, 0x74, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x48, 0x00, 0x52, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4a, 0x0a, 0x0f, 0x73, 0x65, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x74, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, - 0x00, 0x52, 0x0d, 0x73, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x75, 0x6e, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x75, 0x6e, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x6f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x5f, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x6f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x12, 0x53, 0x0a, 0x12, 0x73, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x59, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x69, 0x0a, 0x1a, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, 0x72, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x72, 0x61, 0x73, 0x68, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x17, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x72, 0x61, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, 0x0a, 0x13, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, - 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, - 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x11, 0x67, 0x65, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x52, 0x0a, - 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, - 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x53, 0x0a, 0x12, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x48, 0x00, 0x52, 0x10, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x46, 0x0a, 0x0d, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x00, - 0x52, 0x0c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4c, - 0x0a, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x3d, 0x0a, 0x0a, - 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x48, 0x00, - 0x52, 0x09, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x42, 0x13, 0x0a, 0x11, 0x53, - 0x4d, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x59, 0x0a, 0x0f, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x6e, - 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x57, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x52, 0x0a, 0x0e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x40, 0x0a, - 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x22, - 0x4a, 0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3d, 0x0a, 0x0c, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe4, 0x01, 0x0a, 0x0c, - 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x3d, - 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x23, 0x0a, - 0x0d, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x22, 0xf8, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, - 0x32, 0x35, 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, - 0x36, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0xd7, 0x01, - 0x0a, 0x09, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x0c, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x0b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, - 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, - 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x68, 0x61, 0x35, 0x31, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, - 0x35, 0x31, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x77, 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, 0x73, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x61, 0x6f, 0x73, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x6d, 0x0a, 0x0c, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x75, 0x6c, 0x65, - 0x12, 0x15, 0x0a, 0x06, 0x64, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x64, 0x73, 0x74, 0x49, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, - 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, - 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x72, 0x63, 0x5f, - 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x72, 0x63, 0x49, 0x70, 0x22, - 0xcb, 0x01, 0x0a, 0x11, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x17, 0x0a, 0x07, - 0x76, 0x6c, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x76, - 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x6e, 0x73, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6e, 0x73, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, - 0x6c, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x91, 0x02, - 0x0a, 0x0c, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3c, - 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1d, 0x0a, - 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x53, 0x0a, 0x12, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x11, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x73, 0x22, 0x57, 0x0a, 0x0f, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, - 0x56, 0x61, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x08, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, - 0x72, 0x52, 0x07, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x16, 0x4f, - 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x45, - 0x6e, 0x76, 0x56, 0x61, 0x72, 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x76, 0x61, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x04, 0x76, 0x61, 0x72, 0x73, 0x22, 0x6d, 0x0a, 0x0a, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x76, - 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x76, - 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x03, 0x74, 0x74, 0x6c, 0x22, 0x89, 0x01, 0x0a, 0x10, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, - 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, - 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x66, 0x72, 0x6f, - 0x6d, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6c, - 0x6c, 0x22, 0xc9, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x6f, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, - 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x0a, - 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x2e, 0x0a, - 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x22, 0xce, 0x01, - 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x72, 0x61, 0x73, 0x68, 0x4c, - 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, - 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, - 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2e, - 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x2e, - 0x0a, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6c, 0x6c, 0x22, 0x13, - 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, - 0x69, 0x6e, 0x67, 0x22, 0x58, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, - 0x52, 0x0b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x86, 0x01, - 0x0a, 0x10, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x12, 0x3d, 0x0a, 0x0b, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x5c, 0x0a, 0x09, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x46, - 0x69, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, - 0x35, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, - 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, - 0x73, 0x69, 0x7a, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x0c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x72, - 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, - 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x61, 0x72, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0xd9, 0x06, 0x0a, 0x12, 0x53, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, - 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x12, 0x6e, 0x6f, 0x64, - 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x11, 0x6e, - 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x53, 0x0a, 0x12, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x48, 0x00, 0x52, 0x10, 0x75, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x59, 0x0a, 0x14, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x12, 0x72, 0x75, - 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x62, 0x0a, 0x17, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x15, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x60, 0x0a, 0x17, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x5f, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, - 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, - 0x52, 0x14, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, 0x48, - 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x4c, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, - 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, - 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0e, 0x6e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, - 0x72, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, - 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x5c, 0x0a, 0x15, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, - 0x13, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x79, - 0x6e, 0x63, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, - 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x13, 0x0a, 0x11, 0x53, 0x4d, 0x4f, - 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x89, - 0x02, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, - 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, - 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x43, 0x70, 0x75, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x6d, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x08, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x61, 0x6d, 0x12, 0x3c, 0x0a, 0x0a, - 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x54, 0x0a, 0x09, 0x50, 0x61, - 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, - 0x22, 0x4f, 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x22, 0x55, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x58, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x61, 0x6f, 0x73, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x75, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x69, - 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, - 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, - 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x5d, 0x0a, 0x09, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6f, 0x73, 0x5f, 0x63, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x61, 0x6f, 0x73, 0x43, 0x6f, 0x64, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x7d, 0x0a, 0x14, 0x4f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x4f, 0x0a, 0x0f, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, - 0x76, 0x56, 0x61, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x0d, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x96, 0x01, 0x0a, 0x14, 0x45, 0x6e, 0x76, 0x56, - 0x61, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, - 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x40, - 0x0a, 0x0b, 0x76, 0x61, 0x72, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x0a, 0x76, 0x61, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0x3b, 0x0a, 0x0c, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x15, 0x0a, 0x06, 0x76, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x7d, 0x0a, - 0x07, 0x4c, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x70, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x61, - 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xee, 0x01, 0x0a, - 0x0e, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, - 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x4a, 0x0a, 0x0f, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, - 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, - 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x56, 0x0a, 0x13, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, - 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x22, 0xab, 0x01, - 0x0a, 0x0e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x72, - 0x61, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x03, 0x63, 0x70, 0x75, 0x12, 0x35, 0x0a, 0x04, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x04, 0x64, 0x69, 0x73, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x69, - 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x09, 0x69, 0x6e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, - 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0a, 0x6f, 0x75, 0x74, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x22, 0x41, 0x0a, 0x0e, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x75, 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x9e, - 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x6f, 0x6e, 0x69, 0x74, - 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, - 0x67, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x0e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x22, - 0x9f, 0x05, 0x0a, 0x05, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x53, 0x0a, 0x12, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, - 0x71, 0x75, 0x6f, 0x74, 0x61, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x6f, 0x74, - 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x59, 0x0a, 0x14, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x5f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, - 0x00, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x62, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x5c, 0x0a, 0x15, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x48, 0x00, 0x52, 0x13, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x0c, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, - 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x3d, 0x0a, 0x0a, - 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, - 0x52, 0x09, 0x63, 0x6f, 0x72, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x49, 0x0a, 0x0e, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x22, 0x69, 0x0a, 0x13, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x12, 0x0a, 0x10, - 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x46, 0x0a, 0x10, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, - 0x6c, 0x65, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x86, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, - 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x85, 0x01, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x6f, - 0x63, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5a, 0x0a, 0x15, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x12, 0x41, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x52, 0x06, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x49, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, - 0x22, 0x27, 0x0a, 0x0b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4c, 0x0a, 0x09, 0x43, 0x6f, 0x72, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x63, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x63, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, 0x73, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x61, 0x6f, - 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2a, 0x31, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, - 0x43, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, - 0x54, 0x45, 0x44, 0x10, 0x01, 0x32, 0x6d, 0x0a, 0x09, 0x53, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x4d, - 0x12, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x4d, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x25, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x4d, 0x49, 0x6e, - 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x00, - 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_servicemanager_v3_servicemanager_proto_rawDescOnce sync.Once - file_servicemanager_v3_servicemanager_proto_rawDescData = file_servicemanager_v3_servicemanager_proto_rawDesc -) - -func file_servicemanager_v3_servicemanager_proto_rawDescGZIP() []byte { - file_servicemanager_v3_servicemanager_proto_rawDescOnce.Do(func() { - file_servicemanager_v3_servicemanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_servicemanager_v3_servicemanager_proto_rawDescData) - }) - return file_servicemanager_v3_servicemanager_proto_rawDescData -} - -var file_servicemanager_v3_servicemanager_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_servicemanager_v3_servicemanager_proto_msgTypes = make([]protoimpl.MessageInfo, 52) -var file_servicemanager_v3_servicemanager_proto_goTypes = []interface{}{ - (ConnectionEnum)(0), // 0: servicemanager.v3.ConnectionEnum - (*SMIncomingMessages)(nil), // 1: servicemanager.v3.SMIncomingMessages - (*GetUnitConfigStatus)(nil), // 2: servicemanager.v3.GetUnitConfigStatus - (*CheckUnitConfig)(nil), // 3: servicemanager.v3.CheckUnitConfig - (*SetUnitConfig)(nil), // 4: servicemanager.v3.SetUnitConfig - (*UpdateNetworks)(nil), // 5: servicemanager.v3.UpdateNetworks - (*ClockSync)(nil), // 6: servicemanager.v3.ClockSync - (*RunInstances)(nil), // 7: servicemanager.v3.RunInstances - (*ServiceInfo)(nil), // 8: servicemanager.v3.ServiceInfo - (*LayerInfo)(nil), // 9: servicemanager.v3.LayerInfo - (*VersionInfo)(nil), // 10: servicemanager.v3.VersionInfo - (*FirewallRule)(nil), // 11: servicemanager.v3.FirewallRule - (*NetworkParameters)(nil), // 12: servicemanager.v3.NetworkParameters - (*InstanceInfo)(nil), // 13: servicemanager.v3.InstanceInfo - (*OverrideEnvVars)(nil), // 14: servicemanager.v3.OverrideEnvVars - (*OverrideInstanceEnvVar)(nil), // 15: servicemanager.v3.OverrideInstanceEnvVar - (*EnvVarInfo)(nil), // 16: servicemanager.v3.EnvVarInfo - (*SystemLogRequest)(nil), // 17: servicemanager.v3.SystemLogRequest - (*InstanceLogRequest)(nil), // 18: servicemanager.v3.InstanceLogRequest - (*InstanceCrashLogRequest)(nil), // 19: servicemanager.v3.InstanceCrashLogRequest - (*GetNodeMonitoring)(nil), // 20: servicemanager.v3.GetNodeMonitoring - (*ConnectionStatus)(nil), // 21: servicemanager.v3.ConnectionStatus - (*ImageContentInfo)(nil), // 22: servicemanager.v3.ImageContentInfo - (*ImageFile)(nil), // 23: servicemanager.v3.ImageFile - (*ImageContent)(nil), // 24: servicemanager.v3.ImageContent - (*SMOutgoingMessages)(nil), // 25: servicemanager.v3.SMOutgoingMessages - (*NodeConfiguration)(nil), // 26: servicemanager.v3.NodeConfiguration - (*Partition)(nil), // 27: servicemanager.v3.Partition - (*UnitConfigStatus)(nil), // 28: servicemanager.v3.UnitConfigStatus - (*RunInstancesStatus)(nil), // 29: servicemanager.v3.RunInstancesStatus - (*UpdateInstancesStatus)(nil), // 30: servicemanager.v3.UpdateInstancesStatus - (*InstanceStatus)(nil), // 31: servicemanager.v3.InstanceStatus - (*InstanceIdent)(nil), // 32: servicemanager.v3.InstanceIdent - (*ErrorInfo)(nil), // 33: servicemanager.v3.ErrorInfo - (*OverrideEnvVarStatus)(nil), // 34: servicemanager.v3.OverrideEnvVarStatus - (*EnvVarInstanceStatus)(nil), // 35: servicemanager.v3.EnvVarInstanceStatus - (*EnvVarStatus)(nil), // 36: servicemanager.v3.EnvVarStatus - (*LogData)(nil), // 37: servicemanager.v3.LogData - (*NodeMonitoring)(nil), // 38: servicemanager.v3.NodeMonitoring - (*MonitoringData)(nil), // 39: servicemanager.v3.MonitoringData - (*PartitionUsage)(nil), // 40: servicemanager.v3.PartitionUsage - (*InstanceMonitoring)(nil), // 41: servicemanager.v3.InstanceMonitoring - (*Alert)(nil), // 42: servicemanager.v3.Alert - (*ImageContentRequest)(nil), // 43: servicemanager.v3.ImageContentRequest - (*ClockSyncRequest)(nil), // 44: servicemanager.v3.ClockSyncRequest - (*SystemQuotaAlert)(nil), // 45: servicemanager.v3.SystemQuotaAlert - (*InstanceQuotaAlert)(nil), // 46: servicemanager.v3.InstanceQuotaAlert - (*DeviceAllocateAlert)(nil), // 47: servicemanager.v3.DeviceAllocateAlert - (*ResourceValidateAlert)(nil), // 48: servicemanager.v3.ResourceValidateAlert - (*ResourceValidateErrors)(nil), // 49: servicemanager.v3.ResourceValidateErrors - (*SystemAlert)(nil), // 50: servicemanager.v3.SystemAlert - (*CoreAlert)(nil), // 51: servicemanager.v3.CoreAlert - (*InstanceAlert)(nil), // 52: servicemanager.v3.InstanceAlert - (*timestamppb.Timestamp)(nil), // 53: google.protobuf.Timestamp -} -var file_servicemanager_v3_servicemanager_proto_depIdxs = []int32{ - 2, // 0: servicemanager.v3.SMIncomingMessages.get_unit_config_status:type_name -> servicemanager.v3.GetUnitConfigStatus - 3, // 1: servicemanager.v3.SMIncomingMessages.check_unit_config:type_name -> servicemanager.v3.CheckUnitConfig - 4, // 2: servicemanager.v3.SMIncomingMessages.set_unit_config:type_name -> servicemanager.v3.SetUnitConfig - 7, // 3: servicemanager.v3.SMIncomingMessages.run_instances:type_name -> servicemanager.v3.RunInstances - 14, // 4: servicemanager.v3.SMIncomingMessages.override_env_vars:type_name -> servicemanager.v3.OverrideEnvVars - 17, // 5: servicemanager.v3.SMIncomingMessages.system_log_request:type_name -> servicemanager.v3.SystemLogRequest - 18, // 6: servicemanager.v3.SMIncomingMessages.instance_log_request:type_name -> servicemanager.v3.InstanceLogRequest - 19, // 7: servicemanager.v3.SMIncomingMessages.instance_crash_log_request:type_name -> servicemanager.v3.InstanceCrashLogRequest - 20, // 8: servicemanager.v3.SMIncomingMessages.get_node_monitoring:type_name -> servicemanager.v3.GetNodeMonitoring - 21, // 9: servicemanager.v3.SMIncomingMessages.connection_status:type_name -> servicemanager.v3.ConnectionStatus - 22, // 10: servicemanager.v3.SMIncomingMessages.image_content_info:type_name -> servicemanager.v3.ImageContentInfo - 24, // 11: servicemanager.v3.SMIncomingMessages.image_content:type_name -> servicemanager.v3.ImageContent - 5, // 12: servicemanager.v3.SMIncomingMessages.update_networks:type_name -> servicemanager.v3.UpdateNetworks - 6, // 13: servicemanager.v3.SMIncomingMessages.clock_sync:type_name -> servicemanager.v3.ClockSync - 12, // 14: servicemanager.v3.UpdateNetworks.networks:type_name -> servicemanager.v3.NetworkParameters - 53, // 15: servicemanager.v3.ClockSync.current_time:type_name -> google.protobuf.Timestamp - 8, // 16: servicemanager.v3.RunInstances.services:type_name -> servicemanager.v3.ServiceInfo - 9, // 17: servicemanager.v3.RunInstances.layers:type_name -> servicemanager.v3.LayerInfo - 13, // 18: servicemanager.v3.RunInstances.instances:type_name -> servicemanager.v3.InstanceInfo - 10, // 19: servicemanager.v3.ServiceInfo.version_info:type_name -> servicemanager.v3.VersionInfo - 10, // 20: servicemanager.v3.LayerInfo.version_info:type_name -> servicemanager.v3.VersionInfo - 11, // 21: servicemanager.v3.NetworkParameters.rules:type_name -> servicemanager.v3.FirewallRule - 32, // 22: servicemanager.v3.InstanceInfo.instance:type_name -> servicemanager.v3.InstanceIdent - 12, // 23: servicemanager.v3.InstanceInfo.network_parameters:type_name -> servicemanager.v3.NetworkParameters - 15, // 24: servicemanager.v3.OverrideEnvVars.env_vars:type_name -> servicemanager.v3.OverrideInstanceEnvVar - 32, // 25: servicemanager.v3.OverrideInstanceEnvVar.instance:type_name -> servicemanager.v3.InstanceIdent - 16, // 26: servicemanager.v3.OverrideInstanceEnvVar.vars:type_name -> servicemanager.v3.EnvVarInfo - 53, // 27: servicemanager.v3.EnvVarInfo.ttl:type_name -> google.protobuf.Timestamp - 53, // 28: servicemanager.v3.SystemLogRequest.from:type_name -> google.protobuf.Timestamp - 53, // 29: servicemanager.v3.SystemLogRequest.till:type_name -> google.protobuf.Timestamp - 32, // 30: servicemanager.v3.InstanceLogRequest.instance:type_name -> servicemanager.v3.InstanceIdent - 53, // 31: servicemanager.v3.InstanceLogRequest.from:type_name -> google.protobuf.Timestamp - 53, // 32: servicemanager.v3.InstanceLogRequest.till:type_name -> google.protobuf.Timestamp - 32, // 33: servicemanager.v3.InstanceCrashLogRequest.instance:type_name -> servicemanager.v3.InstanceIdent - 53, // 34: servicemanager.v3.InstanceCrashLogRequest.from:type_name -> google.protobuf.Timestamp - 53, // 35: servicemanager.v3.InstanceCrashLogRequest.till:type_name -> google.protobuf.Timestamp - 0, // 36: servicemanager.v3.ConnectionStatus.cloud_status:type_name -> servicemanager.v3.ConnectionEnum - 23, // 37: servicemanager.v3.ImageContentInfo.image_files:type_name -> servicemanager.v3.ImageFile - 26, // 38: servicemanager.v3.SMOutgoingMessages.node_configuration:type_name -> servicemanager.v3.NodeConfiguration - 28, // 39: servicemanager.v3.SMOutgoingMessages.unit_config_status:type_name -> servicemanager.v3.UnitConfigStatus - 29, // 40: servicemanager.v3.SMOutgoingMessages.run_instances_status:type_name -> servicemanager.v3.RunInstancesStatus - 30, // 41: servicemanager.v3.SMOutgoingMessages.update_instances_status:type_name -> servicemanager.v3.UpdateInstancesStatus - 34, // 42: servicemanager.v3.SMOutgoingMessages.override_env_var_status:type_name -> servicemanager.v3.OverrideEnvVarStatus - 37, // 43: servicemanager.v3.SMOutgoingMessages.log:type_name -> servicemanager.v3.LogData - 38, // 44: servicemanager.v3.SMOutgoingMessages.node_monitoring:type_name -> servicemanager.v3.NodeMonitoring - 42, // 45: servicemanager.v3.SMOutgoingMessages.alert:type_name -> servicemanager.v3.Alert - 43, // 46: servicemanager.v3.SMOutgoingMessages.image_content_request:type_name -> servicemanager.v3.ImageContentRequest - 44, // 47: servicemanager.v3.SMOutgoingMessages.clock_sync_request:type_name -> servicemanager.v3.ClockSyncRequest - 27, // 48: servicemanager.v3.NodeConfiguration.partitions:type_name -> servicemanager.v3.Partition - 31, // 49: servicemanager.v3.RunInstancesStatus.instances:type_name -> servicemanager.v3.InstanceStatus - 31, // 50: servicemanager.v3.UpdateInstancesStatus.instances:type_name -> servicemanager.v3.InstanceStatus - 32, // 51: servicemanager.v3.InstanceStatus.instance:type_name -> servicemanager.v3.InstanceIdent - 33, // 52: servicemanager.v3.InstanceStatus.error_info:type_name -> servicemanager.v3.ErrorInfo - 35, // 53: servicemanager.v3.OverrideEnvVarStatus.env_vars_status:type_name -> servicemanager.v3.EnvVarInstanceStatus - 32, // 54: servicemanager.v3.EnvVarInstanceStatus.instance:type_name -> servicemanager.v3.InstanceIdent - 36, // 55: servicemanager.v3.EnvVarInstanceStatus.vars_status:type_name -> servicemanager.v3.EnvVarStatus - 53, // 56: servicemanager.v3.NodeMonitoring.timestamp:type_name -> google.protobuf.Timestamp - 39, // 57: servicemanager.v3.NodeMonitoring.monitoring_data:type_name -> servicemanager.v3.MonitoringData - 41, // 58: servicemanager.v3.NodeMonitoring.instance_monitoring:type_name -> servicemanager.v3.InstanceMonitoring - 40, // 59: servicemanager.v3.MonitoringData.disk:type_name -> servicemanager.v3.PartitionUsage - 32, // 60: servicemanager.v3.InstanceMonitoring.instance:type_name -> servicemanager.v3.InstanceIdent - 39, // 61: servicemanager.v3.InstanceMonitoring.monitoring_data:type_name -> servicemanager.v3.MonitoringData - 53, // 62: servicemanager.v3.Alert.timestamp:type_name -> google.protobuf.Timestamp - 45, // 63: servicemanager.v3.Alert.system_quota_alert:type_name -> servicemanager.v3.SystemQuotaAlert - 46, // 64: servicemanager.v3.Alert.instance_quota_alert:type_name -> servicemanager.v3.InstanceQuotaAlert - 48, // 65: servicemanager.v3.Alert.resource_validate_alert:type_name -> servicemanager.v3.ResourceValidateAlert - 47, // 66: servicemanager.v3.Alert.device_allocate_alert:type_name -> servicemanager.v3.DeviceAllocateAlert - 50, // 67: servicemanager.v3.Alert.system_alert:type_name -> servicemanager.v3.SystemAlert - 51, // 68: servicemanager.v3.Alert.core_alert:type_name -> servicemanager.v3.CoreAlert - 52, // 69: servicemanager.v3.Alert.instance_alert:type_name -> servicemanager.v3.InstanceAlert - 32, // 70: servicemanager.v3.InstanceQuotaAlert.instance:type_name -> servicemanager.v3.InstanceIdent - 32, // 71: servicemanager.v3.DeviceAllocateAlert.instance:type_name -> servicemanager.v3.InstanceIdent - 49, // 72: servicemanager.v3.ResourceValidateAlert.errors:type_name -> servicemanager.v3.ResourceValidateErrors - 32, // 73: servicemanager.v3.InstanceAlert.instance:type_name -> servicemanager.v3.InstanceIdent - 25, // 74: servicemanager.v3.SMService.RegisterSM:input_type -> servicemanager.v3.SMOutgoingMessages - 1, // 75: servicemanager.v3.SMService.RegisterSM:output_type -> servicemanager.v3.SMIncomingMessages - 75, // [75:76] is the sub-list for method output_type - 74, // [74:75] is the sub-list for method input_type - 74, // [74:74] is the sub-list for extension type_name - 74, // [74:74] is the sub-list for extension extendee - 0, // [0:74] is the sub-list for field type_name -} - -func init() { file_servicemanager_v3_servicemanager_proto_init() } -func file_servicemanager_v3_servicemanager_proto_init() { - if File_servicemanager_v3_servicemanager_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_servicemanager_v3_servicemanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMIncomingMessages); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUnitConfigStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckUnitConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetUnitConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateNetworks); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClockSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RunInstances); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LayerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VersionInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FirewallRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkParameters); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OverrideEnvVars); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OverrideInstanceEnvVar); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnvVarInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceCrashLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetNodeMonitoring); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnectionStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageContentInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageContent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMOutgoingMessages); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeConfiguration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Partition); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnitConfigStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RunInstancesStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateInstancesStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceIdent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ErrorInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OverrideEnvVarStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnvVarInstanceStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnvVarStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LogData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeMonitoring); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MonitoringData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PartitionUsage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceMonitoring); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Alert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageContentRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClockSyncRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemQuotaAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceQuotaAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceAllocateAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceValidateAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceValidateErrors); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CoreAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_servicemanager_v3_servicemanager_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*SMIncomingMessages_GetUnitConfigStatus)(nil), - (*SMIncomingMessages_CheckUnitConfig)(nil), - (*SMIncomingMessages_SetUnitConfig)(nil), - (*SMIncomingMessages_RunInstances)(nil), - (*SMIncomingMessages_OverrideEnvVars)(nil), - (*SMIncomingMessages_SystemLogRequest)(nil), - (*SMIncomingMessages_InstanceLogRequest)(nil), - (*SMIncomingMessages_InstanceCrashLogRequest)(nil), - (*SMIncomingMessages_GetNodeMonitoring)(nil), - (*SMIncomingMessages_ConnectionStatus)(nil), - (*SMIncomingMessages_ImageContentInfo)(nil), - (*SMIncomingMessages_ImageContent)(nil), - (*SMIncomingMessages_UpdateNetworks)(nil), - (*SMIncomingMessages_ClockSync)(nil), - } - file_servicemanager_v3_servicemanager_proto_msgTypes[24].OneofWrappers = []interface{}{ - (*SMOutgoingMessages_NodeConfiguration)(nil), - (*SMOutgoingMessages_UnitConfigStatus)(nil), - (*SMOutgoingMessages_RunInstancesStatus)(nil), - (*SMOutgoingMessages_UpdateInstancesStatus)(nil), - (*SMOutgoingMessages_OverrideEnvVarStatus)(nil), - (*SMOutgoingMessages_Log)(nil), - (*SMOutgoingMessages_NodeMonitoring)(nil), - (*SMOutgoingMessages_Alert)(nil), - (*SMOutgoingMessages_ImageContentRequest)(nil), - (*SMOutgoingMessages_ClockSyncRequest)(nil), - } - file_servicemanager_v3_servicemanager_proto_msgTypes[41].OneofWrappers = []interface{}{ - (*Alert_SystemQuotaAlert)(nil), - (*Alert_InstanceQuotaAlert)(nil), - (*Alert_ResourceValidateAlert)(nil), - (*Alert_DeviceAllocateAlert)(nil), - (*Alert_SystemAlert)(nil), - (*Alert_CoreAlert)(nil), - (*Alert_InstanceAlert)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_servicemanager_v3_servicemanager_proto_rawDesc, - NumEnums: 1, - NumMessages: 52, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_servicemanager_v3_servicemanager_proto_goTypes, - DependencyIndexes: file_servicemanager_v3_servicemanager_proto_depIdxs, - EnumInfos: file_servicemanager_v3_servicemanager_proto_enumTypes, - MessageInfos: file_servicemanager_v3_servicemanager_proto_msgTypes, - }.Build() - File_servicemanager_v3_servicemanager_proto = out.File - file_servicemanager_v3_servicemanager_proto_rawDesc = nil - file_servicemanager_v3_servicemanager_proto_goTypes = nil - file_servicemanager_v3_servicemanager_proto_depIdxs = nil -} diff --git a/vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager.pb.go b/vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager.pb.go new file mode 100644 index 00000000..8abefab0 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager.pb.go @@ -0,0 +1,918 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.26.0 +// source: updatemanager/v2/updatemanager.proto + +package updatemanager + +import ( + common "github.com/aosedge/aos_common/api/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type UpdateState int32 + +const ( + UpdateState_IDLE UpdateState = 0 + UpdateState_PREPARED UpdateState = 1 + UpdateState_UPDATED UpdateState = 2 + UpdateState_FAILED UpdateState = 3 +) + +// Enum value maps for UpdateState. +var ( + UpdateState_name = map[int32]string{ + 0: "IDLE", + 1: "PREPARED", + 2: "UPDATED", + 3: "FAILED", + } + UpdateState_value = map[string]int32{ + "IDLE": 0, + "PREPARED": 1, + "UPDATED": 2, + "FAILED": 3, + } +) + +func (x UpdateState) Enum() *UpdateState { + p := new(UpdateState) + *p = x + return p +} + +func (x UpdateState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UpdateState) Descriptor() protoreflect.EnumDescriptor { + return file_updatemanager_v2_updatemanager_proto_enumTypes[0].Descriptor() +} + +func (UpdateState) Type() protoreflect.EnumType { + return &file_updatemanager_v2_updatemanager_proto_enumTypes[0] +} + +func (x UpdateState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UpdateState.Descriptor instead. +func (UpdateState) EnumDescriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{0} +} + +type ComponentState int32 + +const ( + ComponentState_INSTALLED ComponentState = 0 + ComponentState_INSTALLING ComponentState = 1 + ComponentState_ERROR ComponentState = 2 +) + +// Enum value maps for ComponentState. +var ( + ComponentState_name = map[int32]string{ + 0: "INSTALLED", + 1: "INSTALLING", + 2: "ERROR", + } + ComponentState_value = map[string]int32{ + "INSTALLED": 0, + "INSTALLING": 1, + "ERROR": 2, + } +) + +func (x ComponentState) Enum() *ComponentState { + p := new(ComponentState) + *p = x + return p +} + +func (x ComponentState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ComponentState) Descriptor() protoreflect.EnumDescriptor { + return file_updatemanager_v2_updatemanager_proto_enumTypes[1].Descriptor() +} + +func (ComponentState) Type() protoreflect.EnumType { + return &file_updatemanager_v2_updatemanager_proto_enumTypes[1] +} + +func (x ComponentState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ComponentState.Descriptor instead. +func (ComponentState) EnumDescriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{1} +} + +type CMMessages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to CMMessage: + // + // *CMMessages_PrepareUpdate + // *CMMessages_StartUpdate + // *CMMessages_ApplyUpdate + // *CMMessages_RevertUpdate + CMMessage isCMMessages_CMMessage `protobuf_oneof:"CMMessage"` +} + +func (x *CMMessages) Reset() { + *x = CMMessages{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CMMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMMessages) ProtoMessage() {} + +func (x *CMMessages) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CMMessages.ProtoReflect.Descriptor instead. +func (*CMMessages) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{0} +} + +func (m *CMMessages) GetCMMessage() isCMMessages_CMMessage { + if m != nil { + return m.CMMessage + } + return nil +} + +func (x *CMMessages) GetPrepareUpdate() *PrepareUpdate { + if x, ok := x.GetCMMessage().(*CMMessages_PrepareUpdate); ok { + return x.PrepareUpdate + } + return nil +} + +func (x *CMMessages) GetStartUpdate() *StartUpdate { + if x, ok := x.GetCMMessage().(*CMMessages_StartUpdate); ok { + return x.StartUpdate + } + return nil +} + +func (x *CMMessages) GetApplyUpdate() *ApplyUpdate { + if x, ok := x.GetCMMessage().(*CMMessages_ApplyUpdate); ok { + return x.ApplyUpdate + } + return nil +} + +func (x *CMMessages) GetRevertUpdate() *RevertUpdate { + if x, ok := x.GetCMMessage().(*CMMessages_RevertUpdate); ok { + return x.RevertUpdate + } + return nil +} + +type isCMMessages_CMMessage interface { + isCMMessages_CMMessage() +} + +type CMMessages_PrepareUpdate struct { + PrepareUpdate *PrepareUpdate `protobuf:"bytes,1,opt,name=prepare_update,json=prepareUpdate,proto3,oneof"` +} + +type CMMessages_StartUpdate struct { + StartUpdate *StartUpdate `protobuf:"bytes,2,opt,name=start_update,json=startUpdate,proto3,oneof"` +} + +type CMMessages_ApplyUpdate struct { + ApplyUpdate *ApplyUpdate `protobuf:"bytes,3,opt,name=apply_update,json=applyUpdate,proto3,oneof"` +} + +type CMMessages_RevertUpdate struct { + RevertUpdate *RevertUpdate `protobuf:"bytes,4,opt,name=revert_update,json=revertUpdate,proto3,oneof"` +} + +func (*CMMessages_PrepareUpdate) isCMMessages_CMMessage() {} + +func (*CMMessages_StartUpdate) isCMMessages_CMMessage() {} + +func (*CMMessages_ApplyUpdate) isCMMessages_CMMessage() {} + +func (*CMMessages_RevertUpdate) isCMMessages_CMMessage() {} + +type PrepareComponentInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ComponentId string `protobuf:"bytes,1,opt,name=component_id,json=componentId,proto3" json:"component_id,omitempty"` + ComponentType string `protobuf:"bytes,2,opt,name=component_type,json=componentType,proto3" json:"component_type,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Annotations string `protobuf:"bytes,4,opt,name=annotations,proto3" json:"annotations,omitempty"` + Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"` + Sha256 []byte `protobuf:"bytes,6,opt,name=sha256,proto3" json:"sha256,omitempty"` + Size uint64 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *PrepareComponentInfo) Reset() { + *x = PrepareComponentInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareComponentInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareComponentInfo) ProtoMessage() {} + +func (x *PrepareComponentInfo) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareComponentInfo.ProtoReflect.Descriptor instead. +func (*PrepareComponentInfo) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{1} +} + +func (x *PrepareComponentInfo) GetComponentId() string { + if x != nil { + return x.ComponentId + } + return "" +} + +func (x *PrepareComponentInfo) GetComponentType() string { + if x != nil { + return x.ComponentType + } + return "" +} + +func (x *PrepareComponentInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *PrepareComponentInfo) GetAnnotations() string { + if x != nil { + return x.Annotations + } + return "" +} + +func (x *PrepareComponentInfo) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *PrepareComponentInfo) GetSha256() []byte { + if x != nil { + return x.Sha256 + } + return nil +} + +func (x *PrepareComponentInfo) GetSize() uint64 { + if x != nil { + return x.Size + } + return 0 +} + +type PrepareUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Components []*PrepareComponentInfo `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` +} + +func (x *PrepareUpdate) Reset() { + *x = PrepareUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareUpdate) ProtoMessage() {} + +func (x *PrepareUpdate) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareUpdate.ProtoReflect.Descriptor instead. +func (*PrepareUpdate) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{2} +} + +func (x *PrepareUpdate) GetComponents() []*PrepareComponentInfo { + if x != nil { + return x.Components + } + return nil +} + +type StartUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StartUpdate) Reset() { + *x = StartUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartUpdate) ProtoMessage() {} + +func (x *StartUpdate) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartUpdate.ProtoReflect.Descriptor instead. +func (*StartUpdate) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{3} +} + +type ApplyUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ApplyUpdate) Reset() { + *x = ApplyUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyUpdate) ProtoMessage() {} + +func (x *ApplyUpdate) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyUpdate.ProtoReflect.Descriptor instead. +func (*ApplyUpdate) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{4} +} + +type RevertUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RevertUpdate) Reset() { + *x = RevertUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RevertUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevertUpdate) ProtoMessage() {} + +func (x *RevertUpdate) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RevertUpdate.ProtoReflect.Descriptor instead. +func (*RevertUpdate) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{5} +} + +type ComponentStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ComponentId string `protobuf:"bytes,1,opt,name=component_id,json=componentId,proto3" json:"component_id,omitempty"` + ComponentType string `protobuf:"bytes,2,opt,name=component_type,json=componentType,proto3" json:"component_type,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + State ComponentState `protobuf:"varint,4,opt,name=state,proto3,enum=updatemanager.v2.ComponentState" json:"state,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *ComponentStatus) Reset() { + *x = ComponentStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComponentStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentStatus) ProtoMessage() {} + +func (x *ComponentStatus) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentStatus.ProtoReflect.Descriptor instead. +func (*ComponentStatus) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{6} +} + +func (x *ComponentStatus) GetComponentId() string { + if x != nil { + return x.ComponentId + } + return "" +} + +func (x *ComponentStatus) GetComponentType() string { + if x != nil { + return x.ComponentType + } + return "" +} + +func (x *ComponentStatus) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ComponentStatus) GetState() ComponentState { + if x != nil { + return x.State + } + return ComponentState_INSTALLED +} + +func (x *ComponentStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +type UpdateStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Priority uint32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"` + UpdateState UpdateState `protobuf:"varint,3,opt,name=update_state,json=updateState,proto3,enum=updatemanager.v2.UpdateState" json:"update_state,omitempty"` + Components []*ComponentStatus `protobuf:"bytes,4,rep,name=components,proto3" json:"components,omitempty"` + Error *common.ErrorInfo `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *UpdateStatus) Reset() { + *x = UpdateStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateStatus) ProtoMessage() {} + +func (x *UpdateStatus) ProtoReflect() protoreflect.Message { + mi := &file_updatemanager_v2_updatemanager_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateStatus.ProtoReflect.Descriptor instead. +func (*UpdateStatus) Descriptor() ([]byte, []int) { + return file_updatemanager_v2_updatemanager_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateStatus) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *UpdateStatus) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *UpdateStatus) GetUpdateState() UpdateState { + if x != nil { + return x.UpdateState + } + return UpdateState_IDLE +} + +func (x *UpdateStatus) GetComponents() []*ComponentStatus { + if x != nil { + return x.Components + } + return nil +} + +func (x *UpdateStatus) GetError() *common.ErrorInfo { + if x != nil { + return x.Error + } + return nil +} + +var File_updatemanager_v2_updatemanager_proto protoreflect.FileDescriptor + +var file_updatemanager_v2_updatemanager_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, + 0x76, 0x32, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x1a, 0x16, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xb2, 0x02, 0x0a, 0x0a, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, + 0x48, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, + 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x70, 0x72, 0x65, 0x70, + 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x76, 0x32, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, + 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x42, 0x0a, + 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x12, 0x45, 0x0a, 0x0d, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x76, 0x65, + 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x43, 0x4d, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xda, 0x01, 0x0a, 0x14, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, + 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, + 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x22, 0x57, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x46, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, + 0x72, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x0d, 0x0a, 0x0b, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x0e, 0x0a, 0x0c, 0x52, 0x65, 0x76, + 0x65, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0xd9, 0x01, 0x0a, 0x0f, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x20, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xf4, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x40, 0x0a, 0x0c, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1d, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x41, 0x0a, + 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, 0x3e, 0x0a, 0x0b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x49, + 0x44, 0x4c, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x50, 0x41, 0x52, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x3a, 0x0a, 0x0e, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, + 0x0a, 0x09, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, + 0x0a, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, + 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0x5d, 0x0a, 0x09, 0x55, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x55, 0x4d, 0x12, 0x1e, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_updatemanager_v2_updatemanager_proto_rawDescOnce sync.Once + file_updatemanager_v2_updatemanager_proto_rawDescData = file_updatemanager_v2_updatemanager_proto_rawDesc +) + +func file_updatemanager_v2_updatemanager_proto_rawDescGZIP() []byte { + file_updatemanager_v2_updatemanager_proto_rawDescOnce.Do(func() { + file_updatemanager_v2_updatemanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_updatemanager_v2_updatemanager_proto_rawDescData) + }) + return file_updatemanager_v2_updatemanager_proto_rawDescData +} + +var file_updatemanager_v2_updatemanager_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_updatemanager_v2_updatemanager_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_updatemanager_v2_updatemanager_proto_goTypes = []interface{}{ + (UpdateState)(0), // 0: updatemanager.v2.UpdateState + (ComponentState)(0), // 1: updatemanager.v2.ComponentState + (*CMMessages)(nil), // 2: updatemanager.v2.CMMessages + (*PrepareComponentInfo)(nil), // 3: updatemanager.v2.PrepareComponentInfo + (*PrepareUpdate)(nil), // 4: updatemanager.v2.PrepareUpdate + (*StartUpdate)(nil), // 5: updatemanager.v2.StartUpdate + (*ApplyUpdate)(nil), // 6: updatemanager.v2.ApplyUpdate + (*RevertUpdate)(nil), // 7: updatemanager.v2.RevertUpdate + (*ComponentStatus)(nil), // 8: updatemanager.v2.ComponentStatus + (*UpdateStatus)(nil), // 9: updatemanager.v2.UpdateStatus + (*common.ErrorInfo)(nil), // 10: common.v1.ErrorInfo +} +var file_updatemanager_v2_updatemanager_proto_depIdxs = []int32{ + 4, // 0: updatemanager.v2.CMMessages.prepare_update:type_name -> updatemanager.v2.PrepareUpdate + 5, // 1: updatemanager.v2.CMMessages.start_update:type_name -> updatemanager.v2.StartUpdate + 6, // 2: updatemanager.v2.CMMessages.apply_update:type_name -> updatemanager.v2.ApplyUpdate + 7, // 3: updatemanager.v2.CMMessages.revert_update:type_name -> updatemanager.v2.RevertUpdate + 3, // 4: updatemanager.v2.PrepareUpdate.components:type_name -> updatemanager.v2.PrepareComponentInfo + 1, // 5: updatemanager.v2.ComponentStatus.state:type_name -> updatemanager.v2.ComponentState + 10, // 6: updatemanager.v2.ComponentStatus.error:type_name -> common.v1.ErrorInfo + 0, // 7: updatemanager.v2.UpdateStatus.update_state:type_name -> updatemanager.v2.UpdateState + 8, // 8: updatemanager.v2.UpdateStatus.components:type_name -> updatemanager.v2.ComponentStatus + 10, // 9: updatemanager.v2.UpdateStatus.error:type_name -> common.v1.ErrorInfo + 9, // 10: updatemanager.v2.UMService.RegisterUM:input_type -> updatemanager.v2.UpdateStatus + 2, // 11: updatemanager.v2.UMService.RegisterUM:output_type -> updatemanager.v2.CMMessages + 11, // [11:12] is the sub-list for method output_type + 10, // [10:11] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_updatemanager_v2_updatemanager_proto_init() } +func file_updatemanager_v2_updatemanager_proto_init() { + if File_updatemanager_v2_updatemanager_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_updatemanager_v2_updatemanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CMMessages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareComponentInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RevertUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComponentStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_updatemanager_v2_updatemanager_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*CMMessages_PrepareUpdate)(nil), + (*CMMessages_StartUpdate)(nil), + (*CMMessages_ApplyUpdate)(nil), + (*CMMessages_RevertUpdate)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_updatemanager_v2_updatemanager_proto_rawDesc, + NumEnums: 2, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_updatemanager_v2_updatemanager_proto_goTypes, + DependencyIndexes: file_updatemanager_v2_updatemanager_proto_depIdxs, + EnumInfos: file_updatemanager_v2_updatemanager_proto_enumTypes, + MessageInfos: file_updatemanager_v2_updatemanager_proto_msgTypes, + }.Build() + File_updatemanager_v2_updatemanager_proto = out.File + file_updatemanager_v2_updatemanager_proto_rawDesc = nil + file_updatemanager_v2_updatemanager_proto_goTypes = nil + file_updatemanager_v2_updatemanager_proto_depIdxs = nil +} diff --git a/vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager_grpc.pb.go b/vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager_grpc.pb.go similarity index 93% rename from vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager_grpc.pb.go rename to vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager_grpc.pb.go index 7c586083..9ec4aa52 100644 --- a/vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager_grpc.pb.go +++ b/vendor/github.com/aosedge/aos_common/api/updatemanager/updatemanager_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.26.0 +// source: updatemanager/v2/updatemanager.proto package updatemanager @@ -30,7 +34,7 @@ func NewUMServiceClient(cc grpc.ClientConnInterface) UMServiceClient { } func (c *uMServiceClient) RegisterUM(ctx context.Context, opts ...grpc.CallOption) (UMService_RegisterUMClient, error) { - stream, err := c.cc.NewStream(ctx, &UMService_ServiceDesc.Streams[0], "/updatemanager.v1.UMService/RegisterUM", opts...) + stream, err := c.cc.NewStream(ctx, &UMService_ServiceDesc.Streams[0], "/updatemanager.v2.UMService/RegisterUM", opts...) if err != nil { return nil, err } @@ -118,7 +122,7 @@ func (x *uMServiceRegisterUMServer) Recv() (*UpdateStatus, error) { // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var UMService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "updatemanager.v1.UMService", + ServiceName: "updatemanager.v2.UMService", HandlerType: (*UMServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ @@ -129,5 +133,5 @@ var UMService_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "updatemanager/v1/updatemanager.proto", + Metadata: "updatemanager/v2/updatemanager.proto", } diff --git a/vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager.pb.go b/vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager.pb.go deleted file mode 100644 index 7e4ed44f..00000000 --- a/vendor/github.com/aosedge/aos_common/api/updatemanager/v1/updatemanager.pb.go +++ /dev/null @@ -1,906 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.6.1 -// source: updatemanager/v1/updatemanager.proto - -package updatemanager - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type UmState int32 - -const ( - UmState_IDLE UmState = 0 - UmState_PREPARED UmState = 1 - UmState_UPDATED UmState = 2 - UmState_FAILED UmState = 3 -) - -// Enum value maps for UmState. -var ( - UmState_name = map[int32]string{ - 0: "IDLE", - 1: "PREPARED", - 2: "UPDATED", - 3: "FAILED", - } - UmState_value = map[string]int32{ - "IDLE": 0, - "PREPARED": 1, - "UPDATED": 2, - "FAILED": 3, - } -) - -func (x UmState) Enum() *UmState { - p := new(UmState) - *p = x - return p -} - -func (x UmState) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UmState) Descriptor() protoreflect.EnumDescriptor { - return file_updatemanager_v1_updatemanager_proto_enumTypes[0].Descriptor() -} - -func (UmState) Type() protoreflect.EnumType { - return &file_updatemanager_v1_updatemanager_proto_enumTypes[0] -} - -func (x UmState) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UmState.Descriptor instead. -func (UmState) EnumDescriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{0} -} - -type ComponentStatus int32 - -const ( - ComponentStatus_INSTALLED ComponentStatus = 0 - ComponentStatus_INSTALLING ComponentStatus = 1 - ComponentStatus_ERROR ComponentStatus = 2 -) - -// Enum value maps for ComponentStatus. -var ( - ComponentStatus_name = map[int32]string{ - 0: "INSTALLED", - 1: "INSTALLING", - 2: "ERROR", - } - ComponentStatus_value = map[string]int32{ - "INSTALLED": 0, - "INSTALLING": 1, - "ERROR": 2, - } -) - -func (x ComponentStatus) Enum() *ComponentStatus { - p := new(ComponentStatus) - *p = x - return p -} - -func (x ComponentStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ComponentStatus) Descriptor() protoreflect.EnumDescriptor { - return file_updatemanager_v1_updatemanager_proto_enumTypes[1].Descriptor() -} - -func (ComponentStatus) Type() protoreflect.EnumType { - return &file_updatemanager_v1_updatemanager_proto_enumTypes[1] -} - -func (x ComponentStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ComponentStatus.Descriptor instead. -func (ComponentStatus) EnumDescriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{1} -} - -type CMMessages struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CMMessage: - // *CMMessages_PrepareUpdate - // *CMMessages_StartUpdate - // *CMMessages_ApplyUpdate - // *CMMessages_RevertUpdate - CMMessage isCMMessages_CMMessage `protobuf_oneof:"CMMessage"` -} - -func (x *CMMessages) Reset() { - *x = CMMessages{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CMMessages) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CMMessages) ProtoMessage() {} - -func (x *CMMessages) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CMMessages.ProtoReflect.Descriptor instead. -func (*CMMessages) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{0} -} - -func (m *CMMessages) GetCMMessage() isCMMessages_CMMessage { - if m != nil { - return m.CMMessage - } - return nil -} - -func (x *CMMessages) GetPrepareUpdate() *PrepareUpdate { - if x, ok := x.GetCMMessage().(*CMMessages_PrepareUpdate); ok { - return x.PrepareUpdate - } - return nil -} - -func (x *CMMessages) GetStartUpdate() *StartUpdate { - if x, ok := x.GetCMMessage().(*CMMessages_StartUpdate); ok { - return x.StartUpdate - } - return nil -} - -func (x *CMMessages) GetApplyUpdate() *ApplyUpdate { - if x, ok := x.GetCMMessage().(*CMMessages_ApplyUpdate); ok { - return x.ApplyUpdate - } - return nil -} - -func (x *CMMessages) GetRevertUpdate() *RevertUpdate { - if x, ok := x.GetCMMessage().(*CMMessages_RevertUpdate); ok { - return x.RevertUpdate - } - return nil -} - -type isCMMessages_CMMessage interface { - isCMMessages_CMMessage() -} - -type CMMessages_PrepareUpdate struct { - PrepareUpdate *PrepareUpdate `protobuf:"bytes,1,opt,name=prepare_update,json=prepareUpdate,proto3,oneof"` -} - -type CMMessages_StartUpdate struct { - StartUpdate *StartUpdate `protobuf:"bytes,2,opt,name=start_update,json=startUpdate,proto3,oneof"` -} - -type CMMessages_ApplyUpdate struct { - ApplyUpdate *ApplyUpdate `protobuf:"bytes,3,opt,name=apply_update,json=applyUpdate,proto3,oneof"` -} - -type CMMessages_RevertUpdate struct { - RevertUpdate *RevertUpdate `protobuf:"bytes,4,opt,name=revert_update,json=revertUpdate,proto3,oneof"` -} - -func (*CMMessages_PrepareUpdate) isCMMessages_CMMessage() {} - -func (*CMMessages_StartUpdate) isCMMessages_CMMessage() {} - -func (*CMMessages_ApplyUpdate) isCMMessages_CMMessage() {} - -func (*CMMessages_RevertUpdate) isCMMessages_CMMessage() {} - -type PrepareComponentInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - VendorVersion string `protobuf:"bytes,2,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` - AosVersion uint64 `protobuf:"varint,3,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - Annotations string `protobuf:"bytes,4,opt,name=annotations,proto3" json:"annotations,omitempty"` - Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"` - Sha256 []byte `protobuf:"bytes,6,opt,name=sha256,proto3" json:"sha256,omitempty"` - Sha512 []byte `protobuf:"bytes,7,opt,name=sha512,proto3" json:"sha512,omitempty"` - Size uint64 `protobuf:"varint,8,opt,name=size,proto3" json:"size,omitempty"` -} - -func (x *PrepareComponentInfo) Reset() { - *x = PrepareComponentInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrepareComponentInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrepareComponentInfo) ProtoMessage() {} - -func (x *PrepareComponentInfo) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PrepareComponentInfo.ProtoReflect.Descriptor instead. -func (*PrepareComponentInfo) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{1} -} - -func (x *PrepareComponentInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *PrepareComponentInfo) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -func (x *PrepareComponentInfo) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *PrepareComponentInfo) GetAnnotations() string { - if x != nil { - return x.Annotations - } - return "" -} - -func (x *PrepareComponentInfo) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *PrepareComponentInfo) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *PrepareComponentInfo) GetSha512() []byte { - if x != nil { - return x.Sha512 - } - return nil -} - -func (x *PrepareComponentInfo) GetSize() uint64 { - if x != nil { - return x.Size - } - return 0 -} - -type PrepareUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Components []*PrepareComponentInfo `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` -} - -func (x *PrepareUpdate) Reset() { - *x = PrepareUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrepareUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrepareUpdate) ProtoMessage() {} - -func (x *PrepareUpdate) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PrepareUpdate.ProtoReflect.Descriptor instead. -func (*PrepareUpdate) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{2} -} - -func (x *PrepareUpdate) GetComponents() []*PrepareComponentInfo { - if x != nil { - return x.Components - } - return nil -} - -type StartUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StartUpdate) Reset() { - *x = StartUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StartUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartUpdate) ProtoMessage() {} - -func (x *StartUpdate) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StartUpdate.ProtoReflect.Descriptor instead. -func (*StartUpdate) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{3} -} - -type ApplyUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ApplyUpdate) Reset() { - *x = ApplyUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApplyUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApplyUpdate) ProtoMessage() {} - -func (x *ApplyUpdate) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApplyUpdate.ProtoReflect.Descriptor instead. -func (*ApplyUpdate) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{4} -} - -type RevertUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RevertUpdate) Reset() { - *x = RevertUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RevertUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RevertUpdate) ProtoMessage() {} - -func (x *RevertUpdate) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RevertUpdate.ProtoReflect.Descriptor instead. -func (*RevertUpdate) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{5} -} - -type SystemComponent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - VendorVersion string `protobuf:"bytes,2,opt,name=vendor_version,json=vendorVersion,proto3" json:"vendor_version,omitempty"` - AosVersion uint64 `protobuf:"varint,3,opt,name=aos_version,json=aosVersion,proto3" json:"aos_version,omitempty"` - Status ComponentStatus `protobuf:"varint,4,opt,name=status,proto3,enum=updatemanager.v1.ComponentStatus" json:"status,omitempty"` - Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *SystemComponent) Reset() { - *x = SystemComponent{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemComponent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemComponent) ProtoMessage() {} - -func (x *SystemComponent) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemComponent.ProtoReflect.Descriptor instead. -func (*SystemComponent) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{6} -} - -func (x *SystemComponent) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *SystemComponent) GetVendorVersion() string { - if x != nil { - return x.VendorVersion - } - return "" -} - -func (x *SystemComponent) GetAosVersion() uint64 { - if x != nil { - return x.AosVersion - } - return 0 -} - -func (x *SystemComponent) GetStatus() ComponentStatus { - if x != nil { - return x.Status - } - return ComponentStatus_INSTALLED -} - -func (x *SystemComponent) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type UpdateStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UmId string `protobuf:"bytes,1,opt,name=um_id,json=umId,proto3" json:"um_id,omitempty"` - UmState UmState `protobuf:"varint,2,opt,name=um_state,json=umState,proto3,enum=updatemanager.v1.UmState" json:"um_state,omitempty"` - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` - Components []*SystemComponent `protobuf:"bytes,4,rep,name=components,proto3" json:"components,omitempty"` -} - -func (x *UpdateStatus) Reset() { - *x = UpdateStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateStatus) ProtoMessage() {} - -func (x *UpdateStatus) ProtoReflect() protoreflect.Message { - mi := &file_updatemanager_v1_updatemanager_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateStatus.ProtoReflect.Descriptor instead. -func (*UpdateStatus) Descriptor() ([]byte, []int) { - return file_updatemanager_v1_updatemanager_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateStatus) GetUmId() string { - if x != nil { - return x.UmId - } - return "" -} - -func (x *UpdateStatus) GetUmState() UmState { - if x != nil { - return x.UmState - } - return UmState_IDLE -} - -func (x *UpdateStatus) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -func (x *UpdateStatus) GetComponents() []*SystemComponent { - if x != nil { - return x.Components - } - return nil -} - -var File_updatemanager_v1_updatemanager_proto protoreflect.FileDescriptor - -var file_updatemanager_v1_updatemanager_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, - 0x76, 0x31, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0xb2, 0x02, 0x0a, 0x0a, 0x43, 0x4d, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x70, 0x61, - 0x72, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x48, 0x00, 0x52, 0x0d, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x5f, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x70, 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x45, 0x0a, 0x0d, 0x72, 0x65, 0x76, - 0x65, 0x72, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x48, 0x00, 0x52, 0x0c, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x42, 0x0b, 0x0a, 0x09, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xe6, 0x01, - 0x0a, 0x14, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, - 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, - 0x0b, 0x61, 0x6f, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0a, 0x61, 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, - 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, - 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, - 0x61, 0x35, 0x31, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x35, - 0x31, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x57, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, - 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x46, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x22, - 0x0d, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x0d, - 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x0e, 0x0a, - 0x0c, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0xba, 0x01, - 0x0a, 0x0f, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6f, 0x73, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x61, - 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xb2, 0x01, 0x0a, 0x0c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x75, - 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6d, 0x49, 0x64, - 0x12, 0x34, 0x0a, 0x08, 0x75, 0x6d, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x07, 0x75, - 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x41, 0x0a, 0x0a, - 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2a, - 0x3a, 0x0a, 0x07, 0x55, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x44, - 0x4c, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x50, 0x41, 0x52, 0x45, 0x44, - 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x3b, 0x0a, 0x0f, 0x43, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, - 0x0a, 0x09, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, - 0x0a, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, - 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0x5d, 0x0a, 0x09, 0x55, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x55, 0x4d, 0x12, 0x1e, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_updatemanager_v1_updatemanager_proto_rawDescOnce sync.Once - file_updatemanager_v1_updatemanager_proto_rawDescData = file_updatemanager_v1_updatemanager_proto_rawDesc -) - -func file_updatemanager_v1_updatemanager_proto_rawDescGZIP() []byte { - file_updatemanager_v1_updatemanager_proto_rawDescOnce.Do(func() { - file_updatemanager_v1_updatemanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_updatemanager_v1_updatemanager_proto_rawDescData) - }) - return file_updatemanager_v1_updatemanager_proto_rawDescData -} - -var file_updatemanager_v1_updatemanager_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_updatemanager_v1_updatemanager_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_updatemanager_v1_updatemanager_proto_goTypes = []interface{}{ - (UmState)(0), // 0: updatemanager.v1.UmState - (ComponentStatus)(0), // 1: updatemanager.v1.ComponentStatus - (*CMMessages)(nil), // 2: updatemanager.v1.CMMessages - (*PrepareComponentInfo)(nil), // 3: updatemanager.v1.PrepareComponentInfo - (*PrepareUpdate)(nil), // 4: updatemanager.v1.PrepareUpdate - (*StartUpdate)(nil), // 5: updatemanager.v1.StartUpdate - (*ApplyUpdate)(nil), // 6: updatemanager.v1.ApplyUpdate - (*RevertUpdate)(nil), // 7: updatemanager.v1.RevertUpdate - (*SystemComponent)(nil), // 8: updatemanager.v1.SystemComponent - (*UpdateStatus)(nil), // 9: updatemanager.v1.UpdateStatus -} -var file_updatemanager_v1_updatemanager_proto_depIdxs = []int32{ - 4, // 0: updatemanager.v1.CMMessages.prepare_update:type_name -> updatemanager.v1.PrepareUpdate - 5, // 1: updatemanager.v1.CMMessages.start_update:type_name -> updatemanager.v1.StartUpdate - 6, // 2: updatemanager.v1.CMMessages.apply_update:type_name -> updatemanager.v1.ApplyUpdate - 7, // 3: updatemanager.v1.CMMessages.revert_update:type_name -> updatemanager.v1.RevertUpdate - 3, // 4: updatemanager.v1.PrepareUpdate.components:type_name -> updatemanager.v1.PrepareComponentInfo - 1, // 5: updatemanager.v1.SystemComponent.status:type_name -> updatemanager.v1.ComponentStatus - 0, // 6: updatemanager.v1.UpdateStatus.um_state:type_name -> updatemanager.v1.UmState - 8, // 7: updatemanager.v1.UpdateStatus.components:type_name -> updatemanager.v1.SystemComponent - 9, // 8: updatemanager.v1.UMService.RegisterUM:input_type -> updatemanager.v1.UpdateStatus - 2, // 9: updatemanager.v1.UMService.RegisterUM:output_type -> updatemanager.v1.CMMessages - 9, // [9:10] is the sub-list for method output_type - 8, // [8:9] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name -} - -func init() { file_updatemanager_v1_updatemanager_proto_init() } -func file_updatemanager_v1_updatemanager_proto_init() { - if File_updatemanager_v1_updatemanager_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_updatemanager_v1_updatemanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMMessages); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrepareComponentInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrepareUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StartUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplyUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RevertUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemComponent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_updatemanager_v1_updatemanager_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*CMMessages_PrepareUpdate)(nil), - (*CMMessages_StartUpdate)(nil), - (*CMMessages_ApplyUpdate)(nil), - (*CMMessages_RevertUpdate)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_updatemanager_v1_updatemanager_proto_rawDesc, - NumEnums: 2, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_updatemanager_v1_updatemanager_proto_goTypes, - DependencyIndexes: file_updatemanager_v1_updatemanager_proto_depIdxs, - EnumInfos: file_updatemanager_v1_updatemanager_proto_enumTypes, - MessageInfos: file_updatemanager_v1_updatemanager_proto_msgTypes, - }.Build() - File_updatemanager_v1_updatemanager_proto = out.File - file_updatemanager_v1_updatemanager_proto_rawDesc = nil - file_updatemanager_v1_updatemanager_proto_goTypes = nil - file_updatemanager_v1_updatemanager_proto_depIdxs = nil -} diff --git a/vendor/github.com/aosedge/aos_common/image/image.go b/vendor/github.com/aosedge/aos_common/image/image.go index 12319ef6..d3f9061a 100644 --- a/vendor/github.com/aosedge/aos_common/image/image.go +++ b/vendor/github.com/aosedge/aos_common/image/image.go @@ -76,7 +76,6 @@ const ( // FileInfo file info. type FileInfo struct { Sha256 []byte - Sha512 []byte Size uint64 } @@ -152,20 +151,6 @@ func CheckFileInfo(ctx context.Context, fileName string, fileInfo FileInfo) (err return aoserrors.New("checksum sha256 mismatch") } - hash512 := sha3.New512() - - if _, err = file.Seek(0, io.SeekStart); err != nil { - return aoserrors.Wrap(err) - } - - if _, err := io.Copy(hash512, contextRead); err != nil { - return aoserrors.Wrap(err) - } - - if !reflect.DeepEqual(hash512.Sum(nil), fileInfo.Sha512) { - return aoserrors.New("checksum sha512 mismatch") - } - return nil } @@ -194,18 +179,6 @@ func CreateFileInfo(ctx context.Context, fileName string) (fileInfo FileInfo, er fileInfo.Sha256 = hash256.Sum(nil) - hash512 := sha3.New512() - - if _, err = file.Seek(0, io.SeekStart); err != nil { - return fileInfo, aoserrors.Wrap(err) - } - - if _, err := io.Copy(hash512, contextRead); err != nil { - return fileInfo, aoserrors.Wrap(err) - } - - fileInfo.Sha512 = hash512.Sum(nil) - return fileInfo, nil } diff --git a/vendor/github.com/aosedge/aos_common/journalalerts/journalalerts.go b/vendor/github.com/aosedge/aos_common/journalalerts/journalalerts.go index 5eefbd57..78ac05c2 100644 --- a/vendor/github.com/aosedge/aos_common/journalalerts/journalalerts.go +++ b/vendor/github.com/aosedge/aos_common/journalalerts/journalalerts.go @@ -55,12 +55,12 @@ const microSecondsInSecond = 1000000 // AlertSender alerts sender. type AlertSender interface { - SendAlert(alerts cloudprotocol.AlertItem) + SendAlert(alert interface{}) } // InstanceInfoProvider provides instance info. type InstanceInfoProvider interface { - GetInstanceInfoByID(instanceID string) (ident aostypes.InstanceIdent, aosVersion uint64, err error) + GetInstanceInfoByID(instanceID string) (ident aostypes.InstanceIdent, version string, err error) } // CursorStorage provides API to set and get journal cursor. @@ -305,25 +305,18 @@ func (instance *JournalAlerts) processJournal() (err error) { unit = systemdCgroup } - alert := cloudprotocol.AlertItem{ - Timestamp: time.Unix(int64(entry.RealtimeTimestamp/microSecondsInSecond), - int64((entry.RealtimeTimestamp%microSecondsInSecond)*1000)), - } - - if payload := instance.getServiceInstanceAlert(entry, unit); payload != nil { - alert.Tag = cloudprotocol.AlertTagServiceInstance - alert.Payload = *payload - } else if payload := instance.getCoreComponentAlert(entry, unit); payload != nil { - alert.Tag = cloudprotocol.AlertTagAosCore - alert.Payload = *payload - } else if payload := instance.getSystemAlert(entry); payload != nil { - alert.Tag = cloudprotocol.AlertTagSystemError - alert.Payload = *payload + if alert := instance.getServiceInstanceAlert(entry, unit); alert != nil { + alert.AlertItem = createAlertItem(entry, cloudprotocol.AlertTagServiceInstance) + instance.sender.SendAlert(*alert) + } else if alert := instance.getCoreComponentAlert(entry, unit); alert != nil { + alert.AlertItem = createAlertItem(entry, cloudprotocol.AlertTagAosCore) + instance.sender.SendAlert(*alert) + } else if alert := instance.getSystemAlert(entry); alert != nil { + alert.AlertItem = createAlertItem(entry, cloudprotocol.AlertTagSystemError) + instance.sender.SendAlert(*alert) } else { continue } - - instance.sender.SendAlert(alert) } } @@ -352,17 +345,23 @@ func (instance *JournalAlerts) getServiceInstanceAlert( instanceID = strings.TrimPrefix(instanceID, aosServicePrefix) instanceID = strings.TrimSuffix(instanceID, ".service") - instanceIdent, aosVersion, err := instance.instanceProvider.GetInstanceInfoByID(instanceID) + instanceIdent, version, err := instance.instanceProvider.GetInstanceInfoByID(instanceID) if err != nil { log.Errorf("Can't get instance info: %s", err) return nil } + alertItem := cloudprotocol.AlertItem{ + Timestamp: time.Now(), + Tag: cloudprotocol.AlertTagServiceInstance, + } + return &cloudprotocol.ServiceInstanceAlert{ - Message: entry.Fields[sdjournal.SD_JOURNAL_FIELD_MESSAGE], - InstanceIdent: instanceIdent, - AosVersion: aosVersion, + AlertItem: alertItem, + InstanceIdent: instanceIdent, + Message: entry.Fields[sdjournal.SD_JOURNAL_FIELD_MESSAGE], + ServiceVersion: version, } } @@ -393,3 +392,11 @@ func (instance *JournalAlerts) getSystemAlert(entry *sdjournal.JournalEntry) *cl return &cloudprotocol.SystemAlert{Message: entry.Fields[sdjournal.SD_JOURNAL_FIELD_MESSAGE]} } + +func createAlertItem(entry *sdjournal.JournalEntry, tag string) cloudprotocol.AlertItem { + return cloudprotocol.AlertItem{ + Tag: tag, + Timestamp: time.Unix(int64(entry.RealtimeTimestamp/microSecondsInSecond), + int64((entry.RealtimeTimestamp%microSecondsInSecond)*1000)), + } +} diff --git a/vendor/github.com/aosedge/aos_common/migration/migration.go b/vendor/github.com/aosedge/aos_common/migration/migration.go index cfa51f95..3a87c53e 100644 --- a/vendor/github.com/aosedge/aos_common/migration/migration.go +++ b/vendor/github.com/aosedge/aos_common/migration/migration.go @@ -181,6 +181,7 @@ func copyFile(src string, dst string) (err error) { return aoserrors.Wrap(err) } defer destination.Close() + _, err = io.Copy(destination, source) return aoserrors.Wrap(err) diff --git a/vendor/github.com/aosedge/aos_common/resourcemonitor/alertprocessor.go b/vendor/github.com/aosedge/aos_common/resourcemonitor/alertprocessor.go index 62a0e217..b5aa25f5 100644 --- a/vendor/github.com/aosedge/aos_common/resourcemonitor/alertprocessor.go +++ b/vendor/github.com/aosedge/aos_common/resourcemonitor/alertprocessor.go @@ -18,65 +18,158 @@ package resourcemonitor import ( + "math" "time" "github.com/aosedge/aos_common/aostypes" log "github.com/sirupsen/logrus" ) -type alertCallback func(time time.Time, value uint64) +/*********************************************************************************************************************** + * Consts + **********************************************************************************************************************/ + +const ( + AlertStatusRaise = "raise" + AlertStatusContinue = "continue" + AlertStatusFall = "fall" +) + +/*********************************************************************************************************************** + * Private + **********************************************************************************************************************/ + +type alertCallback func(time time.Time, value uint64, status string) // alertProcessor object for detection alerts. type alertProcessor struct { - name string - source *uint64 - callback alertCallback - rule aostypes.AlertRuleParam - thresholdTime time.Time - thresholdDetected bool + name string + source *uint64 + callback alertCallback + + minTimeout time.Duration + minThreshold uint64 + maxThreshold uint64 + minThresholdTime time.Time + maxThresholdTime time.Time + alertCondition bool } -// createAlertProcessor creates alert processor based on configuration. -func createAlertProcessor(name string, source *uint64, - callback alertCallback, rule aostypes.AlertRuleParam, +// createAlertProcessorPercents creates alert processor based on percents configuration. +func createAlertProcessorPercents(name string, source *uint64, maxValue uint64, + callback alertCallback, rule aostypes.AlertRulePercents, ) (alert *alertProcessor) { - log.WithFields(log.Fields{"rule": rule, "name": name}).Debugf("Create alert processor") + log.WithFields(log.Fields{"rule": rule, "name": name}).Debugf("Create alert percents processor") - return &alertProcessor{name: name, source: source, callback: callback, rule: rule} + return &alertProcessor{ + name: name, + source: source, + callback: callback, + minTimeout: rule.MinTimeout.Duration, + minThreshold: uint64(math.Round(float64(maxValue) * rule.MinThreshold / 100.0)), + maxThreshold: uint64(math.Round(float64(maxValue) * rule.MaxThreshold / 100.0)), + } +} + +// createAlertProcessorPoints creates alert processor based on points configuration. +func createAlertProcessorPoints(name string, source *uint64, + callback alertCallback, rule aostypes.AlertRulePoints, +) (alert *alertProcessor) { + log.WithFields(log.Fields{"rule": rule, "name": name}).Debugf("Create alert points processor") + + return &alertProcessor{ + name: name, + source: source, + callback: callback, + minTimeout: rule.MinTimeout.Duration, + minThreshold: rule.MinThreshold, + maxThreshold: rule.MaxThreshold, + } } // checkAlertDetection checks if alert was detected. func (alert *alertProcessor) checkAlertDetection(currentTime time.Time) { value := *alert.source - if value >= alert.rule.MaxThreshold && alert.thresholdTime.IsZero() { + if !alert.alertCondition { + alert.handleMaxThreshold(currentTime, value) + } else { + alert.handleMinThreshold(currentTime, value) + } +} + +func (alert *alertProcessor) handleMaxThreshold(currentTime time.Time, value uint64) { + if value >= alert.maxThreshold && alert.maxThresholdTime.IsZero() { log.WithFields(log.Fields{ - "name": alert.name, "maxThreshold": alert.rule.MaxThreshold, "value": value, + "name": alert.name, + "maxThreshold": alert.maxThreshold, + "value": value, + "currentTime": currentTime.Format("Jan 2 15:04:05.000"), }).Debugf("Max threshold crossed") - alert.thresholdTime = currentTime + alert.maxThresholdTime = currentTime } - if value < alert.rule.MinThreshold && !alert.thresholdTime.IsZero() { + if value >= alert.maxThreshold && !alert.maxThresholdTime.IsZero() && + currentTime.Sub(alert.maxThresholdTime) >= alert.minTimeout && !alert.alertCondition { + alert.alertCondition = true + alert.maxThresholdTime = currentTime + alert.minThresholdTime = time.Time{} + log.WithFields(log.Fields{ - "name": alert.name, "minThreshold": alert.rule.MinThreshold, "value": value, - }).Debugf("Min threshold crossed") + "name": alert.name, + "value": value, + "status": AlertStatusRaise, + "currentTime": currentTime.Format("Jan 2 15:04:05.000"), + }).Debugf("Resource alert") - alert.thresholdTime = time.Time{} - alert.thresholdDetected = false + alert.callback(currentTime, value, AlertStatusRaise) } - if !alert.thresholdTime.IsZero() && - currentTime.Sub(alert.thresholdTime) >= alert.rule.MinTimeout.Duration && - !alert.thresholdDetected { + if value < alert.maxThreshold && !alert.maxThresholdTime.IsZero() { + alert.maxThresholdTime = time.Time{} + } +} + +func (alert *alertProcessor) handleMinThreshold(currentTime time.Time, value uint64) { + if value <= alert.minThreshold && !alert.minThresholdTime.IsZero() && + currentTime.Sub(alert.minThresholdTime) >= alert.minTimeout { + alert.alertCondition = false + alert.minThresholdTime = currentTime + alert.maxThresholdTime = time.Time{} + + log.WithFields(log.Fields{ + "name": alert.name, + "value": value, + "status": AlertStatusFall, + "currentTime": currentTime.Format("Jan 2 15:04:05.000"), + }).Debugf("Resource alert") + + alert.callback(currentTime, value, AlertStatusFall) + } + + if currentTime.Sub(alert.maxThresholdTime) >= alert.minTimeout && alert.alertCondition { + alert.maxThresholdTime = currentTime + log.WithFields(log.Fields{ "name": alert.name, "value": value, - "currentTime": currentTime.Format("Jan 2 15:04:05"), + "status": AlertStatusContinue, + "currentTime": currentTime.Format("Jan 2 15:04:05.000"), }).Debugf("Resource alert") - alert.thresholdDetected = true + alert.callback(currentTime, value, AlertStatusContinue) + } + + if value <= alert.minThreshold && alert.minThresholdTime.IsZero() { + log.WithFields(log.Fields{ + "name": alert.name, "minThreshold": alert.minThreshold, "value": value, + }).Debugf("Min threshold crossed") + + alert.minThresholdTime = currentTime + } - alert.callback(currentTime, value) + if value > alert.maxThreshold && !alert.minThresholdTime.IsZero() { + alert.minThresholdTime = time.Time{} } } diff --git a/vendor/github.com/aosedge/aos_common/resourcemonitor/averagecalc.go b/vendor/github.com/aosedge/aos_common/resourcemonitor/averagecalc.go new file mode 100644 index 00000000..08cde759 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/resourcemonitor/averagecalc.go @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2024 Renesas Electronics Corporation. +// Copyright (C) 2024 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resourcemonitor + +import ( + "math" +) + +/*********************************************************************************************************************** + * Structs + **********************************************************************************************************************/ + +type averageCalc struct { + sum float64 + count uint64 + windowCount uint64 +} + +/*********************************************************************************************************************** + * Private + **********************************************************************************************************************/ + +func newAverageCalc(windowCount uint64) *averageCalc { + return &averageCalc{windowCount: windowCount} +} + +func (calc *averageCalc) calculate(value float64) float64 { + if calc.count < calc.windowCount { + calc.sum += value + calc.count++ + } else { + calc.sum -= calc.sum / float64(calc.count) + calc.sum += value + } + + return calc.getValue() +} + +func (calc *averageCalc) getValue() float64 { + if calc.count == 0 { + return 0 + } + + return calc.sum / float64(calc.count) +} + +func (calc *averageCalc) getIntValue() uint64 { + return uint64(math.Round(calc.getValue())) +} diff --git a/vendor/github.com/aosedge/aos_common/resourcemonitor/cgroupssystemusage.go b/vendor/github.com/aosedge/aos_common/resourcemonitor/cgroupssystemusage.go index 9ed6d97e..d148c82a 100644 --- a/vendor/github.com/aosedge/aos_common/resourcemonitor/cgroupssystemusage.go +++ b/vendor/github.com/aosedge/aos_common/resourcemonitor/cgroupssystemusage.go @@ -71,9 +71,9 @@ func (usageInstance *cgroupsSystemUsage) FillSystemInfo(instanceID string, insta instance.prevCPU = 0 } - instance.monitoringData.CPU = uint64(math.Round(float64(cpu-instance.prevCPU) * 100.0 / + instance.monitoring.CPU = uint64(math.Round(float64(cpu-instance.prevCPU) * 100.0 / (float64(now.Sub(instance.prevTime).Microseconds())) / float64(cpuCount))) - instance.monitoringData.RAM = ram + instance.monitoring.RAM = ram instance.prevCPU = cpu instance.prevTime = now diff --git a/vendor/github.com/aosedge/aos_common/resourcemonitor/resourcemonitor.go b/vendor/github.com/aosedge/aos_common/resourcemonitor/resourcemonitor.go index 54e0fa07..0f925c79 100644 --- a/vendor/github.com/aosedge/aos_common/resourcemonitor/resourcemonitor.go +++ b/vendor/github.com/aosedge/aos_common/resourcemonitor/resourcemonitor.go @@ -26,6 +26,8 @@ import ( "sync" "time" + "golang.org/x/exp/slices" + "github.com/aosedge/aos_common/aoserrors" "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" @@ -49,9 +51,7 @@ const ( YearPeriod ) -// For optimization capacity should be equals numbers of measurement values -// 5 - RAM, CPU, UsedDisk, InTraffic, OutTraffic. -const capacityAlertProcessorElements = 5 +const monitoringChannelSize = 16 /*********************************************************************************************************************** * Types @@ -62,14 +62,28 @@ type SystemUsageProvider interface { FillSystemInfo(instanceID string, instance *instanceMonitoring) error } +// QuotaAlert quota alert structure. +type QuotaAlert struct { + Timestamp time.Time + Parameter string + Value uint64 + Status string +} + // AlertSender interface to send resource alerts. type AlertSender interface { - SendAlert(alert cloudprotocol.AlertItem) + SendAlert(alert interface{}) } -// MonitoringSender sends monitoring data. -type MonitoringSender interface { - SendMonitoringData(monitoringData cloudprotocol.NodeMonitoringData) +// NodeInfoProvider interface to get node information. +type NodeInfoProvider interface { + GetCurrentNodeInfo() (cloudprotocol.NodeInfo, error) +} + +// NodeConfigProvider interface to get node config. +type NodeConfigProvider interface { + GetCurrentNodeConfig() (cloudprotocol.NodeConfig, error) + SubscribeCurrentNodeConfigChange() <-chan cloudprotocol.NodeConfig } // TrafficMonitoring interface to get network traffic. @@ -78,43 +92,32 @@ type TrafficMonitoring interface { GetInstanceTraffic(instanceID string) (inputTraffic, outputTraffic uint64, err error) } -// PartitionConfig partition information. -type PartitionConfig struct { - Name string `json:"name"` - Types []string `json:"types"` - Path string `json:"path"` -} - // Config configuration for resource monitoring. type Config struct { - aostypes.AlertRules - SendPeriod aostypes.Duration `json:"sendPeriod"` - PollPeriod aostypes.Duration `json:"pollPeriod"` - Partitions []PartitionConfig `json:"partitions"` - Source string `json:"source"` + PollPeriod aostypes.Duration `json:"pollPeriod"` + AverageWindow aostypes.Duration `json:"averageWindow"` + Source string `json:"source"` } // ResourceMonitor instance. type ResourceMonitor struct { sync.Mutex - alertSender AlertSender - monitoringSender MonitoringSender - - config Config - nodeID string - - sendTimer *time.Ticker - pollTimer *time.Ticker - - nodeMonitoringData cloudprotocol.MonitoringData - systemInfo cloudprotocol.SystemInfo - - alertProcessors *list.List - + nodeInfoProvider NodeInfoProvider + nodeConfigProvider NodeConfigProvider + alertSender AlertSender + trafficMonitoring TrafficMonitoring + sourceSystemUsage SystemUsageProvider + + monitoringChannel chan aostypes.NodeMonitoring + pollTimer *time.Ticker + averageWindowCount uint64 + nodeInfo cloudprotocol.NodeInfo + nodeMonitoring aostypes.MonitoringData + nodeAverageData averageMonitoring instanceMonitoringMap map[string]*instanceMonitoring - trafficMonitoring TrafficMonitoring - sourceSystemUsage SystemUsageProvider + alertProcessors *list.List + curNodeConfigListener <-chan cloudprotocol.NodeConfig cancelFunction context.CancelFunc } @@ -138,12 +141,21 @@ type instanceMonitoring struct { uid uint32 gid uint32 partitions []PartitionParam - monitoringData cloudprotocol.InstanceMonitoringData + monitoring aostypes.InstanceMonitoring + averageData averageMonitoring alertProcessorElements []*list.Element prevCPU uint64 prevTime time.Time } +type averageMonitoring struct { + ram *averageCalc + cpu *averageCalc + download *averageCalc + upload *averageCalc + disks map[string]*averageCalc +} + /*********************************************************************************************************************** * Variable **********************************************************************************************************************/ @@ -152,12 +164,12 @@ type instanceMonitoring struct { // //nolint:gochecknoglobals var ( - systemCPUPercent = cpu.Percent - systemVirtualMemory = mem.VirtualMemory - systemDiskUsage = disk.Usage - getUserFSQuotaUsage = fs.GetUserFSQuotaUsage - cpuCount = runtime.NumCPU() - hostSystemUsageInstance SystemUsageProvider = nil + systemCPUPercent = cpu.Percent + systemVirtualMemory = mem.VirtualMemory + systemDiskUsage = disk.Usage + getUserFSQuotaUsage = fs.GetUserFSQuotaUsage + cpuCount = runtime.NumCPU() + instanceUsage SystemUsageProvider = nil ) /*********************************************************************************************************************** @@ -166,88 +178,44 @@ var ( // New creates new resource monitor instance. func New( - nodeID string, config Config, alertsSender AlertSender, monitoringSender MonitoringSender, - trafficMonitoring TrafficMonitoring) ( - monitor *ResourceMonitor, err error, + config Config, nodeInfoProvider NodeInfoProvider, nodeConfigProvider NodeConfigProvider, + trafficMonitoring TrafficMonitoring, alertsSender AlertSender) ( + *ResourceMonitor, error, ) { log.Debug("Create monitor") - monitor = &ResourceMonitor{ - alertSender: alertsSender, - monitoringSender: monitoringSender, - trafficMonitoring: trafficMonitoring, - config: config, - nodeID: nodeID, - sourceSystemUsage: getSourceSystemUsage(config.Source), + monitor := &ResourceMonitor{ + nodeInfoProvider: nodeInfoProvider, + nodeConfigProvider: nodeConfigProvider, + alertSender: alertsSender, + trafficMonitoring: trafficMonitoring, + sourceSystemUsage: getSourceSystemUsage(config.Source), + monitoringChannel: make(chan aostypes.NodeMonitoring, monitoringChannelSize), + curNodeConfigListener: nodeConfigProvider.SubscribeCurrentNodeConfigChange(), } - monitor.alertProcessors = list.New() - - if monitor.config.CPU != nil { - monitor.alertProcessors.PushBack(createAlertProcessor( - "System CPU", - &monitor.nodeMonitoringData.CPU, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert(prepareSystemAlertItem("cpu", time, value)) - }, - *monitor.config.CPU)) + nodeInfo, err := nodeInfoProvider.GetCurrentNodeInfo() + if err != nil { + return nil, aoserrors.Wrap(err) } - if monitor.config.RAM != nil { - monitor.alertProcessors.PushBack(createAlertProcessor( - "System RAM", - &monitor.nodeMonitoringData.RAM, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert(prepareSystemAlertItem("ram", time, value)) - }, - *monitor.config.RAM)) + monitor.averageWindowCount = uint64(config.AverageWindow.Duration.Nanoseconds()) / + uint64(config.PollPeriod.Duration.Nanoseconds()) + if monitor.averageWindowCount == 0 { + monitor.averageWindowCount = 1 } - monitor.nodeMonitoringData.Disk = make([]cloudprotocol.PartitionUsage, len(config.Partitions)) - - for i, partitionParam := range config.Partitions { - monitor.nodeMonitoringData.Disk[i].Name = partitionParam.Name + if err := monitor.setupNodeMonitoring(nodeInfo); err != nil { + return nil, aoserrors.Wrap(err) } - if len(monitor.config.UsedDisks) > 0 { - for _, diskRule := range monitor.config.UsedDisks { - for i := 0; i < len(monitor.nodeMonitoringData.Disk); i++ { - if diskRule.Name != monitor.nodeMonitoringData.Disk[i].Name { - continue - } - - monitor.alertProcessors.PushBack(createAlertProcessor( - "Partition "+monitor.nodeMonitoringData.Disk[i].Name, - &monitor.nodeMonitoringData.Disk[i].UsedSize, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert(prepareSystemAlertItem( - monitor.nodeMonitoringData.Disk[i].Name, time, value)) - }, - diskRule.AlertRuleParam)) - - break - } - } - } - - if monitor.config.InTraffic != nil { - monitor.alertProcessors.PushBack(createAlertProcessor( - "IN Traffic", - &monitor.nodeMonitoringData.InTraffic, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert(prepareSystemAlertItem("inTraffic", time, value)) - }, - *monitor.config.InTraffic)) + nodeConfig, err := nodeConfigProvider.GetCurrentNodeConfig() + if err != nil { + log.Errorf("Can't get node config: %v", err) } - if monitor.config.OutTraffic != nil { - monitor.alertProcessors.PushBack(createAlertProcessor( - "OUT Traffic", - &monitor.nodeMonitoringData.OutTraffic, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert(prepareSystemAlertItem("outTraffic", time, value)) - }, - *monitor.config.OutTraffic)) + if err := monitor.setupSystemAlerts(nodeConfig); err != nil { + log.Errorf("Can't setup system alerts: %v", err) } monitor.instanceMonitoringMap = make(map[string]*instanceMonitoring) @@ -255,12 +223,7 @@ func New( ctx, cancelFunc := context.WithCancel(context.Background()) monitor.cancelFunction = cancelFunc - monitor.pollTimer = time.NewTicker(monitor.config.PollPeriod.Duration) - monitor.sendTimer = time.NewTicker(monitor.config.SendPeriod.Duration) - - if err = monitor.gatheringSystemInfo(); err != nil { - return nil, err - } + monitor.pollTimer = time.NewTicker(config.PollPeriod.Duration) go monitor.run(ctx) @@ -271,10 +234,6 @@ func New( func (monitor *ResourceMonitor) Close() { log.Debug("Close monitor") - if monitor.sendTimer != nil { - monitor.sendTimer.Stop() - } - if monitor.pollTimer != nil { monitor.pollTimer.Stop() } @@ -282,10 +241,8 @@ func (monitor *ResourceMonitor) Close() { if monitor.cancelFunction != nil { monitor.cancelFunction() } -} -func (monitor *ResourceMonitor) GetSystemInfo() cloudprotocol.SystemInfo { - return monitor.systemInfo + close(monitor.monitoringChannel) } // StartInstanceMonitor starts monitoring service. @@ -303,8 +260,31 @@ func (monitor *ResourceMonitor) StartInstanceMonitor( log.WithFields(log.Fields{"id": instanceID}).Debug("Start instance monitoring") - monitor.instanceMonitoringMap[instanceID] = monitor.createInstanceMonitoring( - instanceID, monitoringConfig.AlertRules, monitoringConfig) + instanceMonitoring := &instanceMonitoring{ + uid: uint32(monitoringConfig.UID), + gid: uint32(monitoringConfig.GID), + partitions: monitoringConfig.Partitions, + monitoring: aostypes.InstanceMonitoring{InstanceIdent: monitoringConfig.InstanceIdent}, + } + + monitor.instanceMonitoringMap[instanceID] = instanceMonitoring + + instanceMonitoring.monitoring.Disk = make( + []aostypes.PartitionUsage, len(monitoringConfig.Partitions)) + + for i, partitionParam := range monitoringConfig.Partitions { + instanceMonitoring.monitoring.Disk[i].Name = partitionParam.Name + } + + instanceMonitoring.averageData = *newAverageMonitoring( + monitor.averageWindowCount, instanceMonitoring.monitoring.Disk) + + if monitoringConfig.AlertRules != nil && monitor.alertSender != nil { + if err := monitor.setupInstanceAlerts( + instanceID, instanceMonitoring, *monitoringConfig.AlertRules); err != nil { + log.Errorf("Can't setup instance alerts: %v", err) + } + } return nil } @@ -329,252 +309,377 @@ func (monitor *ResourceMonitor) StopInstanceMonitor(instanceID string) error { return nil } +// GetAverageMonitoring returns average monitoring data. +func (monitor *ResourceMonitor) GetAverageMonitoring() (aostypes.NodeMonitoring, error) { + monitor.Lock() + defer monitor.Unlock() + + log.Debug("Get average monitoring data") + + timestamp := time.Now() + + averageMonitoringData := aostypes.NodeMonitoring{ + NodeID: monitor.nodeInfo.NodeID, + NodeData: monitor.nodeAverageData.toMonitoringData(timestamp), + InstancesData: make([]aostypes.InstanceMonitoring, 0, len(monitor.instanceMonitoringMap)), + } + + for _, instanceMonitoring := range monitor.instanceMonitoringMap { + averageMonitoringData.InstancesData = append(averageMonitoringData.InstancesData, + aostypes.InstanceMonitoring{ + InstanceIdent: instanceMonitoring.monitoring.InstanceIdent, + MonitoringData: instanceMonitoring.averageData.toMonitoringData(timestamp), + }) + } + + return averageMonitoringData, nil +} + +// GetNodeMonitoringChannel return node monitoring channel. +func (monitor *ResourceMonitor) GetNodeMonitoringChannel() <-chan aostypes.NodeMonitoring { + return monitor.monitoringChannel +} + /*********************************************************************************************************************** * Private **********************************************************************************************************************/ +func (monitor *ResourceMonitor) setupNodeMonitoring(nodeInfo cloudprotocol.NodeInfo) error { + monitor.Lock() + defer monitor.Unlock() + + if nodeInfo.MaxDMIPs == 0 { + return aoserrors.Errorf("max DMIPs is 0") + } + + monitor.nodeInfo = nodeInfo + + monitor.nodeMonitoring = aostypes.MonitoringData{ + Disk: make([]aostypes.PartitionUsage, len(nodeInfo.Partitions)), + } + + for i, partitionParam := range nodeInfo.Partitions { + monitor.nodeMonitoring.Disk[i].Name = partitionParam.Name + } + + monitor.nodeAverageData = *newAverageMonitoring(monitor.averageWindowCount, monitor.nodeMonitoring.Disk) + + return nil +} + +func (monitor *ResourceMonitor) setupSystemAlerts(nodeConfig cloudprotocol.NodeConfig) (err error) { + monitor.Lock() + defer monitor.Unlock() + + nodeID := monitor.nodeInfo.NodeID + + monitor.alertProcessors = list.New() + + if nodeConfig.AlertRules == nil || monitor.alertSender == nil { + return nil + } + + if nodeConfig.AlertRules.CPU != nil { + monitor.alertProcessors.PushBack(createAlertProcessorPercents( + "System CPU", + &monitor.nodeMonitoring.CPU, + monitor.nodeInfo.MaxDMIPs, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert(prepareSystemAlertItem(nodeID, "cpu", time, value, status)) + }, + *nodeConfig.AlertRules.CPU)) + } + + if nodeConfig.AlertRules.RAM != nil { + monitor.alertProcessors.PushBack(createAlertProcessorPercents( + "System RAM", + &monitor.nodeMonitoring.RAM, + monitor.nodeInfo.TotalRAM, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert(prepareSystemAlertItem(nodeID, "ram", time, value, status)) + }, + *nodeConfig.AlertRules.RAM)) + } + + for _, diskRule := range nodeConfig.AlertRules.UsedDisks { + diskUsageValue, diskTotalSize, findErr := getDiskUsageValue( + diskRule.Name, monitor.nodeMonitoring.Disk, monitor.nodeInfo.Partitions) + if findErr != nil && err == nil { + err = findErr + continue + } + + monitor.alertProcessors.PushBack(createAlertProcessorPercents( + "Partition "+diskRule.Name, + diskUsageValue, + diskTotalSize, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert(prepareSystemAlertItem(nodeID, diskRule.Name, time, value, status)) + }, + diskRule.AlertRulePercents)) + } + + if nodeConfig.AlertRules.Download != nil { + monitor.alertProcessors.PushBack(createAlertProcessorPoints( + "Download traffic", + &monitor.nodeMonitoring.Download, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert(prepareSystemAlertItem(nodeID, "download", time, value, status)) + }, + *nodeConfig.AlertRules.Download)) + } + + if nodeConfig.AlertRules.Upload != nil { + monitor.alertProcessors.PushBack(createAlertProcessorPoints( + "Upload traffic", + &monitor.nodeMonitoring.Upload, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert(prepareSystemAlertItem(nodeID, "upload", time, value, status)) + }, + *nodeConfig.AlertRules.Upload)) + } + + return err +} + +func getDiskUsageValue( + name string, disksUsage []aostypes.PartitionUsage, disksInfo []cloudprotocol.PartitionInfo, +) (value *uint64, maxValue uint64, err error) { + valueIndex := slices.IndexFunc(disksUsage, func(disk aostypes.PartitionUsage) bool { + return disk.Name == name + }) + + maxValueIndex := slices.IndexFunc(disksInfo, func(disk cloudprotocol.PartitionInfo) bool { + return disk.Name == name + }) + + if valueIndex == -1 || maxValueIndex == -1 { + return nil, 0, aoserrors.Errorf("disk [%s] not found", name) + } + + return &disksUsage[valueIndex].UsedSize, disksInfo[maxValueIndex].TotalSize, nil +} + +func getDiskPath(disks []cloudprotocol.PartitionInfo, name string) (string, error) { + for _, disk := range disks { + if disk.Name == name { + return disk.Path, nil + } + } + + return "", aoserrors.Errorf("can't find disk %s", name) +} + func (monitor *ResourceMonitor) run(ctx context.Context) { for { select { case <-ctx.Done(): return - case <-monitor.sendTimer.C: - monitor.Lock() - monitoringData := monitor.prepareMonitoringData() - monitor.sendMonitoringData(monitoringData) - monitor.Unlock() + case nodeConfig := <-monitor.curNodeConfigListener: + if err := monitor.setupSystemAlerts(nodeConfig); err != nil { + log.Errorf("Can't setup system alerts: %v", err) + } case <-monitor.pollTimer.C: monitor.Lock() monitor.sourceSystemUsage.CacheSystemInfos() monitor.getCurrentSystemData() - monitor.getCurrentInstanceData() + monitor.getCurrentInstancesData() monitor.processAlerts() + monitor.sendMonitoringData() monitor.Unlock() } } } -func (monitor *ResourceMonitor) createInstanceMonitoring( - instanceID string, rules *aostypes.AlertRules, monitoringConfig ResourceMonitorParams, -) *instanceMonitoring { - serviceMonitoring := &instanceMonitoring{ - uid: uint32(monitoringConfig.UID), - gid: uint32(monitoringConfig.GID), - partitions: monitoringConfig.Partitions, - monitoringData: cloudprotocol.InstanceMonitoringData{InstanceIdent: monitoringConfig.InstanceIdent}, - } - - if monitor.alertSender == nil { - return serviceMonitoring - } - - serviceMonitoring.monitoringData.Disk = make( - []cloudprotocol.PartitionUsage, len(monitoringConfig.Partitions)) - - for i, partitionParam := range monitoringConfig.Partitions { - serviceMonitoring.monitoringData.Disk[i].Name = partitionParam.Name - } - - if rules == nil { - return serviceMonitoring - } - - serviceMonitoring.alertProcessorElements = make([]*list.Element, 0, capacityAlertProcessorElements) +func (monitor *ResourceMonitor) setupInstanceAlerts(instanceID string, instanceMonitoring *instanceMonitoring, + rules aostypes.AlertRules, +) (err error) { + instanceMonitoring.alertProcessorElements = make([]*list.Element, 0) if rules.CPU != nil { - e := monitor.alertProcessors.PushBack(createAlertProcessor( + e := monitor.alertProcessors.PushBack(createAlertProcessorPercents( instanceID+" CPU", - &serviceMonitoring.monitoringData.CPU, - func(time time.Time, value uint64) { + &instanceMonitoring.monitoring.CPU, + monitor.nodeInfo.MaxDMIPs, + func(time time.Time, value uint64, status string) { monitor.alertSender.SendAlert( - prepareInstanceAlertItem(monitoringConfig.InstanceIdent, "cpu", time, value)) + prepareInstanceAlertItem( + instanceMonitoring.monitoring.InstanceIdent, "cpu", time, value, status)) }, *rules.CPU)) - serviceMonitoring.alertProcessorElements = append(serviceMonitoring.alertProcessorElements, e) + instanceMonitoring.alertProcessorElements = append(instanceMonitoring.alertProcessorElements, e) } if rules.RAM != nil { - e := monitor.alertProcessors.PushBack(createAlertProcessor( + e := monitor.alertProcessors.PushBack(createAlertProcessorPercents( instanceID+" RAM", - &serviceMonitoring.monitoringData.RAM, - func(time time.Time, value uint64) { + &instanceMonitoring.monitoring.RAM, + monitor.nodeInfo.TotalRAM, + func(time time.Time, value uint64, status string) { monitor.alertSender.SendAlert( - prepareInstanceAlertItem(monitoringConfig.InstanceIdent, "ram", time, value)) + prepareInstanceAlertItem( + instanceMonitoring.monitoring.InstanceIdent, "ram", time, value, status)) }, *rules.RAM)) - serviceMonitoring.alertProcessorElements = append(serviceMonitoring.alertProcessorElements, e) + instanceMonitoring.alertProcessorElements = append(instanceMonitoring.alertProcessorElements, e) } - if len(rules.UsedDisks) > 0 { - for _, diskRule := range rules.UsedDisks { - for i := 0; i < len(serviceMonitoring.monitoringData.Disk); i++ { - if diskRule.Name != serviceMonitoring.monitoringData.Disk[i].Name { - continue - } - - e := monitor.alertProcessors.PushBack(createAlertProcessor( - instanceID+" Partition "+serviceMonitoring.monitoringData.Disk[i].Name, - &serviceMonitoring.monitoringData.Disk[i].UsedSize, - func(time time.Time, value uint64) { - monitor.alertSender.SendAlert( - prepareInstanceAlertItem( - monitoringConfig.InstanceIdent, serviceMonitoring.monitoringData.Disk[i].Name, - time, value)) - }, diskRule.AlertRuleParam)) - - serviceMonitoring.alertProcessorElements = append(serviceMonitoring.alertProcessorElements, e) - - break - } + for _, diskRule := range rules.UsedDisks { + diskUsageValue, diskTotalSize, findErr := getDiskUsageValue( + diskRule.Name, instanceMonitoring.monitoring.Disk, monitor.nodeInfo.Partitions) + if findErr != nil && err == nil { + err = findErr + continue } - } - if rules.InTraffic != nil { - e := monitor.alertProcessors.PushBack(createAlertProcessor( - instanceID+" Traffic IN", - &serviceMonitoring.monitoringData.InTraffic, - func(time time.Time, value uint64) { + e := monitor.alertProcessors.PushBack(createAlertProcessorPercents( + instanceID+" Partition "+diskRule.Name, + diskUsageValue, + diskTotalSize, + func(time time.Time, value uint64, status string) { monitor.alertSender.SendAlert( - prepareInstanceAlertItem(monitoringConfig.InstanceIdent, "inTraffic", time, value)) - }, *rules.InTraffic)) + prepareInstanceAlertItem( + instanceMonitoring.monitoring.InstanceIdent, diskRule.Name, time, value, status)) + }, diskRule.AlertRulePercents)) - serviceMonitoring.alertProcessorElements = append(serviceMonitoring.alertProcessorElements, e) + instanceMonitoring.alertProcessorElements = append(instanceMonitoring.alertProcessorElements, e) } - if rules.OutTraffic != nil { - e := monitor.alertProcessors.PushBack(createAlertProcessor( - instanceID+" Traffic OUT", - &serviceMonitoring.monitoringData.OutTraffic, - func(time time.Time, value uint64) { + if rules.Download != nil { + e := monitor.alertProcessors.PushBack(createAlertProcessorPoints( + instanceID+" download traffic", + &instanceMonitoring.monitoring.Download, + func(time time.Time, value uint64, status string) { monitor.alertSender.SendAlert( - prepareInstanceAlertItem(monitoringConfig.InstanceIdent, "outTraffic", time, value)) - }, *rules.OutTraffic)) + prepareInstanceAlertItem( + instanceMonitoring.monitoring.InstanceIdent, "download", time, value, status)) + }, *rules.Download)) - serviceMonitoring.alertProcessorElements = append(serviceMonitoring.alertProcessorElements, e) + instanceMonitoring.alertProcessorElements = append(instanceMonitoring.alertProcessorElements, e) } - return serviceMonitoring -} - -func (monitor *ResourceMonitor) gatheringSystemInfo() (err error) { - monitor.systemInfo.NumCPUs = uint64(cpuCount) - - memStat, err := systemVirtualMemory() - if err != nil { - return aoserrors.Wrap(err) - } - - monitor.systemInfo.TotalRAM = memStat.Total - - monitor.systemInfo.Partitions = make([]cloudprotocol.PartitionInfo, len(monitor.config.Partitions)) - for i, partition := range monitor.config.Partitions { - monitor.systemInfo.Partitions[i].Name = partition.Name - monitor.systemInfo.Partitions[i].Types = append(monitor.systemInfo.Partitions[i].Types, partition.Types...) - - usageStat, err := systemDiskUsage(partition.Path) - if err != nil { - return aoserrors.Wrap(err) - } + if rules.Upload != nil { + e := monitor.alertProcessors.PushBack(createAlertProcessorPoints( + instanceID+" upload traffic", + &instanceMonitoring.monitoring.Upload, + func(time time.Time, value uint64, status string) { + monitor.alertSender.SendAlert( + prepareInstanceAlertItem( + instanceMonitoring.monitoring.InstanceIdent, "upload", time, value, status)) + }, *rules.Upload)) - monitor.systemInfo.Partitions[i].TotalSize = usageStat.Total + instanceMonitoring.alertProcessorElements = append(instanceMonitoring.alertProcessorElements, e) } - return nil + return err } -func (monitor *ResourceMonitor) prepareMonitoringData() cloudprotocol.NodeMonitoringData { - monitoringData := cloudprotocol.NodeMonitoringData{ - MonitoringData: monitor.nodeMonitoringData, - NodeID: monitor.nodeID, - Timestamp: time.Now(), - ServiceInstances: make([]cloudprotocol.InstanceMonitoringData, 0, len(monitor.instanceMonitoringMap)), +func (monitor *ResourceMonitor) sendMonitoringData() { + nodeMonitoringData := aostypes.NodeMonitoring{ + NodeID: monitor.nodeInfo.NodeID, + NodeData: monitor.nodeMonitoring, + InstancesData: make([]aostypes.InstanceMonitoring, 0, len(monitor.instanceMonitoringMap)), } - for _, instance := range monitor.instanceMonitoringMap { - monitoringData.ServiceInstances = append(monitoringData.ServiceInstances, instance.monitoringData) + for _, instanceMonitoring := range monitor.instanceMonitoringMap { + nodeMonitoringData.InstancesData = append(nodeMonitoringData.InstancesData, + instanceMonitoring.monitoring) } - return monitoringData -} - -func (monitor *ResourceMonitor) sendMonitoringData(nodeMonitoringData cloudprotocol.NodeMonitoringData) { - monitor.monitoringSender.SendMonitoringData(nodeMonitoringData) + monitor.monitoringChannel <- nodeMonitoringData } func (monitor *ResourceMonitor) getCurrentSystemData() { + monitor.nodeMonitoring.Timestamp = time.Now() + cpu, err := getSystemCPUUsage() if err != nil { log.Errorf("Can't get system CPU: %s", err) } - monitor.nodeMonitoringData.CPU = uint64(math.Round(cpu)) + monitor.nodeMonitoring.CPU = monitor.cpuToDMIPs(cpu) - monitor.nodeMonitoringData.RAM, err = getSystemRAMUsage() + monitor.nodeMonitoring.RAM, err = getSystemRAMUsage() if err != nil { log.Errorf("Can't get system RAM: %s", err) } - if len(monitor.nodeMonitoringData.Disk) > 0 { - for i, partitionParam := range monitor.config.Partitions { - monitor.nodeMonitoringData.Disk[i].UsedSize, err = getSystemDiskUsage(partitionParam.Path) - if err != nil { - log.Errorf("Can't get system Disk usage: %v", err) - } + for i, disk := range monitor.nodeMonitoring.Disk { + mountPoint, err := getDiskPath(monitor.nodeInfo.Partitions, disk.Name) + if err != nil { + log.Errorf("Can't get disk path: %v", err) + + continue + } + + monitor.nodeMonitoring.Disk[i].UsedSize, err = getSystemDiskUsage(mountPoint) + if err != nil { + log.Errorf("Can't get system Disk usage: %v", err) } } if monitor.trafficMonitoring != nil { - inTraffic, outTraffic, err := monitor.trafficMonitoring.GetSystemTraffic() + download, upload, err := monitor.trafficMonitoring.GetSystemTraffic() if err != nil { log.Errorf("Can't get system traffic value: %s", err) } - monitor.nodeMonitoringData.InTraffic = inTraffic - monitor.nodeMonitoringData.OutTraffic = outTraffic + monitor.nodeMonitoring.Download = download + monitor.nodeMonitoring.Upload = upload } + monitor.nodeAverageData.updateMonitoringData(monitor.nodeMonitoring) + log.WithFields(log.Fields{ - "CPU": monitor.nodeMonitoringData.CPU, - "RAM": monitor.nodeMonitoringData.RAM, - "Disk": monitor.nodeMonitoringData.Disk, - "IN": monitor.nodeMonitoringData.InTraffic, - "OUT": monitor.nodeMonitoringData.OutTraffic, + "CPU": monitor.nodeMonitoring.CPU, + "RAM": monitor.nodeMonitoring.RAM, + "Disk": monitor.nodeMonitoring.Disk, + "Download": monitor.nodeMonitoring.Download, + "Upload": monitor.nodeMonitoring.Upload, }).Debug("Monitoring data") } -func (monitor *ResourceMonitor) getCurrentInstanceData() { +func (monitor *ResourceMonitor) getCurrentInstancesData() { + timestamp := time.Now() + for instanceID, value := range monitor.instanceMonitoringMap { + value.monitoring.Timestamp = timestamp + err := monitor.sourceSystemUsage.FillSystemInfo(instanceID, value) if err != nil { log.Errorf("Can't fill system usage info: %v", err) } + value.monitoring.CPU = monitor.cpuToDMIPs(float64(value.monitoring.CPU)) + for i, partitionParam := range value.partitions { - value.monitoringData.Disk[i].UsedSize, err = getInstanceDiskUsage(partitionParam.Path, value.uid, value.gid) + value.monitoring.Disk[i].UsedSize, err = getInstanceDiskUsage(partitionParam.Path, value.uid, value.gid) if err != nil { - log.Errorf("Can't get service Disc usage: %v", err) + log.Errorf("Can't get service disk usage: %v", err) } } if monitor.trafficMonitoring != nil { - inTraffic, outTraffic, err := monitor.trafficMonitoring.GetInstanceTraffic(instanceID) + download, upload, err := monitor.trafficMonitoring.GetInstanceTraffic(instanceID) if err != nil { log.Errorf("Can't get service traffic: %s", err) } - value.monitoringData.InTraffic = inTraffic - value.monitoringData.OutTraffic = outTraffic + value.monitoring.Download = download + value.monitoring.Upload = upload } + value.averageData.updateMonitoringData(value.monitoring.MonitoringData) + log.WithFields(log.Fields{ - "id": instanceID, - "CPU": value.monitoringData.CPU, - "RAM": value.monitoringData.RAM, - "Disk": value.monitoringData.Disk, - "IN": value.monitoringData.InTraffic, - "OUT": value.monitoringData.OutTraffic, + "id": instanceID, + "CPU": value.monitoring.CPU, + "RAM": value.monitoring.RAM, + "Disk": value.monitoring.Disk, + "Download": value.monitoring.Download, + "Upload": value.monitoring.Upload, }).Debug("Instance monitoring data") } } @@ -584,7 +689,6 @@ func (monitor *ResourceMonitor) processAlerts() { for e := monitor.alertProcessors.Front(); e != nil; e = e.Next() { alertProcessor, ok := e.Value.(*alertProcessor) - if !ok { log.Error("Unexpected alert processors type") return @@ -601,7 +705,7 @@ func getSystemCPUUsage() (cpuUse float64, err error) { return 0, aoserrors.Wrap(err) } - cpuUse = v[0] + cpuUse = v[0] / float64(cpuCount) return cpuUse, nil } @@ -616,11 +720,11 @@ func getSystemRAMUsage() (ram uint64, err error) { return v.Used, nil } -// getSystemDiskUsage returns disc usage in bytes. -func getSystemDiskUsage(path string) (discUse uint64, err error) { +// getSystemDiskUsage returns disk usage in bytes. +func getSystemDiskUsage(path string) (diskUse uint64, err error) { v, err := systemDiskUsage(path) if err != nil { - return discUse, aoserrors.Wrap(err) + return diskUse, aoserrors.Wrap(err) } return v.Used, nil @@ -635,28 +739,27 @@ func getInstanceDiskUsage(path string, uid, gid uint32) (diskUse uint64, err err return diskUse, nil } -func prepareSystemAlertItem(parameter string, timestamp time.Time, value uint64) cloudprotocol.AlertItem { - return cloudprotocol.AlertItem{ - Timestamp: timestamp, - Tag: cloudprotocol.AlertTagSystemQuota, - Payload: cloudprotocol.SystemQuotaAlert{ - Parameter: parameter, - Value: value, - }, +func prepareSystemAlertItem( + nodeID, parameter string, timestamp time.Time, value uint64, status string, +) cloudprotocol.SystemQuotaAlert { + return cloudprotocol.SystemQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: cloudprotocol.AlertTagSystemQuota}, + NodeID: nodeID, + Parameter: parameter, + Value: value, + Status: status, } } func prepareInstanceAlertItem( - instanceIndent aostypes.InstanceIdent, parameter string, timestamp time.Time, value uint64, -) cloudprotocol.AlertItem { - return cloudprotocol.AlertItem{ - Timestamp: timestamp, - Tag: cloudprotocol.AlertTagInstanceQuota, - Payload: cloudprotocol.InstanceQuotaAlert{ - InstanceIdent: instanceIndent, - Parameter: parameter, - Value: value, - }, + instanceIndent aostypes.InstanceIdent, parameter string, timestamp time.Time, value uint64, status string, +) cloudprotocol.InstanceQuotaAlert { + return cloudprotocol.InstanceQuotaAlert{ + AlertItem: cloudprotocol.AlertItem{Timestamp: timestamp, Tag: cloudprotocol.AlertTagInstanceQuota}, + InstanceIdent: instanceIndent, + Parameter: parameter, + Value: value, + Status: status, } } @@ -665,9 +768,66 @@ func getSourceSystemUsage(source string) SystemUsageProvider { return &xenSystemUsage{} } - if hostSystemUsageInstance != nil { - return hostSystemUsageInstance + if instanceUsage != nil { + return instanceUsage } return &cgroupsSystemUsage{} } + +func (monitor *ResourceMonitor) cpuToDMIPs(cpu float64) uint64 { + return uint64(math.Round(float64(cpu) * float64(monitor.nodeInfo.MaxDMIPs) / 100.0)) +} + +func newAverageMonitoring(windowCount uint64, partitions []aostypes.PartitionUsage) *averageMonitoring { + averageMonitoring := &averageMonitoring{ + ram: newAverageCalc(windowCount), + cpu: newAverageCalc(windowCount), + download: newAverageCalc(windowCount), + upload: newAverageCalc(windowCount), + disks: make(map[string]*averageCalc), + } + + for _, partition := range partitions { + averageMonitoring.disks[partition.Name] = newAverageCalc(windowCount) + } + + return averageMonitoring +} + +func (average *averageMonitoring) toMonitoringData(timestamp time.Time) aostypes.MonitoringData { + data := aostypes.MonitoringData{ + CPU: average.cpu.getIntValue(), + RAM: average.ram.getIntValue(), + Download: average.download.getIntValue(), + Upload: average.upload.getIntValue(), + Disk: make([]aostypes.PartitionUsage, 0, len(average.disks)), + Timestamp: timestamp, + } + + for name, diskUsage := range average.disks { + data.Disk = append(data.Disk, aostypes.PartitionUsage{ + Name: name, UsedSize: diskUsage.getIntValue(), + }) + } + + return data +} + +func (average *averageMonitoring) updateMonitoringData(data aostypes.MonitoringData) { + average.cpu.calculate(float64(data.CPU)) + average.ram.calculate(float64(data.RAM)) + average.download.calculate(float64(data.Download)) + average.upload.calculate(float64(data.Upload)) + + for _, disk := range data.Disk { + averageCalc, ok := average.disks[disk.Name] + if !ok { + log.Errorf("Can't find disk: %s", disk.Name) + + continue + } + + averageCalc.calculate(float64(disk.UsedSize)) + } +} diff --git a/vendor/github.com/aosedge/aos_common/resourcemonitor/xensystemusage.go b/vendor/github.com/aosedge/aos_common/resourcemonitor/xensystemusage.go index 4e636644..f01fdc5b 100644 --- a/vendor/github.com/aosedge/aos_common/resourcemonitor/xensystemusage.go +++ b/vendor/github.com/aosedge/aos_common/resourcemonitor/xensystemusage.go @@ -48,8 +48,8 @@ func (xen *xenSystemUsage) CacheSystemInfos() { func (xen *xenSystemUsage) FillSystemInfo(instanceID string, instance *instanceMonitoring) error { systemInfo, ok := xen.systemInfos[instanceID] if ok { - instance.monitoringData.CPU = uint64(systemInfo.CPUFraction) - instance.monitoringData.RAM = uint64(systemInfo.Memory) * 1024 //nolint:gomnd + instance.monitoring.CPU = uint64(systemInfo.CPUFraction) + instance.monitoring.RAM = uint64(systemInfo.Memory) * 1024 //nolint:mnd } return nil diff --git a/vendor/github.com/aosedge/aos_common/utils/alertutils/alertutils.go b/vendor/github.com/aosedge/aos_common/utils/alertutils/alertutils.go new file mode 100644 index 00000000..f8c1e907 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/utils/alertutils/alertutils.go @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2024 Renesas Electronics Corporation. +// Copyright (C) 2024 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package alertutils + +import ( + "reflect" + + "github.com/aosedge/aos_common/api/cloudprotocol" +) + +// AlertsPayloadEqual compares alerts ignoring timestamp. +// +//nolint:funlen +func AlertsPayloadEqual(alert1, alert2 interface{}) bool { + switch alert1casted := alert1.(type) { + case cloudprotocol.SystemAlert: + alert2casted, ok := alert2.(cloudprotocol.SystemAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.CoreAlert: + alert2casted, ok := alert2.(cloudprotocol.CoreAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.DownloadAlert: + alert2casted, ok := alert2.(cloudprotocol.DownloadAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.SystemQuotaAlert: + alert2casted, ok := alert2.(cloudprotocol.SystemQuotaAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.InstanceQuotaAlert: + alert2casted, ok := alert2.(cloudprotocol.InstanceQuotaAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.DeviceAllocateAlert: + alert2casted, ok := alert2.(cloudprotocol.DeviceAllocateAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.ResourceValidateAlert: + alert2casted, ok := alert2.(cloudprotocol.ResourceValidateAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + + case cloudprotocol.ServiceInstanceAlert: + alert2casted, ok := alert2.(cloudprotocol.ServiceInstanceAlert) + if !ok { + return false + } + + newAlert1 := alert1casted + newAlert1.Timestamp = alert2casted.Timestamp + + return reflect.DeepEqual(newAlert1, alert2casted) + } + + return false +} diff --git a/vendor/github.com/aosedge/aos_common/utils/pbconvert/pbconvert.go b/vendor/github.com/aosedge/aos_common/utils/pbconvert/pbconvert.go index 79cc6f08..08c219dd 100644 --- a/vendor/github.com/aosedge/aos_common/utils/pbconvert/pbconvert.go +++ b/vendor/github.com/aosedge/aos_common/utils/pbconvert/pbconvert.go @@ -20,15 +20,39 @@ package pbconvert import ( "github.com/aosedge/aos_common/aostypes" "github.com/aosedge/aos_common/api/cloudprotocol" - pb "github.com/aosedge/aos_common/api/servicemanager/v3" + pbcommon "github.com/aosedge/aos_common/api/common" + pbiam "github.com/aosedge/aos_common/api/iamanager" + pbsm "github.com/aosedge/aos_common/api/servicemanager" ) /*********************************************************************************************************************** * Public **********************************************************************************************************************/ -func InstanceFilterToPB(filter cloudprotocol.InstanceFilter) *pb.InstanceIdent { - ident := &pb.InstanceIdent{ServiceId: "", SubjectId: "", Instance: -1} +// InstanceFilterFromPB converts InstanceFilter from protobuf to AOS type. +func InstanceFilterFromPB(filter *pbsm.InstanceFilter) cloudprotocol.InstanceFilter { + aosFilter := cloudprotocol.InstanceFilter{} + + if filter.GetServiceId() != "" { + aosFilter.ServiceID = &filter.ServiceId + } + + if filter.GetSubjectId() != "" { + aosFilter.SubjectID = &filter.SubjectId + } + + if filter.GetInstance() != -1 { + instance := (uint64)(filter.GetInstance()) + + aosFilter.Instance = &instance + } + + return aosFilter +} + +// InstanceFilterToPB converts InstanceFilter from AOS type to protobuf. +func InstanceFilterToPB(filter cloudprotocol.InstanceFilter) *pbsm.InstanceFilter { + ident := &pbsm.InstanceFilter{ServiceId: "", SubjectId: "", Instance: -1} if filter.ServiceID != nil { ident.ServiceId = *filter.ServiceID @@ -45,42 +69,48 @@ func InstanceFilterToPB(filter cloudprotocol.InstanceFilter) *pb.InstanceIdent { return ident } -func InstanceIdentToPB(ident aostypes.InstanceIdent) *pb.InstanceIdent { - return &pb.InstanceIdent{ServiceId: ident.ServiceID, SubjectId: ident.SubjectID, Instance: int64(ident.Instance)} -} - -func NetworkParametersToPB(params aostypes.NetworkParameters) *pb.NetworkParameters { - networkParams := &pb.NetworkParameters{ - Ip: params.IP, - Subnet: params.Subnet, - VlanId: params.VlanID, - DnsServers: make([]string, len(params.DNSServers)), - Rules: make([]*pb.FirewallRule, len(params.FirewallRules)), +// InstanceIdentFromPB converts InstanceIdent from protobuf to AOS type. +func InstanceIdentFromPB(ident *pbcommon.InstanceIdent) aostypes.InstanceIdent { + return aostypes.InstanceIdent{ + ServiceID: ident.GetServiceId(), + SubjectID: ident.GetSubjectId(), + Instance: ident.GetInstance(), } +} - copy(networkParams.GetDnsServers(), params.DNSServers) +// InstanceIdentToPB converts InstanceIdent from AOS type to protobuf. +func InstanceIdentToPB(ident aostypes.InstanceIdent) *pbcommon.InstanceIdent { + return &pbcommon.InstanceIdent{ServiceId: ident.ServiceID, SubjectId: ident.SubjectID, Instance: ident.Instance} +} - for i, rule := range params.FirewallRules { - networkParams.Rules[i] = &pb.FirewallRule{ - DstIp: rule.DstIP, - SrcIp: rule.SrcIP, - DstPort: rule.DstPort, - Proto: rule.Proto, - } +// ErrorInfoFromPB converts ErrorInfo from protobuf to AOS type. +func ErrorInfoFromPB(errorInfo *pbcommon.ErrorInfo) *cloudprotocol.ErrorInfo { + if errorInfo == nil { + return nil } - return networkParams + return &cloudprotocol.ErrorInfo{ + AosCode: int(errorInfo.GetAosCode()), + ExitCode: int(errorInfo.GetExitCode()), + Message: errorInfo.GetMessage(), + } } -func NewInstanceIdentFromPB(ident *pb.InstanceIdent) aostypes.InstanceIdent { - return aostypes.InstanceIdent{ - ServiceID: ident.GetServiceId(), - SubjectID: ident.GetSubjectId(), - Instance: uint64(ident.GetInstance()), +// ErrorInfoToPB converts ErrorInfo from AOS type to protobuf. +func ErrorInfoToPB(errorInfo *cloudprotocol.ErrorInfo) *pbcommon.ErrorInfo { + if errorInfo == nil { + return nil + } + + return &pbcommon.ErrorInfo{ + AosCode: int32(errorInfo.AosCode), + ExitCode: int32(errorInfo.ExitCode), + Message: errorInfo.Message, } } -func NewNetworkParametersFromPB(params *pb.NetworkParameters) aostypes.NetworkParameters { +// NetworkParametersFromPB converts NetworkParameters from protobuf to AOS type. +func NewNetworkParametersFromPB(params *pbsm.NetworkParameters) aostypes.NetworkParameters { networkParams := aostypes.NetworkParameters{ IP: params.GetIp(), Subnet: params.GetSubnet(), @@ -102,3 +132,81 @@ func NewNetworkParametersFromPB(params *pb.NetworkParameters) aostypes.NetworkPa return networkParams } + +// NetworkParametersToPB converts NetworkParameters from AOS type to protobuf. +func NetworkParametersToPB(params aostypes.NetworkParameters) *pbsm.NetworkParameters { + networkParams := &pbsm.NetworkParameters{ + Ip: params.IP, + Subnet: params.Subnet, + VlanId: params.VlanID, + DnsServers: make([]string, len(params.DNSServers)), + Rules: make([]*pbsm.FirewallRule, len(params.FirewallRules)), + } + + copy(networkParams.GetDnsServers(), params.DNSServers) + + for i, rule := range params.FirewallRules { + networkParams.Rules[i] = &pbsm.FirewallRule{ + DstIp: rule.DstIP, + SrcIp: rule.SrcIP, + DstPort: rule.DstPort, + Proto: rule.Proto, + } + } + + return networkParams +} + +// NodeInfoFromPB converts NodeInfo from protobuf to Aos type. +func NodeInfoFromPB(pbNodeInfo *pbiam.NodeInfo) cloudprotocol.NodeInfo { + nodeInfo := cloudprotocol.NodeInfo{ + NodeID: pbNodeInfo.GetNodeId(), + NodeType: pbNodeInfo.GetNodeType(), + Name: pbNodeInfo.GetName(), + Status: pbNodeInfo.GetStatus(), + OSType: pbNodeInfo.GetOsType(), + MaxDMIPs: pbNodeInfo.GetMaxDmips(), + TotalRAM: pbNodeInfo.GetTotalRam(), + ErrorInfo: ErrorInfoFromPB(pbNodeInfo.GetError()), + } + + if pbNodeInfo.GetCpus() != nil { + nodeInfo.CPUs = make([]cloudprotocol.CPUInfo, 0, len(pbNodeInfo.GetCpus())) + + for _, cpu := range pbNodeInfo.GetCpus() { + nodeInfo.CPUs = append(nodeInfo.CPUs, cloudprotocol.CPUInfo{ + ModelName: cpu.GetModelName(), + NumCores: cpu.GetNumCores(), + NumThreads: cpu.GetNumThreads(), + Arch: cpu.GetArch(), + ArchFamily: cpu.GetArchFamily(), + MaxDMIPs: cpu.GetMaxDmips(), + }) + } + } + + if pbNodeInfo.GetAttrs() != nil { + nodeInfo.Attrs = make(map[string]interface{}) + + for _, attr := range pbNodeInfo.GetAttrs() { + nodeInfo.Attrs[attr.GetName()] = attr.GetValue() + } + } + + if pbNodeInfo.GetPartitions() != nil { + nodeInfo.Partitions = make([]cloudprotocol.PartitionInfo, 0, len(pbNodeInfo.GetPartitions())) + + for _, partition := range pbNodeInfo.GetPartitions() { + partitionInfo := cloudprotocol.PartitionInfo{ + Name: partition.GetName(), + Types: partition.GetTypes(), + TotalSize: partition.GetTotalSize(), + Path: partition.GetPath(), + } + + nodeInfo.Partitions = append(nodeInfo.Partitions, partitionInfo) + } + } + + return nodeInfo +} diff --git a/vendor/github.com/aosedge/aos_common/utils/semverutils/semverutils.go b/vendor/github.com/aosedge/aos_common/utils/semverutils/semverutils.go new file mode 100644 index 00000000..6e456bc8 --- /dev/null +++ b/vendor/github.com/aosedge/aos_common/utils/semverutils/semverutils.go @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright (C) 2024 Renesas Electronics Corporation. +// Copyright (C) 2024 EPAM Systems, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// semverutils is a simple wrapper around go-version library to compare versions + +package semverutils + +import ( + "github.com/aosedge/aos_common/aoserrors" + semver "github.com/hashicorp/go-version" +) + +func LessThan(version1 string, version2 string) (bool, error) { + semver1, err := semver.NewSemver(version1) + if err != nil { + return false, aoserrors.Wrap(err) + } + + semver2, err := semver.NewSemver(version2) + if err != nil { + return false, aoserrors.Wrap(err) + } + + return semver1.LessThan(semver2), nil +} + +func GreaterThan(version1 string, version2 string) (bool, error) { + semver1, err := semver.NewSemver(version1) + if err != nil { + return false, aoserrors.Wrap(err) + } + + semver2, err := semver.NewSemver(version2) + if err != nil { + return false, aoserrors.Wrap(err) + } + + return semver1.GreaterThan(semver2), nil +} diff --git a/vendor/github.com/aosedge/aos_common/utils/testtools/crypto.go b/vendor/github.com/aosedge/aos_common/utils/testtools/crypto.go index 96a90829..92a9923c 100644 --- a/vendor/github.com/aosedge/aos_common/utils/testtools/crypto.go +++ b/vendor/github.com/aosedge/aos_common/utils/testtools/crypto.go @@ -40,7 +40,7 @@ import ( // DefaultCertificateTemplate default certificate template. var DefaultCertificateTemplate = x509.Certificate{ //nolint:gochecknoglobals SerialNumber: big.NewInt(1), - Version: 3, //nolint:gomnd + Version: 3, //nolint:mnd NotBefore: time.Now().Add(-10 * time.Second), NotAfter: time.Now().AddDate(10, 0, 0), KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | @@ -59,7 +59,7 @@ var DefaultCertificateTemplate = x509.Certificate{ //nolint:gochecknoglobals "*.aos-dev.test", }, BasicConstraintsValid: true, - IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.IPv6loopback}, //nolint:gomnd + IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.IPv6loopback}, //nolint:mnd } /*********************************************************************************************************************** @@ -107,7 +107,7 @@ func GenerateCert( func GenerateCertAndKey( template, parent *x509.Certificate, parentPrivateKey crypto.PrivateKey, ) (cert *x509.Certificate, privateKey crypto.PrivateKey, err error) { - key, err := rsa.GenerateKey(rand.Reader, 2048) //nolint:gomnd + key, err := rsa.GenerateKey(rand.Reader, 2048) //nolint:mnd if err != nil { return nil, nil, aoserrors.Wrap(err) } diff --git a/vendor/golang.org/x/exp/maps/maps.go b/vendor/golang.org/x/exp/maps/maps.go new file mode 100644 index 00000000..ecc0dabb --- /dev/null +++ b/vendor/golang.org/x/exp/maps/maps.go @@ -0,0 +1,94 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package maps defines various functions useful with maps of any type. +package maps + +// Keys returns the keys of the map m. +// The keys will be in an indeterminate order. +func Keys[M ~map[K]V, K comparable, V any](m M) []K { + r := make([]K, 0, len(m)) + for k := range m { + r = append(r, k) + } + return r +} + +// Values returns the values of the map m. +// The values will be in an indeterminate order. +func Values[M ~map[K]V, K comparable, V any](m M) []V { + r := make([]V, 0, len(m)) + for _, v := range m { + r = append(r, v) + } + return r +} + +// Equal reports whether two maps contain the same key/value pairs. +// Values are compared using ==. +func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool { + if len(m1) != len(m2) { + return false + } + for k, v1 := range m1 { + if v2, ok := m2[k]; !ok || v1 != v2 { + return false + } + } + return true +} + +// EqualFunc is like Equal, but compares values using eq. +// Keys are still compared with ==. +func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool { + if len(m1) != len(m2) { + return false + } + for k, v1 := range m1 { + if v2, ok := m2[k]; !ok || !eq(v1, v2) { + return false + } + } + return true +} + +// Clear removes all entries from m, leaving it empty. +func Clear[M ~map[K]V, K comparable, V any](m M) { + for k := range m { + delete(m, k) + } +} + +// Clone returns a copy of m. This is a shallow clone: +// the new keys and values are set using ordinary assignment. +func Clone[M ~map[K]V, K comparable, V any](m M) M { + // Preserve nil in case it matters. + if m == nil { + return nil + } + r := make(M, len(m)) + for k, v := range m { + r[k] = v + } + return r +} + +// Copy copies all key/value pairs in src adding them to dst. +// When a key in src is already present in dst, +// the value in dst will be overwritten by the value associated +// with the key in src. +func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { + for k, v := range src { + dst[k] = v + } +} + +// DeleteFunc deletes any key/value pairs from m for which del returns true. +func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool) { + for k, v := range m { + if del(k, v) { + delete(m, k) + } + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 728977d1..4b1517aa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,15 +7,16 @@ github.com/ThalesIgnite/crypto11 # github.com/anexia-it/fsquota v0.0.0-00010101000000-000000000000 => github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7 ## explicit; go 1.21 github.com/anexia-it/fsquota -# github.com/aosedge/aos_common v0.0.0-20240701123742-84e62a5773fc +# github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a ## explicit; go 1.21 github.com/aosedge/aos_common/aoserrors github.com/aosedge/aos_common/aostypes github.com/aosedge/aos_common/api/cloudprotocol -github.com/aosedge/aos_common/api/communicationmanager/v2 -github.com/aosedge/aos_common/api/iamanager/v4 -github.com/aosedge/aos_common/api/servicemanager/v3 -github.com/aosedge/aos_common/api/updatemanager/v1 +github.com/aosedge/aos_common/api/common +github.com/aosedge/aos_common/api/communicationmanager +github.com/aosedge/aos_common/api/iamanager +github.com/aosedge/aos_common/api/servicemanager +github.com/aosedge/aos_common/api/updatemanager github.com/aosedge/aos_common/image github.com/aosedge/aos_common/journalalerts github.com/aosedge/aos_common/migration @@ -23,11 +24,13 @@ github.com/aosedge/aos_common/resourcemonitor github.com/aosedge/aos_common/spaceallocator github.com/aosedge/aos_common/tpmkey github.com/aosedge/aos_common/utils/action +github.com/aosedge/aos_common/utils/alertutils github.com/aosedge/aos_common/utils/contextreader github.com/aosedge/aos_common/utils/cryptutils github.com/aosedge/aos_common/utils/fs github.com/aosedge/aos_common/utils/pbconvert github.com/aosedge/aos_common/utils/retryhelper +github.com/aosedge/aos_common/utils/semverutils github.com/aosedge/aos_common/utils/syncstream github.com/aosedge/aos_common/utils/testtools github.com/aosedge/aos_common/utils/xentop @@ -177,6 +180,7 @@ golang.org/x/crypto/sha3 # golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 ## explicit; go 1.18 golang.org/x/exp/constraints +golang.org/x/exp/maps golang.org/x/exp/slices # golang.org/x/net v0.23.0 ## explicit; go 1.18