-
Couldn't load subscription status.
- Fork 9
Add NSISTP product and workflows #42
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
Conversation
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.
| else: | ||
| return False, f"date `{date}` has invalid length" | ||
|
|
||
| return True, None |
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.
This could rely entirely on the validation by datetime.datetime.strptime
VALID_DATE_FORMATS = {
4: '%Y',
6: '%Y%m',
8: '%Y%m%d',
}
def valid_date(date: str) -> tuple[bool, str | None]:
if not (date_format := VALID_DATE_FORMATS.get(len(date))):
return False, f"Invalid date length, expected one of: {list(VALID_DATE_FORMATS)}"
try:
_ = datetime.strptime(date, date_format)
return True, None
except ValueError as exc:
return False, f"Invalid date for format {date_format!r}: {exc}"| from surf.config.service_port_tags import SN8_PORT_TAGS_AGGSP, SN8_PORT_TAGS_MSC, SN8_PORT_TAGS_SP_ALL | ||
| from surf.db import SurfSubscriptionTable | ||
| from surf.forms.validator.service_port import service_port | ||
| from surf.products.product_types.sn8_nsistp import Nsistp, NsistpInactive | ||
| from surf.utils.exceptions import DuplicateValueError, FieldValueError |
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.
These surf imports should have been removed probably?
| def nsistp_fill_sap(subscription: NsistpInactive, service_ports: list[dict]) -> None: | ||
| sp = one(service_ports) |
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.
Would be cleaner to do the one(service_ports) selection in the caller function
|
|
||
| def _get_nsistp_subscriptions(subscription_id: UUID | None) -> Iterator[Nsistp]: | ||
| query = ( | ||
| select(SurfSubscriptionTable.subscription_id) |
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.
Can probably just replace SurfSubscriptionTable with SubscriptionTable (from orchestrator.db.models)
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.
Think we want to remove sn8 from the folder structure
|
|
||
|
|
||
| def nsistp_service_port(current: list[State] | None = None) -> type: | ||
| return service_port( |
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.
This surf validator is not present in the example-orchestrator. We'd need a port of that.
|
Like the first commit message already stated, this is the 'SURF NSISTP implementation to be used as basis'. This is the original, very SURF specific, code. But another pull request was made for the refactored code. I suggest we close this one. |
No description provided.