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

Lease6 iaid duid properties #4

Merged

Conversation

freddy36
Copy link
Contributor

add iaid and duid properties to the Lease6 object (extracted from the host_identifier)

@@ -160,6 +162,9 @@ def __init__(self, ip, data, cltt, host_identifier, address_type):
self.last_communication = cltt

self.host_identifier = codecs.decode(host_identifier, "unicode_escape")
host_identifier_bytes = self.host_identifier.encode('latin-1')
self.iaid = int.from_bytes(host_identifier_bytes[0:4], byteorder='little')
Copy link
Owner

Choose a reason for hiding this comment

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

This breaks compatibility with python 2.7 since this function is python 3 specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed now

@MartijnBraam
Copy link
Owner

This is a great functionallity to have but there is no test case added. I also added some comments in the code

@freddy36
Copy link
Contributor Author

python 2.7 compatibility has been restored and test cases have been updated

@MartijnBraam
Copy link
Owner

The python2.7 tests are still failing. It seems my travis config is not fully correct since it reports the status of the coveralls upload but if you look at https://travis-ci.org/MartijnBraam/python-isc-dhcp-leases/jobs/79677899 you can see the errors. These are all unicode but i'm not completely sure how to fix that without breaking python3.2 compatability

Also from the dhcpd.leases documentation:

The IAID_DUID value is recorded as a colon-separated hexadecimal list or as a quoted string. If it is recorded as a quoted string and it contains one or more non-printable characters, those characters are represented as octal escapes - a backslash character followed by three octal digits.

The quoted variant used in the dhcpd6.leases test file are in octal and parsed as a escaped unicode string so the value is correct. Also the code doesn't account for the colon-separated variant but that's a problem for when I actually have a example file to test against

@MartijnBraam MartijnBraam merged commit cdb03a2 into MartijnBraam:master Sep 10, 2015
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.

None yet

2 participants