Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-69925

Validations for the YAML with nmpolicy in the Go package

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • None
    • rhel-net-mgmt
    • ssg_networking
    • 5
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • Hide

      Definition of Done:

      Please mark each item below with ( / ) if completed or ( x ) if incomplete:

      ( ) The acceptance criteria defined below are met.

      Given a YAML configuration file for nmpolicy provided as input to the Go package,

      When the YAML is processed,

      Then nmpolicy should validate that the YAML syntax is correct and well-formed. Also, it should validate that the required fields are present and have valid values and invalid YAML should trigger a clear error message specifying what is wrong.


      ( ) Code changes are included in a downstream build attached to an errata.


      ( ) All required testing (manual and/or automated) passes successfully.


      ( ) Related documentation updates (if applicable) have been completed.

      Show
      Definition of Done: Please mark each item below with ( / ) if completed or ( x ) if incomplete: ( ) The acceptance criteria defined below are met. Given a YAML configuration file for nmpolicy provided as input to the Go package, When the YAML is processed, Then nmpolicy should validate that the YAML syntax is correct and well-formed. Also, it should validate that the required fields are present and have valid values and invalid YAML should trigger a clear error message specifying what is wrong. ( ) Code changes are included in a downstream build attached to an errata. ( ) All required testing (manual and/or automated) passes successfully. ( ) Related documentation updates (if applicable) have been completed.
    • Pass
    • Automated
    • Unspecified Release Note Type - Unknown
    • None

      Similar to the validations performed on the nmstate YAML in the Go package, we need equivalent validations for the YAML used with nmpolicy in the Go package.

      Today, we are using GenerateConfiguration to validate regular nmstate YAML. If an error is returned, we treat the YAML as invalid and provide the error back to the user (screenshot):

      We’re looking for something similar to policies since we want users to provide the policy as input. We need a validator in Go, similar to what GenerateConfiguration has, but designed to validate YAML files containing nmpolicy. For example, it should validate the following:

      capture:
        iface1: interfaces.mac-address == "00:00:5E:00:00:01"
      desiredState:
        interfaces:
        - name: "{{ capture.iface1.interfaces.0.name }}"
          type: ethernet
          state: up
          ipv4: 
            dhcp: false
            enabled: true
            address:
          - ip: 10.244.0.1
            prefix-length: 24
          - ip: 169.254.1.0
            prefix-length: 16 

              fge@redhat.com Gris Ge
              rh-ee-lhadad Linoy Hadad
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated: