-
Notifications
You must be signed in to change notification settings - Fork 10
Add traffic rules tests #394
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
Open
+1,276
−18
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
|
|
||
| from lib.common import _param_add, _param_clear, _param_get, _param_remove, _param_set | ||
| from lib.pif import PIF | ||
|
|
||
| from typing import TYPE_CHECKING, Literal, overload | ||
|
|
||
| if TYPE_CHECKING: | ||
| from lib.host import Host | ||
|
|
||
| class Tunnel: | ||
| xe_prefix = "tunnel" | ||
|
|
||
| def __init__(self, host: Host, uuid: str): | ||
| self.host = host | ||
| self.uuid = uuid | ||
|
|
||
| @overload | ||
| def param_get(self, param_name: str, key: str | None = ..., accept_unknown_key: Literal[False] = ...) -> str: | ||
| ... | ||
|
|
||
| @overload | ||
| def param_get( | ||
| self, param_name: str, key: str | None = ..., accept_unknown_key: Literal[True] = ... | ||
| ) -> str | None: | ||
| ... | ||
|
|
||
| def param_get(self, param_name: str, key: str | None = None, accept_unknown_key: bool = False) -> str | None: | ||
| return _param_get(self.host, self.xe_prefix, self.uuid, param_name, key, accept_unknown_key) | ||
|
|
||
| def param_set(self, param_name: str, value: str | bool | dict[str, str], key: str | None = None) -> None: | ||
| _param_set(self.host, self.xe_prefix, self.uuid, param_name, value, key) | ||
|
|
||
| def param_remove(self, param_name: str, key: str, accept_unknown_key: bool = False) -> None: | ||
| _param_remove(self.host, self.xe_prefix, self.uuid, param_name, key, accept_unknown_key) | ||
|
|
||
| def param_add(self, param_name: str, value: str, key: str | None = None) -> None: | ||
| _param_add(self.host, self.xe_prefix, self.uuid, param_name, value, key) | ||
|
|
||
| def param_clear(self, param_name: str) -> None: | ||
| _param_clear(self.host, self.xe_prefix, self.uuid, param_name) | ||
|
|
||
| def destroy(self): | ||
| logging.info(f"Destroying Tunnel: {self.uuid}") | ||
| self.host.xe('tunnel-destroy', {'uuid': self.uuid}) | ||
|
|
||
| def access_pif(self) -> PIF: | ||
| uuid = self.param_get("access-PIF") | ||
| assert uuid | ||
| return PIF(uuid, self.host) | ||
|
|
||
| def transport_pif(self) -> PIF: | ||
| uuid = self.param_get("transport-PIF") | ||
| assert uuid | ||
| return PIF(uuid, self.host) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
|
|
||
| from lib.common import _param_add, _param_clear, _param_get, _param_remove, _param_set | ||
| from lib.pif import PIF | ||
|
|
||
| from typing import TYPE_CHECKING, Literal, overload | ||
|
|
||
| if TYPE_CHECKING: | ||
| from lib.host import Host | ||
|
|
||
| class VLAN: | ||
| xe_prefix = "vlan" | ||
|
|
||
| def __init__(self, host: Host, uuid: str): | ||
| self.host = host | ||
| self.uuid = uuid | ||
|
|
||
| @overload | ||
| def param_get(self, param_name: str, key: str | None = ..., accept_unknown_key: Literal[False] = ...) -> str: | ||
| ... | ||
|
|
||
| @overload | ||
| def param_get( | ||
| self, param_name: str, key: str | None = ..., accept_unknown_key: Literal[True] = ... | ||
| ) -> str | None: | ||
| ... | ||
|
|
||
| def param_get(self, param_name: str, key: str | None = None, accept_unknown_key: bool = False) -> str | None: | ||
| return _param_get(self.host, self.xe_prefix, self.uuid, param_name, key, accept_unknown_key) | ||
|
|
||
| def param_set(self, param_name: str, value: str | bool | dict[str, str], key: str | None = None) -> None: | ||
| _param_set(self.host, self.xe_prefix, self.uuid, param_name, value, key) | ||
|
|
||
| def param_remove(self, param_name: str, key: str, accept_unknown_key: bool = False) -> None: | ||
| _param_remove(self.host, self.xe_prefix, self.uuid, param_name, key, accept_unknown_key) | ||
|
|
||
| def param_add(self, param_name: str, value: str, key: str | None = None) -> None: | ||
| _param_add(self.host, self.xe_prefix, self.uuid, param_name, value, key) | ||
|
|
||
| def param_clear(self, param_name: str) -> None: | ||
| _param_clear(self.host, self.xe_prefix, self.uuid, param_name) | ||
|
|
||
| def destroy(self): | ||
| logging.info(f"Destroying VLAN: {self.uuid}") | ||
| self.host.xe('vlan-destroy', {'uuid': self.uuid}) | ||
|
|
||
| def tag(self) -> int: | ||
| tag = self.param_get('tag') | ||
| assert tag | ||
| return int(tag) | ||
|
|
||
| def tagged_pif(self) -> PIF: | ||
| uuid = self.param_get("tagged-PIF") | ||
| assert uuid | ||
| return PIF(uuid, self.host) | ||
|
|
||
| def untagged_pif(self) -> PIF: | ||
| uuid = self.param_get("untagged-PIF") | ||
| assert uuid | ||
| return PIF(uuid, self.host) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ pytest>=9.1.1 | |
| pytest-dependency | ||
| requests | ||
| ipdb | ||
| rpm-version>=0.5.1 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is important to mention here that xo_cli is necessary. This PR changes a situation where only one job used to require XO, and now we have another job that requires XO (unless XO was already required by this job previously but not mentioned at the time in the requirements).
Let's add it here to the list of requirements, and I'll make sure it's clear to the team managing CI that this job has such as requirement.
I don't expect any issue, but they need to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sent the message. Only remains the need to update the list of requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added XO mention to the jobs entry (in the last commit I pushed).