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

Remap DHCP JSON response to accommodate draft-04 of the API specification #3002

Merged
merged 6 commits into from
Mar 13, 2018

Conversation

satkunas
Copy link
Contributor

Description

Remap the DHCP output JSON to avoid using dynamic keys. Only static keys are currently allowed in draft-04 of the API specification.

In normal JSON Schema you could use patternProperties, but OpenAPI forbids it. If JSON Schema draft-06 or later were supported you could use propertyNames, but OpenAPI is based on draft-04
Ref: https://github.com/OAI/OpenAPI-Specification/issues/1505#issuecomment-372054402

Impacts

  • Changes pfdhcp JSON response on /dhcp/stats/{interface} and /dhcp/initialease/{interface} endpoints.

Delete branch after merge

YES

Bug Fixes

type: string
description: Lease time
optionRouter:
description: The IPv4 address of the dhcp member
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the IP and MAC description are mixed up

Copy link
Contributor Author

@satkunas satkunas Mar 12, 2018

Choose a reason for hiding this comment

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

Looks good on my end

curl http://localhost:22222/api/v1/dhcp/stats/enp0s8

[{
    "interface": "enp0s8",
    "network": "10.10.0.0/16",
    "free": 65515,
    "category": "none",
    "options": {
        "optionDomainName": "inlinel2.satkunas.com",
        "optionDomainNameServer": "10.10.0.2",
        "optionIPAddressLeaseTime": "24h0m0s",
        "optionRouter": "10.10.0.2",
        "optionSubnetMask": "255.255.0.0"
    },
    "members": [{
        "mac": "ac:cf:85:26:a0:66",
        "ip": "10.10.0.17"
    }, {
        "mac": "b8:27:eb:91:4e:5b",
        "ip": "10.10.0.12"
    }],
    "status": "Normal"
}]

@julsemaan
Copy link
Collaborator

And actually, you were right, I was wrong for the openapi.json + openapi.yaml in the PRs, they shouldn't be included, when we talked I had devel in mind.

So to fix it:

# git checkout bugfix/api-dhcp
# git fetch origin
# git rebase origin/devel
# git checkout origin/devel docs/api/spec/openapi.json
# git checkout origin/devel docs/api/spec/openapi.yaml
# git commit -a -m "undo crap @julsemaan told me to do"
## The line above may say that there is nothing to commit, if that is the case, its fine, just ignore it
# git push origin bugfix/api-dhcp --force

@julsemaan
Copy link
Collaborator

Also, very minor detail, the fix branches should be named fix/prevent-zammitbug and not bugfix/prevent-zammitbug

@julsemaan julsemaan mentioned this pull request Mar 12, 2018
type: string
description: Associated role of the dhcp scope
options:
description: Statistics of the dhcp scope
Copy link
Member

Choose a reason for hiding this comment

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

dhcp -> DHCP everywhere

@satkunas
Copy link
Contributor Author

@julsemaan rebase commited. Also, /s/bigfix/fix noted.

@satkunas satkunas changed the title Remap dhcp JSON to accomodate draft-04 of the API specification Remap DHCP JSON response to accommodate draft-04 of the API specification Mar 12, 2018
@julsemaan julsemaan merged commit 22dcc22 into devel Mar 13, 2018
@julsemaan julsemaan deleted the bugfix/api-dhcp branch March 13, 2018 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants