On 26/11/2014 18:01, Lucas Meneghel Rodrigues wrote:
> [sni[

Very nice.  Is "@prod" YAML though?  What about something like this...

I renamed "variant" to "mux-choice", and also filter-only/filter-out to
mux-only/mux-no for brevity.  I also introduced mux-group, to distinguish
them from variables; finally, I'm using YAML tags to distinguish groups and
choices from variables.

I hope I have not destroyed Lukas's idea too much... the idea was to *keep*
them rather than destroy them.

- foo: 123                                                              # 
variable
- bar: [1,2,3]                                                          # 
variable
- !mux-group hw:                                                        # 
choices below are automatically prefixed by /hw
     - !mux-choice cpu:                                                 # 
/hw/cpu can be intel, amd, arm
         - intel:
             - mux-default: true
             - cpu: 'SandyBridge'                                       # 
variable
         - amd:
             - cpu: 'Opteron_G1'                                        # 
variable
         - arm:
             - mux-only: { '/env': 'debug', '/os': 'linux' }
             - mux-no: { '/hw/net/nic_model' : [ 'e1000', 'rtl8139' ] }
             - cpu: 'cortex-a15 '                                       # 
variable
     - !mux-choice disk:                                                # 
/hw/disk can be scsi, virtio
             - scsi:
                 # Code can use params.get('/hw/disk'), so no need for variables
             - virtio:
                 - mux-default: true
                 - mux-only: { '/os' : 'linux' }
     - !mux-group net:                                                  # 
choices below are automatically prefixed by /hw/net
          - !mux-choice backend:                                        # 
/hw/net/backend
                 - vhost:
                     - mux-default: true
                 - tap:
                 - user:
          - !mux-choice nic_model:                                      # 
/hw/net/nic_model can be virtio, rtl8139, e1000
                 # Code can use params.get('/hw/net/nic_model'), so no need for 
variables
                 # but it doesn't hurt to specify them!
                 - virtio:
                     - mux-default: true
                     - nic_model: virtio
                 - rtl8139:
                     - nic_model: rtl8139
                 - e1000:
                     - nic_model: e1000
- !mux-choice os:                                                       # /os 
can be linux, win
   - linux:
       - dev-tools: 'gcc'
       - !mux-choice distro                                             # 
/os/distro can be fedora, mint
                                                                        # if 
/os is linux
         - fedora:
             - mux-default: true
             - package-manager: 'yum'
             - init: 'systemd'
             - !mux-choice version                                      # 
/os/distro/version can be 13
                   13:                                                  # if 
/os is linux and /os/distro is fedora
         - mint:
             - package-manager: 'apt-get'
             - init: 'init'
             - !mux-choice version                                      # 
/os/distro/version can be 7
                   7:                                                   # if 
/os is linux and /os/distro is mint

   - win:
       - bsod: true
       - !mux-choice dev-tools:                                         # 
/os/dev-tools can be cygwin, mingw, vs
                                                                        # if 
/os is win
          - cygwin:                                                     # if no 
mux-default, first wins
              - dev-tools: Cygwin
          - mingw:
              - dev-tools: MinGW
          - vs:
              - dev-tools: VisualStudio
       - !mux-choice version:                                           # 
/os/version can be win7 or win8
                                                                        # if 
/os is win
          - win7:
          - win8:
              - bsod: false

- !mux-choice env:                                                      # /env 
can be debug or prod
   - debug:
       - mux-only: {'/os/distro': 'fedora' }                            # also 
filters out /os:win
                                                                        # 
because it has no /os/distro
   - prod:
       - mux-default: true

- !mux-choice tests:
   - ping_test:
       - mux-expand: [ '/hw/net' ]                                       # 
ignore mux-default under /hw/net, can still be
                                                                         # 
restricted by user-supplied mux-only/mux-no

I'm not 100% sure this is valid YAML, but should be close.

Thanks,

Paolo

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to