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

dhcp: T6611: add vendor support for ShoreTel IP phones #3884

Open
wants to merge 9 commits into
base: current
Choose a base branch
from

Conversation

bk2zsto
Copy link

@bk2zsto bk2zsto commented Jul 26, 2024

Change Summary

Add ShoreTel support to dhcp

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

dhcp

Proposed changes

update KEA initial conf and interface def

How to test

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Jul 26, 2024


Commit title 'match ShoreTel camel case in interface help' does not match the required format!. Valid title example: T99999: make IPsec secure

Copy link

github-actions bot commented Jul 26, 2024

✅ No issues found in unused-imports check.. Please refer the workflow run

Copy link
Member

@sarthurdev sarthurdev left a comment

Choose a reason for hiding this comment

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

Missing logic to add the option in Kea config, see here: https://github.com/vyos/vyos-1x/blob/current/python/vyos/kea.py#L94

Also please include the option in a dhcp server smoketest to validate the functionality: https://github.com/vyos/vyos-1x/blob/current/smoketest/scripts/cli/test_service_dhcp-server.py#L159

@bk2zsto
Copy link
Author

bk2zsto commented Jul 28, 2024

I flubbed the commit message when I merged current and the build seems to be failing in unrelated areas. The smokes succeeded so I think everything is there. Should I amend the message and push again or just leave it be?

Copy link

CI integration ❌ failed!

Details

CI logs

  • CLI Smoketests 👍 passed
  • Config tests ❌ failed
  • RAID1 tests 👍 passed

@sarthurdev
Copy link
Member

Thanks for the changes, this is looking good. Have you tested a build to ensure the option works as intended?

@bk2zsto
Copy link
Author

bk2zsto commented Jul 28, 2024

Thanks for the changes, this is looking good. Have you tested a build to ensure the option works as intended?

Haven't gotten there yet. I'll be offline for about a week so won't be able to revisit until after that.

Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

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

Just a minor comment about help strings.

@@ -232,6 +232,25 @@
</leafNode>
</children>
</node>
<node name="shoretel">
<properties>
<help>Shoretel-specfic parameters</help>
Copy link
Member

Choose a reason for hiding this comment

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

I suppose we should consistently capitalize "ShoreTel" like they do in their branding.

@bk2zsto
Copy link
Author

bk2zsto commented Aug 7, 2024 via email

@github-actions github-actions bot added the rebase label Aug 8, 2024
@c-po
Copy link
Member

c-po commented Aug 20, 2024

@Mergifyio rebase

Copy link
Contributor

mergify bot commented Aug 20, 2024

rebase

✅ Branch has been successfully rebased

@bk2zsto
Copy link
Author

bk2zsto commented Aug 29, 2024

Have been busy with other projects but for simplicity, the plan was to unconditionally send this option to all clients but an ISC KB shows the issue. It looks like ShoreTel chose 156 and defined it as a string before it was registered (cf. 1.1.1.1) but never told IANA. After that RFC 6926 defined 156 as an integer so Kea barfs on the redefinition if it is in the "dhcp4" (default) space. In the "shoretel" space it will not be sent unless an option 60 triggers it. Oddly (or totally expectedly) Windows DHCP server cares not a whit about this.

The client class stuff is relatively easy in the Kea cfg file itself but how does the top of kea-dhcp4.conf.j2 check for a shared-network that needs the class? Seems really inefficient to kea_shared_network_json, then json.loads() the result and then check for the option. OTOH not looking to unconditionally load up client classes.

I probably have the Python-fu to do a generic/abstract client class checker/handler but not sure how to do it in a VyOS-ic way. This may even be reinventing the wheel, I dont know.

This is my itch to scratch so I can take on the coding but suspect I need some design guidance. Help!

Copy link
Member

@sarthurdev sarthurdev left a comment

Choose a reason for hiding this comment

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

Thanks for your changes, sorry for the lack of comments. The client-class is a great solution for the addition of these options only when needed.

Added few requests to get this PR in a state ready for merge.

<description>Comma-separated parameters for ShoreTel phone configuration</description>
</valueHelp>
<constraint>
<validator name="shoretel-server"/>
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the validator and instead just put the regex in the XML instead.

Example here: https://github.com/vyos/vyos-1x/blob/current/interface-definitions/firewall.xml.in#L14

@@ -114,6 +115,13 @@ def kea_parse_subnet(subnet, config):
if 'bootfile_server' in config['option']:
out['next-server'] = config['option']['bootfile_server']

if kea_client_classes(config):
if kea_client_classes(config,'shoretel'):
Copy link
Member

Choose a reason for hiding this comment

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

This should be optimised so the kea_client_classes is not needing to be called twice.

@@ -138,6 +146,13 @@ def kea_parse_subnet(subnet, config):
if 'bootfile_server' in range_config['option']:
pool['next-server'] = range_config['option']['bootfile_server']

if kea_client_classes(config):
if kea_client_classes(config,'shoretel'):
Copy link
Member

Choose a reason for hiding this comment

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

This should be optimised so the kea_client_classes is not needing to be called twice.

@@ -169,6 +184,13 @@ def kea_parse_subnet(subnet, config):
if 'bootfile_server' in host_config['option']:
reservation['next-server'] = host_config['option']['bootfile_server']

if kea_client_classes(config):
if kea_client_classes(config,'shoretel'):
Copy link
Member

Choose a reason for hiding this comment

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

This should be optimised so the kea_client_classes is not needing to be called twice.

@@ -48,9 +48,9 @@ def _get_environment(location=None):
loc_loader=FileSystemLoader(location)
env = Environment(
# Don't check if template files were modified upon re-rendering
auto_reload=False,
auto_reload=True,
Copy link
Member

Choose a reason for hiding this comment

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

Aren't these changes irrelevant to this PR?

@@ -871,6 +871,32 @@ def kea_high_availability_json(config):

return dumps(data)

@register_filter('kea_client_classes')
Copy link
Member

Choose a reason for hiding this comment

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

As not used in any Jinja templates, this doesn't need to be registered.

@@ -897,12 +923,20 @@ def kea_shared_network_json(shared_networks):
if 'bootfile_server' in config['option']:
network['next-server'] = config['option']['bootfile_server']

if kea_client_classes(config):
if kea_client_classes(config, 'shoretel'):
Copy link
Member

Choose a reason for hiding this comment

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

This should be optimised so the kea_client_classes is not needing to be called twice.

if 'subnet' in config:
for subnet, subnet_config in config['subnet'].items():
if 'disable' in subnet_config:
continue
network['subnet4'].append(kea_parse_subnet(subnet, subnet_config))

if kea_client_classes(subnet_config):
if kea_client_classes(subnet_config, 'shoretel'):
Copy link
Member

Choose a reason for hiding this comment

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

This should be optimised so the kea_client_classes is not needing to be called twice.

@bk2zsto
Copy link
Author

bk2zsto commented Sep 27, 2024 via email

@sarthurdev
Copy link
Member

Let me know if its better to close this out and start again or if I can keep it queued for myself.

Feel free to get to this when you can. Thanks

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

Successfully merging this pull request may close these issues.

4 participants