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

Added DHCP Packet Parser And Generator. #22

Closed
wants to merge 14 commits into from
Closed

Added DHCP Packet Parser And Generator. #22

wants to merge 14 commits into from

Conversation

shun159
Copy link
Member

@shun159 shun159 commented Jan 20, 2014

DHCPを追加致しました。

大変恐縮では御座いますが、
ご指摘・ご意見頂けますと大変幸甚です。

何卒、宜しくお願いします。
以上です。

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 3361363 on shun159:pull_request into 229c20f on trema:develop.

@yasuhito
Copy link
Member

おつかれさまです && さすがにでけえ。。。

とりあえず、ぱっと使い方が分かるように、README に DHCP の example を他と同様に追加してもらえますか?

@yasuhito
Copy link
Member

あと、毎回恐縮とかていねいに書かなくていいですよ! こちらも恐縮するので。。
他の人もなんとなく参加しづらくなっちゃいますしね 🍶

@shun159
Copy link
Member Author

shun159 commented Jan 21, 2014

とりあえず、ぱっと使い方が分かるように、README に DHCP の example を他と同様に追加してもらえますか?

はい、追加しましたー。

あと、毎回恐縮とかていねいに書かなくていいですよ! こちらも恐縮するので。。

すみません。。。ついクセで汗

@yasuhito
Copy link
Member

README 最初にあるパケット種類の箇条書きと、例の順番に整合性を持たせてください。
簡単なほうから並んでいたほうがいいので、DHCP の例は一番最後がいいと思います。

@shun159
Copy link
Member Author

shun159 commented Jan 22, 2014

修正しました。

@shun159
Copy link
Member Author

shun159 commented Feb 5, 2014

レビューいかがでしょうか?

もし、レビューに手間かかり過ぎるほど全然ダメ、とか、先にやるべきこと(ドキュメント整備や開発補助ツールの追加等)があれば、一旦、このPRをcloseにするか、pendingにするとか考えています。

宜しくお願いします。

@yasuhito
Copy link
Member

yasuhito commented Feb 5, 2014

ping ありがとうございます.

今, 別のところにとりかかっていてまだ pio までたどりつけていないので, すみませんが先にすぎょうさんの書いてくれたパケットを Array に変換するやつを pio に入れる作業をしてもらえるでしょうか? とりあえず議論のためのチケットを切ってもらって,ツールのインタフェースの議論を始めたいと思います.

それができたら, それを使って dhcp の *_spec.rb を書き直すなどを始められると思います.

この PR はこのままで大丈夫です.

@shun159
Copy link
Member Author

shun159 commented Feb 5, 2014

@yasuhito
承知しました。有難う御座います。
#20 をそのまま使いたいと思います。

@yasuhito
Copy link
Member

yasuhito commented Mar 3, 2014

ようやく DHCP のマージに取りかかりました。
で実行してみましたが、以下のように 8 つほどエラーが出てしまいました。
簡単に直せそうでしょうか?

prompt> rspec --format d
Pio::Arp::Reply
  .new
    with Integer MAC and IP address
      #to_binary
        returns an Arp Reply binary String
        returns a valid ether frame with size = 64
    with String MAC and Integer IP address
      #to_binary
        returns an Arp Reply binary String
        returns a valid ether frame with size = 64
    when Integer MAC and String IP address
      #to_binary
        returns an Arp Reply binary String
        returns a valid ether frame with size = 64
    when :source_mac is not set
      raises an invalid MAC address error
    when :destination_mac is not set
      raises an invalid MAC address error
    when :sender_protocol_address is not set
      raises an invalid IPv4 address error
    when :target_protocol_address is not set
      raises an invalid IPv4 address error

Pio::Arp::Request
  .new
    with Integer MAC and IP address
      #to_binary
        returns an Arp Request binary String
        returns a valid ether frame with size = 64
    with String MAC and IP address
      #to_binary
        returns an Arp Request binary String
        returns a valid ether frame with size = 64
    with Integer MAC and String IP address
      #to_binary
        returns an Arp Request binary String
        returns a valid ether frame with size = 64
    when :source_mac is not set
      raises an invalid MAC address error
    when :sender_protocol_address is not set
      raises an invalid IPv4 address error
    when :target_protocol_address is not set
      raises an invalid IPv4 address error

Pio::Arp
  .read
    with an ARP Request packet
      class
        should equal Pio::Arp::Request
      destination_mac.to_s
        should eq "ff:ff:ff:ff:ff:ff"
      source_mac.to_s
        should eq "00:26:82:eb:ea:d1"
      ether_type
        should eq 2054
      hardware_type
        should eq 1
      protocol_type
        should eq 2048
      hardware_length
        should eq 6
      protocol_length
        should eq 4
      operation
        should eq 1
      sender_hardware_address.to_s
        should eq "00:26:82:eb:ea:d1"
      sender_protocol_address.to_s
        should eq "192.168.83.3"
      target_hardware_address.to_s
        should eq "00:00:00:00:00:00"
      target_protocol_address.to_s
        should eq "192.168.83.254"
    with an ARP Reply packet
      class
        should equal Pio::Arp::Reply
      destination_mac.to_s
        should eq "00:26:82:eb:ea:d1"
      source_mac.to_s
        should eq "00:16:9d:1d:9c:c4"
      ether_type
        should eq 2054
      hardware_type
        should eq 1
      protocol_type
        should eq 2048
      hardware_length
        should eq 6
      protocol_length
        should eq 4
      operation
        should eq 2
      sender_hardware_address.to_s
        should eq "00:16:9d:1d:9c:c4"
      sender_protocol_address.to_s
        should eq "192.168.83.254"
      target_hardware_address.to_s
        should eq "00:26:82:eb:ea:d1"
      target_protocol_address.to_s
        should eq "192.168.83.3"
    with an ARP Request captured in real environment
      should not raise Exception
    with an ARP Request from a real OpenFlow switch
      should not raise Exception
    with an ARP Reply captured in real environment
      should not raise Exception
    with an invalid ARP packet
      should raise Pio::ParseError

Pio::Dhcp::Ack
  .new
    with Pio::MAC Address and Pio::IPv4Address Address
      #to_binary
        returns a DHCP ack binary string (FAILED - 1)
        returns a valid ether frame with size = 342
    with String MAC Address
      #to_binary
        returns a DHCP ack binary string (FAILED - 2)
        returns a valid ether frame with size = 342

Pio::Dhcp::Discover
  .new
    with MAC object Address
      #to_binary
        returns a DHCP discover binary string (FAILED - 3)
        returns a valid ether frame with size = 342
    with String MAC Address
      #to_binary
        returns a DHCP discover binary string (FAILED - 4)
        returns a valid ether frame with size = 342

Pio::Dhcp::Offer
  .new
    with Pio::MAC Address and Pio::IPv4Address Address
      #to_binary
        returns a DHCP ack binary string (FAILED - 5)
        returns a valid ether frame with size = 342
    with String MAC Address
      #to_binary
        returns a DHCP ack binary string (FAILED - 6)
        returns a valid ether frame with size = 342

Pio::Dhcp::Request
  .new
    with String Address
      #to_binary
        returns a DHCP Request binary string (FAILED - 7)
        returns a valid ether frame with size = 342
    with IPv4Address Object Address And Mac Object Address
      #to_binary
        returns a DHCP Request binary string (FAILED - 8)
        returns a valid ether frame with size = 342

Pio::Dhcp
  .read
    with DHCP Discover frame
      class
        should equal Pio::Dhcp::Discover
      destination_mac.to_s
        should eq "ff:ff:ff:ff:ff:ff"
      source_mac.to_s
        should eq "24:db:ac:41:e5:5b"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 328
      ip_identifier
        should eq 0
      ip_flag
        should eq 0
      ip_fragment
        should eq 0
      ip_ttl
        should eq 128
      ip_protocol
        should eq 17
      ip_header_checksum
        should eq 14758
      ip_source_address.to_s
        should eq "0.0.0.0"
      ip_destination_address.to_s
        should eq "255.255.255.255"
      udp_src_port
        should eq 68
      udp_dst_port
        should eq 67
      udp_length
        should eq 308
      udp_checksum
        should eq 34836
      message_type
        should eq 1
      hw_addr_type
        should eq 1
      hw_addr_len
        should eq 6
      hops
        should eq 0
      transaction_id
        should eq 3735928559
      seconds
        should eq 0
      bootp_flags
        should eq 0
      client_ip_address.to_s
        should eq "0.0.0.0"
      your_ip_address.to_s
        should eq "0.0.0.0"
      next_server_ip_address.to_s
        should eq "0.0.0.0"
      relay_agent_ip_address.to_s
        should eq "0.0.0.0"
      client_mac_address.to_s
        should eq "24:db:ac:41:e5:5b"
      client_identifier_tlv.to_s
        should eq "24:db:ac:41:e5:5b"
      requested_ip_address_tlv.to_s
        should eq "0.0.0.0"
      parameters_list_tlv
        should eq [1, 3, 6, 42]
    with DHCP offer frame
      class
        should equal Pio::Dhcp::Offer
      destination_mac.to_s
        should eq "11:22:33:44:55:66"
      source_mac.to_s
        should eq "aa:bb:cc:dd:ee:ff"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 328
      ip_identifier
        should eq 0
      ip_flag
        should eq 0
      ip_fragment
        should eq 0
      ip_ttl
        should eq 128
      ip_protocol
        should eq 17
      ip_header_checksum
        should eq 47177
      ip_source_address.to_s
        should eq "192.168.0.10"
      ip_destination_address.to_s
        should eq "192.168.0.1"
      udp_src_port
        should eq 67
      udp_dst_port
        should eq 68
      udp_length
        should eq 308
      udp_checksum
        should eq 7780
      message_type
        should eq 2
      hw_addr_type
        should eq 1
      hw_addr_len
        should eq 6
      hops
        should eq 0
      transaction_id
        should eq 3735928559
      seconds
        should eq 0
      bootp_flags
        should eq 0
      client_ip_address.to_s
        should eq "0.0.0.0"
      your_ip_address.to_s
        should eq "192.168.0.1"
      next_server_ip_address.to_s
        should eq "0.0.0.0"
      relay_agent_ip_address.to_s
        should eq "0.0.0.0"
      client_mac_address.to_s
        should eq "aa:bb:cc:dd:ee:ff"
      server_identifier_tlv.to_s
        should eq "192.168.0.10"
      subnet_mask_tlv.to_s
        should eq "255.255.255.0"
      renewal_time_value_tlv
        should eq 3735928559
      rebinding_time_value_tlv
        should eq 3735928559
      ip_address_lease_time_tlv
        should eq 3735928559
    with DHCP Request frame
      class
        should equal Pio::Dhcp::Request
      destination_mac.to_s
        should eq "ff:ff:ff:ff:ff:ff"
      source_mac.to_s
        should eq "24:db:ac:41:e5:5b"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 328
      ip_identifier
        should eq 0
      ip_flag
        should eq 0
      ip_fragment
        should eq 0
      ip_ttl
        should eq 128
      ip_protocol
        should eq 17
      ip_header_checksum
        should eq 14758
      ip_source_address.to_s
        should eq "0.0.0.0"
      ip_destination_address.to_s
        should eq "255.255.255.255"
      udp_src_port
        should eq 68
      udp_dst_port
        should eq 67
      udp_length
        should eq 308
      udp_checksum
        should eq 52915
      message_type
        should eq 3
      hw_addr_type
        should eq 1
      hw_addr_len
        should eq 6
      hops
        should eq 0
      transaction_id
        should eq 3735928559
      seconds
        should eq 0
      bootp_flags
        should eq 0
      client_ip_address.to_s
        should eq "0.0.0.0"
      your_ip_address.to_s
        should eq "0.0.0.0"
      next_server_ip_address.to_s
        should eq "0.0.0.0"
      relay_agent_ip_address.to_s
        should eq "0.0.0.0"
      client_mac_address.to_s
        should eq "24:db:ac:41:e5:5b"
      client_identifier_tlv.to_s
        should eq "24:db:ac:41:e5:5b"
      requested_ip_address_tlv.to_s
        should eq "192.168.0.10"
      parameters_list_tlv
        should eq [1, 3, 6, 42]
    with DHCP ACK frame
      class
        should equal Pio::Dhcp::Ack
      destination_mac.to_s
        should eq "11:22:33:44:55:66"
      source_mac.to_s
        should eq "aa:bb:cc:dd:ee:ff"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 328
      ip_identifier
        should eq 0
      ip_flag
        should eq 0
      ip_fragment
        should eq 0
      ip_ttl
        should eq 128
      ip_protocol
        should eq 17
      ip_header_checksum
        should eq 47177
      ip_source_address.to_s
        should eq "192.168.0.10"
      ip_destination_address.to_s
        should eq "192.168.0.1"
      udp_src_port
        should eq 67
      udp_dst_port
        should eq 68
      udp_length
        should eq 308
      udp_checksum
        should eq 7012
      message_type
        should eq 5
      hw_addr_type
        should eq 1
      hw_addr_len
        should eq 6
      hops
        should eq 0
      transaction_id
        should eq 3735928559
      seconds
        should eq 0
      bootp_flags
        should eq 0
      client_ip_address.to_s
        should eq "0.0.0.0"
      your_ip_address.to_s
        should eq "192.168.0.1"
      next_server_ip_address.to_s
        should eq "0.0.0.0"
      relay_agent_ip_address.to_s
        should eq "0.0.0.0"
      client_mac_address.to_s
        should eq "aa:bb:cc:dd:ee:ff"
      server_identifier_tlv.to_s
        should eq "192.168.0.10"
      subnet_mask_tlv.to_s
        should eq "255.255.255.0"
      renewal_time_value_tlv
        should eq 3735928559
      rebinding_time_value_tlv
        should eq 3735928559
      ip_address_lease_time_tlv
        should eq 3735928559

Pio::Icmp::Reply
  .new
    with :echo_data
      #to_binary
        returns an ICMP reply binary string
    with an empty :echo_data
      #to_binary
        returns an ICMP reply binary string

Pio::Icmp::Request
  .new
    with :echo_data
      #to_binary
        returns an ICMP request binary string
    with an emply :echo_data
      #to_binary
        returns an ICMP request binary string

Pio::Icmp
  .read
    with Icmp request frame
      destination_mac.to_s
        should eq "24:db:ac:41:e5:5b"
      source_mac.to_s
        should eq "00:26:82:eb:ea:d1"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 60
      ip_identifier
        should eq 14803
      ip_fragment
        should eq 0
      ip_ttl
        should eq 128
      ip_protocol
        should eq 1
      ip_header_checksum
        should eq 11984
      ip_source_address.to_s
        should eq "192.168.1.102"
      ip_destination_address.to_s
        should eq "8.8.8.8"
      icmp_type
        should eq 8
      icmp_code
        should eq 0
      icmp_checksum
        should eq 19547
      icmp_identifier
        should eq 256
      icmp_sequence_number
        should eq 1
      echo_data
        should eq "abcdefghijklmnopqrstuvwabcdefghi"
    with Icmp reply frame
      destination_mac.to_s
        should eq "00:26:82:eb:ea:d1"
      source_mac.to_s
        should eq "24:db:ac:41:e5:5b"
      ether_type
        should eq 2048
      ip_version
        should eq 4
      ip_header_length
        should eq 5
      ip_type_of_service
        should eq 0
      ip_total_length
        should eq 60
      ip_identifier
        should eq 0
      ip_fragment
        should eq 0
      ip_ttl
        should eq 45
      ip_protocol
        should eq 1
      ip_header_checksum
        should eq 48035
      ip_source_address.to_s
        should eq "8.8.8.8"
      ip_destination_address.to_s
        should eq "192.168.1.102"
      icmp_type
        should eq 0
      icmp_code
        should eq 0
      icmp_checksum
        should eq 21595
      icmp_identifier
        should eq 256
      icmp_sequence_number
        should eq 1
      echo_data
        should eq "abcdefghijklmnopqrstuvwabcdefghi"
    with an invalid Icmp frame
      should raise Pio::ParseError

Pio::IPv4Address
  .new
    with 10.1.1.1
      to_s
        should eq "10.1.1.1"
      to_i
        should eq 167837953
      prefixlen
        should eq 32
      to_ary
        should eq [10, 1, 1, 1]
      class_a?
        should be true
      class_b?
        should be false
      class_c?
        should be false
      class_d?
        should be false
      class_e?
        should be false
      unicast?
        should be true
      multicast?
        should be false
      .mask!
        to_s
          should eq "10.0.0.0"
        to_i
          should eq 167772160
        to_ary
          should eq [10, 0, 0, 0]
        class_a?
          should be true
        class_b?
          should be false
        class_c?
          should be false
        class_d?
          should be false
        class_e?
          should be false
        unicast?
          should be true
        multicast?
          should be false
    with 172.20.1.1
      to_s
        should eq "172.20.1.1"
      to_i
        should eq 2886992129
      to_ary
        should eq [172, 20, 1, 1]
      class_a?
        should be false
      class_b?
        should be true
      class_c?
        should be false
      class_d?
        should be false
      class_e?
        should be false
      unicast?
        should be true
      multicast?
        should be false
    with 192.168.1.1
      to_s
        should eq "192.168.1.1"
      to_i
        should eq 3232235777
      to_ary
        should eq [192, 168, 1, 1]
      class_a?
        should be false
      class_b?
        should be false
      class_c?
        should be true
      class_d?
        should be false
      class_e?
        should be false
      unicast?
        should be true
      multicast?
        should be false
    with 234.1.1.1
      to_s
        should eq "234.1.1.1"
      to_i
        should eq 3925934337
      to_ary
        should eq [234, 1, 1, 1]
      class_a?
        should be false
      class_b?
        should be false
      class_c?
        should be false
      class_d?
        should be true
      class_e?
        should be false
      unicast?
        should be false
      multicast?
        should be true
    with 192.168.0.1/16
      prefixlen
        should eq 16
    with 192.168.0.1/255.255.255.0
      prefixlen
        should eq 24

Pio::Lldp::Options
  .new
    with :dpid and :port_number
      [:chassis_id]
        should eq 108173701773
      [:port_id]
        should eq 1
      [:destination_mac]
        should eq #<Pio::Mac:70135047226980 "01:80:c2:00:00:0e">
      [:source_mac]
        should eq #<Pio::Mac:70135047245660 "01:02:03:04:05:06">
    with :dpid, :port_number and :destination_mac
      [:chassis_id]
        should eq 108173701773
      [:port_id]
        should eq 1
      [:destination_mac]
        should eq #<Pio::Mac:70135047279220 "06:05:04:03:02:01">
      [:source_mac]
        should eq #<Pio::Mac:70135047297560 "01:02:03:04:05:06">
    with :dpid, :port_number and :source_mac
      [:chassis_id]
        should eq 108173701773
      [:port_id]
        should eq 1
      [:destination_mac]
        should eq #<Pio::Mac:70135047331440 "01:80:c2:00:00:0e">
      [:source_mac]
        should eq #<Pio::Mac:70135047325460 "06:05:04:03:02:01">
    with :dpid, :port_number and :destination_mac(=nil)
      [:chassis_id]
        should eq 108173701773
      [:port_id]
        should eq 1
      [:destination_mac]
        should eq #<Pio::Mac:70135047359060 "01:80:c2:00:00:0e">
      [:source_mac]
        should eq #<Pio::Mac:70135047377740 "01:02:03:04:05:06">
    with :dpid, :port_number, :destination_mac(=nil) and :source_mac(=nil)
      [:chassis_id]
        should eq 108173701773
      [:port_id]
        should eq 1
      [:destination_mac]
        should eq #<Pio::Mac:70135047411520 "01:80:c2:00:00:0e">
      [:source_mac]
        should eq #<Pio::Mac:70135047427300 "01:02:03:04:05:06">
    when :dpid is not passed
      should raise Exception with "The dpid option should be passed."
    when :dpid is nil
      should raise Exception with "The dpid option shouldn't be nil."
    when :port_number is not passed
      should raise Exception with "The port_number option should be passed."
    when :port_number is nil
      should raise Exception with "The port_number option shouldn't be nil."

Pio::Lldp
  .new
    with :dpid and :port_number
      #to_binary
        returns an LLDP binary string
        returns a valid ether frame with size = 64
    with :dpid, :port_number and :source_mac
      #to_binary
        returns an LLDP binary string
        returns a valid ether frame with size = 64
    with :dpid, :port_number, :source_mac and :destination_mac
      #to_binary
        returns an LLDP binary string
        returns a valid ether frame with size = 64
    when :dpid is nil
      should raise Exception with "The dpid option shouldn't be nil."
    when :dpid is not passed
      should raise Exception with "The dpid option should be passed."
    when :port_number is not passed
      should raise Exception with "The port_number option should be passed."
    when :port_number is nil
      should raise Exception with "The port_number option shouldn't be nil."
  .read
    with a minimal LLDP frame
      destination_mac.to_s
        should eq "01:80:c2:00:00:0e"
      source_mac.to_s
        should eq "00:19:2f:a7:b2:8d"
      ether_type
        should eq 35020
      dpid
        should eq 108173701773
      dpid.class
        should eq Fixnum
      chassis_id
        should eq 108173701773
      port_id
        should eq "Uplink to S1"
      port_number
        should eq "Uplink to S1"
      ttl
        should eq 120
      port_description
        should be nil
      system_name
        should be nil
      system_description
        should be nil
      system_capabilities
        should be nil
      management_address
        should be nil
    with a detailed LLDP frame
      destination_mac.to_s
        should eq "01:80:c2:00:00:0e"
      source_mac.to_s
        should eq "00:19:2f:a7:b2:8d"
      ether_type
        should eq 35020
      dpid
        should eq 108173701773
      chassis_id
        should eq 108173701773
      port_id
        should eq "Uplink to S1"
      port_number
        should eq "Uplink to S1"
      ttl
        should eq 120
      port_description
        should eq "Summit300-48-Port 1001"
      system_name
        should eq "Summit300-48"
      system_description
        should eq "Summit300-48 - Version 7.4e.1 (Build 5) by Release_Master 05/27/05 04:53:11"
      system_capabilities.system_capabilities
        should eq 20
      system_capabilities.enabled_capabilities
        should eq 20
      management_address
        should eq "\x00\x010\xF9\xAD\xA0"
      organizationally_specific.oui
        should eq 4623
      organizationally_specific.subtype
        should eq 2
      organizationally_specific.information
        should eq "\a\u0001"
    with an invalid Lldp frame
      should raise Pio::ParseError

Pio::Mac
  .new
    with "11:22:33:44:55:66"
      #==
        should eq #<Pio::Mac:70135049126840 "11:22:33:44:55:66">
        should eq "11:22:33:44:55:66"
        should not eq #<Pio::Mac:70135049143440 "66:55:44:33:22:11">
        should not eq "66:55:44:33:22:11"
        should eq 18838586676582
        should not eq 42
        should not eq "INVALID_MAC_ADDRESS"
      #eql?
        should eql #<Pio::Mac:70135049198400 "11:22:33:44:55:66">
        should eql "11:22:33:44:55:66"
        should not eql #<Pio::Mac:70135049210140 "66:55:44:33:22:11">
        should not eql "66:55:44:33:22:11"
        should eql 18838586676582
        should not eql 42
        should not eql "INVALID_MAC_ADDRESS"
      hash
        should eq 1485999537972125029
      to_i
        should eq 18838586676582
      to_a
        should eq [17, 34, 51, 68, 85, 102]
      to_s
        should eq "11:22:33:44:55:66"
      #to_str
        when "MAC = " + subject
          should eq "MAC = 11:22:33:44:55:66"
      multicast?
        should be true
      broadcast?
        should be false
      reserved?
        should be false
    with reserved address
      when 01:80:c2:00:00:00
        reserved?
          should be true
      when 01:80:c2:00:00:01
        reserved?
          should be true
      when 01:80:c2:00:00:02
        reserved?
          should be true
      when 01:80:c2:00:00:03
        reserved?
          should be true
      when 01:80:c2:00:00:04
        reserved?
          should be true
      when 01:80:c2:00:00:05
        reserved?
          should be true
      when 01:80:c2:00:00:06
        reserved?
          should be true
      when 01:80:c2:00:00:07
        reserved?
          should be true
      when 01:80:c2:00:00:08
        reserved?
          should be true
      when 01:80:c2:00:00:09
        reserved?
          should be true
      when 01:80:c2:00:00:0a
        reserved?
          should be true
      when 01:80:c2:00:00:0b
        reserved?
          should be true
      when 01:80:c2:00:00:0c
        reserved?
          should be true
      when 01:80:c2:00:00:0d
        reserved?
          should be true
      when 01:80:c2:00:00:0e
        reserved?
          should be true
      when 01:80:c2:00:00:0f
        reserved?
          should be true
    with 0
      should eq #<Pio::Mac:70135049475860 "00:00:00:00:00:00">
      to_i
        should eq 0
      to_a
        should eq [0, 0, 0, 0, 0, 0]
      to_s
        should eq "00:00:00:00:00:00"
      multicast?
        should be false
      broadcast?
        should be false
      reserved?
        should be false
    with 0xffffffffffff
      should eq #<Pio::Mac:70135049524140 "ff:ff:ff:ff:ff:ff">
      to_i
        should eq 281474976710655
      to_a
        should eq [255, 255, 255, 255, 255, 255]
      to_s
        should eq "ff:ff:ff:ff:ff:ff"
      multicast?
        should be true
      broadcast?
        should be true
      reserved?
        should be false
    with "INVALID MAC ADDRESS"
      should raise Pio::Mac::InvalidValueError
    with -1
      should raise Pio::Mac::InvalidValueError
    with 0x1000000000000
      should raise Pio::Mac::InvalidValueError
    with [ 1, 2, 3 ]
      should raise Pio::Mac::InvalidValueError

Failures:

  1) Pio::Dhcp::Ack.new with Pio::MAC Address and Pio::IPv4Address Address #to_binary returns a DHCP ack binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_ack_dump

       expected: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 27, 100, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 5, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 118, 66, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 5, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/ack_spec.rb:142:in `block (5 levels) in <top (required)>'

  2) Pio::Dhcp::Ack.new with String MAC Address #to_binary returns a DHCP ack binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_ack_dump

       expected: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 27, 100, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 5, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 118, 66, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 5, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/ack_spec.rb:160:in `block (5 levels) in <top (required)>'

  3) Pio::Dhcp::Discover.new with MAC object Address #to_binary returns a DHCP discover binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_discover_dump

       expected: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 136, 20, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 1, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 0, 0, 0, 0, 55, 4, 1, 3, 6, 42, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 226, 242, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 1, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 0, 0, 0, 0, 55, 4, 1, 3, 6, 42, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/discover_spec.rb:126:in `block (5 levels) in <top (required)>'

  4) Pio::Dhcp::Discover.new with String MAC Address #to_binary returns a DHCP discover binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_discover_dump

       expected: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 136, 20, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 1, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 0, 0, 0, 0, 55, 4, 1, 3, 6, 42, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 226, 242, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 1, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 0, 0, 0, 0, 55, 4, 1, 3, 6, 42, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/discover_spec.rb:140:in `block (5 levels) in <top (required)>'

  5) Pio::Dhcp::Offer.new with Pio::MAC Address and Pio::IPv4Address Address #to_binary returns a DHCP ack binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_offer_dump

       expected: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 30, 100, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 2, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 121, 66, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 2, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/offer_spec.rb:140:in `block (5 levels) in <top (required)>'

  6) Pio::Dhcp::Offer.new with String MAC Address #to_binary returns a DHCP ack binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq dhcp_offer_dump

       expected: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 30, 100, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 2, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [17, 34, 51, 68, 85, 102, 170, 187, 204, 221, 238, 255, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 184, 73, 192, 168, 0, 10, 192, 168, 0, 1, 0, 67, 0, 68, 1, 52, 121, 66, 2, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 170, 187, 204, 221, 238, 255, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 2, 58, 4, 222, 173, 190, 239, 59, 4, 222, 173, 190, 239, 51, 4, 222, 173, 190, 239, 54, 4, 192, 168, 0, 10, 1, 4, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/offer_spec.rb:158:in `block (5 levels) in <top (required)>'

  7) Pio::Dhcp::Request.new with String Address #to_binary returns a DHCP Request binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq valid_dhcp_request_dump

       expected: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 206, 179, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 3, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 192, 168, 0, 10, 55, 4, 1, 3, 6, 42, 54, 4, 192, 168, 0, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 41, 146, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 3, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 192, 168, 0, 10, 55, 4, 1, 3, 6, 42, 54, 4, 192, 168, 0, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/request_spec.rb:134:in `block (5 levels) in <top (required)>'

  8) Pio::Dhcp::Request.new with IPv4Address Object Address And Mac Object Address #to_binary returns a DHCP Request binary string
     Failure/Error: expect(subject.to_binary.unpack('C*')).to eq valid_dhcp_request_dump

       expected: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 206, 179, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 3, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 192, 168, 0, 10, 55, 4, 1, 3, 6, 42, 54, 4, 192, 168, 0, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            got: [255, 255, 255, 255, 255, 255, 36, 219, 172, 65, 229, 91, 8, 0, 69, 0, 1, 72, 0, 0, 0, 0, 128, 17, 57, 166, 0, 0, 0, 0, 255, 255, 255, 255, 0, 68, 0, 67, 1, 52, 41, 146, 1, 1, 6, 0, 222, 173, 190, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 219, 172, 65, 229, 91, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99, 53, 1, 3, 61, 7, 1, 36, 219, 172, 65, 229, 91, 50, 4, 192, 168, 0, 10, 55, 4, 1, 3, 6, 42, 54, 4, 192, 168, 0, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

       (compared using ==)
     # ./spec/pio/dhcp/request_spec.rb:151:in `block (5 levels) in <top (required)>'

Finished in 1.84 seconds
429 examples, 8 failures

Failed examples:

rspec ./spec/pio/dhcp/ack_spec.rb:141 # Pio::Dhcp::Ack.new with Pio::MAC Address and Pio::IPv4Address Address #to_binary returns a DHCP ack binary string
rspec ./spec/pio/dhcp/ack_spec.rb:159 # Pio::Dhcp::Ack.new with String MAC Address #to_binary returns a DHCP ack binary string
rspec ./spec/pio/dhcp/discover_spec.rb:125 # Pio::Dhcp::Discover.new with MAC object Address #to_binary returns a DHCP discover binary string
rspec ./spec/pio/dhcp/discover_spec.rb:139 # Pio::Dhcp::Discover.new with String MAC Address #to_binary returns a DHCP discover binary string
rspec ./spec/pio/dhcp/offer_spec.rb:139 # Pio::Dhcp::Offer.new with Pio::MAC Address and Pio::IPv4Address Address #to_binary returns a DHCP ack binary string
rspec ./spec/pio/dhcp/offer_spec.rb:157 # Pio::Dhcp::Offer.new with String MAC Address #to_binary returns a DHCP ack binary string
rspec ./spec/pio/dhcp/request_spec.rb:133 # Pio::Dhcp::Request.new with String Address #to_binary returns a DHCP Request binary string
rspec ./spec/pio/dhcp/request_spec.rb:150 # Pio::Dhcp::Request.new with IPv4Address Object Address And Mac Object Address #to_binary returns a DHCP Request binary string
Coverage report generated for RSpec to /Users/yasuhito/play/pio/coverage. 1924 / 1937 LOC (99.33%) covered.

@shun159
Copy link
Member Author

shun159 commented Mar 3, 2014

ようやく DHCP のマージに取りかかりました。
で実行してみましたが、以下のように 8 つほどエラーが出てしまいました。
簡単に直せそうでしょうか?

あぁ、こけてますね。。。
specではクリアしてたんですが。

ちょっと今月は本業が忙しくて、対応遅いかもしれませんが、
後ほど、相談させてください。前もって、お知らせいたします。

@yasuhito
Copy link
Member

yasuhito commented Mar 3, 2014

もちろん、時間のあいたときいつでもどうぞ!

@yasuhito
Copy link
Member

とりあえず feature/dhcp ブランチにマージして rubocop だけは通るようにしてみました。失敗する spec は pending にしてあります。

DHCP の各メッセージについて、中身を比較するテストがすべて失敗しています。謎なのは、長さのテストはそれぞれ通っているのに、テストで比較している正解データと長さがまったく違うことです。。。

@yasuhito yasuhito added this to the 0.4.0 milestone Mar 13, 2014
@shun159
Copy link
Member Author

shun159 commented Mar 13, 2014

承知しました。
確認します。

@shun159
Copy link
Member Author

shun159 commented Mar 19, 2014

一旦、これでOKのはず。
いかがでしょうか。
原因は、いくつかのフィールドにゴミが入っていたようです。

@shun159
Copy link
Member Author

shun159 commented Mar 19, 2014

たびたびすみません。
再度、直しました。'\000'となっていた箇所ですが、
"\000"へ修正しました。

@yasuhito
Copy link
Member

ありがとうございます!

  1. コミットログをなるべくきれいにしたいので、こういうすぐ修正したようなコミットは amend でまとめて force push してもらえますか?
  2. length: 64, initial_value: "\000" みたいのって、:length に長さを合わせて \000 を埋めてくれるのでしたっけ? (BinData にそういう記法がある?)。

@shun159
Copy link
Member Author

shun159 commented Mar 20, 2014

1は承知しました。

2は無くても問題なさそうです。結局パディングされるようですので。
https://github.com/dmendel/bindata/wiki/PrimitiveTypes#strings

@shun159
Copy link
Member Author

shun159 commented Mar 20, 2014

無くても問題ないので、
余計な部分は削除します。今晩対応出来るかもしれません。

@yasuhito
Copy link
Member

了解です! ぼくも BinData のマニュアルをもう一度読んでみよう。。

@coveralls
Copy link

Coverage Status

Coverage increased (+49.24%) when pulling 3e7e953 on shun159:pull_request into 190ff02 on trema:develop.

@shun159
Copy link
Member Author

shun159 commented Mar 20, 2014

すみません。なんかコミットをしくじってしまっていました。
次回、気を付けます。

@yasuhito
Copy link
Member

9a1132d でマージしました。
あとはリファクタリングして 0.4.0 をリリースしましょう。

@yasuhito yasuhito closed this Mar 21, 2014
@shun159
Copy link
Member Author

shun159 commented Mar 21, 2014

おぉ!ありがとうございます!

@shun159 shun159 deleted the pull_request branch March 22, 2014 14:33
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.

3 participants