Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
= ICMPv6NIQueryIPv4 - IPv6 address (internal)
a=ICMPv6NIQueryIPv4(data="2001:db8::1").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 0 and a[1] == '2001:db8::1'
= ICMPv6NIQueryIPv4 - IPv6 address
ICMPv6NIQueryIPv4(data="2001:db8::1").data == "2001:db8::1"
= ICMPv6NIQueryIPv4 - IPv4 address (internal)
a=ICMPv6NIQueryIPv4(data="169.254.253.252").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 2 and a[1] == '169.254.253.252'
= ICMPv6NIQueryIPv4 - IPv4 address
ICMPv6NIQueryIPv4(data="169.254.253.252").data == '169.254.253.252'
#####################################################################
+ Test Node Information Query - Flags tests
= ICMPv6NIQuery* - flags handling (Test 1)
t = ICMPv6NIQueryIPv6(flags="T")
a = ICMPv6NIQueryIPv6(flags="A")
c = ICMPv6NIQueryIPv6(flags="C")
l = ICMPv6NIQueryIPv6(flags="L")
s = ICMPv6NIQueryIPv6(flags="S")
g = ICMPv6NIQueryIPv6(flags="G")
all = ICMPv6NIQueryIPv6(flags="TALCLSG")
t.flags == 1 and a.flags == 2 and c.flags == 4 and l.flags == 8 and s.flags == 16 and g.flags == 32 and all.flags == 63
= ICMPv6NIQuery* - flags handling (Test 2)
t = str(ICMPv6NIQueryNOOP(flags="T", nonce="A"*8))[6:8]
a = str(ICMPv6NIQueryNOOP(flags="A", nonce="A"*8))[6:8]
c = str(ICMPv6NIQueryNOOP(flags="C", nonce="A"*8))[6:8]
l = str(ICMPv6NIQueryNOOP(flags="L", nonce="A"*8))[6:8]
s = str(ICMPv6NIQueryNOOP(flags="S", nonce="A"*8))[6:8]
g = str(ICMPv6NIQueryNOOP(flags="G", nonce="A"*8))[6:8]
all = str(ICMPv6NIQueryNOOP(flags="TALCLSG", nonce="A"*8))[6:8]
t == '\x00\x01' and a == '\x00\x02' and c == '\x00\x04' and l == '\x00\x08' and s == '\x00\x10' and g == '\x00\x20' and all == '\x00\x3F'
= ICMPv6NIReply* - flags handling (Test 1)
t = ICMPv6NIReplyIPv6(flags="T")
a = ICMPv6NIReplyIPv6(flags="A")
c = ICMPv6NIReplyIPv6(flags="C")
l = ICMPv6NIReplyIPv6(flags="L")
s = ICMPv6NIReplyIPv6(flags="S")
g = ICMPv6NIReplyIPv6(flags="G")
all = ICMPv6NIReplyIPv6(flags="TALCLSG")
t.flags == 1 and a.flags == 2 and c.flags == 4 and l.flags == 8 and s.flags == 16 and g.flags == 32 and all.flags == 63
= ICMPv6NIReply* - flags handling (Test 2)
t = str(ICMPv6NIReplyNOOP(flags="T", nonce="A"*8))[6:8]
a = str(ICMPv6NIReplyNOOP(flags="A", nonce="A"*8))[6:8]
c = str(ICMPv6NIReplyNOOP(flags="C", nonce="A"*8))[6:8]
l = str(ICMPv6NIReplyNOOP(flags="L", nonce="A"*8))[6:8]
s = str(ICMPv6NIReplyNOOP(flags="S", nonce="A"*8))[6:8]
g = str(ICMPv6NIReplyNOOP(flags="G", nonce="A"*8))[6:8]
all = str(ICMPv6NIReplyNOOP(flags="TALCLSG", nonce="A"*8))[6:8]
t == '\x00\x01' and a == '\x00\x02' and c == '\x00\x04' and l == '\x00\x08' and s == '\x00\x10' and g == '\x00\x20' and all == '\x00\x3F'
= ICMPv6NIQuery* - Flags Default values
a = ICMPv6NIQueryNOOP()
b = ICMPv6NIQueryName()
c = ICMPv6NIQueryIPv4()
d = ICMPv6NIQueryIPv6()
a.flags == 0 and b.flags == 0 and c.flags == 0 and d.flags == 62
= ICMPv6NIReply* - Flags Default values
a = ICMPv6NIReplyIPv6()
b = ICMPv6NIReplyName()
c = ICMPv6NIReplyIPv6()
d = ICMPv6NIReplyIPv4()
e = ICMPv6NIReplyRefuse()
f = ICMPv6NIReplyUnknown()
a.flags == 0 and b.flags == 0 and c.flags == 0 and d.flags == 0 and e.flags == 0 and f.flags == 0
# Nonces
# hashret and answers
# payload guess
# automatic destination address computation when integrated in scapy6
# at least computeNIGroupAddr
#####################################################################
+ Test Node Information Query - Dispatching
= ICMPv6NIQueryIPv6 - dispatch with nothing in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv6())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv6)
= ICMPv6NIQueryIPv6 - dispatch with IPv6 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv6(data="2001::db8::1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv6)
= ICMPv6NIQueryIPv6 - dispatch with IPv4 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv6(data="192.168.0.1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv6)
= ICMPv6NIQueryIPv6 - dispatch with name in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv6(data="alfred"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv6)
= ICMPv6NIQueryName - dispatch with nothing in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryName())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryName)
= ICMPv6NIQueryName - dispatch with IPv6 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryName(data="2001:db8::1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryName)
= ICMPv6NIQueryName - dispatch with IPv4 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryName(data="192.168.0.1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryName)
= ICMPv6NIQueryName - dispatch with name in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryName(data="alfred"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryName)
= ICMPv6NIQueryIPv4 - dispatch with nothing in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv4())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv4)
= ICMPv6NIQueryIPv4 - dispatch with IPv6 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv4(data="2001:db8::1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv4)
= ICMPv6NIQueryIPv4 - dispatch with IPv6 address in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv4(data="192.168.0.1"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv4)
= ICMPv6NIQueryIPv4 - dispatch with name in data
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIQueryIPv4(data="alfred"))
p = IPv6(s)
isinstance(p.payload, ICMPv6NIQueryIPv4)
= ICMPv6NIReplyName - dispatch
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIReplyName())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIReplyName)
= ICMPv6NIReplyIPv6 - dispatch
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIReplyIPv6())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIReplyIPv6)
= ICMPv6NIReplyIPv4 - dispatch
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIReplyIPv4())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIReplyIPv4)
= ICMPv6NIReplyRefuse - dispatch
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIReplyRefuse())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIReplyRefuse)
= ICMPv6NIReplyUnknown - dispatch
s = str(IPv6(src="2001:db8::1", dst="2001:db8::2")/ICMPv6NIReplyUnknown())
p = IPv6(s)
isinstance(p.payload, ICMPv6NIReplyUnknown)
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyNOOP
= ICMPv6NIReplyNOOP - single DNS name without hint => understood as string (internal)
a=ICMPv6NIReplyNOOP(data="abricot").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 0 and type(a[1]) is str and a[1] == "abricot"
= ICMPv6NIReplyNOOP - single DNS name without hint => understood as string
ICMPv6NIReplyNOOP(data="abricot").data == "abricot"
= ICMPv6NIReplyNOOP - fqdn without hint => understood as string (internal)
a=ICMPv6NIReplyNOOP(data="n.d.tld").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 0 and type(a[1]) is str and a[1] == "n.d.tld"
= ICMPv6NIReplyNOOP - fqdn without hint => understood as string
ICMPv6NIReplyNOOP(data="n.d.tld").data == "n.d.tld"
= ICMPv6NIReplyNOOP - IPv6 address without hint => understood as string (internal)
a=ICMPv6NIReplyNOOP(data="2001:0db8::1").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 0 and type(a[1]) is str and a[1] == "2001:0db8::1"
= ICMPv6NIReplyNOOP - IPv6 address without hint => understood as string
ICMPv6NIReplyNOOP(data="2001:0db8::1").data == "2001:0db8::1"
= ICMPv6NIReplyNOOP - IPv4 address without hint => understood as string (internal)
a=ICMPv6NIReplyNOOP(data="169.254.253.010").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 0 and type(a[1]) is str and a[1] == "169.254.253.010"
= ICMPv6NIReplyNOOP - IPv4 address without hint => understood as string
ICMPv6NIReplyNOOP(data="169.254.253.010").data == "169.254.253.010"
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyName
= ICMPv6NIReplyName - single label DNS name as a string (without ttl) (internal)
a=ICMPv6NIReplyName(data="abricot").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x07abricot\x00\x00'
= ICMPv6NIReplyName - single label DNS name as a string (without ttl)
ICMPv6NIReplyName(data="abricot").data == [0, "abricot"]
= ICMPv6NIReplyName - fqdn name as a string (without ttl) (internal)
a=ICMPv6NIReplyName(data="n.d.tld").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x01n\x01d\x03tld\x00'
= ICMPv6NIReplyName - fqdn name as a string (without ttl)
ICMPv6NIReplyName(data="n.d.tld").data == [0, 'n.d.tld']
= ICMPv6NIReplyName - list of 2 single label DNS names (without ttl) (internal)
a=ICMPv6NIReplyName(data=["abricot", "poire"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x07abricot\x00\x00\x05poire\x00\x00'
= ICMPv6NIReplyName - list of 2 single label DNS names (without ttl)
ICMPv6NIReplyName(data=["abricot", "poire"]).data == [0, "abricot", "poire"]
= ICMPv6NIReplyName - [ttl, single-label, single-label, fqdn] (internal)
a=ICMPv6NIReplyName(data=[42, "abricot", "poire", "n.d.tld"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 42 and a[1][1] == '\x07abricot\x00\x00\x05poire\x00\x00\x01n\x01d\x03tld\x00'
= ICMPv6NIReplyName - [ttl, single-label, single-label, fqdn]
ICMPv6NIReplyName(data=[42, "abricot", "poire", "n.d.tld"]).data == [42, "abricot", "poire", "n.d.tld"]
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyIPv6
= ICMPv6NIReplyIPv6 - one IPv6 address without TTL (internal)
a=ICMPv6NIReplyIPv6(data="2001:db8::1").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 3 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "2001:db8::1"
= ICMPv6NIReplyIPv6 - one IPv6 address without TTL
ICMPv6NIReplyIPv6(data="2001:db8::1").data == [(0, '2001:db8::1')]
= ICMPv6NIReplyIPv6 - one IPv6 address without TTL (as a list) (internal)
a=ICMPv6NIReplyIPv6(data=["2001:db8::1"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 3 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "2001:db8::1"
= ICMPv6NIReplyIPv6 - one IPv6 address without TTL (as a list)
ICMPv6NIReplyIPv6(data=["2001:db8::1"]).data == [(0, '2001:db8::1')]
= ICMPv6NIReplyIPv6 - one IPv6 address with TTL (internal)
a=ICMPv6NIReplyIPv6(data=[(0, "2001:db8::1")]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 3 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "2001:db8::1"
= ICMPv6NIReplyIPv6 - one IPv6 address with TTL
ICMPv6NIReplyIPv6(data=[(0, "2001:db8::1")]).data == [(0, '2001:db8::1')]
= ICMPv6NIReplyIPv6 - two IPv6 addresses as a list of strings (without TTL) (internal)
a=ICMPv6NIReplyIPv6(data=["2001:db8::1", "2001:db8::2"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 3 and type(a[1]) is list and len(a[1]) == 2 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "2001:db8::1" and len(a[1][1]) == 2 and a[1][1][0] == 0 and a[1][1][1] == "2001:db8::2"
= ICMPv6NIReplyIPv6 - two IPv6 addresses as a list of strings (without TTL)
ICMPv6NIReplyIPv6(data=["2001:db8::1", "2001:db8::2"]).data == [(0, '2001:db8::1'), (0, '2001:db8::2')]
= ICMPv6NIReplyIPv6 - two IPv6 addresses as a list (first with ttl, second without) (internal)
a=ICMPv6NIReplyIPv6(data=[(42, "2001:db8::1"), "2001:db8::2"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 3 and type(a[1]) is list and len(a[1]) == 2 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 42 and a[1][0][1] == "2001:db8::1" and len(a[1][1]) == 2 and a[1][1][0] == 0 and a[1][1][1] == "2001:db8::2"
= ICMPv6NIReplyIPv6 - two IPv6 addresses as a list (first with ttl, second without)
ICMPv6NIReplyIPv6(data=[(42, "2001:db8::1"), "2001:db8::2"]).data == [(42, "2001:db8::1"), (0, "2001:db8::2")]
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyIPv4
= ICMPv6NIReplyIPv4 - one IPv4 address without TTL (internal)
a=ICMPv6NIReplyIPv4(data="169.254.253.252").getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 4 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "169.254.253.252"
= ICMPv6NIReplyIPv4 - one IPv4 address without TTL
ICMPv6NIReplyIPv4(data="169.254.253.252").data == [(0, '169.254.253.252')]
= ICMPv6NIReplyIPv4 - one IPv4 address without TTL (as a list) (internal)
a=ICMPv6NIReplyIPv4(data=["169.254.253.252"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 4 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "169.254.253.252"
= ICMPv6NIReplyIPv4 - one IPv4 address without TTL (as a list)
ICMPv6NIReplyIPv4(data=["169.254.253.252"]).data == [(0, '169.254.253.252')]
= ICMPv6NIReplyIPv4 - one IPv4 address with TTL (internal)
a=ICMPv6NIReplyIPv4(data=[(0, "169.254.253.252")]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 4 and type(a[1]) is list and len(a[1]) == 1 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "169.254.253.252"
= ICMPv6NIReplyIPv4 - one IPv4 address with TTL (internal)
ICMPv6NIReplyIPv4(data=[(0, "169.254.253.252")]).data == [(0, '169.254.253.252')]
= ICMPv6NIReplyIPv4 - two IPv4 addresses as a list of strings (without TTL)
a=ICMPv6NIReplyIPv4(data=["169.254.253.252", "169.254.253.253"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 4 and type(a[1]) is list and len(a[1]) == 2 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 0 and a[1][0][1] == "169.254.253.252" and len(a[1][1]) == 2 and a[1][1][0] == 0 and a[1][1][1] == "169.254.253.253"
= ICMPv6NIReplyIPv4 - two IPv4 addresses as a list of strings (without TTL) (internal)
ICMPv6NIReplyIPv4(data=["169.254.253.252", "169.254.253.253"]).data == [(0, '169.254.253.252'), (0, '169.254.253.253')]
= ICMPv6NIReplyIPv4 - two IPv4 addresses as a list (first with ttl, second without)
a=ICMPv6NIReplyIPv4(data=[(42, "169.254.253.252"), "169.254.253.253"]).getfieldval("data")
type(a) is tuple and len(a) == 2 and a[0] == 4 and type(a[1]) is list and len(a[1]) == 2 and type(a[1][0]) is tuple and len(a[1][0]) == 2 and a[1][0][0] == 42 and a[1][0][1] == "169.254.253.252" and len(a[1][1]) == 2 and a[1][1][0] == 0 and a[1][1][1] == "169.254.253.253"
= ICMPv6NIReplyIPv4 - two IPv4 addresses as a list (first with ttl, second without) (internal)
ICMPv6NIReplyIPv4(data=[(42, "169.254.253.252"), "169.254.253.253"]).data == [(42, "169.254.253.252"), (0, "169.254.253.253")]
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyRefuse
= ICMPv6NIReplyRefuse - basic instantiation
str(ICMPv6NIReplyRefuse())[:8] == '\x8c\x01\x00\x00\x00\x00\x00\x00'
= ICMPv6NIReplyRefuse - basic dissection
a=ICMPv6NIReplyRefuse('\x8c\x01\x00\x00\x00\x00\x00\x00\xf1\xe9\xab\xc9\x8c\x0by\x18')
a.type == 140 and a.code == 1 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == '\xf1\xe9\xab\xc9\x8c\x0by\x18' and a.data == None
#####################################################################
+ Test Node Information Query - ICMPv6NIReplyUnknown
= ICMPv6NIReplyUnknown - basic instantiation
str(ICMPv6NIReplyUnknown(nonce='\x00'*8)) == '\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= ICMPv6NIReplyRefuse - basic dissection
a=ICMPv6NIReplyRefuse('\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.type == 140 and a.code == 2 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == '\x00'*8 and a.data == None
########### IPv6ExtHdrFragment Class ##########################
+ IPv6ExtHdrFragment Class Test
= IPv6ExtHdrFragment - Basic Instantiation
str(IPv6ExtHdrFragment()) == ';\x00\x00\x00\x00\x00\x00\x00'
= IPv6ExtHdrFragment - Instantiation with specific values
str(IPv6ExtHdrFragment(nh=0xff, res1=0xee, offset=0x1fff, res2=1, m=1, id=0x11111111)) == '\xff\xee\xff\xfb\x11\x11\x11\x11'
= IPv6ExtHdrFragment - Basic Dissection
a=IPv6ExtHdrFragment(';\x00\x00\x00\x00\x00\x00\x00')
a.nh == 59 and a.res1 == 0 and a.offset == 0 and a.res2 == 0 and a.m == 0 and a.id == 0
= IPv6ExtHdrFragment - Instantiation with specific values
a=IPv6ExtHdrFragment('\xff\xee\xff\xfb\x11\x11\x11\x11')
a.nh == 0xff and a.res1 == 0xee and a.offset==0x1fff and a.res2==1 and a.m == 1 and a.id == 0x11111111
########### fragment6() function ####################################
+ Test fragment6 function
= fragment6 - test against a long TCP packet with a 1280 MTU
l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*40000), 1280)
len(l) == 33 and len(str(l[-1])) == 644
########### defragment6() function ####################################
+ Test defragment6 function
= defragment6 - test against a long TCP packet fragmented with a 1280 MTU
l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*40000), 1280)
str(defragment6(l)) == ('`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 'A'*40000)
= defragment6 - test against a large TCP packet fragmented with a 1280 bytes MTU and missing fragments
l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*40000), 1280)
del(l[2])
del(l[4])
del(l[12])
del(l[18])
str(defragment6(l)) == ('`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 2444*'A' + 1232*'X' + 2464*'A' + 1232*'X' + 9856*'A' + 1232*'X' + 7392*'A' + 1232*'X' + 12916*'A')
= defragment6 - test against a TCP packet fragmented with a 800 bytes MTU and missing fragments
l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*4000), 800)
del(l[4])
del(l[2])
str(defragment6(l)) == '`\x00\x00\x00\x0f\xb4\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xb2\x0f\x00\x00AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
########### Route6 Class ############################################
+ Test Route6 class
= Route6 - Route6 flushing
conf.route6.routes=[
( '::1', 128, '::', 'lo', ['::1']),
( 'fe80::20f:1fff:feca:4650', 128, '::', 'lo', ['::1'])]
conf.route6.flush()
not conf.route6.routes
= Route6 - Route6.route
conf.route6.flush()
conf.route6.routes=[
( '::1', 128, '::', 'lo', ['::1']),
( 'fe80::20f:1fff:feca:4650', 128, '::', 'lo', ['::1']),
( 'fe80::', 64, '::', 'eth0', ['fe80::20f:1fff:feca:4650']),
('2001:db8:0:4444:20f:1fff:feca:4650', 128, '::', 'lo', ['::1']),
( '2001:db8:0:4444::', 64, '::', 'eth0', ['2001:db8:0:4444:20f:1fff:feca:4650']),
( '::', 0, 'fe80::20f:34ff:fe8a:8aa1', 'eth0', ['2001:db8:0:4444:20f:1fff:feca:4650', '2002:db8:0:4444:20f:1fff:feca:4650'])
]
conf.route6.route("2002::1") == ('eth0', '2002:db8:0:4444:20f:1fff:feca:4650', 'fe80::20f:34ff:fe8a:8aa1') and conf.route6.route("2001::1") == ('eth0', '2001:db8:0:4444:20f:1fff:feca:4650', 'fe80::20f:34ff:fe8a:8aa1') and conf.route6.route("fe80::20f:1fff:feab:4870") == ('eth0', 'fe80::20f:1fff:feca:4650', '::') and conf.route6.route("::1") == ('lo', '::1', '::') and conf.route6.route("::") == ('eth0', '2001:db8:0:4444:20f:1fff:feca:4650', 'fe80::20f:34ff:fe8a:8aa1')
# There are many other to do.
# Below is our Homework : here is the mountain ...
########### Net6 Class ##############################################
########### ICMPv6MLQuery Class #####################################
########### ICMPv6MLReport Class ####################################
########### ICMPv6MLDone Class ######################################
########### ICMPv6ND_Redirect Class #################################
########### ICMPv6NDOptSrcAddrList Class ############################
########### ICMPv6NDOptTgtAddrList Class ############################
########### ICMPv6ND_INDSol Class ###################################
########### ICMPv6ND_INDAdv Class ###################################
########### ICMPerror6 Class ########################################
########### TracerouteResult6 Class #################################
#####################################################################
#####################################################################
########################## DHCPv6 ##########################
#####################################################################
#####################################################################
#####################################################################
+ Test DHCP6 DUID_LLT
= DUID_LLT basic instantiation
a=DUID_LLT()
= DUID_LLT basic build
str(DUID_LLT()) == '\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DUID_LLT build with specific values
str(DUID_LLT(lladdr="ff:ff:ff:ff:ff:ff", timeval=0x11111111, hwtype=0x2222)) == '\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff'
= DUID_LLT basic dissection
a=DUID_LLT(str(DUID_LLT()))
a.type == 1 and a.hwtype == 1 and a.timeval == 0 and a.lladdr == "00:00:00:00:00:00"
= DUID_LLT dissection with specific values
a=DUID_LLT('\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff')
a.type == 1 and a.hwtype == 0x2222 and a.timeval == 0x11111111 and a.lladdr == "ff:ff:ff:ff:ff:ff"
#####################################################################
+ Test DHCP6 DUID_EN
= DUID_EN basic instantiation
a=DUID_EN()
= DUID_EN basic build
str(DUID_EN()) == '\x00\x02\x00\x00\x017'
= DUID_EN build with specific values
str(DUID_EN(enterprisenum=0x11111111, id="iamastring")) == '\x00\x02\x11\x11\x11\x11iamastring'
= DUID_EN basic dissection
a=DUID_EN('\x00\x02\x00\x00\x017')
a.type == 2 and a.enterprisenum == 311
= DUID_EN dissection with specific values
a=DUID_EN('\x00\x02\x11\x11\x11\x11iamastring')
a.type == 2 and a.enterprisenum == 0x11111111 and a.id =="iamastring"
#####################################################################
+ Test DHCP6 DUID_LL
= DUID_LL basic instantiation
a=DUID_LL()
= DUID_LL basic build
str(DUID_LL()) == '\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00'
= DUID_LL build with specific values
str(DUID_LL(hwtype=1, lladdr="ff:ff:ff:ff:ff:ff")) == '\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff'
= DUID_LL basic dissection
a=DUID_LL(str(DUID_LL()))
a.type == 3 and a.hwtype == 1 and a.lladdr == "00:00:00:00:00:00"
= DUID_LL with specific values
a=DUID_LL('\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff')
a.hwtype == 1 and a.lladdr == "ff:ff:ff:ff:ff:ff"
#####################################################################
+ Test DHCP6 Opt Unknown
= DHCP6 Opt Unknown basic instantiation
a=DHCP6OptUnknown()
= DHCP6 Opt Unknown basic build (default values)
str(DHCP6OptUnknown()) == '\x00\x00\x00\x00'
= DHCP6 Opt Unknown - len computation test
str(DHCP6OptUnknown(data="shouldbe9")) == '\x00\x00\x00\tshouldbe9'
#####################################################################
+ Test DHCP6 Client Identifier option
= DHCP6OptClientId basic instantiation
a=DHCP6OptClientId()
= DHCP6OptClientId basic build
str(DHCP6OptClientId()) == '\x00\x01\x00\x00'
= DHCP6OptClientId instantiation with specific values
str(DHCP6OptClientId(duid="toto")) == '\x00\x01\x00\x04toto'
= DHCP6OptClientId instantiation with DUID_LL
str(DHCP6OptClientId(duid=DUID_LL())) == '\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00'
= DHCP6OptClientId instantiation with DUID_LLT
str(DHCP6OptClientId(duid=DUID_LLT())) == '\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptClientId instantiation with DUID_EN
str(DHCP6OptClientId(duid=DUID_EN())) == '\x00\x01\x00\x06\x00\x02\x00\x00\x017'
= DHCP6OptClientId instantiation with specified length
str(DHCP6OptClientId(optlen=80, duid="somestring")) == '\x00\x01\x00Psomestring'
= DHCP6OptClientId basic dissection
a=DHCP6OptClientId('\x00\x01\x00\x00')
a.optcode == 1 and a.optlen == 0
= DHCP6OptClientId instantiation with specified length
str(DHCP6OptClientId(optlen=80, duid="somestring")) == '\x00\x01\x00Psomestring'
= DHCP6OptClientId basic dissection
a=DHCP6OptClientId('\x00\x01\x00\x00')
a.optcode == 1 and a.optlen == 0
= DHCP6OptClientId dissection with specific duid value
a=DHCP6OptClientId('\x00\x01\x00\x04somestring')
a.optcode == 1 and a.optlen == 4 and isinstance(a.duid, Raw) and a.duid.load == 'some' and isinstance(a.payload, DHCP6OptUnknown)
= DHCP6OptClientId dissection with specific DUID_LL as duid value
a=DHCP6OptClientId('\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00')
a.optcode == 1 and a.optlen == 10 and isinstance(a.duid, DUID_LL) and a.duid.type == 3 and a.duid.hwtype == 1 and a.duid.lladdr == "00:00:00:00:00:00"
= DHCP6OptClientId dissection with specific DUID_LLT as duid value
a=DHCP6OptClientId('\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 1 and a.optlen == 14 and isinstance(a.duid, DUID_LLT) and a.duid.type == 1 and a.duid.hwtype == 1 and a.duid.timeval == 0 and a.duid.lladdr == "00:00:00:00:00:00"
= DHCP6OptClientId dissection with specific DUID_EN as duid value
a=DHCP6OptClientId('\x00\x01\x00\x06\x00\x02\x00\x00\x017')
a.optcode == 1 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type == 2 and a.duid.enterprisenum == 311 and a.duid.id == ""
#####################################################################
+ Test DHCP6 Server Identifier option
= DHCP6OptServerId basic instantiation
a=DHCP6OptServerId()
= DHCP6OptServerId basic build
str(DHCP6OptServerId()) == '\x00\x02\x00\x00'
= DHCP6OptServerId basic build with specific values
str(DHCP6OptServerId(duid="toto")) == '\x00\x02\x00\x04toto'
= DHCP6OptServerId instantiation with DUID_LL
str(DHCP6OptServerId(duid=DUID_LL())) == '\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00'
= DHCP6OptServerId instantiation with DUID_LLT
str(DHCP6OptServerId(duid=DUID_LLT())) == '\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptServerId instantiation with DUID_EN
str(DHCP6OptServerId(duid=DUID_EN())) == '\x00\x02\x00\x06\x00\x02\x00\x00\x017'
= DHCP6OptServerId instantiation with specified length
str(DHCP6OptServerId(optlen=80, duid="somestring")) == '\x00\x02\x00Psomestring'
= DHCP6OptServerId basic dissection
a=DHCP6OptServerId('\x00\x02\x00\x00')
a.optcode == 2 and a.optlen == 0
= DHCP6OptServerId dissection with specific duid value
a=DHCP6OptServerId('\x00\x02\x00\x04somestring')
a.optcode == 2 and a.optlen == 4 and isinstance(a.duid, Raw) and a.duid.load == 'some' and isinstance(a.payload, DHCP6OptUnknown)
= DHCP6OptServerId dissection with specific DUID_LL as duid value
a=DHCP6OptServerId('\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00')
a.optcode == 2 and a.optlen == 10 and isinstance(a.duid, DUID_LL) and a.duid.type == 3 and a.duid.hwtype == 1 and a.duid.lladdr == "00:00:00:00:00:00"
= DHCP6OptServerId dissection with specific DUID_LLT as duid value
a=DHCP6OptServerId('\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 2 and a.optlen == 14 and isinstance(a.duid, DUID_LLT) and a.duid.type == 1 and a.duid.hwtype == 1 and a.duid.timeval == 0 and a.duid.lladdr == "00:00:00:00:00:00"
= DHCP6OptServerId dissection with specific DUID_EN as duid value
a=DHCP6OptServerId('\x00\x02\x00\x06\x00\x02\x00\x00\x017')
a.optcode == 2 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type == 2 and a.duid.enterprisenum == 311 and a.duid.id == ""
#####################################################################
+ Test DHCP6 IA Address Option (IA_TA or IA_NA suboption)
= DHCP6OptIAAddress - Basic Instantiation
str(DHCP6OptIAAddress()) == '\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptIAAddress - Basic Dissection
a = DHCP6OptIAAddress('\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 5 and a.optlen == 24 and a.addr == "::" and a.preflft == 0 and a. validlft == 0 and a.iaid == 0 and a.iaaddropts == ""
= DHCP6OptIAAddress - Instantiation with specific values
str(DHCP6OptIAAddress(optlen=0x1111, addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaid=0x88888888, iaaddropts="somestring")) == '\x00\x05\x11\x11""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwww\x88\x88\x88\x88somestring'
= DHCP6OptIAAddress - Instantiation with specific values (default optlen computation)
str(DHCP6OptIAAddress(addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaid=0x88888888, iaaddropts="somestring")) == '\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwww\x88\x88\x88\x88somestring'
= DHCP6OptIAAddress - Dissection with specific values
a = DHCP6OptIAAddress('\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwww\x88\x88\x88\x88somestring')
a.optcode == 5 and a.optlen == 34 and a.addr == "2222:3333::5555" and a.preflft == 0x66666666 and a. validlft == 0x77777777 and a.iaid == 0x88888888 and a.iaaddropts == "somestring"
#####################################################################
+ Test DHCP6 Identity Association for Non-temporary Addresses Option
= DHCP6OptIA_NA - Basic Instantiation
str(DHCP6OptIA_NA()) == '\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptIA_NA - Basic Dissection
a = DHCP6OptIA_NA('\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 3 and a.optlen == 12 and a.iaid == 0 and a.T1 == 0 and a.T2==0 and a.ianaopts == []
= DHCP6OptIA_NA - Instantiation with specific values (keep automatic length computation)
str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == '\x00\x03\x00\x0c""""3333DDDD'
= DHCP6OptIA_NA - Instantiation with specific values (forced optlen)
str(DHCP6OptIA_NA(optlen=0x1111, iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == '\x00\x03\x11\x11""""3333DDDD'
= DHCP6OptIA_NA - Instantiation with a list of IA Addresses (optlen automatic computation)
str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444, ianaopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == '\x00\x03\x00L""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptIA_NA - Dissection with specific values
a = DHCP6OptIA_NA('\x00\x03\x00L""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 3 and a.optlen == 76 and a.iaid == 0x22222222 and a.T1 == 0x33333333 and a.T2==0x44444444 and len(a.ianaopts) == 2 and isinstance(a.ianaopts[0], DHCP6OptIAAddress) and isinstance(a.ianaopts[1], DHCP6OptIAAddress)
#####################################################################
+ Test DHCP6 Identity Association for Temporary Addresses Option
= DHCP6OptIA_TA - Basic Instantiation
str(DHCP6OptIA_TA()) == '\x00\x04\x00\x04\x00\x00\x00\x00'
= DHCP6OptIA_TA - Basic Dissection
a = DHCP6OptIA_TA('\x00\x04\x00\x04\x00\x00\x00\x00')
a.optcode == 4 and a.optlen == 4 and a.iaid == 0 and a.iataopts == []
= DHCP6OptIA_TA - Instantiation with specific values
str(DHCP6OptIA_TA(optlen=0x1111, iaid=0x22222222, iataopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == '\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptIA_TA - Dissection with specific values
a = DHCP6OptIA_TA('\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 4 and a.optlen == 0x1111 and a.iaid == 0x22222222 and len(a.iataopts) == 2 and isinstance(a.iataopts[0], DHCP6OptIAAddress) and isinstance(a.iataopts[1], DHCP6OptIAAddress)
#####################################################################
+ Test DHCP6 Option Request Option
= DHCP6OptOptReq - Basic Instantiation
str(DHCP6OptOptReq()) == '\x00\x06\x00\x04\x00\x17\x00\x18'
= DHCP6OptOptReq - optlen field computation
str(DHCP6OptOptReq(reqopts=[1,2,3,4])) == '\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04'
= DHCP6OptOptReq - instantiation with empty list
str(DHCP6OptOptReq(reqopts=[])) == '\x00\x06\x00\x00'
= DHCP6OptOptReq - Basic dissection
a=DHCP6OptOptReq('\x00\x06\x00\x00')
a.optcode == 6 and a.optlen == 0 and a.reqopts == [23,24]
= DHCP6OptOptReq - Dissection with specific value
a=DHCP6OptOptReq('\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04')
a.optcode == 6 and a.optlen == 8 and a.reqopts == [1,2,3,4]
#####################################################################
+ Test DHCP6 Option - Preference option
= DHCP6OptPref - Basic instantiation
str(DHCP6OptPref()) == '\x00\x07\x00\x01\xff'
= DHCP6OptPref - Instantiation with specific values
str(DHCP6OptPref(optlen=0xffff, prefval= 0x11)) == '\x00\x07\xff\xff\x11'
= DHCP6OptPref - Basic Dissection
a=DHCP6OptPref('\x00\x07\x00\x01\xff')
a.optcode == 7 and a.optlen == 1 and a.prefval == 255
= DHCP6OptPref - Dissection with specific values
a=DHCP6OptPref('\x00\x07\xff\xff\x11')
a.optcode == 7 and a.optlen == 0xffff and a.prefval == 0x11
#####################################################################
+ Test DHCP6 Option - Elapsed Time
= DHCP6OptElapsedTime - Basic Instantiation
str(DHCP6OptElapsedTime()) == '\x00\x08\x00\x02\x00\x00'
= DHCP6OptElapsedTime - Instantiation with specific elapsedtime value
str(DHCP6OptElapsedTime(elapsedtime=421)) == '\x00\x08\x00\x02\x01\xa5'
= DHCP6OptElapsedTime - Basic Dissection
a=DHCP6OptElapsedTime('\x00\x08\x00\x02\x00\x00')
a.optcode == 8 and a.optlen == 2 and a.elapsedtime == 0
= DHCP6OptElapsedTime - Dissection with specific values
a=DHCP6OptElapsedTime('\x00\x08\x00\x02\x01\xa5')
a.optcode == 8 and a.optlen == 2 and a.elapsedtime == 421
#####################################################################
+ Test DHCP6 Option - Server Unicast Address
= DHCP6OptServerUnicast - Basic Instantiation
str(DHCP6OptServerUnicast()) == '\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= DHCP6OptServerUnicast - Instantiation with specific values (test 1)
str(DHCP6OptServerUnicast(srvaddr="2001::1")) == '\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
= DHCP6OptServerUnicast - Instantiation with specific values (test 2)
str(DHCP6OptServerUnicast(srvaddr="2001::1", optlen=42)) == '\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
= DHCP6OptServerUnicast - Dissection with default values
a=DHCP6OptServerUnicast('\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.optcode == 12 and a.optlen == 16 and a.srvaddr == "::"
= DHCP6OptServerUnicast - Dissection with specific values (test 1)
a=DHCP6OptServerUnicast('\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
a.optcode == 12 and a.optlen == 16 and a.srvaddr == "2001::1"
= DHCP6OptServerUnicast - Dissection with specific values (test 2)
a=DHCP6OptServerUnicast('\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
a.optcode == 12 and a.optlen == 42 and a.srvaddr == "2001::1"
#####################################################################
+ Test DHCP6 Option - Status Code
= DHCP6OptStatusCode - Basic Instantiation
str(DHCP6OptStatusCode()) == '\x00\r\x00\x02\x00\x00'
= DHCP6OptStatusCode - Instantiation with specific values
str(DHCP6OptStatusCode(optlen=42, statuscode=0xff, statusmsg="Hello")) == '\x00\r\x00*\x00\xffHello'
= DHCP6OptStatusCode - Automatic Length computation
str(DHCP6OptStatusCode(statuscode=0xff, statusmsg="Hello")) == '\x00\r\x00\x07\x00\xffHello'
# Add tests to verify Unicode behavior
#####################################################################
+ Test DHCP6 Option - Rapid Commit
= DHCP6OptRapidCommit - Basic Instantiation
str(DHCP6OptRapidCommit()) == '\x00\x0e\x00\x00'
= DHCP6OptRapidCommit - Basic Dissection
a=DHCP6OptRapidCommit('\x00\x0e\x00\x00')
a.optcode == 14 and a.optlen == 0
#####################################################################
+ Test DHCP6 Option - User class
= DHCP6OptUserClass - Basic Instantiation
str(DHCP6OptUserClass()) == '\x00\x0f\x00\x00'
= DHCP6OptUserClass - Basic Dissection
a = DHCP6OptUserClass('\x00\x0f\x00\x00')
a.optcode == 15 and a.optlen == 0 and a.userclassdata == []
= DHCP6OptUserClass - Instantiation with one user class data structure
str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something")])) == '\x00\x0f\x00\x0b\x00\tsomething'
= DHCP6OptUserClass - Dissection with one user class data structure
a = DHCP6OptUserClass('\x00\x0f\x00\x0b\x00\tsomething')
a.optcode == 15 and a.optlen == 11 and len(a.userclassdata) == 1 and isinstance(a.userclassdata[0], USER_CLASS_DATA) and a.userclassdata[0].len == 9 and a.userclassdata[0].data == 'something'
= DHCP6OptUserClass - Instantiation with two user class data structures
str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something"), USER_CLASS_DATA(data="somethingelse")])) == '\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse'
= DHCP6OptUserClass - Dissection with two user class data structures
a = DHCP6OptUserClass('\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse')
a.optcode == 15 and a.optlen == 26 and len(a.userclassdata) == 2 and isinstance(a.userclassdata[0], USER_CLASS_DATA) and isinstance(a.userclassdata[1], USER_CLASS_DATA) and a.userclassdata[0].len == 9 and a.userclassdata[0].data == 'something' and a.userclassdata[1].len == 13 and a.userclassdata[1].data == 'somethingelse'
#####################################################################
+ Test DHCP6 Option - Vendor class
= DHCP6OptVendorClass - Basic Instantiation
str(DHCP6OptVendorClass()) == '\x00\x10\x00\x04\x00\x00\x00\x00'
= DHCP6OptVendorClass - Basic Dissection
a = DHCP6OptVendorClass('\x00\x10\x00\x04\x00\x00\x00\x00')
a.optcode == 16 and a.optlen == 4 and a.enterprisenum == 0 and a.vcdata == []
= DHCP6OptVendorClass - Instantiation with one vendor class data structure
str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something")])) == '\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething'
= DHCP6OptVendorClass - Dissection with one vendor class data structure
a = DHCP6OptVendorClass('\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething')
a.optcode == 16 and a.optlen == 15 and a.enterprisenum == 0 and len(a.vcdata) == 1 and isinstance(a.vcdata[0], VENDOR_CLASS_DATA) and a.vcdata[0].len == 9 and a.vcdata[0].data == 'something'
= DHCP6OptVendorClass - Instantiation with two vendor class data structures
str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something"), VENDOR_CLASS_DATA(data="somethingelse")])) == '\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse'
= DHCP6OptVendorClass - Dissection with two vendor class data structures
a = DHCP6OptVendorClass('\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse')
a.optcode == 16 and a.optlen == 30 and a.enterprisenum == 0 and len(a.vcdata) == 2 and isinstance(a.vcdata[0], VENDOR_CLASS_DATA) and isinstance(a.vcdata[1], VENDOR_CLASS_DATA) and a.vcdata[0].len == 9 and a.vcdata[0].data == 'something' and a.vcdata[1].len == 13 and a.vcdata[1].data == 'somethingelse'
#####################################################################
+ Test DHCP6 Option - Vendor-specific information
= DHCP6OptVendorSpecificInfo - Basic Instantiation
str(DHCP6OptVendorSpecificInfo()) == '\x00\x11\x00\x04\x00\x00\x00\x00'
= DHCP6OptVendorSpecificInfo - Basic Dissection
a = DHCP6OptVendorSpecificInfo('\x00\x11\x00\x04\x00\x00\x00\x00')
a.optcode == 17 and a.optlen == 4 and a.enterprisenum == 0
= DHCP6OptVendorSpecificInfo - Instantiation with specific values (one option)
str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something")])) == '\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething'
= DHCP6OptVendorSpecificInfo - Dissection with with specific values (one option)
a = DHCP6OptVendorSpecificInfo('\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething')
a.optcode == 17 and a.optlen == 17 and a.enterprisenum == 0xeeeeeeee and len(a.vso) == 1 and isinstance(a.vso[0], VENDOR_SPECIFIC_OPTION) and a.vso[0].optlen == 9 and a.vso[0].optdata == 'something'
= DHCP6OptVendorSpecificInfo - Instantiation with specific values (two options)
str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something"), VENDOR_SPECIFIC_OPTION(optcode=42, optdata="somethingelse")])) == '\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse'
= DHCP6OptVendorSpecificInfo - Dissection with with specific values (two options)
a = DHCP6OptVendorSpecificInfo('\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse')
a.optcode == 17 and a.optlen == 34 and a.enterprisenum == 0xeeeeeeee and len(a.vso) == 2 and isinstance(a.vso[0], VENDOR_SPECIFIC_OPTION) and isinstance(a.vso[1], VENDOR_SPECIFIC_OPTION) and a.vso[0].optlen == 9 and a.vso[0].optdata == 'something' and a.vso[1].optlen == 13 and a.vso[1].optdata == 'somethingelse'
#####################################################################
+ Test DHCP6 Option - Interface-Id
= DHCP6OptIfaceId - Basic Instantiation
str(DHCP6OptIfaceId()) == '\x00\x12\x00\x00'
= DHCP6OptIfaceId - Basic Dissection
a = DHCP6OptIfaceId('\x00\x12\x00\x00')
a.optcode == 18 and a.optlen == 0
= DHCP6OptIfaceId - Instantiation with specific value
str(DHCP6OptIfaceId(ifaceid="something")) == '\x00\x12\x00\x09something'
= DHCP6OptIfaceId - Dissection with specific value
a = DHCP6OptIfaceId('\x00\x12\x00\x09something')
a.optcode == 18 and a.optlen == 9 and a.ifaceid == "something"
#####################################################################
+ Test DHCP6 Option - Reconfigure Message
= DHCP6OptReconfMsg - Basic Instantiation
str(DHCP6OptReconfMsg()) == '\x00\x13\x00\x01\x0b'
= DHCP6OptReconfMsg - Basic Dissection
a = DHCP6OptReconfMsg('\x00\x13\x00\x01\x0b')
a.optcode == 19 and a.optlen == 1 and a.msgtype == 11
= DHCP6OptReconfMsg - Instantiation with specific values
str(DHCP6OptReconfMsg(optlen=4, msgtype=5)) == '\x00\x13\x00\x04\x05'
= DHCP6OptReconfMsg - Dissection with specific values
a = DHCP6OptReconfMsg('\x00\x13\x00\x04\x05')
a.optcode == 19 and a.optlen == 4 and a.msgtype == 5
#####################################################################
+ Test DHCP6 Option - Reconfigure Accept
= DHCP6OptReconfAccept - Basic Instantiation
str(DHCP6OptReconfAccept()) == '\x00\x14\x00\x00'
= DHCP6OptReconfAccept - Basic Dissection
a = DHCP6OptReconfAccept('\x00\x14\x00\x00')
a.optcode == 20 and a.optlen == 0
= DHCP6OptReconfAccept - Instantiation with specific values
str(DHCP6OptReconfAccept(optlen=23)) == '\x00\x14\x00\x17'
= DHCP6OptReconfAccept - Dssection with specific values
a = DHCP6OptReconfAccept('\x00\x14\x00\x17')
a.optcode == 20 and a.optlen == 23
#####################################################################
+ Test DHCP6 Option - SIP Servers Domain Name List
= DHCP6OptSIPDomains - Basic Instantiation
str(DHCP6OptSIPDomains()) == '\x00\x15\x00\x00'
= DHCP6OptSIPDomains - Basic Dissection
a = DHCP6OptSIPDomains('\x00\x15\x00\x00')
a.optcode == 21 and a.optlen == 0 and a.sipdomains == []
= DHCP6OptSIPDomains - Instantiation with one domain
str(DHCP6OptSIPDomains(sipdomains=["toto.example.org"])) == '\x00\x15\x00\x12\x04toto\x07example\x03org\x00'
= DHCP6OptSIPDomains - Dissection with one domain
a = DHCP6OptSIPDomains('\x00\x15\x00\x12\x04toto\x07example\x03org\x00')
a.optcode == 21 and a.optlen == 18 and len(a.sipdomains) == 1 and a.sipdomains[0] == "toto.example.org"
= DHCP6OptSIPDomains - Instantiation with two domains
str(DHCP6OptSIPDomains(sipdomains=["toto.example.org", "titi.example.org"])) == '\x00\x15\x00$\x04toto\x07example\x03org\x00\x04titi\x07example\x03org\x00'
= DHCP6OptSIPDomains - Dissection with two domains
a = DHCP6OptSIPDomains('\x00\x15\x00$\x04toto\x07example\x03org\x00\x04TITI\x07example\x03org\x00')
a.optcode == 21 and a.optlen == 36 and len(a.sipdomains) == 2 and a.sipdomains[0] == "toto.example.org" and a.sipdomains[1] == "TITI.example.org"
= DHCP6OptSIPDomains - Enforcing only one dot at end of domain
str(DHCP6OptSIPDomains(sipdomains=["toto.example.org."])) == '\x00\x15\x00\x12\x04toto\x07example\x03org\x00'
#####################################################################
+ Test DHCP6 Option - SIP Servers IPv6 Address List
= DHCP6OptSIPServers - Basic Instantiation
str(DHCP6OptSIPServers()) == '\x00\x16\x00\x00'
= DHCP6OptSIPServers - Basic Dissection
a = DHCP6OptSIPServers('\x00\x16\x00\x00')
a.optcode == 22 and a. optlen == 0 and a.sipservers == []
= DHCP6OptSIPServers - Instantiation with specific values (1 address)
str(DHCP6OptSIPServers(sipservers = ["2001:db8::1"] )) == '\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
= DHCP6OptSIPServers - Dissection with specific values (1 address)
a = DHCP6OptSIPServers('\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
a.optcode == 22 and a.optlen == 16 and len(a.sipservers) == 1 and a.sipservers[0] == "2001:db8::1"
= DHCP6OptSIPServers - Instantiation with specific values (2 addresses)
str(DHCP6OptSIPServers(sipservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02'
= DHCP6OptSIPServers - Dissection with specific values (2 addresses)
a = DHCP6OptSIPServers('\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02')
a.optcode == 22 and a.optlen == 32 and len(a.sipservers) == 2 and a.sipservers[0] == "2001:db8::1" and a.sipservers[1] == "2001:db8::2"
#####################################################################
+ Test DHCP6 Option - DNS Recursive Name Server
= DHCP6OptDNSServers - Basic Instantiation
str(DHCP6OptDNSServers()) == '\x00\x17\x00\x00'
= DHCP6OptDNSServers - Basic Dissection
a = DHCP6OptDNSServers('\x00\x17\x00\x00')
a.optcode == 23 and a. optlen == 0 and a.dnsservers == []
= DHCP6OptDNSServers - Instantiation with specific values (1 address)
str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1"] )) == '\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
= DHCP6OptDNSServers - Dissection with specific values (1 address)
a = DHCP6OptDNSServers('\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
a.optcode == 23 and a.optlen == 16 and len(a.dnsservers) == 1 and a.dnsservers[0] == "2001:db8::1"
= DHCP6OptDNSServers - Instantiation with specific values (2 addresses)
str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02'
= DHCP6OptDNSServers - Dissection with specific values (2 addresses)
a = DHCP6OptDNSServers('\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02')
a.optcode == 23 and a.optlen == 32 and len(a.dnsservers) == 2 and a.dnsservers[0] == "2001:db8::1" and a.dnsservers[1] == "2001:db8::2"
#####################################################################
+ Test DHCP6 Option - DNS Domain Search List Option
= DHCP6OptDNSDomains - Basic Instantiation
str(DHCP6OptDNSDomains()) == '\x00\x18\x00\x00'
= DHCP6OptDNSDomains - Basic Dissection
a = DHCP6OptDNSDomains('\x00\x18\x00\x00')
a.optcode == 24 and a.optlen == 0 and a.dnsdomains == []
= DHCP6OptDNSDomains - Instantiation with specific values (1 domain)
str(DHCP6OptDNSDomains(dnsdomains=["toto.example.com"])) == '\x00\x18\x00\x12\x04toto\x07example\x03com\x00'