PageRenderTime 185ms CodeModel.GetById 2ms app.highlight 176ms RepoModel.GetById 1ms app.codeStats 0ms

/usr/src/suites/os/smf/tests/include/create_piece.pm

https://bitbucket.org/illumos/illumos-stc
Perl | 1564 lines | 1065 code | 324 blank | 175 comment | 41 complexity | e00b757987bbe32a7e3b67b3b97f7d63 MD5 | raw file
   1#
   2# CDDL HEADER START
   3#
   4# The contents of this file are subject to the terms of the
   5# Common Development and Distribution License (the "License").
   6# You may not use this file except in compliance with the License.
   7#
   8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9# or http://www.opensolaris.org/os/licensing.
  10# See the License for the specific language governing permissions
  11# and limitations under the License.
  12#
  13# When distributing Covered Code, include this CDDL HEADER in each
  14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15# If applicable, add the following below this CDDL HEADER, with the
  16# fields enclosed by brackets "[]" replaced with your own identifying
  17# information: Portions Copyright [yyyy] [name of copyright owner]
  18#
  19# CDDL HEADER END
  20#
  21
  22#
  23# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24#
  25#
  26
  27use strict;
  28use warnings;
  29
  30use lib "$ENV{STF_SUITE}/tests/include";
  31use Class::Struct;
  32
  33use piece_types;
  34use write_piece;
  35
  36struct value => { reverse qw{
  37	$ leftside
  38	$ rightside
  39	$ middle
  40}};
  41
  42struct piece => { reverse qw{
  43	$ type
  44	$ ident
  45	$ write
  46	$ close
  47	@ values
  48	@ associations
  49}};
  50
  51our $template_piece;
  52our $pieces;
  53our $p;
  54our $v;
  55
  56#
  57# A number of functions to create each of the different pieces
  58# that will make up a manifest.
  59#
  60
  61#
  62# Create a service_bundle piece
  63#
  64sub SERVICEBUNDLE() {
  65	my $values = shift;
  66
  67	if (!defined($pieces) || $pieces eq "uninitialized") {
  68		our $pieces = piece->new();
  69	}
  70
  71	$p = $pieces;
  72
  73	$p->type($piece_types::SERVICEBUNDLE);
  74	$p->write(\&write_service_bundle);
  75	@{$p->associations} = ();
  76
  77	my $setident = 0;
  78	my @vals = split(/,/, $values);
  79	foreach my $val (@vals) {
  80		my ($l, $r) = split(/=/, $val);
  81
  82		if ($l eq "name") {
  83			$setident = 1;
  84			$p->ident($r);
  85		}
  86
  87		$v = value->new();
  88		$v->leftside($l);
  89		$v->rightside($r);
  90
  91		push(@{$p->values}, $v);
  92	}
  93}
  94
  95#
  96# Create a service piece
  97#
  98sub SERVICE() {
  99	my $association = shift;
 100	my $values = shift;
 101
 102	$p = piece->new();
 103	$p->type($piece_types::SERVICE);
 104	$p->write(\&write_service);
 105	@{$p->associations} = ();
 106
 107	my $setident = 0;
 108	my @vals = split(/,/, $values);
 109	foreach my $val (@vals) {
 110		my ($l, $r) = split(/=/, $val);
 111
 112		if ($l eq "name") {
 113			$setident = 1;
 114			$p->ident($r);
 115		}
 116
 117		$v = value->new();
 118		$v->leftside($l);
 119		$v->rightside($r);
 120
 121		push(@{$p->values}, $v);
 122	}
 123
 124	my ($asstype, $assname) = split(/:/, $association);
 125	&associate_piece($asstype, $assname, $p);
 126}
 127	
 128#
 129# Create a exec_method piece
 130#
 131sub EXECMETHOD() {
 132	my $association = shift;
 133	my $values = shift;
 134
 135	$p = piece->new();
 136	$p->type($piece_types::EXECMETHOD);
 137	$p->write(\&write_exec_method);
 138	@{$p->associations} = ();
 139
 140	my $setident = 0;
 141	my @vals = split(/,/, $values);
 142	foreach my $val (@vals) {
 143		my ($l, $r) = split(/=/, $val);
 144
 145		if ($l eq "name") {
 146			$setident = 1;
 147			$p->ident($r);
 148		}
 149
 150		$v = value->new();
 151		$v->leftside($l);
 152		$v->rightside($r);
 153
 154		push(@{$p->values}, $v);
 155	}
 156
 157	my ($asstype, $assname) = split(/:/, $association);
 158	&associate_piece($asstype, $assname, $p);
 159}
 160
 161
 162
 163#
 164# Create a property group piece
 165#
 166sub PROPERTYGROUP() {
 167	my $association = shift;
 168	my $values = shift;
 169
 170	$p = piece->new();
 171	$p->type($piece_types::PROPERTYGROUP);
 172	$p->write(\&write_property_group);
 173	@{$p->associations} = ();
 174
 175	my $setident = 0;
 176	my @vals = split(/,/, $values);
 177	foreach my $val (@vals) {
 178		my ($l, $r) = split(/=/, $val);
 179
 180		if ($l eq "name") {
 181			$setident = 1;
 182			$p->ident($r);
 183		}
 184
 185		$v = value->new();
 186		$v->leftside($l);
 187		$v->rightside($r);
 188
 189		push(@{$p->values}, $v);
 190	}
 191
 192	my ($asstype, $assname) = split(/:/, $association);
 193	&associate_piece($asstype, $assname, $p);
 194}
 195
 196#
 197# Create a createdefaultinstance piece
 198#
 199sub CREATEDEFAULTINSTANCE() {
 200	my $association = shift;
 201	my $values = shift;
 202
 203	$p = piece->new();
 204	$p->type($piece_types::CREATEDEFAULTINSTANCE);
 205	$p->write(\&write_create_default_instance);
 206	@{$p->associations} = ();
 207
 208	my $setident = 0;
 209	if ($values ne "true" && $values ne "false") {
 210		return();
 211	}
 212
 213	$v = value->new();
 214	$v->leftside($values);
 215	push(@{$p->values}, $v);
 216
 217	my ($asstype, $assname) = split(/:/, $association);
 218	&associate_piece($asstype, $assname, $p);
 219}
 220
 221#
 222# Create a single_instance piece
 223#
 224sub SINGLEINSTANCE() {
 225	my $association = shift;
 226	my $values = shift;
 227
 228	$p = piece->new();
 229	$p->type($piece_types::SINGLEINSTANCE);
 230	$p->write(\&write_single_instance);
 231	@{$p->associations} = ();
 232
 233	my $setident = 0;
 234	my @vals = split(/,/, $values);
 235	foreach my $val (@vals) {
 236		my ($l, $r) = split(/=/, $val);
 237
 238		if ($l eq "name") {
 239			$setident = 1;
 240			$p->ident($r);
 241		}
 242
 243		$v = value->new();
 244		$v->leftside($l);
 245		$v->rightside($r);
 246
 247		push(@{$p->values}, $v);
 248	}
 249
 250	my ($asstype, $assname) = split(/:/, $association);
 251	&associate_piece($asstype, $assname, $p);
 252}
 253
 254#
 255# Create a restarter piece
 256#
 257sub RESTARTER() {
 258	my $association = shift;
 259	my $values = shift;
 260
 261	$p = piece->new();
 262	$p->type($piece_types::RESTARTER);
 263	$p->write(\&write_restarter);
 264	@{$p->associations} = ();
 265
 266	my $setident = 0;
 267	my @vals = split(/,/, $values);
 268	foreach my $val (@vals) {
 269		my ($l, $r) = split(/=/, $val);
 270
 271		if ($l eq "name") {
 272			$setident = 1;
 273			$p->ident($r);
 274		}
 275
 276		$v = value->new();
 277		$v->leftside($l);
 278		$v->rightside($r);
 279
 280		push(@{$p->values}, $v);
 281	}
 282
 283	my ($asstype, $assname) = split(/:/, $association);
 284	&associate_piece($asstype, $assname, $p);
 285}
 286
 287#
 288# Create a dependency piece
 289#
 290sub DEPENDENCY() {
 291	my $association = shift;
 292	my $values = shift;
 293
 294	$p = piece->new();
 295	$p->type($piece_types::DEPENDENCY);
 296	$p->write(\&write_dependency);
 297	@{$p->associations} = ();
 298
 299	my $setident = 0;
 300	my @vals = split(/,/, $values);
 301	foreach my $val (@vals) {
 302		my ($l, $r) = split(/=/, $val);
 303
 304		if ($l eq "name") {
 305			$setident = 1;
 306			$p->ident($r);
 307		}
 308
 309		$v = value->new();
 310		$v->leftside($l);
 311		$v->rightside($r);
 312
 313		push(@{$p->values}, $v);
 314	}
 315
 316	my ($asstype, $assname) = split(/:/, $association);
 317	&associate_piece($asstype, $assname, $p);
 318}
 319
 320#
 321# Create a dependent piece
 322#
 323sub DEPENDENT() {
 324	my $association = shift;
 325	my $values = shift;
 326
 327	$p = piece->new();
 328	$p->type($piece_types::DEPENDENT);
 329	$p->write(\&write_dependent);
 330	@{$p->associations} = ();
 331
 332	my $setident = 0;
 333	my @vals = split(/,/, $values);
 334	foreach my $val (@vals) {
 335		my ($l, $r) = split(/=/, $val);
 336
 337		if ($l eq "name") {
 338			$setident = 1;
 339			$p->ident($r);
 340		}
 341
 342		$v = value->new();
 343		$v->leftside($l);
 344		$v->rightside($r);
 345
 346		push(@{$p->values}, $v);
 347	}
 348
 349	my ($asstype, $assname) = split(/:/, $association);
 350	&associate_piece($asstype, $assname, $p);
 351}
 352
 353#
 354# Create a method_context piece
 355#
 356sub METHODCONTEXT() {
 357	my $association = shift;
 358	my $values = shift;
 359
 360	$p = piece->new();
 361	$p->type($piece_types::METHODCONTEXT);
 362	$p->write(\&write_method_context);
 363	@{$p->associations} = ();
 364
 365	my $setident = 0;
 366	my @vals = split(/,/, $values);
 367	foreach my $val (@vals) {
 368		my ($l, $r) = split(/=/, $val);
 369
 370		if ($l eq "name") {
 371			$setident = 1;
 372			$p->ident($r);
 373		}
 374
 375		$v = value->new();
 376		$v->leftside($l);
 377		$v->rightside($r);
 378
 379		push(@{$p->values}, $v);
 380	}
 381
 382	my ($asstype, $assname) = split(/:/, $association);
 383	&associate_piece($asstype, $assname, $p);
 384}
 385
 386#
 387# Create a instance piece
 388#
 389sub INSTANCE() {
 390	my $association = shift;
 391	my $values = shift;
 392
 393	$p = piece->new();
 394	$p->type($piece_types::INSTANCE);
 395	$p->write(\&write_instance);
 396	@{$p->associations} = ();
 397
 398	my $setident = 0;
 399	my @vals = split(/,/, $values);
 400	foreach my $val (@vals) {
 401		my ($l, $r) = split(/=/, $val);
 402
 403		if ($l eq "name") {
 404			$setident = 1;
 405			$p->ident($r);
 406		}
 407
 408		$v = value->new();
 409		$v->leftside($l);
 410		$v->rightside($r);
 411
 412		push(@{$p->values}, $v);
 413	}
 414
 415	my ($asstype, $assname) = split(/:/, $association);
 416	&associate_piece($asstype, $assname, $p);
 417}
 418
 419#
 420# Create a stability piece
 421#
 422sub STABILITY() {
 423	my $association = shift;
 424	my $values = shift;
 425
 426	$p = piece->new();
 427	$p->type($piece_types::STABILITY);
 428	$p->write(\&write_stability);
 429	@{$p->associations} = ();
 430
 431	my $setident = 0;
 432	my @vals = split(/,/, $values);
 433	foreach my $val (@vals) {
 434		my ($l, $r) = split(/=/, $val);
 435
 436		if ($l eq "name") {
 437			$setident = 1;
 438			$p->ident($r);
 439		}
 440
 441		$v = value->new();
 442		$v->leftside($l);
 443		$v->rightside($r);
 444
 445		push(@{$p->values}, $v);
 446	}
 447
 448	my ($asstype, $assname) = split(/:/, $association);
 449	&associate_piece($asstype, $assname, $p);
 450}
 451
 452#
 453# Create a template piece
 454#
 455sub TEMPLATE() {
 456	my $association = shift;
 457	my $values = shift;
 458
 459	$template_piece = 1;
 460	$p = piece->new();
 461	$p->type($piece_types::TEMPLATE);
 462	$p->write(\&write_template);
 463	@{$p->associations} = ();
 464
 465	my $setident = 0;
 466	my @vals = split(/,/, $values);
 467	foreach my $val (@vals) {
 468		my ($l, $r) = split(/=/, $val);
 469
 470		if ($l eq "name") {
 471			$setident = 1;
 472			$p->ident($r);
 473		}
 474
 475		$v = value->new();
 476		$v->leftside($l);
 477		$v->rightside($r);
 478
 479		push(@{$p->values}, $v);
 480	}
 481
 482	if ($setident != 1) {
 483		$p->ident("DEFAULT");
 484	}
 485
 486	my ($asstype, $assname) = split(/:/, $association);
 487	&associate_piece($asstype, $assname, $p);
 488}
 489
 490#
 491# Create a common_name piece
 492#
 493sub COMMONNAME() {
 494	my $association = shift;
 495	my $values = shift;
 496
 497	$p = piece->new();
 498	$p->type($piece_types::COMMONNAME);
 499	$p->write(\&write_common_name);
 500	@{$p->associations} = ();
 501
 502	my $setident = 0;
 503	my $cname;
 504	my $lang;
 505	while ($values) {
 506		($lang, $cname, $values) = split(/,/, $values, 3);
 507		$v = value->new();
 508		$v->leftside("lang");
 509		$v->rightside($lang);
 510
 511		push(@{$p->values}, $v);
 512
 513		$v = value->new();
 514		$v->leftside("${lang}_cname");
 515		$v->rightside($cname);
 516
 517		push(@{$p->values}, $v);
 518	}
 519
 520	$p->ident("$cname");
 521
 522	my ($asstype, $assname) = split(/:/, $association);
 523	&associate_piece($asstype, $assname, $p);
 524}
 525
 526#
 527# Create a description piece
 528#
 529sub DESCRIPTION() {
 530	my $association = shift;
 531	my $values = shift;
 532
 533	$p = piece->new();
 534	$p->type($piece_types::DESCRIPTION);
 535	$p->write(\&write_description);
 536	@{$p->associations} = ();
 537
 538	my $setident = 0;
 539	my @vals = split(/,/, $values);
 540	foreach my $val (@vals) {
 541		my ($l, $r) = split(/=/, $val);
 542
 543		if ($l eq "name") {
 544			$setident = 1;
 545			$p->ident($r);
 546		}
 547
 548		$v = value->new();
 549		$v->leftside($l);
 550		$v->rightside($r);
 551
 552		push(@{$p->values}, $v);
 553	}
 554
 555	my ($asstype, $assname) = split(/:/, $association);
 556	&associate_piece($asstype, $assname, $p);
 557}
 558
 559#
 560# Create a documentation piece
 561#
 562sub DOCUMENTATION() {
 563	my $association = shift;
 564	my $values = shift;
 565
 566	$p = piece->new();
 567	$p->type($piece_types::DOCUMENTATION);
 568	$p->write(\&write_documentation);
 569	@{$p->associations} = ();
 570
 571	my $setident = 0;
 572	my @vals = split(/,/, $values);
 573	foreach my $val (@vals) {
 574		my ($l, $r) = split(/=/, $val);
 575
 576		if ($l eq "name") {
 577			$setident = 1;
 578			$p->ident($r);
 579		}
 580
 581		$v = value->new();
 582		$v->leftside($l);
 583		$v->rightside($r);
 584
 585		push(@{$p->values}, $v);
 586	}
 587
 588	my ($asstype, $assname) = split(/:/, $association);
 589	&associate_piece($asstype, $assname, $p);
 590}
 591
 592#
 593# Create a pg_pattern piece
 594#
 595sub PGPATTERN() {
 596	my $association = shift;
 597	my $values = shift;
 598
 599	$p = piece->new();
 600	$p->type($piece_types::PGPATTERN);
 601	$p->write(\&write_pg_pattern);
 602	@{$p->associations} = ();
 603
 604	my $setident = 0;
 605	my @vals = split(/,/, $values);
 606	foreach my $val (@vals) {
 607		my ($l, $r) = split(/=/, $val);
 608
 609		if ($l eq "name") {
 610			$setident = 1;
 611			$p->ident($r);
 612		}
 613
 614		$v = value->new();
 615		$v->leftside($l);
 616		$v->rightside($r);
 617
 618		push(@{$p->values}, $v);
 619	}
 620
 621	my ($asstype, $assname) = split(/:/, $association);
 622	&associate_piece($asstype, $assname, $p);
 623}
 624
 625#
 626# Create a prop_pattern piece
 627#
 628sub PROPPATTERN() {
 629	my $association = shift;
 630	my $values = shift;
 631
 632	$p = piece->new();
 633	$p->type($piece_types::PROPPATTERN);
 634	$p->write(\&write_prop_pattern);
 635	@{$p->associations} = ();
 636
 637	my $setident = 0;
 638	my @vals = split(/,/, $values);
 639	foreach my $val (@vals) {
 640		my ($l, $r) = split(/=/, $val);
 641
 642		if ($l eq "name") {
 643			$setident = 1;
 644			$p->ident($r);
 645		}
 646
 647		$v = value->new();
 648		$v->leftside($l);
 649		$v->rightside($r);
 650
 651		push(@{$p->values}, $v);
 652	}
 653
 654	my ($asstype, $assname) = split(/:/, $association);
 655	&associate_piece($asstype, $assname, $p);
 656}
 657
 658#
 659# Create a units piece
 660#
 661sub UNITS() {
 662	my $association = shift;
 663	my $values = shift;
 664
 665	$p = piece->new();
 666	$p->type($piece_types::UNITS);
 667	$p->write(\&write_units);
 668	@{$p->associations} = ();
 669
 670	my $setident = 0;
 671	my @vals = split(/,/, $values);
 672	foreach my $val (@vals) {
 673		my ($l, $r) = split(/=/, $val);
 674
 675		if ($l eq "name") {
 676			$setident = 1;
 677			$p->ident($r);
 678		}
 679
 680		$v = value->new();
 681		$v->leftside($l);
 682		$v->rightside($r);
 683
 684		push(@{$p->values}, $v);
 685	}
 686
 687	my ($asstype, $assname) = split(/:/, $association);
 688	&associate_piece($asstype, $assname, $p);
 689}
 690
 691#
 692# Create a visibility piece
 693#
 694sub VISIBILITY() {
 695	my $association = shift;
 696	my $values = shift;
 697
 698	$p = piece->new();
 699	$p->type($piece_types::VISIBILITY);
 700	$p->write(\&write_visibility);
 701	@{$p->associations} = ();
 702
 703	my $setident = 0;
 704	my @vals = split(/,/, $values);
 705	foreach my $val (@vals) {
 706		my ($l, $r) = split(/=/, $val);
 707
 708		if ($l eq "name") {
 709			$setident = 1;
 710			$p->ident($r);
 711		}
 712
 713		$v = value->new();
 714		$v->leftside($l);
 715		$v->rightside($r);
 716
 717		push(@{$p->values}, $v);
 718	}
 719
 720	my ($asstype, $assname) = split(/:/, $association);
 721	&associate_piece($asstype, $assname, $p);
 722}
 723
 724#
 725# Create a cardinality piece
 726#
 727sub CARDINALITY() {
 728	my $association = shift;
 729	my $values = shift;
 730
 731	$p = piece->new();
 732	$p->type($piece_types::CARDINALITY);
 733	$p->write(\&write_cardinality);
 734	@{$p->associations} = ();
 735
 736	my $setident = 0;
 737	my @vals = split(/,/, $values);
 738	foreach my $val (@vals) {
 739		my ($l, $r) = split(/=/, $val);
 740
 741		if ($l eq "name") {
 742			$setident = 1;
 743			$p->ident($r);
 744		}
 745
 746		$v = value->new();
 747		$v->leftside($l);
 748		$v->rightside($r);
 749
 750		push(@{$p->values}, $v);
 751	}
 752
 753	my ($asstype, $assname) = split(/:/, $association);
 754	&associate_piece($asstype, $assname, $p);
 755}
 756
 757#
 758# Create a internal_separator piece
 759#
 760sub INTERNALSEPARATORS() {
 761	my $association = shift;
 762	my $values = shift;
 763
 764	$p = piece->new();
 765	$p->type($piece_types::INTERNALSEPARATORS);
 766	$p->write(\&write_internal_separators);
 767	@{$p->associations} = ();
 768
 769	my $setident = 0;
 770	my @vals = split(/,/, $values);
 771	foreach my $val (@vals) {
 772		my ($l, $r) = split(/=/, $val);
 773
 774		if ($l eq "name") {
 775			$setident = 1;
 776			$p->ident($r);
 777		}
 778
 779		$v = value->new();
 780		$v->leftside($l);
 781		$v->rightside($r);
 782
 783		push(@{$p->values}, $v);
 784	}
 785
 786	my ($asstype, $assname) = split(/:/, $association);
 787	&associate_piece($asstype, $assname, $p);
 788}
 789
 790#
 791# Create a values piece
 792#
 793sub VALUES() {
 794	my $association = shift;
 795	my $values = shift;
 796
 797	$p = piece->new();
 798	$p->type($piece_types::VALUES);
 799	$p->write(\&write_values);
 800	@{$p->associations} = ();
 801
 802	my $setident = 0;
 803	my @vals = split(/,/, $values);
 804	foreach my $val (@vals) {
 805		my ($l, $r) = split(/=/, $val);
 806
 807		if ($l eq "ident") {
 808			$setident = 1;
 809			$p->ident($r);
 810		}
 811	}
 812
 813	my ($asstype, $assname) = split(/:/, $association);
 814	&associate_piece($asstype, $assname, $p);
 815}
 816
 817#
 818# Create a constraints piece
 819#
 820sub CONSTRAINTS() {
 821	my $association = shift;
 822	my $values = shift;
 823
 824	$p = piece->new();
 825	$p->type($piece_types::CONSTRAINTS);
 826	$p->write(\&write_constraints);
 827	@{$p->associations} = ();
 828
 829	my $setident = 0;
 830	my @vals = split(/,/, $values);
 831	foreach my $val (@vals) {
 832		my ($l, $r) = split(/=/, $val);
 833
 834		if ($l eq "ident") {
 835			$setident = 1;
 836			$p->ident($r);
 837		}
 838	}
 839
 840	my ($asstype, $assname) = split(/:/, $association);
 841	&associate_piece($asstype, $assname, $p);
 842}
 843
 844#
 845# Create a value piece
 846#
 847sub VALUE() {
 848	my $association = shift;
 849	my $values = shift;
 850
 851	$p = piece->new();
 852	$p->type($piece_types::VALUE);
 853	$p->write(\&write_value);
 854	@{$p->associations} = ();
 855
 856	my $setident = 0;
 857	my @vals = split(/,/, $values);
 858	foreach my $val (@vals) {
 859		my ($l, $r) = split(/=/, $val);
 860
 861		if ($l eq "name") {
 862			$setident = 1;
 863			$p->ident($r);
 864		}
 865
 866		$v = value->new();
 867		$v->leftside($l);
 868		$v->rightside($r);
 869
 870		push(@{$p->values}, $v);
 871	}
 872
 873	my ($asstype, $assname) = split(/:/, $association);
 874	&associate_piece($asstype, $assname, $p);
 875}
 876
 877#
 878# Create a range piece
 879#
 880sub RANGE() {
 881	my $association = shift;
 882	my $values = shift;
 883
 884	$p = piece->new();
 885	$p->type($piece_types::RANGE);
 886	$p->write(\&write_range);
 887	@{$p->associations} = ();
 888
 889	my $setident = 0;
 890	my @vals = split(/,/, $values);
 891	foreach my $val (@vals) {
 892		my ($l, $r) = split(/=/, $val);
 893
 894		if ($l eq "name") {
 895			$setident = 1;
 896			$p->ident($r);
 897		}
 898
 899		$v = value->new();
 900		$v->leftside($l);
 901		$v->rightside($r);
 902
 903		push(@{$p->values}, $v);
 904	}
 905
 906	my ($asstype, $assname) = split(/:/, $association);
 907	&associate_piece($asstype, $assname, $p);
 908}
 909
 910#
 911# Create a value_set piece
 912#
 913sub VALUESET() {
 914	my $association = shift;
 915	my $values = shift;
 916
 917	$p = piece->new();
 918	$p->type($piece_types::VALUESET);
 919	$p->write(\&write_valueset);
 920	@{$p->associations} = ();
 921
 922	my $setident = 0;
 923	my @vals = split(/,/, $values);
 924	foreach my $val (@vals) {
 925		my ($l, $r) = split(/=/, $val);
 926
 927		if ($l eq "name") {
 928			$setident = 1;
 929			$p->ident($r);
 930		}
 931
 932		$v = value->new();
 933		$v->leftside($l);
 934		$v->rightside($r);
 935
 936		push(@{$p->values}, $v);
 937	}
 938
 939	my ($asstype, $assname) = split(/:/, $association);
 940	&associate_piece($asstype, $assname, $p);
 941}
 942
 943#
 944# Create a all_values piece
 945#
 946sub ALLVALUES() {
 947	my $association = shift;
 948	my $values = shift;
 949
 950	$p = piece->new();
 951	$p->type($piece_types::ALLVALUES);
 952	$p->write(\&write_allvalues);
 953	@{$p->associations} = ();
 954
 955	my $setident = 0;
 956	my @vals = split(/,/, $values);
 957	foreach my $val (@vals) {
 958		my ($l, $r) = split(/=/, $val);
 959
 960		if ($l eq "name") {
 961			$setident = 1;
 962			$p->ident($r);
 963		}
 964
 965		$v = value->new();
 966		$v->leftside($l);
 967		$v->rightside($r);
 968
 969		push(@{$p->values}, $v);
 970	}
 971
 972	my ($asstype, $assname) = split(/:/, $association);
 973	&associate_piece($asstype, $assname, $p);
 974}
 975
 976#
 977# Create a doclink piece
 978#
 979sub DOCLINK() {
 980	my $association = shift;
 981	my $values = shift;
 982
 983	$p = piece->new();
 984	$p->type($piece_types::DOCLINK);
 985	$p->write(\&write_doclink);
 986	@{$p->associations} = ();
 987
 988	my $setident = 0;
 989	my @vals = split(/,/, $values);
 990	foreach my $val (@vals) {
 991		my ($l, $r) = split(/=/, $val);
 992
 993		if ($l eq "name") {
 994			$setident = 1;
 995			$p->ident($r);
 996		}
 997
 998		$v = value->new();
 999		$v->leftside($l);
1000		$v->rightside($r);
1001
1002		push(@{$p->values}, $v);
1003	}
1004
1005	my ($asstype, $assname) = split(/:/, $association);
1006	&associate_piece($asstype, $assname, $p);
1007}
1008
1009#
1010# Create a manpage piece
1011#
1012sub MANPAGE() {
1013	my $association = shift;
1014	my $values = shift;
1015
1016	$p = piece->new();
1017	$p->type($piece_types::MANPAGE);
1018	$p->write(\&write_manpage);
1019	@{$p->associations} = ();
1020
1021	my $setident = 0;
1022	my @vals = split(/,/, $values);
1023	foreach my $val (@vals) {
1024		my ($l, $r) = split(/=/, $val);
1025
1026		if ($l eq "name") {
1027			$setident = 1;
1028			$p->ident($r);
1029		}
1030
1031		$v = value->new();
1032		$v->leftside($l);
1033		$v->rightside($r);
1034
1035		push(@{$p->values}, $v);
1036	}
1037
1038	my ($asstype, $assname) = split(/:/, $association);
1039	&associate_piece($asstype, $assname, $p);
1040}
1041
1042#
1043# Create a service_fmri piece
1044#
1045sub SERVICEFMRI() {
1046	my $association = shift;
1047	my $values = shift;
1048
1049	$p = piece->new();
1050	$p->type($piece_types::SERVICEFMRI);
1051	$p->write(\&write_service_fmri);
1052	@{$p->associations} = ();
1053
1054	my $setident = 0;
1055	my @vals = split(/,/, $values);
1056	foreach my $val (@vals) {
1057		my ($l, $r) = split(/=/, $val);
1058
1059		if ($l eq "name") {
1060			$setident = 1;
1061			$p->ident($r);
1062		}
1063
1064		$v = value->new();
1065		$v->leftside($l);
1066		$v->rightside($r);
1067
1068		push(@{$p->values}, $v);
1069	}
1070
1071	my ($asstype, $assname) = split(/:/, $association);
1072	&associate_piece($asstype, $assname, $p);
1073}
1074
1075#
1076# Create a method_profile piece
1077#
1078sub METHODPROFILE() {
1079	my $association = shift;
1080	my $values = shift;
1081
1082	$p = piece->new();
1083	$p->type($piece_types::METHODPROFILE);
1084	$p->write(\&write_method_profile);
1085	@{$p->associations} = ();
1086
1087	my $setident = 0;
1088	my @vals = split(/,/, $values);
1089	foreach my $val (@vals) {
1090		my ($l, $r) = split(/=/, $val);
1091
1092		if ($l eq "name") {
1093			$setident = 1;
1094			$p->ident($r);
1095		}
1096
1097		$v = value->new();
1098		$v->leftside($l);
1099		$v->rightside($r);
1100
1101		push(@{$p->values}, $v);
1102	}
1103
1104	my ($asstype, $assname) = split(/:/, $association);
1105	&associate_piece($asstype, $assname, $p);
1106}
1107
1108#
1109# Create a method_credential piece
1110#
1111sub METHODCREDENTIAL() {
1112	my $association = shift;
1113	my $values = shift;
1114
1115	$p = piece->new();
1116	$p->type($piece_types::METHODCREDENTIAL);
1117	$p->write(\&write_method_credential);
1118	@{$p->associations} = ();
1119
1120	my $setident = 0;
1121	my @vals = split(/,/, $values);
1122	foreach my $val (@vals) {
1123		my ($l, $r) = split(/=/, $val);
1124
1125		if ($l eq "name") {
1126			$setident = 1;
1127			$p->ident($r);
1128		}
1129
1130		$v = value->new();
1131		$v->leftside($l);
1132		$v->rightside($r);
1133
1134		push(@{$p->values}, $v);
1135	}
1136
1137	my ($asstype, $assname) = split(/:/, $association);
1138	&associate_piece($asstype, $assname, $p);
1139}
1140
1141#
1142# Create a method_environment piece
1143#
1144sub METHODENVIRONMENT() {
1145	my $association = shift;
1146	my $values = shift;
1147
1148	$p = piece->new();
1149	$p->type($piece_types::METHODENVIRONMENT);
1150	$p->write(\&write_method_environment);
1151	@{$p->associations} = ();
1152
1153	my $setident = 0;
1154	my @vals = split(/,/, $values);
1155	foreach my $val (@vals) {
1156		my ($l, $r) = split(/=/, $val);
1157
1158		if ($l eq "name") {
1159			$setident = 1;
1160			$p->ident($r);
1161		}
1162
1163		$v = value->new();
1164		$v->leftside($l);
1165		$v->rightside($r);
1166
1167		push(@{$p->values}, $v);
1168	}
1169
1170	my ($asstype, $assname) = split(/:/, $association);
1171	&associate_piece($asstype, $assname, $p);
1172}
1173
1174#
1175# Create a prop_val piece
1176#
1177sub PROPVAL() {
1178	my $association = shift;
1179	my $values = shift;
1180
1181	$p = piece->new();
1182	$p->type($piece_types::PROPVAL);
1183	$p->write(\&write_propval);
1184	@{$p->associations} = ();
1185
1186	my $setident = 0;
1187	my @vals = split(/,/, $values);
1188	foreach my $val (@vals) {
1189		my ($l, $r) = split(/=/, $val);
1190
1191		if ($l eq "name") {
1192			$setident = 1;
1193			$p->ident($r);
1194		}
1195
1196		$v = value->new();
1197		$v->leftside($l);
1198		$v->rightside($r);
1199
1200		push(@{$p->values}, $v);
1201	}
1202
1203	my ($asstype, $assname) = split(/:/, $association);
1204	&associate_piece($asstype, $assname, $p);
1205}
1206
1207#
1208# Create a property piece
1209#
1210sub PROPERTY() {
1211	my $association = shift;
1212	my $values = shift;
1213
1214	$p = piece->new();
1215	$p->type($piece_types::PROPERTY);
1216	$p->write(\&write_property);
1217	@{$p->associations} = ();
1218
1219	my $setident = 0;
1220	my @vals = split(/,/, $values);
1221	foreach my $val (@vals) {
1222		my ($l, $r) = split(/=/, $val);
1223
1224		if ($l eq "name") {
1225			$setident = 1;
1226			$p->ident($r);
1227		}
1228
1229		$v = value->new();
1230		$v->leftside($l);
1231		$v->rightside($r);
1232
1233		push(@{$p->values}, $v);
1234	}
1235
1236	my ($asstype, $assname) = split(/:/, $association);
1237	&associate_piece($asstype, $assname, $p);
1238}
1239
1240#
1241# Create a count_list piece
1242#
1243sub COUNTLIST() {
1244	my $association = shift;
1245	my $values = shift;
1246
1247	$p = piece->new();
1248	$p->type($piece_types::COUNTLIST);
1249	$p->write(\&write_count_list);
1250	@{$p->associations} = ();
1251
1252	my $setident = 0;
1253	my @vals = split(/,/, $values);
1254	foreach my $val (@vals) {
1255		$v = value->new();
1256		$v->rightside($val);
1257
1258		push(@{$p->values}, $v);
1259	}
1260
1261	my ($asstype, $assname) = split(/:/, $association);
1262	&associate_piece($asstype, $assname, $p);
1263}
1264
1265#
1266# Create a interger_list piece
1267#
1268sub INTEGERLIST() {
1269	my $association = shift;
1270	my $values = shift;
1271
1272	$p = piece->new();
1273	$p->type($piece_types::INTEGERLIST);
1274	$p->write(\&write_integer_list);
1275	@{$p->associations} = ();
1276
1277	my $setident = 0;
1278	my @vals = split(/,/, $values);
1279	foreach my $val (@vals) {
1280		$v = value->new();
1281		$v->rightside($val);
1282
1283		push(@{$p->values}, $v);
1284	}
1285
1286	my ($asstype, $assname) = split(/:/, $association);
1287	&associate_piece($asstype, $assname, $p);
1288}
1289
1290#
1291# Create a opaque_list piece
1292#
1293sub OPAQUELIST() {
1294	my $association = shift;
1295	my $values = shift;
1296
1297	$p = piece->new();
1298	$p->type($piece_types::OPAQUELIST);
1299	$p->write(\&write_opaque_list);
1300	@{$p->associations} = ();
1301
1302	my $setident = 0;
1303	my @vals = split(/,/, $values);
1304	foreach my $val (@vals) {
1305		$v = value->new();
1306		$v->rightside($val);
1307
1308		push(@{$p->values}, $v);
1309	}
1310
1311	my ($asstype, $assname) = split(/:/, $association);
1312	&associate_piece($asstype, $assname, $p);
1313}
1314
1315#
1316# Create a host_list piece
1317#
1318sub HOSTLIST() {
1319	my $association = shift;
1320	my $values = shift;
1321
1322	$p = piece->new();
1323	$p->type($piece_types::HOSTLIST);
1324	$p->write(\&write_host_list);
1325	@{$p->associations} = ();
1326
1327	my $setident = 0;
1328	my @vals = split(/,/, $values);
1329	foreach my $val (@vals) {
1330		$v = value->new();
1331		$v->rightside($val);
1332
1333		push(@{$p->values}, $v);
1334	}
1335
1336	my ($asstype, $assname) = split(/:/, $association);
1337	&associate_piece($asstype, $assname, $p);
1338}
1339
1340#
1341# Create a hostname_list piece
1342#
1343sub HOSTNAMELIST() {
1344	my $association = shift;
1345	my $values = shift;
1346
1347	$p = piece->new();
1348	$p->type($piece_types::HOSTNAMELIST);
1349	$p->write(\&write_host_name_list);
1350	@{$p->associations} = ();
1351
1352	my $setident = 0;
1353	my @vals = split(/,/, $values);
1354	foreach my $val (@vals) {
1355		$v = value->new();
1356		$v->rightside($val);
1357
1358		push(@{$p->values}, $v);
1359	}
1360
1361	my ($asstype, $assname) = split(/:/, $association);
1362	&associate_piece($asstype, $assname, $p);
1363}
1364
1365#
1366# Create a netaddress4_list piece
1367#
1368sub NETADDRESSV4LIST() {
1369	my $association = shift;
1370	my $values = shift;
1371
1372	$p = piece->new();
1373	$p->type($piece_types::NETADDRESSV4LIST);
1374	$p->write(\&write_net_address_v4_list);
1375	@{$p->associations} = ();
1376
1377	my $setident = 0;
1378	my @vals = split(/,/, $values);
1379	foreach my $val (@vals) {
1380		$v = value->new();
1381		$v->rightside($val);
1382
1383		push(@{$p->values}, $v);
1384	}
1385
1386	my ($asstype, $assname) = split(/:/, $association);
1387	&associate_piece($asstype, $assname, $p);
1388}
1389
1390#
1391# Create a netaddressv6_list piece
1392#
1393sub NETADDRESSV6LIST() {
1394	my $association = shift;
1395	my $values = shift;
1396
1397	$p = piece->new();
1398	$p->type($piece_types::NETADDRESSV6LIST);
1399	$p->write(\&write_net_address_v6_list);
1400	@{$p->associations} = ();
1401
1402	my $setident = 0;
1403	my @vals = split(/,/, $values);
1404	foreach my $val (@vals) {
1405		$v = value->new();
1406		$v->rightside($val);
1407
1408		push(@{$p->values}, $v);
1409	}
1410
1411	my ($asstype, $assname) = split(/:/, $association);
1412	&associate_piece($asstype, $assname, $p);
1413}
1414
1415#
1416# Create a time_list piece
1417#
1418sub TIMELIST() {
1419	my $association = shift;
1420	my $values = shift;
1421
1422	$p = piece->new();
1423	$p->type($piece_types::TIMELIST);
1424	$p->write(\&write_time_list);
1425	@{$p->associations} = ();
1426
1427	my $setident = 0;
1428	my @vals = split(/,/, $values);
1429	foreach my $val (@vals) {
1430		$v = value->new();
1431		$v->rightside($val);
1432
1433		push(@{$p->values}, $v);
1434	}
1435
1436	my ($asstype, $assname) = split(/:/, $association);
1437	&associate_piece($asstype, $assname, $p);
1438}
1439
1440#
1441# Create a astring_list piece
1442#
1443sub ASTRINGLIST() {
1444	my $association = shift;
1445	my $values = shift;
1446
1447	$p = piece->new();
1448	$p->type($piece_types::ASTRINGLIST);
1449	$p->write(\&write_astring_list);
1450	@{$p->associations} = ();
1451
1452	my $setident = 0;
1453	my @vals = split(/,/, $values);
1454	foreach my $val (@vals) {
1455		$v = value->new();
1456		$v->rightside($val);
1457
1458		push(@{$p->values}, $v);
1459	}
1460
1461	my ($asstype, $assname) = split(/:/, $association);
1462	&associate_piece($asstype, $assname, $p);
1463}
1464
1465#
1466# Create a ustring_list piece
1467#
1468sub USTRINGLIST() {
1469	my $association = shift;
1470	my $values = shift;
1471
1472	$p = piece->new();
1473	$p->type($piece_types::USTRINGLIST);
1474	$p->write(\&write_ustring_list);
1475	@{$p->associations} = ();
1476
1477	my $setident = 0;
1478	my @vals = split(/,/, $values);
1479	foreach my $val (@vals) {
1480		$v = value->new();
1481		$v->rightside($val);
1482
1483		push(@{$p->values}, $v);
1484	}
1485
1486	my ($asstype, $assname) = split(/:/, $association);
1487	&associate_piece($asstype, $assname, $p);
1488}
1489
1490#
1491# Create a boolean_list piece
1492#
1493sub BOOLEANLIST() {
1494	my $association = shift;
1495	my $values = shift;
1496
1497	$p = piece->new();
1498	$p->type($piece_types::BOOLEANLIST);
1499	$p->write(\&write_boolean_list);
1500	@{$p->associations} = ();
1501
1502	my $setident = 0;
1503	my @vals = split(/,/, $values);
1504	foreach my $val (@vals) {
1505		$v = value->new();
1506		$v->rightside($val);
1507
1508		push(@{$p->values}, $v);
1509	}
1510
1511	my ($asstype, $assname) = split(/:/, $association);
1512	&associate_piece($asstype, $assname, $p);
1513}
1514
1515#
1516# Create a fmri_list piece
1517#
1518sub FMRILIST() {
1519	my $association = shift;
1520	my $values = shift;
1521
1522	$p = piece->new();
1523	$p->type($piece_types::FMRILIST);
1524	$p->write(\&write_fmri_list);
1525	@{$p->associations} = ();
1526
1527	my $setident = 0;
1528	my @vals = split(/,/, $values);
1529	foreach my $val (@vals) {
1530		$v = value->new();
1531		$v->rightside($val);
1532
1533		push(@{$p->values}, $v);
1534	}
1535
1536	my ($asstype, $assname) = split(/:/, $association);
1537	&associate_piece($asstype, $assname, $p);
1538}
1539
1540#
1541# Create a uri_list piece
1542#
1543sub URILIST() {
1544	my $association = shift;
1545	my $values = shift;
1546
1547	$p = piece->new();
1548	$p->type($piece_types::URILIST);
1549	$p->write(\&write_uri_list);
1550	@{$p->associations} = ();
1551
1552	my $setident = 0;
1553	my @vals = split(/,/, $values);
1554	foreach my $val (@vals) {
1555		$v = value->new();
1556		$v->rightside($val);
1557
1558		push(@{$p->values}, $v);
1559	}
1560
1561	my ($asstype, $assname) = split(/:/, $association);
1562	&associate_piece($asstype, $assname, $p);
1563}
1564return (1);