Skip to content

Commit

Permalink
Merge remote-tracking branch 'ttn/v3.28' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansmares committed Oct 31, 2023
2 parents c2b3be9 + 997906e commit c26f8d6
Show file tree
Hide file tree
Showing 51 changed files with 3,521 additions and 1,131 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ with the exception that this project **does not** follow Semantic Versioning.

For details about compatibility between different releases, see the **Commitments and Releases** section of our README.

## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

### Fixed

- Resolve scroll jumps when selecting different tabs of a table in the Console.

### Security

## [3.28.0] - 2023-10-31

### Added
Expand Down
84 changes: 60 additions & 24 deletions config/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3509,6 +3509,42 @@
"file": "shared.go"
}
},
"error:pkg/console/internal/events/protocol:message_type": {
"translations": {
"en": "invalid message type `{type}`"
},
"description": {
"package": "pkg/console/internal/events/protocol",
"file": "protocol.go"
}
},
"error:pkg/console/internal/events/subscriptions:already_subscribed": {
"translations": {
"en": "already subscribed with ID `{id}`"
},
"description": {
"package": "pkg/console/internal/events/subscriptions",
"file": "subscriptions.go"
}
},
"error:pkg/console/internal/events/subscriptions:no_identifiers": {
"translations": {
"en": "no identifiers"
},
"description": {
"package": "pkg/console/internal/events/subscriptions",
"file": "subscriptions.go"
}
},
"error:pkg/console/internal/events/subscriptions:not_subscribed": {
"translations": {
"en": "not subscribed with ID `{id}`"
},
"description": {
"package": "pkg/console/internal/events/subscriptions",
"file": "subscriptions.go"
}
},
"error:pkg/crypto/cryptoservices:no_app_key": {
"translations": {
"en": "no AppKey specified"
Expand Down Expand Up @@ -4382,67 +4418,67 @@
"file": "conversion.go"
}
},
"error:pkg/events/grpc:invalid_regexp": {
"error:pkg/events/grpc:no_identifiers": {
"translations": {
"en": "invalid regexp"
"en": "no identifiers"
},
"description": {
"package": "pkg/events/grpc",
"file": "grpc.go"
}
},
"error:pkg/events/grpc:no_identifiers": {
"error:pkg/events/grpc:storage_disabled": {
"translations": {
"en": "no identifiers"
"en": "events storage is not not enabled"
},
"description": {
"package": "pkg/events/grpc",
"file": "grpc.go"
}
},
"error:pkg/events/grpc:no_matching_events": {
"error:pkg/events/redis:channel_closed": {
"translations": {
"en": "no matching events for regexp `{regexp}`"
"en": "channel closed"
},
"description": {
"package": "pkg/events/grpc",
"file": "grpc.go"
"package": "pkg/events/redis",
"file": "redis.go"
}
},
"error:pkg/events/grpc:storage_disabled": {
"error:pkg/events/redis:unknown_encoding": {
"translations": {
"en": "events storage is not not enabled"
"en": "unknown encoding"
},
"description": {
"package": "pkg/events/grpc",
"file": "grpc.go"
"package": "pkg/events/redis",
"file": "codec.go"
}
},
"error:pkg/events/grpc:unknown_event_name": {
"error:pkg/events:invalid_regexp": {
"translations": {
"en": "unknown event `{name}`"
"en": "invalid regexp"
},
"description": {
"package": "pkg/events/grpc",
"file": "grpc.go"
"package": "pkg/events",
"file": "pattern.go"
}
},
"error:pkg/events/redis:channel_closed": {
"error:pkg/events:no_matching_events": {
"translations": {
"en": "channel closed"
"en": "no matching events for regexp `{regexp}`"
},
"description": {
"package": "pkg/events/redis",
"file": "redis.go"
"package": "pkg/events",
"file": "pattern.go"
}
},
"error:pkg/events/redis:unknown_encoding": {
"error:pkg/events:unknown_event_name": {
"translations": {
"en": "unknown encoding"
"en": "unknown event `{name}`"
},
"description": {
"package": "pkg/events/redis",
"file": "codec.go"
"package": "pkg/events",
"file": "pattern.go"
}
},
"error:pkg/fetch:fetch_file": {
Expand Down
13 changes: 11 additions & 2 deletions cypress/e2e/console/admin-panel/packet-broker/networks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ describe('Packet Broker networks', () => {
cy.intercept('/api/v3/pba/home-networks/policies*', {
fixture: 'console/packet-broker/policies-home-network.json',
})
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks`)
cy.visit(
`${Cypress.config(
'consoleRootPath',
)}/admin-panel/packet-broker/routing-configuration/networks`,
)
cy.findByLabelText('Use custom routing policies').check()

const { networks } = this.networks
const networksFiltered = networks.filter(
Expand Down Expand Up @@ -73,7 +78,11 @@ describe('Packet Broker networks', () => {
n => n.forwarder_id.net_id === 19 && n.forwarder_id.tenant_id === 'johan',
)

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks/19/johan`)
cy.visit(
`${Cypress.config(
'consoleRootPath',
)}/admin-panel/packet-broker/routing-configuration/networks/19/johan`,
)

cy.findAllByText(`${network.id.net_id.toString(16).padStart(6, '0')}/${network.id.tenant_id}`)
cy.findByText(
Expand Down
26 changes: 14 additions & 12 deletions cypress/e2e/console/admin-panel/packet-broker/registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ describe('Packet Broker registration', () => {
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByText('Packet Broker', { selector: 'h1' }).should('be.visible')
cy.findByText(/Packet Broker can be used to exchange traffic/).should('be.visible')
cy.findByText('Packet Broker documentation', { selector: 'a' }).should('be.visible')
cy.findByText(/Packet Broker is a service by The Things Industries/).should('be.visible')
cy.findByText('Packet Broker', { selector: 'a' }).should('be.visible')
cy.findByText('Packet Broker website', { selector: 'a' }).should('be.visible')
cy.findByText('Register network', { selector: 'span' }).should('be.visible')
cy.findByText('Enable Packet Broker', { selector: 'span' }).should('be.visible')
cy.findByTestId('switch')
.should('be.visible')
.and('not.be.checked')
.and('not.have.attr', 'disabled')
cy.findByText(/To enable peering/).should('be.visible')
cy.findByText(/Enabling will allow/).should('be.visible')

cy.findByText('Default routing policy').should('not.exist')
cy.findByText('Networks').should('not.exist')
Expand All @@ -89,18 +89,20 @@ describe('Packet Broker registration', () => {
cy.loginConsole({ user_id: 'admin', password: 'admin' })
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByText('Register network').click()
cy.findByText('Register network').next().findByTestId('switch').should('be.checked')
cy.findByText('List network publicly')
cy.findByText('Enable Packet Broker').click()
cy.findByText('Enable Packet Broker').next().findByTestId('switch').should('be.checked')
cy.findByText('List my network in Packet Broker publicly')
.should('be.visible')
.next()
.findByTestId('switch')
.should('be.checked')
cy.findByTestId('feature-info-forwarder-enabled').should('be.visible')
cy.findByTestId('feature-info-home-network-enabled').should('be.visible')
cy.findByTestId('tabs').findByText('Default routing policy').should('be.visible')
cy.findByTestId('tabs').findByText('Networks').should('be.visible')
cy.findByLabelText('Do not use a default routing policy for this network').should('be.checked')
cy.findByLabelText('Forward traffic to all networks registered in Packet Broker').should(
'exist',
)
cy.findByLabelText(
'Forward traffic to The Things Stack Sandbox (community network) only',
).should('exist')
cy.findByLabelText('Use custom routing policies').should('exist')

cy.findByTestId('error-notification').should('not.exist')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,63 @@ describe('Packet Broker routing policies', () => {
cy.loginConsole({ user_id: 'admin', password: 'admin' })
})

it('succeeds setting a default routing policy', () => {
it('succeeds setting a "traffic to all networks" routing configuration', () => {
cy.intercept('GET', '/api/v3/pba/home-networks/policies/default', { statusCode: 404 })
cy.intercept('PUT', '/api/v3/pba/home-networks/policies/default', {})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19', {})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19/johan', {})
cy.intercept('/api/v3/pba/networks*', { fixture: 'console/packet-broker/networks.json' })
cy.intercept('/api/v3/pba/home-networks/policies*', {
fixture: 'console/packet-broker/policies-home-network.json',
})
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByLabelText('Use default routing policy for this network').check()
cy.findByLabelText('Forward traffic to all networks registered in Packet Broker').check()
cy.findByRole('button', { name: 'Save routing configuration' }).click()

cy.findByTestId('error-notification').should('not.exist')
cy.findByTestId('toast-notification')
.should('be.visible')
.findByText('Default routing configuration set')
.should('be.visible')
})

it('succeeds setting a "only ttn" routing configuration', () => {
cy.intercept('GET', '/api/v3/pba/home-networks/policies/default', { statusCode: 404 })
cy.intercept('/api/v3/pba/networks*', { fixture: 'console/packet-broker/networks.json' })
cy.intercept('/api/v3/pba/home-networks/policies*', {
fixture: 'console/packet-broker/policies-home-network.json',
})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/default', {})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19', {})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19/johan', {})
cy.intercept('PUT', '/api/v3/pba/home-networks/policies/19/ttn', {})
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByLabelText(
'Forward traffic to The Things Stack Sandbox (community network) only',
).check()
cy.findByRole('button', { name: 'Save routing configuration' }).click()

cy.findByTestId('error-notification').should('not.exist')
cy.findByTestId('toast-notification')
.should('be.visible')
.findByText('Default routing configuration set')
.should('be.visible')
})

it('succeeds setting a custom routing configuration with a default routing policy', () => {
cy.intercept('GET', '/api/v3/pba/home-networks/policies/default', {
fixture: 'console/packet-broker/default-policy.json',
})
cy.intercept('PUT', '/api/v3/pba/home-networks/policies/default', {})
cy.intercept('/api/v3/pba/networks*', { fixture: 'console/packet-broker/networks.json' })
cy.intercept('/api/v3/pba/home-networks/policies*', {
fixture: 'console/packet-broker/policies-home-network.json',
})
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByLabelText('Use custom routing policies').check()

// Check routing policy form checkboxes.
cy.findByText('Uplink')
Expand All @@ -56,30 +107,35 @@ describe('Packet Broker routing policies', () => {
cy.findByLabelText('MAC data').check()
cy.findByLabelText('Application data').check()
})
cy.findByRole('button', { name: 'Save default policy' }).click()
cy.findByRole('button', { name: 'Save routing configuration' }).click()

cy.findByTestId('error-notification').should('not.exist')
cy.findByTestId('toast-notification')
.should('be.visible')
.findByText('Default routing policy set')
.findByText('Default routing configuration set')
.should('be.visible')
})

it('succeeds unsetting a default routing policy', () => {
cy.intercept('PUT', '/api/v3/pba/home-networks/policies/default', {})
cy.intercept('/api/v3/pba/networks*', { fixture: 'console/packet-broker/networks.json' })
cy.intercept('/api/v3/pba/home-networks/policies*', {
fixture: 'console/packet-broker/policies-home-network.json',
})
cy.intercept('GET', '/api/v3/pba/home-networks/policies/default', {
fixture: 'console/packet-broker/default-policy.json',
fixture: 'console/packet-broker/default-custom-policy.json',
})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/default', {})

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByLabelText('Do not use a default routing policy for this network').check()
cy.findByRole('button', { name: 'Save default policy' }).click()
cy.findByRole('button', { name: 'Save routing configuration' }).click()

cy.findByTestId('error-notification').should('not.exist')
cy.findByTestId('toast-notification')
.should('be.visible')
.findByText('Default routing policy set')
.findByText('Default routing configuration set')
.should('be.visible')
})

Expand All @@ -93,7 +149,11 @@ describe('Packet Broker routing policies', () => {
})
cy.intercept('PUT', '/api/v3/pba/home-networks/policies/19', {})

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks/19`)
cy.visit(
`${Cypress.config(
'consoleRootPath',
)}/admin-panel/packet-broker/routing-configuration/networks/19`,
)

// Check routing policy form checkboxes.
cy.findByLabelText('Use network specific routing policy').check()
Expand Down Expand Up @@ -138,7 +198,11 @@ describe('Packet Broker routing policies', () => {
})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19', {})

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks/19`)
cy.visit(
`${Cypress.config(
'consoleRootPath',
)}/admin-panel/packet-broker/routing-configuration/networks/19`,
)

cy.findByLabelText('Do not use a routing policy for this network').check()
cy.findByRole('button', { name: 'Save routing policy' }).click()
Expand All @@ -161,7 +225,11 @@ describe('Packet Broker routing policies', () => {
})
cy.intercept('DELETE', '/api/v3/pba/home-networks/policies/19', {})

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks/19`)
cy.visit(
`${Cypress.config(
'consoleRootPath',
)}/admin-panel/packet-broker/routing-configuration/networks/19`,
)

cy.findByLabelText('Use default routing policy for this network').check()
cy.findByRole('button', { name: 'Save routing policy' }).click()
Expand Down
11 changes: 11 additions & 0 deletions cypress/fixtures/console/packet-broker/default-custom-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"updated_at": "2021-06-21T12:09:26.810087Z",
"uplink": {
"join_request": true,
"mac_data": false,
"application_data": true,
"signal_quality": false,
"localization": false
},
"downlink": { "join_accept": true, "mac_data": false, "application_data": true }
}
Loading

0 comments on commit c26f8d6

Please sign in to comment.