| 1 |
# -*- cperl -*- |
| 2 |
use utf8; |
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
# this file is used by test script |
| 7 |
|
| 8 |
return [ |
| 9 |
[ |
| 10 |
name => 'SubSlave2', |
| 11 |
gist => 'subslave2 with aa2:{aa2}', |
| 12 |
element => [ |
| 13 |
[qw/aa2 ab2 ac2 ad2 Z/] => { |
| 14 |
type => 'leaf', |
| 15 |
value_type => 'string' |
| 16 |
} |
| 17 |
] |
| 18 |
], |
| 19 |
|
| 20 |
[ |
| 21 |
name => 'SubSlave', |
| 22 |
gist => 'subslave with aa:{aa}', |
| 23 |
element => [ |
| 24 |
[qw/aa ab ac ad/] => { |
| 25 |
type => 'leaf', |
| 26 |
value_type => 'uniline' |
| 27 |
}, |
| 28 |
sub_slave => { |
| 29 |
type => 'node', |
| 30 |
config_class_name => 'SubSlave2', |
| 31 |
} |
| 32 |
] |
| 33 |
], |
| 34 |
|
| 35 |
[ |
| 36 |
name => 'X_base_class2', |
| 37 |
gist => 'x_base_class2 with X:{X}', |
| 38 |
element => [ |
| 39 |
X => { |
| 40 |
type => 'leaf', |
| 41 |
value_type => 'enum', |
| 42 |
choice => [qw/Av Bv Cv/] |
| 43 |
}, |
| 44 |
], |
| 45 |
class_description => 'rather dummy class to check include feature', |
| 46 |
], |
| 47 |
|
| 48 |
[ |
| 49 |
name => 'X_base_class', |
| 50 |
gist => 'x_base_class with X:{X}', |
| 51 |
include => 'X_base_class2', |
| 52 |
], |
| 53 |
|
| 54 |
[ |
| 55 |
name => 'SlaveZ', |
| 56 |
gist => 'SlaveZ Z:{Z} DX:{DX}', |
| 57 |
element => [ |
| 58 |
[qw/Z/] => { |
| 59 |
type => 'leaf', |
| 60 |
value_type => 'enum', |
| 61 |
choice => [qw/Av Bv Cv/] |
| 62 |
}, |
| 63 |
[qw/DX/] => { |
| 64 |
type => 'leaf', |
| 65 |
value_type => 'enum', |
| 66 |
default => 'Dv', |
| 67 |
choice => [qw/Av Bv Cv Dv/] |
| 68 |
}, |
| 69 |
], |
| 70 |
include => 'X_base_class', |
| 71 |
include_after => 'Z', |
| 72 |
], |
| 73 |
|
| 74 |
[ |
| 75 |
name => 'SlaveY', |
| 76 |
gist => 'slaveY with Y:{Y}', |
| 77 |
element => [ |
| 78 |
std_id => { |
| 79 |
type => 'hash', |
| 80 |
index_type => 'string', |
| 81 |
cargo => { |
| 82 |
type => 'node', |
| 83 |
config_class_name => 'SlaveZ' |
| 84 |
}, |
| 85 |
}, |
| 86 |
sub_slave => { |
| 87 |
type => 'node', |
| 88 |
config_class_name => 'SubSlave', |
| 89 |
}, |
| 90 |
[qw/a_string a_long_string another_string/] => { |
| 91 |
type => 'leaf', |
| 92 |
mandatory => 1, |
| 93 |
value_type => 'string' |
| 94 |
}, |
| 95 |
warp2 => { |
| 96 |
type => 'warped_node', |
| 97 |
config_class_name => 'SubSlave', |
| 98 |
morph => 1, |
| 99 |
warp => { |
| 100 |
follow => '! tree_macro', |
| 101 |
rules => [ |
| 102 |
mXY => { config_class_name => 'SubSlave2' }, |
| 103 |
XZ => { config_class_name => 'SubSlave2' } |
| 104 |
] |
| 105 |
}, |
| 106 |
}, |
| 107 |
Y => { |
| 108 |
type => 'leaf', |
| 109 |
value_type => 'enum', |
| 110 |
choice => [qw/Av Bv Cv/] |
| 111 |
}, |
| 112 |
], |
| 113 |
include => 'X_base_class', |
| 114 |
], |
| 115 |
|
| 116 |
[ |
| 117 |
name => 'Master', |
| 118 |
class_description => " |
| 119 |
|
| 120 |
=head1 coucou |
| 121 |
|
| 122 |
Master description . Let's go for a very long description with utf8 chars: ßéè. |
| 123 |
|
| 124 |
Big class to do: |
| 125 |
|
| 126 |
=over |
| 127 |
|
| 128 |
=item * |
| 129 |
|
| 130 |
shiny |
| 131 |
|
| 132 |
=item * |
| 133 |
|
| 134 |
beautiful |
| 135 |
|
| 136 |
=back |
| 137 |
|
| 138 |
things. |
| 139 |
", |
| 140 |
level => [ [qw/lista hash_a tree_macro int_v/] => 'important' ], |
| 141 |
rw_config => { |
| 142 |
backend => 'cds_file', |
| 143 |
config_dir => '/foo', |
| 144 |
file => 'a_test.cds', |
| 145 |
auto_create => 1 |
| 146 |
}, |
| 147 |
gist => 'M tree_macro:{tree_macro}', |
| 148 |
accept => [ |
| 149 |
'foo.*' => { type => 'leaf', value_type => 'uniline'} |
| 150 |
], |
| 151 |
element => [ |
| 152 |
tree_macro => { |
| 153 |
type => 'leaf', |
| 154 |
value_type => 'enum', |
| 155 |
choice => [qw/XY XZ mXY/], |
| 156 |
help => { |
| 157 |
XY => 'XY help', |
| 158 |
XZ => 'XZ help', |
| 159 |
mXY => 'mXY help', |
| 160 |
} |
| 161 |
}, |
| 162 |
pop_in_out => { |
| 163 |
type => 'leaf', |
| 164 |
level => 'hidden', |
| 165 |
value_type => 'uniline', |
| 166 |
default => 'yada yada', |
| 167 |
warp => { |
| 168 |
follow => '! tree_macro', |
| 169 |
rules => [ |
| 170 |
XZ => { level => 'normal' }, |
| 171 |
], |
| 172 |
}, |
| 173 |
}, |
| 174 |
|
| 175 |
[qw/compute_av compute_bv/] => { |
| 176 |
type => 'leaf', |
| 177 |
class => 'Config::Model::Value', |
| 178 |
value_type => 'integer', |
| 179 |
}, |
| 180 |
compute_int => { |
| 181 |
type => 'leaf', |
| 182 |
class => 'Config::Model::Value', |
| 183 |
value_type => 'integer', |
| 184 |
compute => { |
| 185 |
formula => '$a + $b', |
| 186 |
variables => { a => '- compute_av', b => '- compute_bv' } |
| 187 |
}, |
| 188 |
min => -4, |
| 189 |
max => 4, |
| 190 |
}, |
| 191 |
std_id => { |
| 192 |
type => 'hash', |
| 193 |
index_type => 'string', |
| 194 |
cargo => { |
| 195 |
type => 'node', |
| 196 |
config_class_name => 'SlaveZ' |
| 197 |
}, |
| 198 |
}, |
| 199 |
[qw/lista listb/] => { |
| 200 |
type => 'list', |
| 201 |
cargo => { |
| 202 |
type => 'leaf', |
| 203 |
value_type => 'uniline' |
| 204 |
}, |
| 205 |
summary => 'lista and listb are used to yada yada with utf8 chars: ßéè', |
| 206 |
}, |
| 207 |
[qw/hash_a hash_b/] => { |
| 208 |
type => 'hash', |
| 209 |
index_type => 'string', |
| 210 |
cargo => { |
| 211 |
type => 'leaf', |
| 212 |
value_type => 'uniline' |
| 213 |
}, |
| 214 |
}, |
| 215 |
ordered_hash => { |
| 216 |
type => 'hash', |
| 217 |
index_type => 'string', |
| 218 |
ordered => 1, |
| 219 |
cargo => { |
| 220 |
type => 'leaf', |
| 221 |
value_type => 'uniline' |
| 222 |
}, |
| 223 |
}, |
| 224 |
ordered_hash_of_mandatory => { |
| 225 |
type => 'hash', |
| 226 |
index_type => 'string', |
| 227 |
ordered => 1, |
| 228 |
cargo => { |
| 229 |
type => 'leaf', |
| 230 |
value_type => 'uniline', |
| 231 |
mandatory => 1, |
| 232 |
}, |
| 233 |
}, |
| 234 |
'ordered_hash_of_nodes' => { |
| 235 |
type => 'hash', |
| 236 |
index_type => 'string', |
| 237 |
ordered => 1, |
| 238 |
cargo => { |
| 239 |
type => 'node', |
| 240 |
config_class_name => 'SlaveZ' |
| 241 |
}, |
| 242 |
}, |
| 243 |
olist => { |
| 244 |
type => 'list', |
| 245 |
cargo => { |
| 246 |
type => 'node', |
| 247 |
config_class_name => 'SlaveZ', |
| 248 |
}, |
| 249 |
}, |
| 250 |
enum_list => { |
| 251 |
type => 'list', |
| 252 |
cargo => { |
| 253 |
type => 'leaf', |
| 254 |
value_type => 'enum', |
| 255 |
choice => [qw/A B C/], |
| 256 |
} |
| 257 |
}, |
| 258 |
|
| 259 |
"list_with_warn_duplicates" => { |
| 260 |
type => 'list', |
| 261 |
duplicates => 'warn' , |
| 262 |
cargo => { type => 'leaf', value_type => 'string' } |
| 263 |
}, |
| 264 |
"hash_with_warn_duplicates" => { |
| 265 |
type => 'hash', |
| 266 |
index_type => 'string', |
| 267 |
duplicates => 'warn' , |
| 268 |
cargo => { type => 'leaf', value_type => 'string' } |
| 269 |
}, |
| 270 |
warp => { |
| 271 |
type => 'warped_node', |
| 272 |
config_class_name => 'SlaveY', |
| 273 |
morph => 1, |
| 274 |
warp => { |
| 275 |
follow => '! tree_macro', |
| 276 |
rules => [ |
| 277 |
#XY => { config_class_name => 'SlaveY'}, |
| 278 |
mXY => { config_class_name => 'SlaveY' }, |
| 279 |
XZ => { config_class_name => 'SlaveZ' } |
| 280 |
] |
| 281 |
} |
| 282 |
}, |
| 283 |
|
| 284 |
'slave_y' => { |
| 285 |
type => 'node', |
| 286 |
config_class_name => 'SlaveY', |
| 287 |
}, |
| 288 |
|
| 289 |
string_with_def => { |
| 290 |
type => 'leaf', |
| 291 |
value_type => 'uniline', |
| 292 |
default => 'yada yada' |
| 293 |
}, |
| 294 |
a_uniline => { |
| 295 |
type => 'leaf', |
| 296 |
value_type => 'uniline', |
| 297 |
default => 'yada yada' |
| 298 |
}, |
| 299 |
a_boolean => { |
| 300 |
type => 'leaf', |
| 301 |
value_type => 'boolean', |
| 302 |
}, |
| 303 |
yes_no_boolean => { |
| 304 |
type => 'leaf', |
| 305 |
value_type => 'boolean', |
| 306 |
upstream_default => 'yes', |
| 307 |
write_as => [ 'no', 'yes' ], |
| 308 |
}, |
| 309 |
[qw/a_string a_long_string another_string/] => { |
| 310 |
type => 'leaf', |
| 311 |
value_type => 'string' |
| 312 |
}, |
| 313 |
[qw/a_very_long_string/] => { |
| 314 |
type => 'leaf', |
| 315 |
value_type => 'string', |
| 316 |
default => " This program is free software; you can redistribute it and/or modify |
| 317 |
it under the terms of the GNU Lesser General Public License as |
| 318 |
published by the Free Software Foundation; either version 2.1 of the |
| 319 |
License, or (at your option) any later version. |
| 320 |
On Debian GNU/Linux systems, the complete text of version 2.1 of the GNU |
| 321 |
Lesser General Public License can be found in `/usr/share/common-licenses/LGPL-2.1'" |
| 322 |
}, |
| 323 |
[qw/a_mandatory_string another_mandatory_string/] => { |
| 324 |
type => 'leaf', |
| 325 |
mandatory => 1, |
| 326 |
value_type => 'string' |
| 327 |
}, |
| 328 |
int_v => { |
| 329 |
type => 'leaf', |
| 330 |
value_type => 'integer', |
| 331 |
default => '10', |
| 332 |
min => 5, |
| 333 |
max => 15 |
| 334 |
}, |
| 335 |
upstream_default => { |
| 336 |
type => 'leaf', |
| 337 |
value_type => 'integer', |
| 338 |
upstream_default => '10', |
| 339 |
}, |
| 340 |
my_plain_check_list => { |
| 341 |
type => 'check_list', |
| 342 |
choice => [ 'AA' .. 'AE' ], |
| 343 |
help => { |
| 344 |
AA => 'AA help', |
| 345 |
AC => 'AC help', |
| 346 |
AE => 'AE help', |
| 347 |
}, |
| 348 |
description => |
| 349 |
'my_plain_check_list nto so helpful description', |
| 350 |
}, |
| 351 |
enum_with_help => { |
| 352 |
type => 'leaf', |
| 353 |
value_type => 'enum' , |
| 354 |
choice => [ 'AA' .. 'AE' ], |
| 355 |
help => { map { ( $_ => "$_ help with utf8 ßé²") ;} ('AA' .. 'AE') }, |
| 356 |
description => |
| 357 |
'my_plain_check_list not so helpful description', |
| 358 |
}, |
| 359 |
enum_with_help_and_long_desc => { |
| 360 |
type => 'leaf', |
| 361 |
value_type => 'enum' , |
| 362 |
choice => [ 'AA' .. 'AE' ], |
| 363 |
help => { map { ( $_ => "$_ help with utf8 ßé²") ;} ('AA' .. 'AE') } , |
| 364 |
description => |
| 365 |
"my_plain_check_list not so helpful\n even if B<long> description 😁", |
| 366 |
}, |
| 367 |
my_ref_check_list => { |
| 368 |
type => 'check_list', |
| 369 |
refer_to => '- hash_a + ! hash_b', |
| 370 |
}, |
| 371 |
'ordered_checklist' => { |
| 372 |
type => 'check_list', |
| 373 |
choice => [ 'A' .. 'Z' ], |
| 374 |
ordered => 1, |
| 375 |
help => { A => 'A help', E => 'E help' }, |
| 376 |
summary => 'will checklist be served ? ;-) ', |
| 377 |
}, |
| 378 |
|
| 379 |
'check_list_with_upstream_default', => { |
| 380 |
# from OpenSsh Ssh model (KexAlgorithms) |
| 381 |
'choice' => [ |
| 382 |
'ecdh-sha2-nistp256', |
| 383 |
'ecdh-sha2-nistp384', |
| 384 |
'ecdh-sha2-nistp521', |
| 385 |
'diffie-hellman-group-exchange-sha256', |
| 386 |
'diffie-hellman-group-exchange-sha1', |
| 387 |
'diffie-hellman-group14-sha1', |
| 388 |
'diffie-hellman-group1-sha1' |
| 389 |
], |
| 390 |
'description' => 'Specifies the available KEX (Key Exchange) algorithms.', |
| 391 |
'type' => 'check_list', |
| 392 |
'upstream_default_list' => [ |
| 393 |
'diffie-hellman-group-exchange-sha1', |
| 394 |
'diffie-hellman-group-exchange-sha256', |
| 395 |
'diffie-hellman-group1-sha1', |
| 396 |
'diffie-hellman-group14-sha1', |
| 397 |
'ecdh-sha2-nistp256', |
| 398 |
'ecdh-sha2-nistp384', |
| 399 |
'ecdh-sha2-nistp521' |
| 400 |
] |
| 401 |
}, |
| 402 |
my_reference => { |
| 403 |
type => 'leaf', |
| 404 |
value_type => 'reference', |
| 405 |
refer_to => '- hash_a + ! hash_b', |
| 406 |
summary => 'justify a long help ;-) ', |
| 407 |
}, |
| 408 |
|
| 409 |
warn_unless => { |
| 410 |
type => 'leaf', |
| 411 |
value_type => 'string', |
| 412 |
warn_unless_match => |
| 413 |
{ foo => { msg => '', fix => '$_ = "foo".$_;' } }, |
| 414 |
}, |
| 415 |
always_warn => { |
| 416 |
type => 'leaf', |
| 417 |
value_type => 'string', |
| 418 |
warn => 'Always warn whenever used', |
| 419 |
}, |
| 420 |
hash_with_warn_unless_key_match => { |
| 421 |
type => 'hash', |
| 422 |
index_type => 'string', |
| 423 |
cargo => { type => 'leaf', value_type => 'string' }, |
| 424 |
warn_unless_key_match => 'foo', |
| 425 |
}, |
| 426 |
|
| 427 |
], |
| 428 |
description => [ |
| 429 |
tree_macro => 'controls behavior of other elements', |
| 430 |
a_long_string => "long string with \\n in it and with utf8 chars: ßéè", |
| 431 |
my_reference => "very long help:\n" |
| 432 |
. "Config::Model enables a project developer to provide an interactive configuration editor to his users. For this he must: |
| 433 |
- describe the structure and constraint of his project's configuration |
| 434 |
- if the configuration data is not stored in INI file or in Perl data |
| 435 |
file, he must provide some code to read and write configuration from |
| 436 |
configuration files. |
| 437 |
" |
| 438 |
] |
| 439 |
], |
| 440 |
]; |
| 441 |
|
| 442 |
# do not put 1; at the end or Model-> load will not work |