Skip to content

Commit

Permalink
Add tests for DHCPv6 / rfc7600
Browse files Browse the repository at this point in the history
Add for section 4.9.  Provisioning 4rd Parameters to CEs
  • Loading branch information
jpereira authored and alandekok committed Jan 17, 2020
1 parent 245d7bf commit 8f3328f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
3 changes: 1 addition & 2 deletions share/dictionary/dhcpv6/dictionary.rfc7600
Expand Up @@ -10,8 +10,7 @@
#
##############################################################################

# This is really "group" of 4RD-Map-Rule
ATTRIBUTE 4RD 97 octets # Complex struct see RFC 7600
ATTRIBUTE 4RD 97 group # Complex struct see RFC 7600

ATTRIBUTE 4RD-Map-Rule 98 struct
MEMBER 4RD-Map-Rule-IPv4-Prefix-Len uint8
Expand Down
61 changes: 59 additions & 2 deletions src/tests/unit/protocols/dhcpv6/rfc7600.txt
Expand Up @@ -9,11 +9,68 @@
proto dhcpv6
proto-dictionary dhcpv6

encode-pair 4RD-Non-Map-Rule-Flag-Traffic-Class-Provided = true, 4RD-Non-Map-Rule-Flag-Hub-And-Spoke = true, 4RD-Non-Map-Rule-Domain-PMTU = 31
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | option = OPTION_4RD_MAP_RULE | option-length |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | prefix4-len | prefix6-len | ea-len |W| Reserved |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | rule-ipv4-prefix |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | |
# + +
# | rule-ipv6-prefix |
# + +
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# Figure 8: Encapsulated Option for Mapping-Rule Parameters
#
# o option code: 98, encapsulated OPTION_4RD_MAP_RULE option (see Section 6)
# o option-length: 20
# o prefix4-len: number of bits of the Rule IPv4 prefix
# o prefix6-len: number of bits of the Rule IPv6 prefix
# o ea-len: EA-bits length
# o W: WKP authorized, = 1 if set
# o rule-ipv4-prefix: Rule IPv4 prefix, left-aligned
# o rule-ipv6-prefix: Rule IPv6 prefix, left-aligned
#
encode-pair 4RD = { 4RD-Map-Rule-IPv4-Prefix-Len = 16, 4RD-Map-Rule-IPv6-Prefix-Len = 128, 4RD-Map-Rule-EA-Len = 4, 4RD-Map-Rule-WPK-Authorized = 1, 4RD-Map-Rule-IPv4-Prefix = 0x01020304 }
match 00 61 00 0c 00 62 00 08 10 80 04 01 01 02 03 04

decode-pair -
match 4RD = { 4RD-Map-Rule-IPv4-Prefix-Len = 16, 4RD-Map-Rule-IPv6-Prefix-Len = 128, 4RD-Map-Rule-EA-Len = 4, 4RD-Map-Rule-WPK-Authorized = 1, 4RD-Map-Rule-IPv4-Prefix = 0x01020304 }

#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# |option =OPTION_4RD_NON_MAP_RULE| option-length |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# |H| 0 |T| traffic-class | domain-pmtu |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# Figure 9: Encapsulated Option for Non-Mapping-Rule Parameters of 4rd Domains
#
# o option code: 99, encapsulated OPTION_4RD_NON_MAP_RULE option (see Section 6)
# o option-length: 4
# o H: Hub-and-spoke topology (= 1 if Yes)
# o T: Traffic Class flag (= 1 if a Tunnel Traffic Class is provided)
# o traffic-class: Tunnel Traffic Class
# o domain-pmtu: Domain PMTU (at least 1280 octets)
#
# Means other than DHCPv6 that may prove useful to provide 4rd
# parameters to CEs are off-scope for this document. The same or
# similar parameter formats would, however, be recommended to
# facilitate training and operation.
#
encode-pair 4RD-Non-Map-Rule-Flag-Traffic-Class-Provided = yes, 4RD-Non-Map-Rule-Flag-Hub-And-Spoke = yes, 4RD-Non-Map-Rule-Domain-PMTU = 31
match 00 63 00 02 81 1f

decode-pair -
match 4RD-Non-Map-Rule-Flag-Traffic-Class-Provided = yes, 4RD-Non-Map-Rule-Flag-Reserved = 0, 4RD-Non-Map-Rule-Flag-Hub-And-Spoke = yes, 4RD-Non-Map-Rule-Domain-PMTU = 31

count
match 6
match 10

0 comments on commit 8f3328f

Please sign in to comment.