Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Add LoRa route map validation and fix LoRa messages URL #491

Merged
merged 7 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/addons/lora-adapter/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
MF_LORA_ADAPTER_LOG_LEVEL: debug
MF_THINGS_ES_URL: things-redis:6379
MF_LORA_ADAPTER_ROUTEMAP_URL: lora-redis:6379
MF_LORA_ADAPTER_LORA_MESSAGE_URL: tcp://159.65.205.240:1883
MF_LORA_ADAPTER_LORA_MESSAGE_URL: tcp://mainflux.io:1883
MF_LORA_ADAPTER_HTTP_PORT: 8187
MF_NATS_URL: nats://nats:4222
ports:
Expand Down
6 changes: 6 additions & 0 deletions lora/redis/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ func (es eventStore) handleUpdateThing(ute updateThingEvent) error {
if em.Type != protocol {
return errors.New("Lora protocol not found in thing metadatada")
}
if em.DevEUI != "" {
return errors.New("Lora device EUI not found in thing metadatada")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move these errors to var block at the beginning of the file.

}

return es.svc.CreateThing(ute.id, em.DevEUI)
}
Expand All @@ -187,6 +190,9 @@ func (es eventStore) handleCreateChannel(cce createChannelEvent) error {
if cm.Type != protocol {
return errors.New("Lora protocol not found in channel metadatada")
}
if cm.AppID != "" {
return errors.New("Lora application ID not found in channel metadatada")
}

return es.svc.CreateChannel(cce.id, cm.AppID)
}
Expand Down
4 changes: 2 additions & 2 deletions lora/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ var (
ErrMalformedMessage = errors.New("malformed message received")

// ErrNotFoundDev indicates a non-existent route map for a device EUI.
ErrNotFoundDev = errors.New("route map not found for device EUI")
ErrNotFoundDev = errors.New("route map not found for this device EUI")

// ErrNotFoundApp indicates a non-existent route map for an application ID.
ErrNotFoundApp = errors.New("route map not found for application ID")
ErrNotFoundApp = errors.New("route map not found for this application ID")
)

// Service specifies an API that must be fullfiled by the domain service
Expand Down