Skip to content

Conversation

fiorix
Copy link
Owner

@fiorix fiorix commented Feb 12, 2015

This change has much better documentation and test coverage, adds support for a test server analogous to net/http/httptest, and has a few bug fixes (most notably in Float64 and Unsigned64).

It fixes all warnings from go vet and golint, at the expense of being backwards incompatible. Constants like SessionId are now SessionID and so on. Also, the avp/format package has been renamed to datatype to reflect the RFC nomenclature.

The default dictionary parser dict.Default has both the Base Protocol (app 0) and Credit Control (app 4) applications, and the standalone Credit Control is gone.

The Format interface has been renamed to DataType to resemble the RFC
nomenclature. There's a slight change in the interface regarding the
Format method and FormatId type, which are now Type and TypeID
respectively.

Test coverage is above 90% although some of the tests are very similar,
since some types (e.g. DiameterIdentity, DiameterURI, etc) are inherited
from base types like OctetString and Integer32.

All comments and code conform 100% to golint.
There's a separate script to generate codes.go now. Not sure if this
should be called automatically using Go generate for now, but it can in
the future.

The focus of this commit is to clean up the file and make it satisfy
golint with no warnings - mostly about Id vs ID.
This is part of the rename of the "format" package to "datatype" and all
sub-packages where it propagates.
Mostly comments and Id->ID
Currently 3 files are automatically generated from dictionaries that
live in dict/testdata/*.xml:

- commands.go: List of Diameter commands (CE, CC, etc)
- avp/codes.go: List of AVP codes (OriginHost and so on)
- dict/default.go: Default built-in dictionary parser

There's no need to use Go generate for now, so once a dictionary is
updated (although it shoudln't) or a new dictionary is added, we should
run `sh autogen.sh` once. The generated code is gofmt'ed as expected.

Since this commit, the default Parser will include both the Base
dictionary (app=0) and the Credit Control dictionary (app=4).
Currently 3 files are automatically generated from dictionaries that
live in dict/testdata/*.xml:

- commands.go: List of Diameter commands (CE, CC, etc)
- avp/codes.go: List of AVP codes (OriginHost and so on)
- dict/default.go: Default built-in dictionary parser

There's no need to use Go generate for now, so once a dictionary is
updated (although it shoudln't) or a new dictionary is added, we should
run `sh autogen.sh` once. The generated code is gofmt'ed as expected.

Since this commit, the default Parser will include both the Base
dictionary (app=0) and the Credit Control dictionary (app=4).
@fiorix
Copy link
Owner Author

fiorix commented Feb 12, 2015

See this @dwilkie.

fiorix added a commit that referenced this pull request Feb 12, 2015
@fiorix fiorix merged commit c9afbdf into master Feb 12, 2015
@fiorix fiorix deleted the v3 branch February 13, 2015 03:31
@dwilkie
Copy link
Contributor

dwilkie commented Feb 13, 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.

2 participants