1 #ident "%Z%%M% %I% %E% SMI" mwc 2 3 CDDL HEADER START 4 5 The contents of this file are subject to the terms of the 6 Common Development and Distribution License, Version 1.0 only 7 (the "License"). You may not use this file except in compliance 8 with the License. 9 10 You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 or http://www.opensolaris.org/os/licensing. 12 See the License for the specific language governing permissions 13 and limitations under the License. 14 15 When distributing Covered Code, include this CDDL HEADER in each 16 file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 If applicable, add the following below this CDDL HEADER, with the 18 fields enclosed by brackets "[]" replaced with your own identifying 19 information: Portions Copyright [yyyy] [name of copyright owner] 20 21 CDDL HEADER END 22 23 Enterprise: Private Layer Test Specification 24 ============================================ 25 26 ABSTRACT 27 28 This document describes two test specifications intended to be 29 used in the development of test suite(s) designed to validate the private 30 layer API described in Section 2.1 of the Enterprise DHCP Service 31 Architecture Specification (ARCH) [1]. The first specification outlines 32 testing requirements for the DHCP default file API (ARCH, section 2.1.1) 33 [1]. The second specification outlines the testing requirements for the 34 dhcptab and dhcp network container API (ARCH, section 2.1.2) [1]. Each 35 specification contains a basic sanity test specification, designed to 36 verify that the API works as designed when fed data in the correct form. 37 Each specification also contains a full test specification, which 38 compliments the basic sanity test by providing cases which test the 39 stability and MT-safeness of the API. 40 41 TEST APPLICATION 42 43 Test suite(s) written to these specifications should be run on 44 an instance of each reference platform on each build of the ON 45 consolidation. See "Enterprise Reference Platforms" [2] for more 46 information. 47 48 1.0 DHCP default file API Test Specification 49 50 1.1 ABSTRACT 51 52 This test specification is divided into two subspecifications 53 outlining the testing requirements for validating the default file API 54 described in Section 2.1.1 of ARCH [1]. The first specification describes 55 a basic sanity test, which describes the testing requirements to verify 56 that the API works as designed when fed data in the correct form. The 57 second specification describes a full test, which complements the basic 58 sanity test by defining test requirements which test the error checking 59 behavior and MT-safeness of the API. 60 61 1.2 TEST APPLICATION 62 63 Test suite(s) written to this specification should be run on the 64 reference platform of each of the supported architectures (sparcv8, 65 sparcv9, IA32, IA64) for each build of the ON consolidation. See 66 "Enterprise Reference Platforms" [2]. 67 68 1.3 TEST PREPARATION 69 70 Prior to running a test suite, install SUNWdhcsr and SUNWdhcsu 71 on the testing platform. No external setup is required for this test 72 suite. Remove any existing default file, /etc/default/dhcp. 73 74 1.4 BASIC SANITY TEST 75 76 Description 77 78 This test validates the basic operation of the default 79 file API function calls when presented with valid input. 80 81 Test Data 82 83 RESOURCE=files 84 PATH=/var/dhcp_test 85 RUN_MODE=server 86 VERBOSE=TRUE 87 RELAY_HOPS=8 88 INTERFACES=hme0,le0,qfe3 89 ETHERS_COMPAT=FALSE 90 ICMP_VERIFY=TRUE 91 OFFER_CACHE_TIMEOUT=11 92 RESCAN_INTERVAL=61 93 LOGGING_FACILITY=6 94 BOOTP_COMPAT=FALSE 95 96 Case #1 write_dhcp_defaults: 97 98 Use function to write the test data, using file mode of 99 0646. Confirm that data written matches test data. Confirm that 100 default file created has 0646 file mode and the function 101 returns 0. 102 103 Case #2 read_dhcp_defaults: 104 105 Create default file containing test data. Read data 106 using the function. Confirm data contained with dhcp_defaults_t 107 matches test data and the function returns 0. 108 109 Case #3 delete_dhcp_defaults: 110 111 Remove the default file using the function. Confirm 112 that default file has been removed and the function returns 0. 113 114 Case #4 query_dhcp_defaults: 115 116 Call function, cycling through each test data key. 117 Confirm that key is found, and that data returned is correct 118 and the function returns 0. 119 120 Case #5: free_dhcp_defaults: 121 122 Using the dhcp_defaults_t built containing the test 123 data, confirm that the function returns 0. 124 125 1.5 FULL TEST 126 127 Description 128 129 This test verifies that the default file API function 130 calls respond correctly when presented with incorrect data. It 131 also validates the MT-safeness of the API. 132 133 Test Data 134 135 RESOURCE=files 136 PATH=/var/dhcp_test 137 RUN_MODE=server 138 VERBOSE=TRUE 139 RELAY_HOPS=8 140 INTERFACES=hme0,le0,qfe3 141 ETHERS_COMPAT=FALSE 142 ICMP_VERIFY=TRUE 143 OFFER_CACHE_TIMEOUT=11 144 RESCAN_INTERVAL=61 145 LOGGING_FACILITY=6 146 BOOTP_COMPAT=FALSE 147 148 Case #1 all API function calls: 149 150 Call each of the API functions with invalid argument(s). 151 For functions that take more than one argument, call those 152 functions once for each argument, providing invalid data for 153 each argument in turn. Confirm that functions return -1 and set 154 errno to EINVAL. 155 156 Case #2 existing lock file: 157 158 Create /etc/default/.dhcp_defaults_lock. Confirm that 159 read_dhcp_defaults and write_dhcp_defaults return -1 and set 160 errno to EAGAIN. 161 162 Case #2 read_dhcp_defaults: 163 164 Condition Expected Result 165 ========= =============== 166 167 No default file. Confirm that the function 168 returns -1 and sets errno 169 to ENOENT. 170 171 Default file w/ Confirm that the function 172 mode set to 000. returns -1 and sets errno 173 to EACCESS. 174 175 Case #3 delete_dhcp_defaults: 176 177 Condition Expected Result 178 ========= =============== 179 180 No default file. Confirm that the function 181 returns -1 and sets errno 182 to ENOENT. 183 184 Default file w/ Confirm that the function 185 mode set to 000. returns -1 and sets errno 186 to EACCESS. 187 188 Case #3 write_dhcp_defaults: 189 190 Condition Expected Result 191 ========= =============== 192 193 Default file w/ Confirm that the function 194 mode set to 000. returns -1 and sets errno 195 to EACCESS. 196 197 Case #4 Multi-access stress: 198 199 Preparation: 200 201 Generate TUNABLE versions of the default file 202 containing unique combinations of defaults (no 203 line within the TUNABLE files are the same). The 204 default file will be written/accessed using UFS. 205 206 Tunable default values: 207 208 TUNABLE value: 5 209 INTERATE value: 100 210 211 A single multi-threaded test program can be 212 written which can be used in the following 3 cases. 213 It will write/read a unique version of the default 214 file. It will retry a default file operation if EAGAIN 215 is returned. 216 217 4.1. Multiple processes 218 219 Run TUNABLE instances of the test program which 220 writes / reads a different version of the TUNABLE 221 default file possibilities for a tunable (INTERATE) 222 number of iterations at once. Once the instances of 223 the test program have completed their interations, 224 verify that the file consists of exactly one of the 225 TUNABLE possible versions of the default file. 226 227 4.2. Multiple threads, single process 228 229 Run a single instance of the test program which 230 creates a tunable number of threads (TUNABLE) each of 231 which will write and read one of the unique default file 232 combinations for a tunable (INTERATE) number of 233 interations. Verify that after the program completes, 234 exactly one of the TUNABLE possible versions of the 235 default files exists. 236 237 4.3. Multiple threads, multiple processes, NFS in use 238 239 Run multiple versions of the test program, each 240 using multiple threads, some versions of the test 241 program accessing the default directory using NFS, 242 others using UFS. Verify after the test programs 243 complete that exactly one of the TUNABLE possible 244 versions of the default file exists. 245 246 Caution: ensure that the number of threads * 247 number of processes does not exceed the number of unique 248 possible default files. 249 250 4.4. Variation of 4.1-4.3: 251 252 Generate another process which periodically 253 snags the default file lock file, and verifies that the 254 current version of the default file matches one of the 255 unique default file versions. 256 257 2.0 dhcptab and dhcp network container API Test Specification 258 259 2.1 ABSTRACT 260 261 This test specification is divided into two subspecifications 262 outlining the testing requirements for validating the dhcptab and dhcp 263 network container API described in Section 2.1.2 of ARCH [1]. The first 264 specification describes a basic sanity test, which describes the testing 265 requirements to verify that the API works as designed when fed data in 266 the correct form with the correct preconditions present. The second 267 specification describes a full test, which complements the basic sanity 268 test by defining test requirements which test the error checking 269 behavior and MT-safeness of the API. 270 271 2.2 TEST APPLICATION 272 273 Test suite(s) written to this specification should be run on the 274 reference platform of each of the supported architectures (sparcv8, 275 sparcv9, IA32, IA64) for each build of the ON consolidation. See 276 "Enterprise Reference Platforms" [2]. 277 278 2.3 TEST PREPARATION 279 280 Prior to running a test suite, install SUNWdhcsr and SUNWdhcsu 281 on the testing platform. Select a public module SUNWdhc{df,db,dn} and 282 install it. Configure any data service providing service to the public 283 module. Set the RESOURCE and PATH default file parameters as required by 284 the public module. Note that if the underlying public module's 285 environment is appropriately configured, the results of testing the API 286 should be the same for any other appropriately configured public module. 287 The public module status can be verified by running the basic sanity 288 test for the specific public module. The tester should record the 289 public module environment used during the test. 290 291 2.4 BASIC SANITY TEST 292 293 Description 294 295 This test validates the basic operation of the dhcptab 296 and dhcp network container API function calls when presented with 297 valid input. 298 299 Test Data 300 301 Item Description Application 302 ==== =========== =========== 303 <network address> IP address of *_dn 304 network. Ensure 305 that appropriate 306 subnet mask is 307 available in 308 netmasks(4). 309 Candidate networks 310 have to have at 311 least 3000 hosts. 312 313 dt records As follows: *_dt 314 315 SrootOpt s Vendor=SUNW.Ultra-1 SUNW.i86pc,1,ASCII,1,0 316 SrootIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,2,IP,1,1 317 SrootNM s Vendor=SUNW.Ultra-1 SUNW.i86pc,3,ASCII,1,0 318 SrootPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,4,ASCII,1,0 319 SswapIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,5,IP,1,1 320 SswapPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,6,ASCII,1,0 321 SbootFIL s Vendor=SUNW.Ultra-1 SUNW.i86pc,7,ASCII,1,0 322 Stz s Vendor=SUNW.Ultra-1 SUNW.i86pc,8,ASCII,1,0 323 SbootRS s Vendor=SUNW.Ultra-1 SUNW.i86pc,9,NUMBER,2,1 324 SinstIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,10,IP,1,1 325 SinstNM s Vendor=SUNW.Ultra-1 SUNW.i86pc,11,ASCII,1,0 326 SinstPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,12,ASCII,1,0 327 SsysidCF s Vendor=SUNW.Ultra-1 SUNW.i86pc,13,ASCII,1,0 328 SjumpsCF s Vendor=SUNW.Ultra-1 SUNW.i86pc,14,ASCII,1,0 329 Sterm s Vendor=SUNW.Ultra-1 SUNW.i86pc,15,ASCII,1,0 330 Locale m :UTCoffst=-18000: 331 Solaris m :SrootIP4=129.148.174.27:SrootNM="atlantic": \ 332 :SinstIP4=129.148.174.27:SinstNM="atlantic": \ 333 :Sterm="xterm":BootSrvA=129.148.174.27: 334 sparc m \ 335 :SrootPTH="/export/s28/solaris1of2.s28s_wos/latest/Solaris_8/Tools/Boot": \ 336 :SinstPTH="/export/s28/solaris1of2.s28s_wos/latest": 337 sun4u m :Include=Solaris:Include=sparc: 338 i86pc m :Include=Solaris:SbootFIL="/platform/i86pc/kernel/unix": \ 339 :SinstPTH="/export/s28/solaris1of2.s28x_wos/latest": \ 340 :SrootPTH="/export/s28/solaris1of2.s28x_wos/latest/Solaris_8/Tools/Boot": 341 SUNW.i86pc m :Include=i86pc: 342 SUNW.Ultra-1 m :SbootFIL="/platform/sun4u/kernel/sparcv9/unix": \ 343 :Include=sun4u: 344 <network address> m :Subnet=255.255.0.0:Router=172.21.0.2: \ 345 :Broadcst=172.21.255.255: 346 atlantic m :Include=Locale:Timeserv=129.148.174.27:LeaseTim=3600: \ 347 :LeaseNeg:Hostname:DNSdmain="snt.east.sun.com": \ 348 :DNSserv=172.21.0.1: 349 010800207E8A02 m :Impress=172.22.255.27: 350 351 352 <network address> Dhcp network container. *_dn 353 354 dn records ~3000, as follows: *_dn 355 356 00 00 <network address>+6 172.21.0.2 0 atlantic 357 . 358 . 359 . 360 00 00 <network address>+3006 172.21.0.2 0 atlantic 361 362 363 364 Case #1 dhcpsvc_errmsg: 365 366 Use function in a loop to display all messages 367 associated with the error codes in Figure 2 of ARCH [1]. Verify 368 that messages are displayed correctly. 369 370 Case #2 enumerate_dd: 371 372 Verify that this function properly enumerates the public 373 modules present on the machine under test in 374 /usr/lib/inet/dhcp/svc. Free memory (count entries in modules). 375 376 Case #3 status_dd: 377 378 Verify that the selected data store service is correctly 379 configured. 380 381 Case #4 capability_dd: 382 383 Verify that this function returns the correct 384 capabilities for the public module currently configured for use. 385 Note: Some public modules may not support this function, which 386 will cause this function to return DSVC_UNSUPPORTED. 387 388 Case #5 open_dd: 389 390 Using DSVC_CREATE | DSVC_READ | DSVC_WRITE, create a 391 dhcptab container and a dhcp network container (called 392 <network address>). Preserve the handles returned for later 393 use in the following test cases. 394 395 Case #6 list_dd: 396 397 Verify that this function properly returns the currently 398 available DHCP containers (Case #5) in the data service hosting 399 the public module. Only those containers created in Case #5 400 should exist. Free memory (count entries in listppp). 401 402 Case #7 add_dd_entry: 403 404 Using the handles returned in Case #5, add the test 405 data records to the dhcptab and dhcp network containers. 406 407 Case #8 lookup_dd: 408 409 8.1. Verify case #7. 410 411 Using a "count" of -1 and a "query" value set 412 using DSVC_QINIT (Figure 5 of ARCH[1]), verify that the 413 contents of the dhcptab container and <network address> 414 container match the test data. "records" should equal 415 the number of records for each container. Note that the 416 order of the records returned may not be the same as 417 the order in which they were added in case #7. 418 419 8.2 Verify dhcptab container type. 420 421 8.2.1. Look for all records with a DT_QTYPE 422 value of "s". Verify that only the "s" type 423 records are returned. 424 425 8.2.2. Look for all records with DT_QTYPE value 426 of "m". Verify that only the "m" type records 427 are returned. 428 429 8.2.3. Look for DT_QKEY of "atlantic". Verify 430 that only the macro "atlantic" is returned. 431 432 8.2.4. Look for DT_QKEY of i86pc and not a 433 DT_QTYPE of "m". Verify that only the macro 434 "i86pc" is returned. 435 436 8.3 Verify dhcp network container type. 437 438 8.2.1. Look for all records with a DN_QCIP 439 of <network address>+100. Verify that only 440 one record (with a cip of 441 <network address>+100) is returned. 442 443 8.2.2. Look for all records with DN_QMACRO 444 value of "atlantic". Verify that all records 445 are returned ("records" == 3000). Note that 446 records returned may be in a different order 447 than they were added as part of case #7. 448 449 Case #9 modify_dd_entry: 450 451 9.1 Modify dhcptab container records 452 453 9.1.1 Using lookup_dd to find the record with a 454 DT_QKEY of "Sterm", change the name of the 455 record from "Sterm" to "sTERM". Use lookup_dd to 456 verify that the original record has been 457 renamed. 458 459 9.1.2 Using lookup_dd to find the record with a 460 DT_QKEY of "Solaris", change the value portion 461 of the record to be: 462 463 :SrootIP4=129.148.174.27:SrootNM="atlantic": \ 464 :SinstIP4=129.148.174.27:SinstNM="atlantic": \ 465 :sTERM="sun-cmd":BootSrvA=129.148.174.27: 466 467 Using lookup_dd, reexecute the lookup and verify 468 that the value portion of the record has been 469 modified correctly. 470 471 9.2 Modify dhcp network container records 472 473 9.2.1 Using lookup_dd to find the record with a 474 DN_QCIP of <network address>+10, change the 475 lease field to 1/1/2000 and the flags field to 476 MANUAL. Use lookup_dd to verify that the 477 original record has been changed. 478 479 9.2.2 Using lookup_dd to find the record with a 480 DN_QFLAGS of MANUAL. Change the dn_cid field 481 to 01080020FFFFFF, dn_flags field to 482 MANUAL+AUTOMATIC, dn_sip field to 172.23.0.77, 483 dn_lease field to -1, dn_macro field to "happy", 484 and the dn_comment field to "This is a test". 485 Use lookup_dd to verify that the original record 486 has been changed. 487 488 489 Case #10 delete_dd_entry: 490 491 10.1 Delete dhcptab container record 492 493 Using lookup_dd to find the record with a 494 DT_QKEY of SUNW.Ultra-1, delete this record. Verify 495 using lookup_dd that this record can no longer be found. 496 497 10.2 Delete dhcp network container record 498 499 Using lookup_dd to find the record with a 500 DN_QCIP of <network address>+101, delete this record. 501 Verify using lookup_dd that this record can no longer be 502 found. 503 504 Case #11 close_dd: 505 506 11.1 Close the open instance of the dhcptab container. 507 Verify that close_dd returns DSVC_SUCCESS. 508 509 11.2 Close the open instance of the dhcp network 510 container <network address>. Verify that close_dd 511 returns DSVC_SUCCESS. 512 513 Case #12 remove_dd: 514 515 12.1 Remove the dhcptab container. Verify that it no 516 longer exists using list_dd. 517 518 12.2 Remove the dhcp network container <network 519 address>. Verify that it no longer exists using list_dd. 520 521 2.5 FULL TEST 522 523 Description 524 525 This test verifies that the dhcptab and dhcp network 526 container API function calls respond correctly when presented with 527 incorrect data. It also validates the MT-safeness of the API. 528 The test suite should allow any number of concurrent threads or 529 test suite processes to be invoked. 530 531 Test Data 532 533 Item Description Application 534 ==== =========== =========== 535 <network address> IP address of *_dn 536 network. Ensure 537 that appropriate 538 subnet mask is 539 available in 540 netmasks(4). 541 Candidate networks 542 have to have at 543 least 3000 hosts. 544 545 dt records As follows: *_dt 546 547 SrootOpt s Vendor=SUNW.Ultra-1 SUNW.i86pc,1,ASCII,1,0 548 SrootIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,2,IP,1,1 549 SrootNM s Vendor=SUNW.Ultra-1 SUNW.i86pc,3,ASCII,1,0 550 SrootPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,4,ASCII,1,0 551 SswapIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,5,IP,1,1 552 SswapPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,6,ASCII,1,0 553 SbootFIL s Vendor=SUNW.Ultra-1 SUNW.i86pc,7,ASCII,1,0 554 Stz s Vendor=SUNW.Ultra-1 SUNW.i86pc,8,ASCII,1,0 555 SbootRS s Vendor=SUNW.Ultra-1 SUNW.i86pc,9,NUMBER,2,1 556 SinstIP4 s Vendor=SUNW.Ultra-1 SUNW.i86pc,10,IP,1,1 557 SinstNM s Vendor=SUNW.Ultra-1 SUNW.i86pc,11,ASCII,1,0 558 SinstPTH s Vendor=SUNW.Ultra-1 SUNW.i86pc,12,ASCII,1,0 559 SsysidCF s Vendor=SUNW.Ultra-1 SUNW.i86pc,13,ASCII,1,0 560 SjumpsCF s Vendor=SUNW.Ultra-1 SUNW.i86pc,14,ASCII,1,0 561 Sterm s Vendor=SUNW.Ultra-1 SUNW.i86pc,15,ASCII,1,0 562 Locale m :UTCoffst=-18000: 563 Solaris m :SrootIP4=129.148.174.27:SrootNM="atlantic": \ 564 :SinstIP4=129.148.174.27:SinstNM="atlantic": \ 565 :Sterm="xterm":BootSrvA=129.148.174.27: 566 sparc m \ 567 :SrootPTH="/export/s28/solaris1of2.s28s_wos/latest/Solaris_8/Tools/Boot": \ 568 :SinstPTH="/export/s28/solaris1of2.s28s_wos/latest": 569 sun4u m :Include=Solaris:Include=sparc: 570 i86pc m :Include=Solaris:SbootFIL="/platform/i86pc/kernel/unix": \ 571 :SinstPTH="/export/s28/solaris1of2.s28x_wos/latest": \ 572 :SrootPTH="/export/s28/solaris1of2.s28x_wos/latest/Solaris_8/Tools/Boot": 573 SUNW.i86pc m :Include=i86pc: 574 SUNW.Ultra-1 m :SbootFIL="/platform/sun4u/kernel/sparcv9/unix": \ 575 :Include=sun4u: 576 <network address> m :Subnet=255.255.0.0:Router=172.21.0.2: \ 577 :Broadcst=172.21.255.255: 578 atlantic m :Include=Locale:Timeserv=129.148.174.27:LeaseTim=3600: \ 579 :LeaseNeg:Hostname:DNSdmain="snt.east.sun.com": \ 580 :DNSserv=172.21.0.1: 581 010800207E8A02 m :Impress=172.22.255.27: 582 583 584 <network address> Dhcp network container. *_dn 585 586 dn records ~3000, as follows: *_dn 587 588 00 00 <network address>+6 172.21.0.2 0 atlantic 589 . 590 . 591 . 592 00 00 <network address>+3006 172.21.0.2 0 atlantic 593 594 595 596 Case #1 all API function calls: 597 598 1.1 Invalid arguments 599 600 Call each of the API functions with invalid 601 argument(s). For functions that take more than one 602 argument, call those functions once for each argument, 603 providing invalid data for each argument in turn. 604 Confirm that functions return DSVC_INVAL for all cases 605 but dhcpsvc_errmsg. This function should return a 606 string of "unknown". 607 608 1.2 No public modules (N/A for dhcpsvc_errmsg) 609 610 Call each of the API functions. Verify that 611 DSVC_ENOENT is returned. 612 613 1.3 Permission (N/A for dhcpsvc_errmsg) 614 615 Change the permission of the public module to be 616 unreadable by any user (000). Verify that DSVC_ACCESS 617 is returned. Restore permission of public module. 618 619 Case #2 status_dd: 620 621 2.1 Supporting data service not configured. 622 623 Verify that DSVC_SUCCESS is *not* returned. 624 Some public modules may not return the same error message 625 in this case. All should fail. 626 627 2.2 Configured data service, but unavailable. 628 629 Using a data service-specific method of making 630 the data service temporarily unavailable, call the 631 function. DSVC_BUSY or DSVC_INTERNAL (different depending 632 on implementation) is returned. 633 634 2.3 Configured data service, available. 635 636 Verify that DSVC_SUCCESS is returned. 637 638 Case #3 open_dd: 639 640 Perform the following subcases once each for the dhcptab 641 container and dhcp network container described in the test 642 data. 643 644 3.1 No container 645 646 Call function with DSVC_READ | DSVC_WRITE. 647 Verify that DSVC_NOENT is returned. 648 649 3.2 Basic 650 651 Using DSVC_CREATE | DSVC_READ | DSVC_WRITE, 652 create a dhcptab container and a dhcp network container 653 (called <network address>). 654 655 3.3 NON_BLOCK 656 657 Call function with DSVC_READ | DSVC_WRITE | 658 DSVC_NONBLOCK. Depending on whether the public module 659 supports it (see module doc), the function should return 660 either DSVC_SUCCESS or DSVC_UNSUPPORTED. 661 662 3.4 Container exists 663 664 Using DSVC_CREATE | DSVC_READ | DSVC_WRITE, 665 verify that the function returns DSVC_EXISTS. 666 667 Cleanup: Remove the containers using remove_dd. 668 669 Case #4 list_dd: 670 671 4.1 No containers 672 673 Verify that list_dd returns DSVC_NOENT. 674 675 Case #5 add_dd_entry: 676 677 Create and load containers as per Case #5 and Case 678 #7 of the Basic Sanity Test. 679 680 5.1 Record exists 681 682 Attempt to add a test data record for the 683 dhcptab container and dhcp network container 684 respectively. Verify that DSVC_EXISTS is returned. 685 686 5.2 Busy 687 688 Close containers with close_dd. Reopen with 689 DSVC_NONBLOCK specified. If success is returned, using a 690 data service specific technique for making the service 691 busy, attempt to add an additional record to each of the 692 two containers. Verify that DSVC_BUSY is returned. 693 Remove the busy condition, and reattempt the add. Verify 694 that DSVC_SUCCESS is returned. close_dd the containers. 695 696 5.3 Read only 697 698 Reopen the containers with DSVC_READ access 699 only. If success is returned, attempt to add a new 700 record to each container. Verify that DSVC_ACCESS is 701 returned. close_dd the containers. 702 703 Cleanup: Remove the containers using remove_dd. 704 705 Case #5 lookup_dd: 706 707 Create and load containers as per Case #5 and Case #7 of 708 the Basic Sanity Test. 709 710 5.1. Record does not exist. 711 712 Produce dhcptab container and dhcp network 713 container queries that would not be satisfied by the 714 test data. Verify that DSVC_SUCCESS is returned, and 715 "records" is 0. 716 717 5.2 Busy 718 719 Close containers with close_dd. Reopen with 720 DSVC_NONBLOCK specified. If DSVC_SUCCESS is returned, 721 using a data service specific technique for making 722 the service busy, attempt to perform a valid lookup of 723 records in each of the two containers. Verify that DSVC_BUSY 724 is returned. Remove the busy condition, and reattempt 725 the lookups. Verify that DSVC_SUCCESS is returned, and 726 that data returned is valid. close_dd the containers. 727 728 5.3 Write only 729 730 Reopen the containers with DSVC_WRITE access 731 only. If success is returned, attempt to perform 732 lookup_dd's using any syntactically legal query for each 733 container type. Verify that DSVC_ACCESS is returned. 734 close_dd the containers. 735 736 Cleanup: Remove the containers using remove_dd. 737 738 Case #6 modify_dd_entry: 739 740 Create and load containers as per Case #5 and Case #7 of 741 the Basic Sanity Test. 742 743 6.1 Unknown record 744 745 Fabricate dn_rec_t / dt_rec_t instances known not 746 to exist in the respective containers. Attempt to modify 747 the records. Verify that DSVC_NOENT is returned. 748 749 6.2 Update Collision #1 750 751 Use lookup_dd to find valid dhcptab and dhcp 752 network container records (one each). Change the 753 signature on the resultant dt_rec_t / dn_rec_t. Attempt 754 to modify records. Verify that DSVC_COLLISION is returned. 755 756 6.3 Update Collision #2 757 758 Use lookup_dd to find valid dhcptab and dhcp 759 network container records (one each). Attempt to rename 760 the records to names which already exist (dt_key + 761 dt_type, dn_cip). Verify that DSVC_EXISTS is returned. 762 763 6.4 Busy 764 765 Close containers with close_dd. Reopen with 766 DSVC_NONBLOCK specified. If DSVC_SUCCESS is returned, 767 acquire valid dhcptab and dhcp network container 768 records using lookup_dd. Using a data service specific 769 technique for making the service busy, attempt to 770 modify the value (non-key fields) of the records. Verify 771 that DSVC_BUSY is returned. Remove the busy condition, 772 and reattempt the modifies. Verify that DSVC_SUCCESS 773 is returned. Reacquire the records. Verify that the 774 contents have been suitably updated. close_dd the 775 containers. 776 777 6.5 Read only 778 779 Reopen the containers with DSVC_READ access 780 only. If success is returned, locate valid container 781 records using the appropriate queries to lookup_dd. 782 Modify the contents of a copy of the dt_rec_t / 783 dn_rec_t. Attempt to modify the record in the containers. 784 Verify that DSVC_ACCESS is returned. close_dd the 785 containers. 786 787 Cleanup: Remove the containers using remove_dd. 788 789 Case #7 free_dd: 790 791 This function should be used to release the results of 792 lookup_dd calls. Its operation must be validated by running this 793 test suite under bcheck with -memuse, and ensuring that no free 794 blocks remain after exit. Note that the test suite must be 795 written with care to make this case useful (free any allocated 796 memory before exit). 797 798 Case #8 delete_dd_entry: 799 800 Create and load containers as per Case #5 and Case #7 of 801 the Basic Sanity Test. 802 803 8.1 Unknown record 804 805 Fabricate dn_rec_t / dt_rec_t instances known not 806 to exist in the respective containers. Attempt to delete 807 the records. Verify that DSVC_NOENT is returned. 808 809 8.2 Busy 810 811 Close containers with close_dd. Reopen with 812 DSVC_NONBLOCK specified. If DSVC_SUCCESS is returned, 813 acquire valid dhcptab and dhcp network container 814 records using lookup_dd. Using a data service specific 815 technique for making the service busy, attempt to 816 delete the records. Verify that DSVC_BUSY is returned. 817 Remove the busy condition, and reattempt the deletes. 818 Verify that DSVC_SUCCESS is returned. Attempt to 819 reacquire the records. Verify that the records have been 820 deleted. close_dd the containers. 821 822 8.3 Read only 823 824 Reopen the containers with DSVC_READ access 825 only. If success is returned, locate valid container 826 records using the appropriate queries to lookup_dd. 827 Attempt to delete the records in the containers. 828 Verify that DSVC_ACCESS is returned. close_dd the 829 containers. 830 831 Cleanup: Remove the containers using remove_dd. 832 833 Case #9 close_dd: 834 835 9.1 Busy 836 837 Create containers as per Case #5 of the Basic 838 Sanity Test, with the exception that DSVC_NONBLOCK is 839 specified. If DSVC_SUCCESS is returned, using a data 840 service specific technique for making the service busy, 841 attempt to close the containers using the handles 842 returned by open_dd. Verify that DSVC_BUSY is returned. 843 Remove the busy condition, and reattempt the close_dd. 844 Verify that DSVC_SUCCESS is returned. 845 846 Cleanup: Remove the containers using remove_dd. 847 848 Case #10 remove_dd: 849 850 Create containers as per Case #5 of the Basic Sanity Test. 851 852 10.1 Unknown container 853 854 Attempt to remove a non-existent dhcp network 855 container. Verify that DSVC_NOENT is returned. 856 857 10.2 Busy 858 859 Close containers with close_dd. Reopen with 860 DSVC_NONBLOCK specified. If DSVC_SUCCESS is returned, 861 using a data service specific technique for making the 862 service busy, attempt to remove the containers. Verify 863 that DSVC_BUSY is returned. Remove the busy condition, 864 close_dd the containers, and reattempt the removes. 865 Verify that DSVC_SUCCESS is returned. Verify using 866 list_dd that the containers have been removed. 867 868 Case #11 Multi-access stress 869 870 The service provider layer modules underneath 871 the private layer are not required to manage reference 872 counts for open instances. So while individual private 873 layer handles are considered to be MT-safe (and parallel 874 access to data containers is suitably protected), an 875 application using the private layer API must synchronize 876 close and/or container remove operations among threads 877 such that no threads hold handles to a container after 878 the handle has been closed or the container has been 879 removed. 880 881 This case assumes a test which is 882 multi-threaded, and can run the following test using 883 from 1 to THREADS threads. The test can also be run in 884 multiple concurrent processes. 885 886 The goal of this test is to ensure that the API 887 is MT-safe with respect to the containers and the 888 records contained within those containers. This goal is 889 accomplished by verifying that the end result of the 890 test is consistent. 891 892 Tunable default values: 893 894 PROCESSES: 20 895 THREADS: 20 896 897 11.1 The dhcptab container test 898 899 11.1.1 open_dd 900 901 Create a dhcptab using DSVC_CREATE | 902 DSVC_READ | DSVC_WRITE. If DSVC_EXISTS is 903 returned, retry the open attempt w/o the 904 DSVC_CREATE flag. Log that this event occurred. 905 Handle will be used for balance of test. If any 906 other error occurs, terminate the test as 907 failed. 908 909 11.1.2 add_dd_entry 910 911 Add the test data records to the dhcptab 912 container. If DSVC_EXISTS is returned, skip that 913 record, and continue attempting to add the other 914 records. Log that this event occurred. If any 915 other error occurs, terminate the test as 916 failed. 917 918 11.1.3 lookup_dd 919 920 Using DT_QKEY of "atlantic" and DT_QTYPE 921 of "m", find the atlantic record. Compare its 922 value against the test data. If it has 923 changed, then output a message to this affect. 924 If any error occurs, terminate the test as failed. 925 926 11.1.4 modify_dd_entry 927 928 Using the results of 11.1.3, change the 929 record as follows. If it is no different from 930 the test data, change the value to: 931 932 :Timeserv=129.148.174.28:LeaseTim=86400: \ 933 :Hostname:DNSdmain="east.sun.com":DNSserv=172.23.3.3: 934 935 If it doesn't match the test data 936 value, change the LeaseTim by incrementing it by 937 one. Attempt to update the record. If it fails 938 with DSVC_COLLISION, retry 11.1.3 and 11.1.4 for 939 three attempts. Log message if modify was 940 unsuccessful. If any other error occurs, 941 terminate the test as failed. 942 943 11.1.5 delete_dd_entry 944 945 Use lookup_dd to find a DT_QKEY of 946 "SjumpsCF" and a DT_QTYPE of "s". If it does 947 not exist, log a message. If it does exist, 948 attempt to delete it. If DSVC_NOENT is returned, 949 log a message. 950 951 11.1.6 close_dd 952 953 Use close_dd to close the open handle. 954 If DSVC_NOENT is returned, log a message. 955 956 11.1.7 epilogue 957 958 Compare the resultant dhcptab container 959 to the test data. The only differences should be 960 a changed value of the atlantic macro as 961 expected from 11.1.4 and the SjumpsCF symbol 962 should be removed. Any other inconsistency means 963 the test has failed. 964 965 Clean up: Remove the dhcptab container. 966 967 11.2 The dhcp network container test 968 969 11.2.1 open_dd 970 971 Create a <network address> dhcp network 972 container using DSVC_CREATE | DSVC_READ | DSVC_WRITE. 973 If DSVC_EXISTS is returned, retry the open 974 attempt w/o the DSVC_CREATE flag. Log that this 975 event occurred. Handle will be used for balance 976 of test. If any other error occurs, terminate 977 the test as failed. 978 979 11.2.2 add_dd_entry 980 981 Add the test data records to the dhcp 982 network container. If DSVC_EXISTS is 983 returned, skip that record, and continue 984 attempting to add the other records. Log that 985 this event occurred. If any other error occurs, 986 terminate the test as failed. 987 988 11.2.3 lookup_dd 989 990 Find the DN_QCIP of <network address>+102 991 record. Compare its value against the test data. 992 If it has changed, then output a message to this 993 affect. If any error occurs, terminate the test 994 as failed. 995 996 11.2.4 modify_dd_entry 997 998 Using the results of 11.2.3, change the 999 record as follows. If it is no different from 1000 the test data, change the value to: 1001 1002 01DEADBEEF 03 <network address>+102 172.23.3.3 941619403 Solaris 1003 1004 If it doesn't match the test data 1005 value, change dn_lease by incrementing it by 1006 one. Attempt to update the record. If it fails 1007 with DSVC_COLLISION, retry 11.2.3 and 11.2.4 for 1008 three attempts. Log message if modify was 1009 unsuccessful. If any other error occurs, 1010 terminate the test as failed. 1011 1012 11.2.5 delete_dd_entry 1013 1014 Use lookup_dd to find a DN_QCIP of 1015 <network address>+1001. If it does not exist, 1016 log a message. If it does exist, attempt to 1017 delete it. If DSVC_NOENT is returned, log a 1018 message. 1019 1020 11.2.6 close_dd 1021 1022 Use close_dd to close the open handle. 1023 If DSVC_NOENT is returned, log a message. 1024 1025 11.2.7 epilogue 1026 1027 The <network address> dhcp network 1028 container should be consistent at the end of 1029 a test run. The only differences should be a 1030 changed value of the <network address>+102 1031 record with the value as per 11.2.4 and the 1032 lease time potentially incremented, as well as 1033 the <network address>+1001 record missing. 1034 Any other inconsistency means the test has 1035 failed. 1036 1037 Cleanup: remove <network address> dhcp network 1038 container. 1039 1040 11.3 Multi-process run 1041 1042 Run 11.1 and 11.2 in PROCESSES separate 1043 processes. 1044 1045 11.4 Multi-threaded run, single process 1046 1047 Run 11.1 and 11.2 in THREADS separate threads 1048 within a single process. 1049 1050 11.5 Multi-process, Multi-threaded run 1051 1052 Run 11.1 and 11.2 in PROCESSES separate 1053 processes each spawning THREADS separate threads. 1054 1055 REFERENCES 1056 1057 [1] "Enterprise DHCP Service Architecture Specification", mwc, 1058 6/25/1999. 1059 1060 [2] "Enterprise Reference Hardware Platforms", mwc, 10/23/1999.