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

subscription tests and support #108

Open
wants to merge 1 commit into
base: testcases
Choose a base branch
from

Conversation

martin-volf
Copy link
Contributor

No description provided.

@@ -10,3 +10,6 @@ enable_extra_logs: False # configuration of gNMI library - whether to enable int

# test-case specific settings
oc_interface: MgmtEth0/RP0/CPU0/0

get-path: /interfaces
Copy link
Contributor

Choose a reason for hiding this comment

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

some comment to mark "subscribe" test related variables (plus short description of allowed value/meaning?)

self.requester: t.Optional[Requester] = None

def test_teardown(self) -> None:
self.paths = []
Copy link
Contributor

Choose a reason for hiding this comment

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

super().test_teardown() should be first item imho in case executive steps fail/raise exception...

Suite Setup Setup gNMI Client
Suite Teardown Close gNMI Client
Test Setup Setup gNMI Client
Test Teardown Teardown gNMI state
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming you are sure we want new client for each test (not suite), shouldn't you close the client in [Test teardown] as well? (you removed invocation Close gNMI Client, and teardown_test() does not invoke close_client()!)



Subscribe ONCE with updates_only in the SubscriptionList
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. ONCE Subscription operation is invoked with updates_only field set in SubscriptionRequest. Test verifies only one SubscribeResponse with only sync_response set to true.
[Tags] unimplemented

Basic functionality of the Subscribe POLL RPC .
Copy link
Contributor

Choose a reason for hiding this comment

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

[W] 0301 Not allowed character '.' found in 'Basic functionality of the Subscribe POLL RPC .' test case name (not-allowed-char-in-name)

(output of robocop -e wrong-case-in-keyword-name ./testtool/ | grep Subscribe, there are few other instances...)


QOS marked subscriptions
[Tags] unimplemented
Copy link
Contributor

Choose a reason for hiding this comment

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

imho adding also Skip KW as test "implementation" to silence some robocop lints allows easier resolution of actually failing tests vs non-existing ones... (same for other instances of "unimplemented" further)

... response with "sync_response".
Given Subscription paths ${GET-PATH}
And Subscription ONCE with encoding JSON_IETF
Then Device sends terminated response series and closes the stream
Copy link
Contributor

Choose a reason for hiding this comment

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

a bit too detailed/verbose imho, shorten at least a bit - maybe something like "Device terminates series on stream" - technical/interesting details can be clarified in [Documentation] of KW...

... respond with a series of responses terminated by an empty
... response with "sync_response".
Given Subscription paths ${GET-PATH}
And Subscription ONCE with encoding JSON_IETF
Copy link
Contributor

Choose a reason for hiding this comment

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

Subscription "mode" to clarify a bit?

Copy link
Contributor

Choose a reason for hiding this comment

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

These values might be strongly specific to supported models per device itself...
Maybe this should be part of device configuration .yaml as standalone section?
IMHO no need to separate from other device settings - no need to maintain in two (or more) separate places and having to remember them, instead of one single .yaml (woth proper description/sections separation) passed to robot.

encoding_str_to_int('JSON_IETF'))
responses = self._client.subscribe(slist)
return next(responses)
def __init__(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

super().__init__()!

Copy link
Contributor

Choose a reason for hiding this comment

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

[Documentation] missing across all KWs, but i assume that's to be filled in when tests stabilize/are cleaned up/de-linted later...

[Documentation] Test that the device correctly responds to all three
... "Subscribe" request modes. No further functionality (such as actually
[Documentation] Test that the device correctly responds to all three
... "Subscribe" request modes. No further functionality (such as actually
Copy link
Contributor

Choose a reason for hiding this comment

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

Does test close request on the server? Or does request remain open?

... send an initial set of responses terminated by an empty
... response with "sync_response".
Given Subscription paths ${GET-PATH}
And Subscription POLL with encoding JSON_IETF
Copy link
Contributor

Choose a reason for hiding this comment

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

Description mentions STREAM but POLL is in test.


STREAM with TARGET_DEFINED mode
[Tags] unimplemented
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to remove TARGET_DEFINED completely



Subscribe ONCE with updates_only in the SubscriptionList
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. ONCE Subscription operation is invoked with updates_only field set in SubscriptionRequest. Test verifies only one SubscribeResponse with only sync_response set to true.
[Tags] unimplemented
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve text
" Test verifies only one SubscribeResponse is received with only sync_response set to true:



Subscribe ONCE with updates_only in the SubscriptionList
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. ONCE Subscription operation is invoked with updates_only field set in SubscriptionRequest. Test verifies only one SubscribeResponse with only sync_response set to true.
[Tags] unimplemented

Basic functionality of the Subscribe POLL RPC .
# Parameters: common connection parameters, path, poll count, poll interval.
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. Subscription operation is invoked. First SubscriptionRequest is ONCE. After that POLL subscription requests are invoked with poll interval delay. Test verifies for each subscription data is received. Optionally, it can verify the data is the same as the one received in response for ONCE subscription. Test issues WARNING, if SubscriptionResponse stream is closed prematurely. Test issues WARNING if Updates in SubscriptionResponse are aggregated.
Copy link
Contributor

Choose a reason for hiding this comment

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

First SubscriptionRequest is ONCE. - this is wrong, it should be First SubscriptionRequest is with POLL mode in SubscriptionList.


Basic functionality of the Subscribe POLL RPC .
# Parameters: common connection parameters, path, poll count, poll interval.
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. Subscription operation is invoked. First SubscriptionRequest is ONCE. After that POLL subscription requests are invoked with poll interval delay. Test verifies for each subscription data is received. Optionally, it can verify the data is the same as the one received in response for ONCE subscription. Test issues WARNING, if SubscriptionResponse stream is closed prematurely. Test issues WARNING if Updates in SubscriptionResponse are aggregated.
[Tags] unimplemented

Subscribe POLL RPC with updates_only in the SubscriptionList.
# Parameters: common connection parameters, path, poll count, poll interval.
# Failure: Device does not respond, responds with an error, responds with an empty notification set or with a notification without updates, responds with incorrect encoding.
# Test is passed path to the data model, which contains limited number of elements. Subscription` operation is invoked. First SubscriptionRequest is ONCE with filled SubscriptionList containing updates_only set to true. This subscription is handled as ONCE subscription. After that, empty POLL subscription requests are invoked with poll interval delay. Test verifies for each subscription (also for initial ONCE) a SubscriptionResponse is received with only sync_response set to true (without other fields). Test issues WARNING, if SubscriptionResponse stream is closed prematurely. Test issues WARNING if Updates in SubscriptionResponse are aggregated.
Copy link
Contributor

Choose a reason for hiding this comment

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

First SubscriptionRequest is ONCE. - this is wrong, it should be First SubscriptionRequest is with POLL mode in SubscriptionList.

while (response := self.response_queue.get(block=wait)) is not None:
yield response
except queue.Empty:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there equivalent for responses.cancel() found in read_subscribe_responses in the client?

super().__init__()

def run(self) -> None:
# TODO: this dumps the MultiThreaded thing exception for XR
Copy link
Contributor

Choose a reason for hiding this comment

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

How it will be handled? I suggest WARNING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants